@beinformed/ui 1.17.0 → 1.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/esm/hooks/useForm.js +11 -1
- package/esm/hooks/useForm.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +2 -0
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/content/SectionModel.js +2 -0
- package/esm/models/content/SectionModel.js.map +1 -1
- package/esm/models/index.js +1 -0
- package/esm/models/index.js.map +1 -1
- package/esm/redux/actions/FormAttributeSet.js +10 -1
- package/esm/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/hooks/useForm.js +15 -2
- package/lib/hooks/useForm.js.flow +14 -0
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js +2 -0
- package/lib/models/attributes/AttributeContent.js.flow +2 -0
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/content/SectionModel.js +2 -0
- package/lib/models/content/SectionModel.js.flow +2 -0
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/index.js +8 -0
- package/lib/models/index.js.flow +1 -0
- package/lib/models/index.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js +14 -2
- package/lib/redux/actions/FormAttributeSet.js.flow +10 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/package.json +17 -17
- package/src/hooks/useForm.js +14 -0
- package/src/models/attributes/AttributeContent.js +2 -0
- package/src/models/content/SectionModel.js +2 -0
- package/src/models/index.js +1 -0
- package/src/redux/actions/FormAttributeSet.js +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.17.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.17.2...v1.17.3) (2022-04-13)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **flowtype:** set correct return type for validation hook ([19d5f80](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/19d5f800be6fd0ca64944b6b64496636b8556075))
|
|
10
|
+
|
|
11
|
+
### [1.17.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.17.1...v1.17.2) (2022-04-07)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **validate:** Added useAttributeValidate to validate the attribute onBlur ([#17](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/issues/17)) ([426b592](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/426b592015cf07d2c35d1708a54b7d68b6ab9cec))
|
|
16
|
+
|
|
17
|
+
### [1.17.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.17.0...v1.17.1) (2022-03-30)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- **models:** export ChoiceAttributeOptionCollection through models index file ([c2d4d64](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/c2d4d64d46ecf9e26e60364b8e170d4e395c8220))
|
|
22
|
+
|
|
5
23
|
## [1.17.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.16.1...v1.17.0) (2022-03-29)
|
|
6
24
|
|
|
7
25
|
### Features
|
package/esm/hooks/useForm.js
CHANGED
|
@@ -3,7 +3,7 @@ import Href from "../models/href/Href";
|
|
|
3
3
|
import { getSetting, HTTP_METHODS } from "../constants";
|
|
4
4
|
import { loadModularUI, removeModelByKey } from "../redux/_modularui";
|
|
5
5
|
import { useModularUI } from "./useModularUI";
|
|
6
|
-
import { addRepeatableAttributeSet, cancelForm, cancelRepeatableAttributeSet, previousObject, removeRepeatableAttributeSet, showFormNotification, updateFormAttribute } from "../redux/actions";
|
|
6
|
+
import { addRepeatableAttributeSet, cancelForm, cancelRepeatableAttributeSet, previousObject, removeRepeatableAttributeSet, showFormNotification, updateFormAttribute, validateFormAttribute } from "../redux/actions";
|
|
7
7
|
import FormModel from "../models/form/FormModel";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -76,6 +76,16 @@ export var useAttributeUpdate = function useAttributeUpdate(form, object) {
|
|
|
76
76
|
return dispatch(updateFormAttribute(form, object, attribute, value, options));
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* Validate attributes of a form
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export var useAttributeValidate = function useAttributeValidate(form) {
|
|
84
|
+
var dispatch = useDispatch();
|
|
85
|
+
return function () {
|
|
86
|
+
return dispatch(validateFormAttribute(form));
|
|
87
|
+
};
|
|
88
|
+
};
|
|
79
89
|
/**
|
|
80
90
|
* Attributeset actions
|
|
81
91
|
*/
|
package/esm/hooks/useForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useDispatch","Href","getSetting","HTTP_METHODS","loadModularUI","removeModelByKey","useModularUI","addRepeatableAttributeSet","cancelForm","cancelRepeatableAttributeSet","previousObject","removeRepeatableAttributeSet","showFormNotification","updateFormAttribute","validateFormAttribute","FormModel","useForm","href","formHref","addParameter","form","method","POST","targetModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","useAttributeUpdate","object","attribute","value","options","useAttributeValidate","useAttributeSet","save"],"mappings":"AACA,SAASA,WAAT,QAA4B,aAA5B;AAEA,OAAOC,IAAP,MAAiB,qBAAjB;AAEA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,cAAzC;AAEA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,qBAAhD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,SACEC,yBADF,EAEEC,UAFF,EAGEC,4BAHF,EAIEC,cAJF,EAKEC,4BALF,EAMEC,oBANF,EAOEC,mBAPF,EAQEC,qBARF,QASO,kBATP;AAWA,OAAOC,SAAP,MAAsB,0BAAtB;;AA+BA;AACA;AACA;AACA,OAAO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAqC;AAC1D,MAAMC,QAAQ,GAAG,IAAIjB,IAAJ,CAASgB,IAAT,CAAjB;;AAEA,MAAI,CAACf,UAAU,CAAC,oBAAD,CAAf,EAAuC;AACrCgB,IAAAA,QAAQ,CAACC,YAAT,CAAsB,QAAtB,EAAgC,OAAhC;AACD;;AAED,MAAMC,IAAI,GAAGd,YAAY,CAAC,MAAD,EAASY,QAAT,EAAmB;AAC1CG,IAAAA,MAAM,EAAElB,YAAY,CAACmB,IADqB;AAE1CC,IAAAA,WAAW,EAAER,SAF6B;AAG1CS,IAAAA,eAAe,EAAE;AAHyB,GA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M,EAANA,MAJK;AAKLxB,IAAAA,oBAAoB,EAAEyB;AALjB,GAAP;AAOD,CA9BM;AAgCP;AACA;AACA;;AACA,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,CAChClB,IADgC,EAEhCmB,MAFgC,EAGR;AACxB,MAAMZ,QAAQ,GAAG3B,WAAW,EAA5B;AAEA,SAAO,UACLwC,SADK,EAELC,KAFK,EAGLC,OAHK;AAAA,WAIFf,QAAQ,CAACd,mBAAmB,CAACO,IAAD,EAAOmB,MAAP,EAAeC,SAAf,EAA0BC,KAA1B,EAAiCC,OAAjC,CAApB,CAJN;AAAA,GAAP;AAKD,CAXM;AAaP;AACA;AACA;;AACA,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAClCvB,IADkC,EAER;AAC1B,MAAMO,QAAQ,GAAG3B,WAAW,EAA5B;AAEA,SAAO;AAAA,WAAM2B,QAAQ,CAACb,qBAAqB,CAACM,IAAD,CAAtB,CAAd;AAAA,GAAP;AACD,CANM;AAQP;AACA;AACA;;AACA,OAAO,IAAMwB,eAAe,GAAG,SAAlBA,eAAkB,CAACxB,IAAD,EAAuC;AACpE,MAAMO,QAAQ,GAAG3B,WAAW,EAA5B;AAEA,SAAO;AACL6C,IAAAA,IAAI,EAAE;AAAA,aAAMlB,QAAQ,CAACpB,yBAAyB,CAACa,IAAD,CAA1B,CAAd;AAAA,KADD;AAELS,IAAAA,MAAM,EAAE,gBAACU,MAAD;AAAA,aACNZ,QAAQ,CAAClB,4BAA4B,CAACW,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA,KAFH;AAILH,IAAAA,MAAM,EAAE,gBAACG,MAAD;AAAA,aACNZ,QAAQ,CAAChB,4BAA4B,CAACS,IAAD,EAAOmB,MAAP,CAA7B,CADF;AAAA;AAJH,GAAP;AAOD,CAVM","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n validateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel, AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateModelAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateModelAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateModelAction,\n cancel: (object: FormObjectModel) => UpdateModelAction,\n remove: (object: FormObjectModel) => UpdateModelAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\ntype AttributeValidateHook = () => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Validate attributes of a form\n */\nexport const useAttributeValidate = (\n form: FormModel\n): AttributeValidateHook => {\n const dispatch = useDispatch();\n\n return () => dispatch(validateFormAttribute(form));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
|
|
@@ -31,6 +31,8 @@ import SectionModel from "../content/SectionModel";
|
|
|
31
31
|
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
32
32
|
import { isPlainObject } from "../../utils";
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
*/
|
|
34
36
|
var AttributeContent = /*#__PURE__*/function () {
|
|
35
37
|
function AttributeContent(content) {
|
|
36
38
|
_classCallCheck(this, AttributeContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;;IAaMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOL,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAIO,WAAW,GAAG,IAAlB;AACA,UAAIC,iBAAiB,GAAG,IAAxB;AAEA,UAAMC,KAAK,qBAAG,KAAKH,QAAR,4EAAG,eAAeI,MAAlB,0DAAG,sBAAuBD,KAArC;;AACA,UAAIA,KAAJ,EAAW;AACTF,QAAAA,WAAW,GAAGE,KAAd;AACD;;AAED,UAAME,WAAW,sBAAG,KAAKL,QAAR,6EAAG,gBAAeI,MAAlB,0DAAG,sBAAuBC,WAA3C;;AACA,UAAIA,WAAJ,EAAiB;AACf,YAAIR,aAAa,CAACQ,WAAD,CAAb,IAA8B,aAAaA,WAA/C,EAA4D;AAC1DH,UAAAA,iBAAiB,GAAGG,WAAW,CAACC,OAAhC;AACD,SAFD,MAEO,IAAI,OAAOD,WAAP,KAAuB,QAA3B,EAAqC;AAC1CH,UAAAA,iBAAiB,GAAGG,WAApB;AACD;AACF;;AAED,aAAO;AAAEF,QAAAA,KAAK,EAAEF,WAAT;AAAsBI,QAAAA,WAAW,EAAEH;AAAnC,OAAP;AACD;AAED;AACF;;;;SACE,eAA2B;AAAA;;AACzB,6BAAI,KAAKF,QAAT,4CAAI,gBAAeO,QAAnB,EAA6B;AAAA;;AAC3B,wCAAO,KAAKP,QAAL,CAAcO,QAArB,0DAAO,wEAA4B,UAACC,OA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AAKE,mCAAL,CAGL,iBAHK,EAGc,YAHd,EAG4BF,MAH5B,CAAP;AAID;AAED;AACF;;;;SACE,eAA6C;AAC3C,aAAO,KAAKC,4BAAL,CACL,qBADK,EAEL,eAFK,CAAP;AAID;AAED;AACF;AACA;;;;WACE,kCAAyBD,MAAzB,EAAyE;AACvE,aAAO,KAAKE,mCAAL,CAGL,qBAHK,EAGkB,eAHlB,EAGmCF,MAHnC,CAAP;AAID;AAED;AACF;;;;SACE,eAAoC;AAClC,aAAO,KAAKC,4BAAL,CACL,gBADK,EAEL,UAFK,CAAP;AAID;AAED;AACF;;;;WACE,2BAAkBE,KAAlB,EAA6D;AAAA;;AAC3D,aAAO,yCAAKR,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,0BAAAO,KAAK,MAAL,CAAAA,KAAK,EAAUP,OAAO,CAACQ,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKV,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCS,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,qBAAST,OAAO,CAACW,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;;AAGH,eAAe7B,gBAAf","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (element.propertyElement) {\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (element.textFragmentElement) {\n const { label, layouthint, textfragments } =\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (element.contentElement) {\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["retrieveText","hasAllContentInData","SectionModel","LayoutHintCollection","isPlainObject","AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,YAAT,QAA6B,0BAA7B;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AAEA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,aAAT,QAA8B,aAA9B;;AAaA;AACA;IACMC,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;;AAAA;;AACjC,SAAKC,QAAL,GAAgBD,OAAhB;AACD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAOL,mBAAmB,EAA1B;AACD;AAED;AACF;;;;SACE,eAGE;AAAA;;AACA,UAAIO,WAAW,GAAG,IAAlB;AACA,UAAIC,iBAAiB,GAAG,IAAxB;AAEA,UAAMC,KAAK,qBAAG,KAAKH,QAAR,4EAAG,eAAeI,MAAlB,0DAAG,sBAAuBD,KAArC;;AACA,UAAIA,KAAJ,EAAW;AACTF,QAAAA,WAAW,GAAGE,KAAd;AACD;;AAED,UAAME,WAAW,sBAAG,KAAKL,QAAR,6EAAG,gBAAeI,MAAlB,0DAAG,sBAAuBC,WAA3C;;AACA,UAAIA,WAAJ,EAAiB;AACf,YAAIR,aAAa,CAACQ,WAAD,CAAb,IAA8B,aAAaA,WAA/C,EAA4D;AAC1DH,UAAAA,iBAAiB,GAAGG,WAAW,CAACC,OAAhC;AACD,SAFD,MAEO,IAAI,OAAOD,WAAP,KAAuB,QAA3B,EAAqC;AAC1CH,UAAAA,iBAAiB,GAAGG,WAApB;AACD;AACF;;AAED,aAAO;AAAEF,QAAAA,KAAK,EAAEF,WAAT;AAAsBI,QAAAA,WAAW,EAAEH;AAAnC,OAA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";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\n/**\n */\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (element.propertyElement) {\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (element.textFragmentElement) {\n const { label, layouthint, textfragments } =\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (element.contentElement) {\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
@@ -31,6 +31,8 @@ import SubSectionModel from "./SubSectionModel";
|
|
|
31
31
|
import { createHashFromHref } from "../../utils/helpers/createHash";
|
|
32
32
|
import LinkModel from "../links/LinkModel";
|
|
33
33
|
import { retrieveText } from "../../utils";
|
|
34
|
+
/**
|
|
35
|
+
*/
|
|
34
36
|
|
|
35
37
|
var SectionModel = /*#__PURE__*/function (_BaseModel) {
|
|
36
38
|
_inherits(SectionModel, _BaseModel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/content/SectionModel.js"],"names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","data","entryDate","_entryDate","referred","_selflink","_links","self","selflink","href","type","sourceLabel","id","_id","getData","number","body","childSections","childSection","section","label","_childSections","sections","subSections","subSection","selfhref","push","referredChilds","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,mBAAtB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AAEA,SAASC,kBAAT,QAAmC,gCAAnC;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AAGA,SAASC,YAAT,QAA6B,aAA7B;;
|
|
1
|
+
{"version":3,"sources":["../../../src/models/content/SectionModel.js"],"names":["BaseModel","ContentLinkModel","SubSectionModel","createHashFromHref","LinkModel","retrieveText","SectionModel","data","entryDate","_entryDate","referred","_selflink","_links","self","selflink","href","type","sourceLabel","id","_id","getData","number","body","childSections","childSection","section","label","_childSections","sections","subSections","subSection","selfhref","push","referredChilds","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAP,MAAsB,mBAAtB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,O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;AAAA;AAAA;AAAA;;AAqB3D,aAAOL,QAAP;AACD;;;;EAnLwB5B,S;;AAsL3B,eAAeM,YAAf","sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(data: Object, entryDate: ISO_DATE | null) {\n super(data, {});\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(this.data._links?.self);\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate\n )\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map((childSection) => new SectionModel(childSection, this.entryDate));\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection)\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"file":"SectionModel.js"}
|
package/esm/models/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { default as AttributeModel } from "./attributes/AttributeModel";
|
|
|
9
9
|
import { default as BooleanAttributeModel } from "./attributes/BooleanAttributeModel";
|
|
10
10
|
import { default as CaptchaAttributeModel } from "./attributes/CaptchaAttributeModel";
|
|
11
11
|
import { default as ChoiceAttributeModel } from "./attributes/ChoiceAttributeModel";
|
|
12
|
+
export { default as ChoiceAttributeOptionCollection } from "./attributes/ChoiceAttributeOptionCollection";
|
|
12
13
|
export { default as ChoiceAttributeOptionModel } from "./attributes/ChoiceAttributeOptionModel";
|
|
13
14
|
import { default as CompositeAttributeModel } from "./attributes/CompositeAttributeModel";
|
|
14
15
|
export { default as CompositeAttributeChildCollection } from "./attributes/CompositeAttributeChildCollection";
|
package/esm/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/index.js"],"names":["default","resolveModel","BaseCollection","ActionCollection","ActionModel","ApplicationModel","AttributeCollection","AttributeSetModel","AttributeModel","BooleanAttributeModel","CaptchaAttributeModel","ChoiceAttributeModel","ChoiceAttributeOptionModel","CompositeAttributeModel","CompositeAttributeChildCollection","DatetimeAttributeModel","HelptextAttributeModel","LabelAttributeModel","MemoAttributeModel","MoneyAttributeModel","NumberAttributeModel","PasswordAttributeModel","StringAttributeModel","UploadAttributeModel","XMLAttributeModel","AttributeContent","LayoutHintRuleCollection","addLayoutHintRule","updateLayoutHintRules","BaseLayoutHintRule","DependentAttribute","RemainingTotalUploadSize","CaseViewModel","BusinessScenarioModel","ConceptDetailModel","ConceptIndexModel","ConceptLinkModel","ConceptRelationCollection","ConceptRelationModel","ConceptTypeDetailModel","SourceReferenceCollection","SourceReferenceModel","ConstraintCollection","ConstraintModel","ContentIndexModel","ContentLinkModel","ContentModel","ContentTOCModel","ContentTypeModel","SectionModel","SubSectionModel","ContentConfiguration","ContentConfigurationElements","ContentConfigurationEndResults","ContentConfigurationQuestions","ContentConfigurationResults","DetailModel","ErrorCollection","ErrorModel","ErrorResponse","AssignmentFilterModel","FilterModel","RangeFilterModel","ConceptIndexFilterModel","FilterCollection","FormModel","FormObjectModel","GroupingModel","GroupModel","Href","ListHref","LinkCollection","LinkModel","ListDetailModel","ListHeaderModel","ListItemCollection","ListItemModel","ListModel","LookupOptionsModel","LookupOptionCollection","ModelCatalogModel","ProcessStatusSettingsModel","PagesizeModel","PagingModel","Parameter","GroupingPanelModel","CaseSearchModel","SortingModel","SortOptionModel","TabModel","TaskGroupCollection","TaskGroupModel","UserModel","UserProfileModel","UserServicesModel"],"mappings":"AACA,SAASA,OAAO,IAA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mBA9BF,EA+BEC,oBA/BF,EAgCEC,sBAhCF,EAiCER,uBAjCF,EAkCES,oBAlCF,EAmCEC,oBAnCF,EAoCEC,iBApCF,EAqCEoC,qBArCF,EAsCEC,WAtCF,EAuCEC,gBAvCF,EAwCEC,uBAxCF","sourcesContent":["// @flow\nexport { default as resolveModel } from \"./resolveModel\";\n\nexport { default as BaseCollection } from \"./base/BaseCollection\";\n\nexport { default as ActionCollection } from \"./actions/ActionCollection\";\nexport { default as ActionModel } from \"./actions/ActionModel\";\n\nimport { default as ApplicationModel } from \"./application/ApplicationModel\";\n\nexport { default as AttributeCollection } from \"./attributes/AttributeCollection\";\nexport { default as AttributeSetModel } from \"./attributes/AttributeSetModel\";\n\nexport { default as AttributeModel } from \"./attributes/AttributeModel\";\nimport { default as BooleanAttributeModel } from \"./attributes/BooleanAttributeModel\";\nimport { default as CaptchaAttributeModel } from \"./attributes/CaptchaAttributeModel\";\nimport { default as ChoiceAttributeModel } from \"./attributes/ChoiceAttributeModel\";\nexport { default as ChoiceAttributeOptionModel } from \"./attributes/ChoiceAttributeOptionModel\";\nimport { default as CompositeAttributeModel } from \"./attributes/CompositeAttributeModel\";\nexport { default as CompositeAttributeChildCollection } from \"./attributes/CompositeAttributeChildCollection\";\nimport { default as DatetimeAttributeModel } from \"./attributes/DatetimeAttributeModel\";\nimport { default as HelptextAttributeModel } from \"./attributes/HelptextAttributeModel\";\nimport { default as LabelAttributeModel } from \"./attributes/LabelAttributeModel\";\nimport { default as MemoAttributeModel } from \"./attributes/MemoAttributeModel\";\nimport { default as MoneyAttributeModel } from \"./attributes/MoneyAttributeModel\";\nimport { default as NumberAttributeModel } from \"./attributes/NumberAttributeModel\";\nimport { default as PasswordAttributeModel } from \"./attributes/PasswordAttributeModel\";\nimport { default as StringAttributeModel } from \"./attributes/StringAttributeModel\";\nimport { default as UploadAttributeModel } from \"./attributes/UploadAttributeModel\";\nimport { default as XMLAttributeModel } from \"./attributes/XMLAttributeModel\";\n\nexport { default as AttributeContent } from \"./attributes/AttributeContent\";\n\nexport {\n default as LayoutHintRuleCollection,\n addLayoutHintRule,\n updateLayoutHintRules,\n} from \"./attributes/layouthint-rules/LayoutHintRuleCollection\";\nexport { default as BaseLayoutHintRule } from \"./attributes/layouthint-rules/BaseLayoutHintRule\";\nexport { default as DependentAttribute } from \"./attributes/layouthint-rules/DependentAttribute\";\nexport { default as RemainingTotalUploadSize } from \"./attributes/layouthint-rules/RemainingTotalUploadSize\";\n\nimport { default as CaseViewModel } from \"./caseview/CaseViewModel\";\n\nimport { default as BusinessScenarioModel } from \"./concepts/BusinessScenarioModel\";\nimport { default as ConceptDetailModel } from \"./concepts/ConceptDetailModel\";\nimport { default as ConceptIndexModel } from \"./concepts/ConceptIndexModel\";\nexport { default as ConceptLinkModel } from \"./concepts/ConceptLinkModel\";\nexport { default as ConceptRelationCollection } from \"./concepts/ConceptRelationCollection\";\nexport { default as ConceptRelationModel } from \"./concepts/ConceptRelationModel\";\nimport { default as ConceptTypeDetailModel } from \"./concepts/ConceptTypeDetailModel\";\nexport { default as SourceReferenceCollection } from \"./concepts/SourceReferenceCollection\";\nexport { default as SourceReferenceModel } from \"./concepts/SourceReferenceModel\";\n\nexport { default as ConstraintCollection } from \"./attributes/input-constraints/ConstraintCollection\";\nexport { default as ConstraintModel } from \"./attributes/input-constraints/ConstraintModel\";\n\nimport { default as ContentIndexModel } from \"./content/ContentIndexModel\";\nexport { default as ContentLinkModel } from \"./content/ContentLinkModel\";\nimport { default as ContentModel } from \"./content/ContentModel\";\nimport { default as ContentTOCModel } from \"./content/ContentTOCModel\";\nimport { default as ContentTypeModel } from \"./content/ContentTypeModel\";\nexport { default as SectionModel } from \"./content/SectionModel\";\nexport { default as SubSectionModel } from \"./content/SubSectionModel\";\n\nexport { default as ContentConfiguration } from \"./contentconfiguration/ContentConfiguration\";\nexport { default as ContentConfigurationElements } from \"./contentconfiguration/ContentConfigurationElements\";\nexport { default as ContentConfigurationEndResults } from \"./contentconfiguration/ContentConfigurationEndResults\";\nexport { default as ContentConfigurationQuestions } from \"./contentconfiguration/ContentConfigurationQuestions\";\nexport { default as ContentConfigurationResults } from \"./contentconfiguration/ContentConfigurationResults\";\n\nimport { default as DetailModel } from \"./detail/DetailModel\";\n\nexport { default as ErrorCollection } from \"./error/ErrorCollection\";\nexport { default as ErrorModel } from \"./error/ErrorModel\";\nexport { default as ErrorResponse } from \"./error/ErrorResponse\";\n\nimport { default as AssignmentFilterModel } from \"./filters/AssignmentFilterModel\";\nimport { default as FilterModel } from \"./filters/FilterModel\";\nimport { default as RangeFilterModel } from \"./filters/RangeFilterModel\";\nimport { default as ConceptIndexFilterModel } from \"./filters/ConceptIndexFilterModel\";\nexport { default as FilterCollection } from \"./filters/FilterCollection\";\n\nimport { default as FormModel } from \"./form/FormModel\";\nexport { default as FormObjectModel } from \"./form/FormObjectModel\";\n\nexport { default as GroupingModel, GroupModel } from \"./grouping/GroupingModel\";\n\nexport { default as Href } from \"./href/Href\";\nexport { default as ListHref } from \"./href/ListHref\";\n\nexport { default as LinkCollection } from \"./links/LinkCollection\";\nexport { default as LinkModel } from \"./links/LinkModel\";\n\nimport { default as ListDetailModel } from \"./list/ListDetailModel\";\nexport { default as ListHeaderModel } from \"./list/ListHeaderModel\";\nexport { default as ListItemCollection } from \"./list/ListItemCollection\";\nexport { default as ListItemModel } from \"./list/ListItemModel\";\nimport { default as ListModel } from \"./list/ListModel\";\n\nexport { default as LookupOptionsModel } from \"./lookup/LookupOptionsModel\";\nexport { default as LookupOptionCollection } from \"./lookup/LookupOptionCollection\";\n\nimport { default as ModelCatalogModel } from \"./modelcatalog/ModelCatalogModel\";\n\nexport { default as ProcessStatusSettingsModel } from \"./process/ProcessStatusSettingsModel\";\n\nexport { default as PagesizeModel } from \"./paging/PagesizeModel\";\nexport { default as PagingModel } from \"./paging/PagingModel\";\n\nexport { default as Parameter } from \"./parameter/Parameter\";\n\nimport { default as GroupingPanelModel } from \"./panels/GroupingPanelModel\";\n\nimport { default as CaseSearchModel } from \"./search/CaseSearchModel\";\n\nexport { default as SortingModel } from \"./sorting/SortingModel\";\nexport { default as SortOptionModel } from \"./sorting/SortOptionModel\";\n\nimport { default as TabModel } from \"./tab/TabModel\";\n\nexport { default as TaskGroupCollection } from \"./taskgroup/TaskGroupCollection\";\nimport { default as TaskGroupModel } from \"./taskgroup/TaskGroupModel\";\n\nimport { default as UserModel } from \"./user/UserModel\";\nimport { default as UserProfileModel } from \"./user/UserProfileModel\";\nimport { default as UserServicesModel } from \"./user/UserServicesModel\";\n\nexport {\n ApplicationModel,\n CaseSearchModel,\n CaseViewModel,\n ListDetailModel,\n DetailModel,\n FormModel,\n GroupingPanelModel,\n ListModel,\n TabModel,\n TaskGroupModel,\n UserModel,\n UserProfileModel,\n UserServicesModel,\n ModelCatalogModel,\n ConceptIndexModel,\n ConceptDetailModel,\n BusinessScenarioModel,\n ConceptTypeDetailModel,\n ContentIndexModel,\n ContentTOCModel,\n ContentModel,\n ContentTypeModel,\n BooleanAttributeModel,\n CaptchaAttributeModel,\n ChoiceAttributeModel,\n DatetimeAttributeModel,\n HelptextAttributeModel,\n LabelAttributeModel,\n MemoAttributeModel,\n MoneyAttributeModel,\n NumberAttributeModel,\n PasswordAttributeModel,\n CompositeAttributeModel,\n StringAttributeModel,\n UploadAttributeModel,\n XMLAttributeModel,\n AssignmentFilterModel,\n FilterModel,\n RangeFilterModel,\n ConceptIndexFilterModel,\n};\n\nexport type * from \"./types\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/models/index.js"],"names":["default","resolveModel","BaseCollection","ActionCollection","ActionModel","ApplicationModel","AttributeCollection","AttributeSetModel","AttributeModel","BooleanAttributeModel","CaptchaAttributeModel","ChoiceAttributeModel","ChoiceAttributeOptionCollection","ChoiceAttributeOptionModel","CompositeAttributeModel","CompositeAttributeChildCollection","DatetimeAttributeModel","HelptextAttributeModel","LabelAttributeModel","MemoAttributeModel","MoneyAttributeModel","NumberAttributeModel","PasswordAttributeModel","StringAttributeModel","UploadAttributeModel","XMLAttributeModel","AttributeContent","LayoutHintRuleCollection","addLayoutHintRule","updateLayoutHintRules","BaseLayoutHintRule","DependentAttribute","RemainingTotalUploadSize","CaseViewModel","BusinessScenarioModel","ConceptDetailModel","ConceptIndexModel","ConceptLinkModel","ConceptRelationCollection","ConceptRelationModel","ConceptTypeDetailModel","SourceReferenceCollection","SourceReferenceModel","ConstraintCollection","ConstraintModel","ContentIndexModel","ContentLinkModel","ContentModel","ContentTOCModel","ContentTypeModel","SectionModel","SubSectionModel","ContentConfiguration","ContentConfigurationElements","ContentConfigurationEndResults","ContentConfigurationQuestions","ContentConfigurationResults","DetailModel","ErrorCollection","ErrorModel","ErrorResponse","AssignmentFilterModel","FilterModel","RangeFilterModel","ConceptIndexFilterModel","FilterCollection","FormModel","FormObjectModel","GroupingModel","GroupModel","Href","ListHref","LinkCollection","LinkModel","ListDetailModel","ListHeaderModel","ListItemCollection","ListItemModel","ListModel","LookupOptionsModel","LookupOptionCollection","ModelCatalogModel","ProcessStatusSettingsModel","PagesizeModel","PagingModel","Parameter","GroupingPanelModel","CaseSearchModel","SortingModel","SortOptionModel","TabModel","TaskGroupCollection","TaskGroupModel","UserModel","UserProfileModel","UserServicesModel"],"mappings":"AACA,SAASA,OAAO,IAAIC,YAApB,QAAwC,gBAAxC;AAEA,SAASD,OAAO,IAAIE,cAApB,QAA0C,uBAA1C;AAEA,SAASF,OAAO,IAAIG,gBAApB,QAA4C,4BAA5C;AACA,SAASH,OAAO,IAAII,WAApB,QAAuC,uBAAvC;AAEA,SAASJ,OAAO,IAAIK,gBAApB,QAA4C,gCAA5C;AAEA,SAASL,OAAO,IAAIM,mBAApB,QAA+C,kCAA/C;AACA,SAASN,OAAO,IAAIO,iBAApB,QAA6C,gCAA7C;AAEA,SAASP,OAAO,IAAIQ,cAApB,QAA0C,6BAA1C;AACA,SAASR,OAAO,IAAIS,qBAApB,QAAiD,oCAAjD;AACA,SAAST,OAAO,IAAIU,qBAApB,QA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AAEA,SAASvF,OAAO,IAAIwF,YAApB,QAAwC,wBAAxC;AACA,SAASxF,OAAO,IAAIyF,eAApB,QAA2C,2BAA3C;AAEA,SAASzF,OAAO,IAAI0F,QAApB,QAAoC,gBAApC;AAEA,SAAS1F,OAAO,IAAI2F,mBAApB,QAA+C,iCAA/C;AACA,SAAS3F,OAAO,IAAI4F,cAApB,QAA0C,4BAA1C;AAEA,SAAS5F,OAAO,IAAI6F,SAApB,QAAqC,kBAArC;AACA,SAAS7F,OAAO,IAAI8F,gBAApB,QAA4C,yBAA5C;AACA,SAAS9F,OAAO,IAAI+F,iBAApB,QAA6C,0BAA7C;AAEA,SACE1F,gBADF,EAEEkF,eAFF,EAGEtD,aAHF,EAIEyC,eAJF,EAKEjB,WALF,EAMES,SANF,EAOEoB,kBAPF,EAQER,SARF,EASEY,QATF,EAUEE,cAVF,EAWEC,SAXF,EAYEC,gBAZF,EAaEC,iBAbF,EAcEd,iBAdF,EAeE7C,iBAfF,EAgBED,kBAhBF,EAiBED,qBAjBF,EAkBEM,sBAlBF,EAmBEK,iBAnBF,EAoBEG,eApBF,EAqBED,YArBF,EAsBEE,gBAtBF,EAuBExC,qBAvBF,EAwBEC,qBAxBF,EAyBEC,oBAzBF,EA0BEK,sBA1BF,EA2BEC,sBA3BF,EA4BEC,mBA5BF,EA6BEC,kBA7BF,EA8BEC,mBA9BF,EA+BEC,oBA/BF,EAgCEC,sBAhCF,EAiCER,uBAjCF,EAkCES,oBAlCF,EAmCEC,oBAnCF,EAoCEC,iBApCF,EAqCEoC,qBArCF,EAsCEC,WAtCF,EAuCEC,gBAvCF,EAwCEC,uBAxCF","sourcesContent":["// @flow\nexport { default as resolveModel } from \"./resolveModel\";\n\nexport { default as BaseCollection } from \"./base/BaseCollection\";\n\nexport { default as ActionCollection } from \"./actions/ActionCollection\";\nexport { default as ActionModel } from \"./actions/ActionModel\";\n\nimport { default as ApplicationModel } from \"./application/ApplicationModel\";\n\nexport { default as AttributeCollection } from \"./attributes/AttributeCollection\";\nexport { default as AttributeSetModel } from \"./attributes/AttributeSetModel\";\n\nexport { default as AttributeModel } from \"./attributes/AttributeModel\";\nimport { default as BooleanAttributeModel } from \"./attributes/BooleanAttributeModel\";\nimport { default as CaptchaAttributeModel } from \"./attributes/CaptchaAttributeModel\";\nimport { default as ChoiceAttributeModel } from \"./attributes/ChoiceAttributeModel\";\nexport { default as ChoiceAttributeOptionCollection } from \"./attributes/ChoiceAttributeOptionCollection\";\nexport { default as ChoiceAttributeOptionModel } from \"./attributes/ChoiceAttributeOptionModel\";\nimport { default as CompositeAttributeModel } from \"./attributes/CompositeAttributeModel\";\nexport { default as CompositeAttributeChildCollection } from \"./attributes/CompositeAttributeChildCollection\";\nimport { default as DatetimeAttributeModel } from \"./attributes/DatetimeAttributeModel\";\nimport { default as HelptextAttributeModel } from \"./attributes/HelptextAttributeModel\";\nimport { default as LabelAttributeModel } from \"./attributes/LabelAttributeModel\";\nimport { default as MemoAttributeModel } from \"./attributes/MemoAttributeModel\";\nimport { default as MoneyAttributeModel } from \"./attributes/MoneyAttributeModel\";\nimport { default as NumberAttributeModel } from \"./attributes/NumberAttributeModel\";\nimport { default as PasswordAttributeModel } from \"./attributes/PasswordAttributeModel\";\nimport { default as StringAttributeModel } from \"./attributes/StringAttributeModel\";\nimport { default as UploadAttributeModel } from \"./attributes/UploadAttributeModel\";\nimport { default as XMLAttributeModel } from \"./attributes/XMLAttributeModel\";\n\nexport { default as AttributeContent } from \"./attributes/AttributeContent\";\n\nexport {\n default as LayoutHintRuleCollection,\n addLayoutHintRule,\n updateLayoutHintRules,\n} from \"./attributes/layouthint-rules/LayoutHintRuleCollection\";\nexport { default as BaseLayoutHintRule } from \"./attributes/layouthint-rules/BaseLayoutHintRule\";\nexport { default as DependentAttribute } from \"./attributes/layouthint-rules/DependentAttribute\";\nexport { default as RemainingTotalUploadSize } from \"./attributes/layouthint-rules/RemainingTotalUploadSize\";\n\nimport { default as CaseViewModel } from \"./caseview/CaseViewModel\";\n\nimport { default as BusinessScenarioModel } from \"./concepts/BusinessScenarioModel\";\nimport { default as ConceptDetailModel } from \"./concepts/ConceptDetailModel\";\nimport { default as ConceptIndexModel } from \"./concepts/ConceptIndexModel\";\nexport { default as ConceptLinkModel } from \"./concepts/ConceptLinkModel\";\nexport { default as ConceptRelationCollection } from \"./concepts/ConceptRelationCollection\";\nexport { default as ConceptRelationModel } from \"./concepts/ConceptRelationModel\";\nimport { default as ConceptTypeDetailModel } from \"./concepts/ConceptTypeDetailModel\";\nexport { default as SourceReferenceCollection } from \"./concepts/SourceReferenceCollection\";\nexport { default as SourceReferenceModel } from \"./concepts/SourceReferenceModel\";\n\nexport { default as ConstraintCollection } from \"./attributes/input-constraints/ConstraintCollection\";\nexport { default as ConstraintModel } from \"./attributes/input-constraints/ConstraintModel\";\n\nimport { default as ContentIndexModel } from \"./content/ContentIndexModel\";\nexport { default as ContentLinkModel } from \"./content/ContentLinkModel\";\nimport { default as ContentModel } from \"./content/ContentModel\";\nimport { default as ContentTOCModel } from \"./content/ContentTOCModel\";\nimport { default as ContentTypeModel } from \"./content/ContentTypeModel\";\nexport { default as SectionModel } from \"./content/SectionModel\";\nexport { default as SubSectionModel } from \"./content/SubSectionModel\";\n\nexport { default as ContentConfiguration } from \"./contentconfiguration/ContentConfiguration\";\nexport { default as ContentConfigurationElements } from \"./contentconfiguration/ContentConfigurationElements\";\nexport { default as ContentConfigurationEndResults } from \"./contentconfiguration/ContentConfigurationEndResults\";\nexport { default as ContentConfigurationQuestions } from \"./contentconfiguration/ContentConfigurationQuestions\";\nexport { default as ContentConfigurationResults } from \"./contentconfiguration/ContentConfigurationResults\";\n\nimport { default as DetailModel } from \"./detail/DetailModel\";\n\nexport { default as ErrorCollection } from \"./error/ErrorCollection\";\nexport { default as ErrorModel } from \"./error/ErrorModel\";\nexport { default as ErrorResponse } from \"./error/ErrorResponse\";\n\nimport { default as AssignmentFilterModel } from \"./filters/AssignmentFilterModel\";\nimport { default as FilterModel } from \"./filters/FilterModel\";\nimport { default as RangeFilterModel } from \"./filters/RangeFilterModel\";\nimport { default as ConceptIndexFilterModel } from \"./filters/ConceptIndexFilterModel\";\nexport { default as FilterCollection } from \"./filters/FilterCollection\";\n\nimport { default as FormModel } from \"./form/FormModel\";\nexport { default as FormObjectModel } from \"./form/FormObjectModel\";\n\nexport { default as GroupingModel, GroupModel } from \"./grouping/GroupingModel\";\n\nexport { default as Href } from \"./href/Href\";\nexport { default as ListHref } from \"./href/ListHref\";\n\nexport { default as LinkCollection } from \"./links/LinkCollection\";\nexport { default as LinkModel } from \"./links/LinkModel\";\n\nimport { default as ListDetailModel } from \"./list/ListDetailModel\";\nexport { default as ListHeaderModel } from \"./list/ListHeaderModel\";\nexport { default as ListItemCollection } from \"./list/ListItemCollection\";\nexport { default as ListItemModel } from \"./list/ListItemModel\";\nimport { default as ListModel } from \"./list/ListModel\";\n\nexport { default as LookupOptionsModel } from \"./lookup/LookupOptionsModel\";\nexport { default as LookupOptionCollection } from \"./lookup/LookupOptionCollection\";\n\nimport { default as ModelCatalogModel } from \"./modelcatalog/ModelCatalogModel\";\n\nexport { default as ProcessStatusSettingsModel } from \"./process/ProcessStatusSettingsModel\";\n\nexport { default as PagesizeModel } from \"./paging/PagesizeModel\";\nexport { default as PagingModel } from \"./paging/PagingModel\";\n\nexport { default as Parameter } from \"./parameter/Parameter\";\n\nimport { default as GroupingPanelModel } from \"./panels/GroupingPanelModel\";\n\nimport { default as CaseSearchModel } from \"./search/CaseSearchModel\";\n\nexport { default as SortingModel } from \"./sorting/SortingModel\";\nexport { default as SortOptionModel } from \"./sorting/SortOptionModel\";\n\nimport { default as TabModel } from \"./tab/TabModel\";\n\nexport { default as TaskGroupCollection } from \"./taskgroup/TaskGroupCollection\";\nimport { default as TaskGroupModel } from \"./taskgroup/TaskGroupModel\";\n\nimport { default as UserModel } from \"./user/UserModel\";\nimport { default as UserProfileModel } from \"./user/UserProfileModel\";\nimport { default as UserServicesModel } from \"./user/UserServicesModel\";\n\nexport {\n ApplicationModel,\n CaseSearchModel,\n CaseViewModel,\n ListDetailModel,\n DetailModel,\n FormModel,\n GroupingPanelModel,\n ListModel,\n TabModel,\n TaskGroupModel,\n UserModel,\n UserProfileModel,\n UserServicesModel,\n ModelCatalogModel,\n ConceptIndexModel,\n ConceptDetailModel,\n BusinessScenarioModel,\n ConceptTypeDetailModel,\n ContentIndexModel,\n ContentTOCModel,\n ContentModel,\n ContentTypeModel,\n BooleanAttributeModel,\n CaptchaAttributeModel,\n ChoiceAttributeModel,\n DatetimeAttributeModel,\n HelptextAttributeModel,\n LabelAttributeModel,\n MemoAttributeModel,\n MoneyAttributeModel,\n NumberAttributeModel,\n PasswordAttributeModel,\n CompositeAttributeModel,\n StringAttributeModel,\n UploadAttributeModel,\n XMLAttributeModel,\n AssignmentFilterModel,\n FilterModel,\n RangeFilterModel,\n ConceptIndexFilterModel,\n};\n\nexport type * from \"./types\";\n"],"file":"index.js"}
|
|
@@ -17,7 +17,7 @@ export var updateFormAttribute = function updateFormAttribute(form, formObject,
|
|
|
17
17
|
return function (dispatch) {
|
|
18
18
|
var newForm = form.clone();
|
|
19
19
|
|
|
20
|
-
if (
|
|
20
|
+
if (options.validate === undefined) {
|
|
21
21
|
options.validate = true;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -50,4 +50,13 @@ export var updateFormAttribute = function updateFormAttribute(form, formObject,
|
|
|
50
50
|
return dispatch(updateModel(newForm));
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Validate an attribute on a form
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
export var validateFormAttribute = function validateFormAttribute(form) {
|
|
58
|
+
return function (dispatch) {
|
|
59
|
+
return dispatch(validateFormObject(form));
|
|
60
|
+
};
|
|
61
|
+
};
|
|
53
62
|
//# sourceMappingURL=FormAttributeSet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateModel","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations"],"mappings":"AACA,SAASA,WAAT,QAA4B,uBAA5B;AAEA,SAASC,UAAT,QAA2B,0BAA3B;AAEA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,oBAAT,QAAqC,kBAArC;;AAOA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAC9B,SADWA,mBACX,CACEC,IADF,EAEEC,UAFF,EAGEC,SAHF,EAIEC,UAJF;AAAA,MAKEC,OALF,uEAK+B;AAC3BC,IAAAA,UAAU,EAAE,KADe;AAE3BC,IAAAA,QAAQ,EAAE,KAFiB;AAG3BC,IAAAA,WAAW,EAAE,KAHc;AAI3BC,IAAAA,QAAQ,EAAE;AAJiB,GAL/B;AAAA,SAYA,UAACC,QAAD,EAAwB;AACtB,QAAMC,OAAO,GAAGV,IAAI,CAACW,KAAL,EAAhB;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateModel","getSetting","validateFormObject","autosaveFormObject","autosubmitFormObject","updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations","validateFormAttribute"],"mappings":"AACA,SAASA,WAAT,QAA4B,uBAA5B;AAEA,SAASC,UAAT,QAA2B,0BAA3B;AAEA,SAASC,kBAAT,QAAmC,mBAAnC;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AACA,SAASC,oBAAT,QAAqC,kBAArC;;AAOA;AACA;AACA;AACA,OAAO,IAAMC,mBAAmB,GAC9B,SADW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CAACa,OAAD,CAAnB,CAAR;AACD;;AAED,QACEA,OAAO,CAACG,iBAAR,IACAT,OAAO,CAACI,QADR,IAEAE,OAAO,CAACG,iBAAR,CAA0BS,qBAF1B,IAGA3B,UAAU,CAAC,+BAAD,CAJZ,EAKE;AACAc,MAAAA,QAAQ,CAACb,kBAAkB,CAACc,OAAD,CAAnB,CAAR;AACD;;AAED,WAAOD,QAAQ,CAACf,WAAW,CAACgB,OAAD,CAAZ,CAAf;AACD,GAzDD;AAAA,CADK;AA4DP;AACA;AACA;;AACA,OAAO,IAAMa,qBAAqB,GAChC,SADWA,qBACX,CAACvB,IAAD;AAAA,SACA,UAACS,QAAD,EAAwB;AACtB,WAAOA,QAAQ,CAACb,kBAAkB,CAACI,IAAD,CAAnB,CAAf;AACD,GAHD;AAAA,CADK","sourcesContent":["// @flow\nimport { updateModel } from \"../_modularui/actions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false,\n forceUpdate: false,\n validate: true,\n }\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (\n newForm.currentFormObject &&\n newForm.currentFormObject.equals(formObject)\n ) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n\n if (\n newForm.currentFormObject &&\n options.validate &&\n newForm.currentFormObject.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n dispatch(validateFormObject(newForm));\n }\n\n return dispatch(updateModel(newForm));\n };\n\n/**\n * Validate an attribute on a form\n */\nexport const validateFormAttribute =\n (form: FormModel): ThunkAction =>\n (dispatch: Dispatch) => {\n return dispatch(validateFormObject(form));\n };\n"],"file":"FormAttributeSet.js"}
|
package/lib/hooks/useForm.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useFormNavigation = exports.useForm = exports.useAttributeUpdate = exports.useAttributeSet = void 0;
|
|
8
|
+
exports.useFormNavigation = exports.useForm = exports.useAttributeValidate = exports.useAttributeUpdate = exports.useAttributeSet = void 0;
|
|
9
9
|
|
|
10
10
|
var _reactRedux = require("react-redux");
|
|
11
11
|
|
|
@@ -98,12 +98,25 @@ var useAttributeUpdate = function useAttributeUpdate(form, object) {
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Validate attributes of a form
|
|
102
102
|
*/
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
exports.useAttributeUpdate = useAttributeUpdate;
|
|
106
106
|
|
|
107
|
+
var useAttributeValidate = function useAttributeValidate(form) {
|
|
108
|
+
var dispatch = (0, _reactRedux.useDispatch)();
|
|
109
|
+
return function () {
|
|
110
|
+
return dispatch((0, _actions.validateFormAttribute)(form));
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Attributeset actions
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
exports.useAttributeValidate = useAttributeValidate;
|
|
119
|
+
|
|
107
120
|
var useAttributeSet = function useAttributeSet(form) {
|
|
108
121
|
var dispatch = (0, _reactRedux.useDispatch)();
|
|
109
122
|
return {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
removeRepeatableAttributeSet,
|
|
17
17
|
showFormNotification,
|
|
18
18
|
updateFormAttribute,
|
|
19
|
+
validateFormAttribute,
|
|
19
20
|
} from "../redux/actions";
|
|
20
21
|
|
|
21
22
|
import FormModel from "../models/form/FormModel";
|
|
@@ -47,6 +48,8 @@ type AttributeUpdateHook = (
|
|
|
47
48
|
options: UpdateFormOptions
|
|
48
49
|
) => void;
|
|
49
50
|
|
|
51
|
+
type AttributeValidateHook = () => void;
|
|
52
|
+
|
|
50
53
|
/**
|
|
51
54
|
* Load a form by href
|
|
52
55
|
*/
|
|
@@ -119,6 +122,17 @@ export const useAttributeUpdate = (
|
|
|
119
122
|
) => dispatch(updateFormAttribute(form, object, attribute, value, options));
|
|
120
123
|
};
|
|
121
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Validate attributes of a form
|
|
127
|
+
*/
|
|
128
|
+
export const useAttributeValidate = (
|
|
129
|
+
form: FormModel
|
|
130
|
+
): AttributeValidateHook => {
|
|
131
|
+
const dispatch = useDispatch();
|
|
132
|
+
|
|
133
|
+
return () => dispatch(validateFormAttribute(form));
|
|
134
|
+
};
|
|
135
|
+
|
|
122
136
|
/**
|
|
123
137
|
* Attributeset actions
|
|
124
138
|
*/
|
package/lib/hooks/useForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useForm","href","formHref","Href","addParameter","form","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","useAttributeSet","save"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useForm.js"],"names":["useForm","href","formHref","Href","addParameter","form","method","HTTP_METHODS","POST","targetModel","FormModel","removeOnUnmount","model","useFormNavigation","dispatch","previous","cancel","submit","connectKey","selfhref","data","formdata","updateModel","remove","showFormNotificationAction","showFormNotification","useAttributeUpdate","object","attribute","value","options","useAttributeValidate","useAttributeSet","save"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAWA;;AA+BA;AACA;AACA;AACO,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAqC;AAC1D,MAAMC,QAAQ,GAAG,IAAIC,aAAJ,CAASF,IAAT,CAAjB;;AAEA,MAAI,CAAC,2BAAW,oBAAX,CAAL,EAAuC;AACrCC,IAAAA,QAAQ,CAACE,YAAT,CAAsB,QAAtB,EAAgC,OAAhC;AACD;;AAED,MAAMC,IAAI,GAAG,gCAAa,MAAb,EAAqBH,QAArB,EAA+B;AAC1CI,IAAAA,MAAM,EAAEC,wBAAaC,IADqB;AAE1CC,IAAAA,WAAW,EAAEC,kBAF6B;AAG1CC,IAAAA,eAAe,EAAE;AAHyB,GAA/B,CAAb;;AAMA,MAAIN,IAAJ,aAAIA,IAAJ,eAAIA,IAAI,CAAEO,KAAV,EAAiB;AACf,WAAOP,IAAI,CAACO,KAAZ;AACD;AACF,CAhBM;AAkBP;AACA;AACA;;;;;AACO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,GAA0B;AACzD,MAAMC,QAAQ,GAAG,8BAAjB;;AAEA,MAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACV,IAAD;AAAA,WAAqBS,QAAQ,CAAC,6BAAeT,IAAf,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AA,GAAP;AAKD,CAXM;AAaP;AACA;AACA;;;;;AACO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAClC1B,IADkC,EAER;AAC1B,MAAMS,QAAQ,GAAG,8BAAjB;AAEA,SAAO;AAAA,WAAMA,QAAQ,CAAC,oCAAsBT,IAAtB,CAAD,CAAd;AAAA,GAAP;AACD,CANM;AAQP;AACA;AACA;;;;;AACO,IAAM2B,eAAe,GAAG,SAAlBA,eAAkB,CAAC3B,IAAD,EAAuC;AACpE,MAAMS,QAAQ,GAAG,8BAAjB;AAEA,SAAO;AACLmB,IAAAA,IAAI,EAAE;AAAA,aAAMnB,QAAQ,CAAC,wCAA0BT,IAA1B,CAAD,CAAd;AAAA,KADD;AAELW,IAAAA,MAAM,EAAE,gBAACW,MAAD;AAAA,aACNb,QAAQ,CAAC,2CAA6BT,IAA7B,EAAmCsB,MAAnC,CAAD,CADF;AAAA,KAFH;AAILJ,IAAAA,MAAM,EAAE,gBAACI,MAAD;AAAA,aACNb,QAAQ,CAAC,2CAA6BT,IAA7B,EAAmCsB,MAAnC,CAAD,CADF;AAAA;AAJH,GAAP;AAOD,CAVM","sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\n\nimport Href from \"../models/href/Href\";\n\nimport { getSetting, HTTP_METHODS } from \"../constants\";\n\nimport { loadModularUI, removeModelByKey } from \"../redux/_modularui\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport {\n addRepeatableAttributeSet,\n cancelForm,\n cancelRepeatableAttributeSet,\n previousObject,\n removeRepeatableAttributeSet,\n showFormNotification,\n updateFormAttribute,\n validateFormAttribute,\n} from \"../redux/actions\";\n\nimport FormModel from \"../models/form/FormModel\";\n\nimport type { FormObjectModel, AttributeType } from \"../models\";\nimport type { UpdateFormOptions } from \"../redux/types\";\nimport type {\n RemoveModelByKeyAction,\n UpdateModelAction,\n} from \"../redux/_modularui\";\n\ntype FormNavigationHook = {\n previous: (form: FormModel) => UpdateModelAction,\n cancel: (form: FormModel) => void,\n submit: (form: FormModel) => void,\n showFormNotification: (form: FormModel) => void,\n remove: (form: FormModel) => RemoveModelByKeyAction,\n};\n\ntype AttributeSetHook = {\n save: () => UpdateModelAction,\n cancel: (object: FormObjectModel) => UpdateModelAction,\n remove: (object: FormObjectModel) => UpdateModelAction,\n};\n\ntype AttributeUpdateHook = (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n) => void;\n\ntype AttributeValidateHook = () => void;\n\n/**\n * Load a form by href\n */\nexport const useForm = (href: string | Href): ?FormModel => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n });\n\n if (form?.model) {\n return form.model;\n }\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = (): FormNavigationHook => {\n const dispatch = useDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n loadModularUI(form.connectKey, form.selfhref, {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateModel: form,\n targetModel: FormModel,\n })\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Update attributes of a form\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n object: FormObjectModel\n): AttributeUpdateHook => {\n const dispatch = useDispatch();\n\n return (\n attribute: AttributeType,\n value: string,\n options: UpdateFormOptions\n ) => dispatch(updateFormAttribute(form, object, attribute, value, options));\n};\n\n/**\n * Validate attributes of a form\n */\nexport const useAttributeValidate = (\n form: FormModel\n): AttributeValidateHook => {\n const dispatch = useDispatch();\n\n return () => dispatch(validateFormAttribute(form));\n};\n\n/**\n * Attributeset actions\n */\nexport const useAttributeSet = (form: FormModel): AttributeSetHook => {\n const dispatch = useDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n"],"file":"useForm.js"}
|
|
@@ -61,6 +61,8 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
61
61
|
|
|
62
62
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
*/
|
|
64
66
|
var AttributeContent = /*#__PURE__*/function () {
|
|
65
67
|
function AttributeContent(content) {
|
|
66
68
|
(0, _classCallCheck2.default)(this, AttributeContent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","LayoutHintCollection","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","SectionModel","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;IAaMA,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;AAAA;AACjC,SAAKC,Q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ADK,EAEL,UAFK,CAAP;AAID;AAED;AACF;;;;WACE,2BAAkBE,KAAlB,EAA6D;AAAA;;AAC3D,aAAO,sCAAKT,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,uBAAAQ,KAAK,MAAL,CAAAA,KAAK,EAAUR,OAAO,CAACS,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKX,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCU,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,mCAASV,OAAO,CAACY,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;eAGY/B,gB","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (element.propertyElement) {\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (element.textFragmentElement) {\n const { label, layouthint, textfragments } =\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (element.contentElement) {\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/models/attributes/AttributeContent.js"],"names":["AttributeContent","content","_content","headerLabel","headerDescription","label","header","description","message","elements","element","propertyElement","layouthint","properties","LayoutHintCollection","textFragmentElement","textfragments","textfragment","text","contentElement","sections","section","SectionModel","elementName","collectionName","getContentElements","labels","getContentElementCollections","getContentElementCollectionByLabels","types","type","referredSections","push","getReferredSections"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;;;AAaA;AACA;IACMA,gB;AAGJ,4BAAYC,OAAZ,EAAmC;AAAA;AAAA;AACjC,SAAKC,Q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ADK,EAEL,UAFK,CAAP;AAID;AAED;AACF;;;;WACE,2BAAkBE,KAAlB,EAA6D;AAAA;;AAC3D,aAAO,sCAAKT,QAAL,kBAAqB,UAACC,OAAD;AAAA,eAAa,uBAAAQ,KAAK,MAAL,CAAAA,KAAK,EAAUR,OAAO,CAACS,IAAlB,CAAlB;AAAA,OAArB,CAAP;AACD;AAED;AACF;AACA;;;;WACE,6BAAoBJ,MAApB,EAAgE;AAC9D,aAAO,KAAKE,mCAAL,CAGL,gBAHK,EAGa,UAHb,EAGyBF,MAHzB,CAAP;AAID;AAED;AACF;;;;WACE,+BAA6D;AAC3D,UAAMK,gBAAgB,GAAG,EAAzB;;AAD2D,iDAGrC,KAAKX,QAHgC;AAAA;;AAAA;AAG3D,4DAAqC;AAAA,cAA1BC,OAA0B;AACnCU,UAAAA,gBAAgB,CAACC,IAAjB,OAAAD,gBAAgB,mCAASV,OAAO,CAACY,mBAAR,EAAT,EAAhB;AACD;AAL0D;AAAA;AAAA;AAAA;AAAA;;AAO3D,aAAOF,gBAAP;AACD;;;;;eAGY/B,gB","sourcesContent":["// @flow\nimport { retrieveText } from \"../../utils/helpers/text\";\nimport { hasAllContentInData } from \"../../constants/Settings\";\nimport SectionModel from \"../content/SectionModel\";\n\nimport LayoutHintCollection from \"../layouthint/LayoutHintCollection\";\nimport { isPlainObject } from \"../../utils\";\n\nimport type {\n ContentData,\n ContentElementMapped,\n PropertyData,\n PropertyElementMapped,\n TextFragmentData,\n TextFragmentElementMapped,\n ContentAll,\n} from \"../types\";\nimport type SubSectionModel from \"../content/SubSectionModel\";\n\n/**\n */\nclass AttributeContent {\n _content: ?ContentData;\n\n constructor(content: ?ContentData) {\n this._content = content;\n }\n\n /**\n */\n get fromData(): boolean {\n return hasAllContentInData();\n }\n\n /**\n */\n get header(): {\n label: ?string,\n description: ?string,\n } {\n let headerLabel = null;\n let headerDescription = null;\n\n const label = this._content?.header?.label;\n if (label) {\n headerLabel = label;\n }\n\n const description = this._content?.header?.description;\n if (description) {\n if (isPlainObject(description) && \"message\" in description) {\n headerDescription = description.message;\n } else if (typeof description === \"string\") {\n headerDescription = description;\n }\n }\n\n return { label: headerLabel, description: headerDescription };\n }\n\n /**\n */\n get elements(): ContentAll {\n if (this._content?.elements) {\n return this._content.elements?.map((element) => {\n if (element.propertyElement) {\n const { label, layouthint, properties } = element.propertyElement;\n\n return {\n propertyElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n properties,\n },\n };\n }\n\n if (element.textFragmentElement) {\n const { label, layouthint, textfragments } =\n element.textFragmentElement;\n return {\n textFragmentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n textfragments: textfragments.map((textfragment) => ({\n ...textfragment,\n text: retrieveText(textfragment.text),\n })),\n },\n };\n }\n\n if (element.contentElement) {\n const { label, layouthint, sections } = element.contentElement;\n return {\n contentElement: {\n label,\n layouthint: new LayoutHintCollection(layouthint),\n sections: sections.map(\n (section) => new SectionModel(section, null)\n ),\n },\n };\n }\n\n // $FlowIssue\n return element;\n });\n }\n\n return [];\n }\n\n /**\n */\n get label(): ?string {\n return this._content?.label;\n }\n\n /**\n */\n getContentElements<T>(elementName: string): Array<T> {\n // $FlowIssue incompatible-return\n return this.elements.filter((element) => elementName in element);\n }\n\n /**\n */\n getContentElementCollections<T>(\n elementName: string,\n collectionName: string\n ): Array<T> {\n return this.getContentElements(elementName)\n .map((element) => element[elementName][collectionName])\n .flat();\n }\n\n /**\n */\n getContentElementCollectionByLabels<T, U>(\n elementName: string,\n collectionName: string,\n labels: Array<string>\n ): Array<U> {\n return (\n this.getContentElements<T>(elementName)\n // $FlowIssue incompatible-use\n .filter((element) => labels.includes(element[elementName].label))\n // $FlowIssue incompatible-use\n .map((element) => element[elementName][collectionName])\n .flat()\n );\n }\n\n /**\n */\n get properties(): Array<PropertyData> {\n return this.getContentElementCollections<PropertyData>(\n \"propertyElement\",\n \"properties\"\n );\n }\n\n /**\n * Get concept properties by property element label\n */\n getConceptPropertiesByLabels(labels: Array<string>): Array<PropertyData> {\n return this.getContentElementCollectionByLabels<\n PropertyElementMapped,\n PropertyData\n >(\"propertyElement\", \"properties\", labels);\n }\n\n /**\n */\n get textfragments(): Array<TextFragmentData> {\n return this.getContentElementCollections<TextFragmentData>(\n \"textFragmentElement\",\n \"textfragments\"\n );\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getTextFragmentsByLabels(labels: Array<string>): Array<TextFragmentData> {\n return this.getContentElementCollectionByLabels<\n TextFragmentElementMapped,\n TextFragmentData\n >(\"textFragmentElement\", \"textfragments\", labels);\n }\n\n /**\n */\n get sections(): Array<SectionModel> {\n return this.getContentElementCollections<SectionModel>(\n \"contentElement\",\n \"sections\"\n );\n }\n\n /**\n */\n getSectionsByType(types: Array<string>): Array<SectionModel> {\n return this.sections.filter((section) => types.includes(section.type));\n }\n\n /**\n * Get concept text fragments by text fragment element label\n */\n getSectionsByLabels(labels: Array<string>): Array<SectionModel> {\n return this.getContentElementCollectionByLabels<\n ContentElementMapped,\n SectionModel\n >(\"contentElement\", \"sections\", labels);\n }\n\n /**\n */\n getReferredSections(): Array<SectionModel | SubSectionModel> {\n const referredSections = [];\n\n for (const section of this.sections) {\n referredSections.push(...section.getReferredSections());\n }\n\n return referredSections;\n }\n}\n\nexport default AttributeContent;\n"],"file":"AttributeContent.js"}
|
|
@@ -59,6 +59,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
59
59
|
|
|
60
60
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
*/
|
|
62
64
|
var SectionModel = /*#__PURE__*/function (_BaseModel) {
|
|
63
65
|
(0, _inherits2.default)(SectionModel, _BaseModel);
|
|
64
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/models/content/SectionModel.js"],"names":["SectionModel","data","entryDate","_entryDate","referred","_selflink","LinkModel","_links","self","selflink","href","type","sourceLabel","id","_id","getData","number","body","childSections","childSection","ContentLinkModel","section","label","_childSections","sections","subSections","subSection","SubSectionModel","selfhref","push","referredChilds","getReferredSections","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAGA;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/models/content/SectionModel.js"],"names":["SectionModel","data","entryDate","_entryDate","referred","_selflink","LinkModel","_links","self","selflink","href","type","sourceLabel","id","_id","getData","number","body","childSections","childSection","ContentLinkModel","section","label","_childSections","sections","subSections","subSection","SubSectionModel","selfhref","push","referredChilds","getReferredSections","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAGA;;;;;;;;;;;;AAEA;AACA;IACMA,Y;;;;;AAKJ,wBAAYC,IAAZ,EAA0BC,SAA1B,EAAsD;AAAA;;AAAA;AACpD,8BAAMD,IAAN,EAAY,EAAZ;AADoD;AAAA;AAAA;AAGpD,UAAKE,UAAL,GAAkBD,SAAlB;AAHoD;AAIrD;AAED;AACF;;;;;SACE,eAAwB;AACtB,aAAO,KAAKD,IAAL,CAAUG,QAAjB;AACD;AAED;AACF;;;;SACE,eAA0B;AACxB,UAAI,CAAC,KAAKC,SAAV,EAAqB;AAAA;;AACnB,aAAKA,SAAL,GAAiB,IAAIC,kBAAJ,sBAAc,KAAKL,IAAL,CAAUM,MAAxB,sDAAc,kBAAkBC,IAAhC,CAAjB;AACD;;AACD,aAAO,KAAKH,SAAZ;AACD;AAED;AACF;;;;SACE,eAAqB;AACnB,aAAO,KAAKI,QAAL,CAAcC,IAArB;AACD;AAED;AACF;;;;SACE,eAAiC;AAC/B,aAAO,KAAKP,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AT,CAAcH,UAAd;AACD;;AAED,cAAMI,cAAc,GAAGJ,UAAU,CAACK,mBAAX,EAAvB;AACAP,UAAAA,QAAQ,CAACK,IAAT,OAAAL,QAAQ,mCAASM,cAAT,EAAR;AACD;AAV0D;AAAA;AAAA;AAAA;AAAA;;AAAA,kDAYhC,KAAKZ,aAZ2B;AAAA;;AAAA;AAY3D,+DAA+C;AAAA,cAApCC,YAAoC;;AAC7C,cAAIA,YAAY,CAACf,QAAjB,EAA2B;AACzBoB,YAAAA,QAAQ,CAACK,IAAT,CAAcV,YAAd;AACD;;AAED,cAAMW,eAAc,GAAGX,YAAY,CAACY,mBAAb,EAAvB;;AACAP,UAAAA,QAAQ,CAACK,IAAT,OAAAL,QAAQ,mCAASM,eAAT,EAAR;AACD;AAnB0D;AAAA;AAAA;AAAA;AAAA;;AAqB3D,aAAON,QAAP;AACD;;;EAnLwBQ,mB;;eAsLZhC,Y","sourcesContent":["// @flow\nimport BaseModel from \"../base/BaseModel\";\nimport ContentLinkModel from \"./ContentLinkModel\";\nimport SubSectionModel from \"./SubSectionModel\";\n\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\nimport LinkModel from \"../links/LinkModel\";\n\nimport type Href from \"../href/Href\";\nimport { retrieveText } from \"../../utils\";\n\n/**\n */\nclass SectionModel extends BaseModel {\n _entryDate: ISO_DATE | null;\n _selflink: ?LinkModel;\n _childSections: Array<SectionModel>;\n\n constructor(data: Object, entryDate: ISO_DATE | null) {\n super(data, {});\n\n this._entryDate = entryDate;\n }\n\n /**\n */\n get referred(): boolean {\n return this.data.referred;\n }\n\n /**\n */\n get selflink(): LinkModel {\n if (!this._selflink) {\n this._selflink = new LinkModel(this.data._links?.self);\n }\n return this._selflink;\n }\n\n /**\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n */\n get entryDate(): ISO_DATE | null {\n return this._entryDate;\n }\n\n /**\n */\n get type(): string {\n return this.data.type;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this.data.sourceLabel;\n }\n\n /**\n */\n get id(): string {\n return this.data.id || this.data._id;\n }\n\n /**\n */\n get key(): string {\n return this.id;\n }\n\n /**\n * Get content label\n */\n get label(): string {\n return this.getData(\"label\", \"\");\n }\n\n /**\n * Retrieve number of section\n */\n get number(): string | null {\n return this.data.number ?? null;\n }\n\n /**\n * Get content body\n */\n get body(): ?string {\n return retrieveText(this.data.body);\n }\n\n /**\n * Retrieve child section links\n */\n get childSectionLinks(): Array<ContentLinkModel> {\n return this.data.childSections\n ? this.data.childSections.map(\n (childSection) =>\n new ContentLinkModel(\n {\n section: childSection.id || childSection._id,\n _id: childSection.id || childSection._id,\n label: childSection.label,\n sourceLabel: childSection.sourceLabel,\n _links: childSection._links,\n },\n this.entryDate\n )\n )\n : [];\n }\n\n /**\n */\n get selfContentLink(): ContentLinkModel {\n return new ContentLinkModel(\n {\n section: this.id,\n _id: this.id,\n label: this.data.label,\n sourceLabel: this.data.sourceLabel,\n _links: this.data._links,\n },\n this.entryDate\n );\n }\n\n /**\n * Get tree of child sections\n */\n get childSections(): Array<SectionModel> {\n if (!this._childSections && this.data.childSections) {\n this._childSections = this.data.childSections\n .filter((childSection) => \"body\" in childSection)\n .map((childSection) => new SectionModel(childSection, this.entryDate));\n }\n return this._childSections || [];\n }\n\n /**\n * set resolved child sections\n */\n set childSections(sections: Array<SectionModel>) {\n this._childSections = sections || [];\n }\n\n /**\n * Get sub sections\n */\n get subSections(): Array<SubSectionModel> {\n return this.data.subSections\n ? this.data.subSections.map(\n (subSection) => new SubSectionModel(subSection)\n )\n : [];\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n getReferredSections(): Array<SubSectionModel | SectionModel> {\n const sections = [];\n\n for (const subSection of this.subSections) {\n if (subSection.referred) {\n sections.push(subSection);\n }\n\n const referredChilds = subSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n for (const childSection of this.childSections) {\n if (childSection.referred) {\n sections.push(childSection);\n }\n\n const referredChilds = childSection.getReferredSections();\n sections.push(...referredChilds);\n }\n\n return sections;\n }\n}\n\nexport default SectionModel;\n"],"file":"SectionModel.js"}
|
package/lib/models/index.js
CHANGED
|
@@ -107,6 +107,12 @@ Object.defineProperty(exports, "ChoiceAttributeModel", {
|
|
|
107
107
|
return _ChoiceAttributeModel.default;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
+
Object.defineProperty(exports, "ChoiceAttributeOptionCollection", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function get() {
|
|
113
|
+
return _ChoiceAttributeOptionCollection.default;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
110
116
|
Object.defineProperty(exports, "ChoiceAttributeOptionModel", {
|
|
111
117
|
enumerable: true,
|
|
112
118
|
get: function get() {
|
|
@@ -598,6 +604,8 @@ var _CaptchaAttributeModel = _interopRequireDefault(require("./attributes/Captch
|
|
|
598
604
|
|
|
599
605
|
var _ChoiceAttributeModel = _interopRequireDefault(require("./attributes/ChoiceAttributeModel"));
|
|
600
606
|
|
|
607
|
+
var _ChoiceAttributeOptionCollection = _interopRequireDefault(require("./attributes/ChoiceAttributeOptionCollection"));
|
|
608
|
+
|
|
601
609
|
var _ChoiceAttributeOptionModel = _interopRequireDefault(require("./attributes/ChoiceAttributeOptionModel"));
|
|
602
610
|
|
|
603
611
|
var _CompositeAttributeModel = _interopRequireDefault(require("./attributes/CompositeAttributeModel"));
|
package/lib/models/index.js.flow
CHANGED
|
@@ -15,6 +15,7 @@ export { default as AttributeModel } from "./attributes/AttributeModel";
|
|
|
15
15
|
import { default as BooleanAttributeModel } from "./attributes/BooleanAttributeModel";
|
|
16
16
|
import { default as CaptchaAttributeModel } from "./attributes/CaptchaAttributeModel";
|
|
17
17
|
import { default as ChoiceAttributeModel } from "./attributes/ChoiceAttributeModel";
|
|
18
|
+
export { default as ChoiceAttributeOptionCollection } from "./attributes/ChoiceAttributeOptionCollection";
|
|
18
19
|
export { default as ChoiceAttributeOptionModel } from "./attributes/ChoiceAttributeOptionModel";
|
|
19
20
|
import { default as CompositeAttributeModel } from "./attributes/CompositeAttributeModel";
|
|
20
21
|
export { default as CompositeAttributeChildCollection } from "./attributes/CompositeAttributeChildCollection";
|
package/lib/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/models/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAKA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AACA","sourcesContent":["// @flow\nexport { default as resolveModel } from \"./resolveModel\";\n\nexport { default as BaseCollection } from \"./base/BaseCollection\";\n\nexport { default as ActionCollection } from \"./actions/ActionCollection\";\nexport { default as ActionModel } from \"./actions/ActionModel\";\n\nimport { default as ApplicationModel } from \"./application/ApplicationModel\";\n\nexport { default as AttributeCollection } from \"./attributes/AttributeCollection\";\nexport { default as AttributeSetModel } from \"./attributes/AttributeSetModel\";\n\nexport { default as AttributeModel } from \"./attributes/AttributeModel\";\nimport { default as BooleanAttributeModel } from \"./attributes/BooleanAttributeModel\";\nimport { default as CaptchaAttributeModel } from \"./attributes/CaptchaAttributeModel\";\nimport { default as ChoiceAttributeModel } from \"./attributes/ChoiceAttributeModel\";\nexport { default as ChoiceAttributeOptionCollection } from \"./attributes/ChoiceAttributeOptionCollection\";\nexport { default as ChoiceAttributeOptionModel } from \"./attributes/ChoiceAttributeOptionModel\";\nimport { default as CompositeAttributeModel } from \"./attributes/CompositeAttributeModel\";\nexport { default as CompositeAttributeChildCollection } from \"./attributes/CompositeAttributeChildCollection\";\nimport { default as DatetimeAttributeModel } from \"./attributes/DatetimeAttributeModel\";\nimport { default as HelptextAttributeModel } from \"./attributes/HelptextAttributeModel\";\nimport { default as LabelAttributeModel } from \"./attributes/LabelAttributeModel\";\nimport { default as MemoAttributeModel } from \"./attributes/MemoAttributeModel\";\nimport { default as MoneyAttributeModel } from \"./attributes/MoneyAttributeModel\";\nimport { default as NumberAttributeModel } from \"./attributes/NumberAttributeModel\";\nimport { default as PasswordAttributeModel } from \"./attributes/PasswordAttributeModel\";\nimport { default as StringAttributeModel } from \"./attributes/StringAttributeModel\";\nimport { default as UploadAttributeModel } from \"./attributes/UploadAttributeModel\";\nimport { default as XMLAttributeModel } from \"./attributes/XMLAttributeModel\";\n\nexport { default as AttributeContent } from \"./attributes/AttributeContent\";\n\nexport {\n default as LayoutHintRuleCollection,\n addLayoutHintRule,\n updateLayoutHintRules,\n} from \"./attributes/layouthint-rules/LayoutHintRuleCollection\";\nexport { default as BaseLayoutHintRule } from \"./attributes/layouthint-rules/BaseLayoutHintRule\";\nexport { default as DependentAttribute } from \"./attributes/layouthint-rules/DependentAttribute\";\nexport { default as RemainingTotalUploadSize } from \"./attributes/layouthint-rules/RemainingTotalUploadSize\";\n\nimport { default as CaseViewModel } from \"./caseview/CaseViewModel\";\n\nimport { default as BusinessScenarioModel } from \"./concepts/BusinessScenarioModel\";\nimport { default as ConceptDetailModel } from \"./concepts/ConceptDetailModel\";\nimport { default as ConceptIndexModel } from \"./concepts/ConceptIndexModel\";\nexport { default as ConceptLinkModel } from \"./concepts/ConceptLinkModel\";\nexport { default as ConceptRelationCollection } from \"./concepts/ConceptRelationCollection\";\nexport { default as ConceptRelationModel } from \"./concepts/ConceptRelationModel\";\nimport { default as ConceptTypeDetailModel } from \"./concepts/ConceptTypeDetailModel\";\nexport { default as SourceReferenceCollection } from \"./concepts/SourceReferenceCollection\";\nexport { default as SourceReferenceModel } from \"./concepts/SourceReferenceModel\";\n\nexport { default as ConstraintCollection } from \"./attributes/input-constraints/ConstraintCollection\";\nexport { default as ConstraintModel } from \"./attributes/input-constraints/ConstraintModel\";\n\nimport { default as ContentIndexModel } from \"./content/ContentIndexModel\";\nexport { default as ContentLinkModel } from \"./content/ContentLinkModel\";\nimport { default as ContentModel } from \"./content/ContentModel\";\nimport { default as ContentTOCModel } from \"./content/ContentTOCModel\";\nimport { default as ContentTypeModel } from \"./content/ContentTypeModel\";\nexport { default as SectionModel } from \"./content/SectionModel\";\nexport { default as SubSectionModel } from \"./content/SubSectionModel\";\n\nexport { default as ContentConfiguration } from \"./contentconfiguration/ContentConfiguration\";\nexport { default as ContentConfigurationElements } from \"./contentconfiguration/ContentConfigurationElements\";\nexport { default as ContentConfigurationEndResults } from \"./contentconfiguration/ContentConfigurationEndResults\";\nexport { default as ContentConfigurationQuestions } from \"./contentconfiguration/ContentConfigurationQuestions\";\nexport { default as ContentConfigurationResults } from \"./contentconfiguration/ContentConfigurationResults\";\n\nimport { default as DetailModel } from \"./detail/DetailModel\";\n\nexport { default as ErrorCollection } from \"./error/ErrorCollection\";\nexport { default as ErrorModel } from \"./error/ErrorModel\";\nexport { default as ErrorResponse } from \"./error/ErrorResponse\";\n\nimport { default as AssignmentFilterModel } from \"./filters/AssignmentFilterModel\";\nimport { default as FilterModel } from \"./filters/FilterModel\";\nimport { default as RangeFilterModel } from \"./filters/RangeFilterModel\";\nimport { default as ConceptIndexFilterModel } from \"./filters/ConceptIndexFilterModel\";\nexport { default as FilterCollection } from \"./filters/FilterCollection\";\n\nimport { default as FormModel } from \"./form/FormModel\";\nexport { default as FormObjectModel } from \"./form/FormObjectModel\";\n\nexport { default as GroupingModel, GroupModel } from \"./grouping/GroupingModel\";\n\nexport { default as Href } from \"./href/Href\";\nexport { default as ListHref } from \"./href/ListHref\";\n\nexport { default as LinkCollection } from \"./links/LinkCollection\";\nexport { default as LinkModel } from \"./links/LinkModel\";\n\nimport { default as ListDetailModel } from \"./list/ListDetailModel\";\nexport { default as ListHeaderModel } from \"./list/ListHeaderModel\";\nexport { default as ListItemCollection } from \"./list/ListItemCollection\";\nexport { default as ListItemModel } from \"./list/ListItemModel\";\nimport { default as ListModel } from \"./list/ListModel\";\n\nexport { default as LookupOptionsModel } from \"./lookup/LookupOptionsModel\";\nexport { default as LookupOptionCollection } from \"./lookup/LookupOptionCollection\";\n\nimport { default as ModelCatalogModel } from \"./modelcatalog/ModelCatalogModel\";\n\nexport { default as ProcessStatusSettingsModel } from \"./process/ProcessStatusSettingsModel\";\n\nexport { default as PagesizeModel } from \"./paging/PagesizeModel\";\nexport { default as PagingModel } from \"./paging/PagingModel\";\n\nexport { default as Parameter } from \"./parameter/Parameter\";\n\nimport { default as GroupingPanelModel } from \"./panels/GroupingPanelModel\";\n\nimport { default as CaseSearchModel } from \"./search/CaseSearchModel\";\n\nexport { default as SortingModel } from \"./sorting/SortingModel\";\nexport { default as SortOptionModel } from \"./sorting/SortOptionModel\";\n\nimport { default as TabModel } from \"./tab/TabModel\";\n\nexport { default as TaskGroupCollection } from \"./taskgroup/TaskGroupCollection\";\nimport { default as TaskGroupModel } from \"./taskgroup/TaskGroupModel\";\n\nimport { default as UserModel } from \"./user/UserModel\";\nimport { default as UserProfileModel } from \"./user/UserProfileModel\";\nimport { default as UserServicesModel } from \"./user/UserServicesModel\";\n\nexport {\n ApplicationModel,\n CaseSearchModel,\n CaseViewModel,\n ListDetailModel,\n DetailModel,\n FormModel,\n GroupingPanelModel,\n ListModel,\n TabModel,\n TaskGroupModel,\n UserModel,\n UserProfileModel,\n UserServicesModel,\n ModelCatalogModel,\n ConceptIndexModel,\n ConceptDetailModel,\n BusinessScenarioModel,\n ConceptTypeDetailModel,\n ContentIndexModel,\n ContentTOCModel,\n ContentModel,\n ContentTypeModel,\n BooleanAttributeModel,\n CaptchaAttributeModel,\n ChoiceAttributeModel,\n DatetimeAttributeModel,\n HelptextAttributeModel,\n LabelAttributeModel,\n MemoAttributeModel,\n MoneyAttributeModel,\n NumberAttributeModel,\n PasswordAttributeModel,\n CompositeAttributeModel,\n StringAttributeModel,\n UploadAttributeModel,\n XMLAttributeModel,\n AssignmentFilterModel,\n FilterModel,\n RangeFilterModel,\n ConceptIndexFilterModel,\n};\n\nexport type * from \"./types\";\n"],"file":"index.js"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.updateFormAttribute = void 0;
|
|
6
|
+
exports.validateFormAttribute = exports.updateFormAttribute = void 0;
|
|
7
7
|
|
|
8
8
|
var _actions = require("../_modularui/actions");
|
|
9
9
|
|
|
@@ -28,7 +28,7 @@ var updateFormAttribute = function updateFormAttribute(form, formObject, attribu
|
|
|
28
28
|
return function (dispatch) {
|
|
29
29
|
var newForm = form.clone();
|
|
30
30
|
|
|
31
|
-
if (
|
|
31
|
+
if (options.validate === undefined) {
|
|
32
32
|
options.validate = true;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -61,6 +61,18 @@ var updateFormAttribute = function updateFormAttribute(form, formObject, attribu
|
|
|
61
61
|
return dispatch((0, _actions.updateModel)(newForm));
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Validate an attribute on a form
|
|
66
|
+
*/
|
|
67
|
+
|
|
64
68
|
|
|
65
69
|
exports.updateFormAttribute = updateFormAttribute;
|
|
70
|
+
|
|
71
|
+
var validateFormAttribute = function validateFormAttribute(form) {
|
|
72
|
+
return function (dispatch) {
|
|
73
|
+
return dispatch((0, _FormValidations.validateFormObject)(form));
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.validateFormAttribute = validateFormAttribute;
|
|
66
78
|
//# sourceMappingURL=FormAttributeSet.js.map
|
|
@@ -31,7 +31,7 @@ export const updateFormAttribute =
|
|
|
31
31
|
(dispatch: Dispatch) => {
|
|
32
32
|
const newForm = form.clone();
|
|
33
33
|
|
|
34
|
-
if (
|
|
34
|
+
if (options.validate === undefined) {
|
|
35
35
|
options.validate = true;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -74,3 +74,12 @@ export const updateFormAttribute =
|
|
|
74
74
|
|
|
75
75
|
return dispatch(updateModel(newForm));
|
|
76
76
|
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Validate an attribute on a form
|
|
80
|
+
*/
|
|
81
|
+
export const validateFormAttribute =
|
|
82
|
+
(form: FormModel): ThunkAction =>
|
|
83
|
+
(dispatch: Dispatch) => {
|
|
84
|
+
return dispatch(validateFormObject(form));
|
|
85
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations"],"mappings":";;;;;;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAOA;AACA;AACA;AACO,IAAMA,mBAAmB,GAC9B,SADWA,mBACX,CACEC,IADF,EAEEC,UAFF,EAGEC,SAHF,EAIEC,UAJF;AAAA,MAKEC,OALF,uEAK+B;AAC3BC,IAAAA,UAAU,EAAE,KADe;AAE3BC,IAAAA,QAAQ,EAAE,KAFiB;AAG3BC,IAAAA,WAAW,EAAE,KAHc;AAI3BC,IAAAA,QAAQ,EAAE;AAJiB,GAL/B;AAAA,SAYA,UAACC,QAAD,EAAwB;AACtB,QAAMC,OAAO,GAAGV,IAAI,CAACW,KAAL,EAAhB;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../../../src/redux/actions/FormAttributeSet.js"],"names":["updateFormAttribute","form","formObject","attribute","inputvalue","options","autosubmit","autosave","forceUpdate","validate","dispatch","newForm","clone","undefined","currentFormObject","equals","updateAttribute","completedFormObjects","forEach","completeObject","isValid","autosubmitAction","isChanged","hasDynamicValidations","validateFormAttribute"],"mappings":";;;;;;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAOA;AACA;AACA;AACO,IAAMA,mBAAmB,GAC9B,SADWA,mBACX,CACEC,IADF,EAEEC,UAFF,EAGEC,SAHF,EAIEC,UAJF;AAAA,MAKEC,OALF,uEAK+B;AAC3BC,IAAAA,UAAU,EAAE,KADe;AAE3BC,IAAAA,QAAQ,EAAE,KAFiB;A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AAQ,CAAC,yCAAmBC,OAAnB,CAAD,CAAR;AACD;;AAED,WAAOD,QAAQ,CAAC,0BAAYC,OAAZ,CAAD,CAAf;AACD,GAzDD;AAAA,CADK;AA4DP;AACA;AACA;;;;;AACO,IAAMa,qBAAqB,GAChC,SADWA,qBACX,CAACvB,IAAD;AAAA,SACA,UAACS,QAAD,EAAwB;AACtB,WAAOA,QAAQ,CAAC,yCAAmBT,IAAnB,CAAD,CAAf;AACD,GAHD;AAAA,CADK","sourcesContent":["// @flow\nimport { updateModel } from \"../_modularui/actions\";\n\nimport { getSetting } from \"../../constants/Settings\";\n\nimport { validateFormObject } from \"./FormValidations\";\nimport { autosaveFormObject } from \"./FormAutosave\";\nimport { autosubmitFormObject } from \"./FormAutosubmit\";\n\nimport type { Dispatch, ThunkAction, UpdateFormOptions } from \"../types\";\nimport type { AttributeType } from \"../../models/types\";\nimport type FormModel from \"../../models/form/FormModel\";\nimport type FormObjectModel from \"../../models/form/FormObjectModel\";\n\n/**\n * Update an attribute on a form\n */\nexport const updateFormAttribute =\n (\n form: FormModel,\n formObject: FormObjectModel,\n attribute: AttributeType,\n inputvalue: string,\n options: UpdateFormOptions = {\n autosubmit: false,\n autosave: false,\n forceUpdate: false,\n validate: true,\n }\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n const newForm = form.clone();\n\n if (options.validate === undefined) {\n options.validate = true;\n }\n\n if (\n newForm.currentFormObject &&\n newForm.currentFormObject.equals(formObject)\n ) {\n newForm.currentFormObject.updateAttribute(attribute, inputvalue);\n } else {\n newForm.completedFormObjects.forEach((completeObject) => {\n if (completeObject.equals(formObject)) {\n completeObject.updateAttribute(attribute, inputvalue);\n }\n });\n }\n\n if (options.autosubmit && newForm.isValid) {\n const autosubmitAction = autosubmitFormObject(\n newForm,\n attribute,\n options.forceUpdate\n );\n if (autosubmitAction) {\n return dispatch(autosubmitAction);\n }\n }\n\n if (options.autosave && newForm.isValid && newForm.isChanged()) {\n dispatch(autosaveFormObject(newForm));\n }\n\n if (\n newForm.currentFormObject &&\n options.validate &&\n newForm.currentFormObject.hasDynamicValidations &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\")\n ) {\n dispatch(validateFormObject(newForm));\n }\n\n return dispatch(updateModel(newForm));\n };\n\n/**\n * Validate an attribute on a form\n */\nexport const validateFormAttribute =\n (form: FormModel): ThunkAction =>\n (dispatch: Dispatch) => {\n return dispatch(validateFormObject(form));\n };\n"],"file":"FormAttributeSet.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.3",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"styled-components": "^5.2.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@babel/runtime-corejs3": "^7.17.
|
|
81
|
+
"@babel/runtime-corejs3": "^7.17.9",
|
|
82
82
|
"big.js": "^6.1.1",
|
|
83
83
|
"date-fns": "^2.28.0",
|
|
84
84
|
"deepmerge": "^4.2.2",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@babel/cli": "^7.17.3",
|
|
99
|
-
"@babel/core": "^7.17.
|
|
99
|
+
"@babel/core": "^7.17.9",
|
|
100
100
|
"@babel/eslint-parser": "^7.17.0",
|
|
101
101
|
"@babel/eslint-plugin": "^7.16.5",
|
|
102
102
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
@@ -106,39 +106,39 @@
|
|
|
106
106
|
"@babel/preset-react": "^7.16.7",
|
|
107
107
|
"@commitlint/cli": "^16.2.3",
|
|
108
108
|
"@commitlint/config-conventional": "^16.2.1",
|
|
109
|
-
"@testing-library/react-hooks": "^
|
|
109
|
+
"@testing-library/react-hooks": "^8.0.0",
|
|
110
110
|
"auditjs": "^4.0.36",
|
|
111
111
|
"babel-jest": "^27.5.1",
|
|
112
|
-
"babel-plugin-styled-components": "^2.0.
|
|
112
|
+
"babel-plugin-styled-components": "^2.0.7",
|
|
113
113
|
"cherry-pick": "^0.5.0",
|
|
114
114
|
"cross-env": "^7.0.3",
|
|
115
115
|
"documentation": "^13.2.5",
|
|
116
|
-
"eslint": "^8.
|
|
116
|
+
"eslint": "^8.13.0",
|
|
117
117
|
"eslint-config-prettier": "^8.3.0",
|
|
118
118
|
"eslint-plugin-babel": "^5.3.1",
|
|
119
119
|
"eslint-plugin-ft-flow": "^2.0.1",
|
|
120
|
-
"eslint-plugin-import": "^2.
|
|
121
|
-
"eslint-plugin-jest": "^26.1.
|
|
122
|
-
"eslint-plugin-jsdoc": "^
|
|
120
|
+
"eslint-plugin-import": "^2.26.0",
|
|
121
|
+
"eslint-plugin-jest": "^26.1.4",
|
|
122
|
+
"eslint-plugin-jsdoc": "^39.2.1",
|
|
123
123
|
"eslint-plugin-react": "^7.28.0",
|
|
124
|
-
"eslint-plugin-react-hooks": "^4.
|
|
125
|
-
"flow-bin": "^0.
|
|
124
|
+
"eslint-plugin-react-hooks": "^4.4.0",
|
|
125
|
+
"flow-bin": "^0.176.0",
|
|
126
126
|
"flow-copy-source": "^2.0.9",
|
|
127
127
|
"flow-typed": "^3.6.1",
|
|
128
|
-
"glob": "^
|
|
128
|
+
"glob": "^8.0.1",
|
|
129
129
|
"history": "^4.0.0",
|
|
130
130
|
"husky": "^7.0.4",
|
|
131
131
|
"jest": "^27.5.1",
|
|
132
|
-
"jest-junit": "^13.
|
|
132
|
+
"jest-junit": "^13.1.0",
|
|
133
133
|
"jest-sonar-reporter": "^2.0.0",
|
|
134
134
|
"jscodeshift": "^0.13.1",
|
|
135
135
|
"lint-staged": "^12.3.7",
|
|
136
|
-
"polished": "^4.
|
|
137
|
-
"prettier": "^2.6.
|
|
136
|
+
"polished": "^4.2.2",
|
|
137
|
+
"prettier": "^2.6.2",
|
|
138
138
|
"react": "^17.0.2",
|
|
139
139
|
"react-dom": "^17.0.2",
|
|
140
|
-
"react-helmet-async": "^1.
|
|
141
|
-
"react-redux": "^7.2.
|
|
140
|
+
"react-helmet-async": "^1.3.0",
|
|
141
|
+
"react-redux": "^7.2.8",
|
|
142
142
|
"react-router": "^5.2.0",
|
|
143
143
|
"react-test-renderer": "^17.0.2",
|
|
144
144
|
"redux": "^4.1.2",
|
package/src/hooks/useForm.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
removeRepeatableAttributeSet,
|
|
17
17
|
showFormNotification,
|
|
18
18
|
updateFormAttribute,
|
|
19
|
+
validateFormAttribute,
|
|
19
20
|
} from "../redux/actions";
|
|
20
21
|
|
|
21
22
|
import FormModel from "../models/form/FormModel";
|
|
@@ -47,6 +48,8 @@ type AttributeUpdateHook = (
|
|
|
47
48
|
options: UpdateFormOptions
|
|
48
49
|
) => void;
|
|
49
50
|
|
|
51
|
+
type AttributeValidateHook = () => void;
|
|
52
|
+
|
|
50
53
|
/**
|
|
51
54
|
* Load a form by href
|
|
52
55
|
*/
|
|
@@ -119,6 +122,17 @@ export const useAttributeUpdate = (
|
|
|
119
122
|
) => dispatch(updateFormAttribute(form, object, attribute, value, options));
|
|
120
123
|
};
|
|
121
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Validate attributes of a form
|
|
127
|
+
*/
|
|
128
|
+
export const useAttributeValidate = (
|
|
129
|
+
form: FormModel
|
|
130
|
+
): AttributeValidateHook => {
|
|
131
|
+
const dispatch = useDispatch();
|
|
132
|
+
|
|
133
|
+
return () => dispatch(validateFormAttribute(form));
|
|
134
|
+
};
|
|
135
|
+
|
|
122
136
|
/**
|
|
123
137
|
* Attributeset actions
|
|
124
138
|
*/
|
package/src/models/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as AttributeModel } from "./attributes/AttributeModel";
|
|
|
15
15
|
import { default as BooleanAttributeModel } from "./attributes/BooleanAttributeModel";
|
|
16
16
|
import { default as CaptchaAttributeModel } from "./attributes/CaptchaAttributeModel";
|
|
17
17
|
import { default as ChoiceAttributeModel } from "./attributes/ChoiceAttributeModel";
|
|
18
|
+
export { default as ChoiceAttributeOptionCollection } from "./attributes/ChoiceAttributeOptionCollection";
|
|
18
19
|
export { default as ChoiceAttributeOptionModel } from "./attributes/ChoiceAttributeOptionModel";
|
|
19
20
|
import { default as CompositeAttributeModel } from "./attributes/CompositeAttributeModel";
|
|
20
21
|
export { default as CompositeAttributeChildCollection } from "./attributes/CompositeAttributeChildCollection";
|
|
@@ -31,7 +31,7 @@ export const updateFormAttribute =
|
|
|
31
31
|
(dispatch: Dispatch) => {
|
|
32
32
|
const newForm = form.clone();
|
|
33
33
|
|
|
34
|
-
if (
|
|
34
|
+
if (options.validate === undefined) {
|
|
35
35
|
options.validate = true;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -74,3 +74,12 @@ export const updateFormAttribute =
|
|
|
74
74
|
|
|
75
75
|
return dispatch(updateModel(newForm));
|
|
76
76
|
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Validate an attribute on a form
|
|
80
|
+
*/
|
|
81
|
+
export const validateFormAttribute =
|
|
82
|
+
(form: FormModel): ThunkAction =>
|
|
83
|
+
(dispatch: Dispatch) => {
|
|
84
|
+
return dispatch(validateFormObject(form));
|
|
85
|
+
};
|