@icure/form 1.1.14 → 1.1.16
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/.yarn/cache/@lit-labs-ssr-dom-shim-npm-1.2.0-6bda8c35cb-704621c28d.zip +0 -0
- package/.yarn/cache/@lit-reactive-element-npm-1.6.3-4828441e51-79b58631c3.zip +0 -0
- package/.yarn/cache/@lit-reactive-element-npm-2.0.4-4836436301-368d788d9e.zip +0 -0
- package/.yarn/cache/@material-animation-npm-14.0.0-canary.53b3cad2f.0-06a813cdea-9b5190654c.zip +0 -0
- package/.yarn/cache/@material-base-npm-14.0.0-canary.53b3cad2f.0-d195c1fdc4-9f4928d115.zip +0 -0
- package/.yarn/cache/@material-button-npm-14.0.0-canary.53b3cad2f.0-d4b070f508-873295c56a.zip +0 -0
- package/.yarn/cache/@material-density-npm-14.0.0-canary.53b3cad2f.0-48c1f65059-a23f00edfe.zip +0 -0
- package/.yarn/cache/@material-dialog-npm-14.0.0-canary.53b3cad2f.0-96168fa294-c1a498b81a.zip +0 -0
- package/.yarn/cache/@material-dom-npm-14.0.0-canary.53b3cad2f.0-ac009dc871-f5817f76dd.zip +0 -0
- package/.yarn/cache/@material-elevation-npm-14.0.0-canary.53b3cad2f.0-3312f06793-2f8945c7b6.zip +0 -0
- package/.yarn/cache/@material-feature-targeting-npm-14.0.0-canary.53b3cad2f.0-a919042d50-e7a1ed68f9.zip +0 -0
- package/.yarn/cache/@material-floating-label-npm-14.0.0-canary.53b3cad2f.0-eb8f330f2f-5295dc481d.zip +0 -0
- package/.yarn/cache/@material-focus-ring-npm-14.0.0-canary.53b3cad2f.0-b22f851a2e-92273b1247.zip +0 -0
- package/.yarn/cache/@material-icon-button-npm-14.0.0-canary.53b3cad2f.0-e158d26048-19b51665f2.zip +0 -0
- package/.yarn/cache/@material-line-ripple-npm-14.0.0-canary.53b3cad2f.0-d089468db9-6518961487.zip +0 -0
- package/.yarn/cache/@material-list-npm-14.0.0-canary.53b3cad2f.0-df9ce05084-6c977f518d.zip +0 -0
- package/.yarn/cache/@material-menu-npm-14.0.0-canary.53b3cad2f.0-9489b592c8-71b6a1f4dd.zip +0 -0
- package/.yarn/cache/@material-menu-surface-npm-14.0.0-canary.53b3cad2f.0-52212f38f4-ad48e168ca.zip +0 -0
- package/.yarn/cache/@material-mwc-base-npm-0.27.0-79caf3ef2b-07af17edfc.zip +0 -0
- package/.yarn/cache/@material-mwc-button-npm-0.27.0-4b85f2b26f-2ef5cc0951.zip +0 -0
- package/.yarn/cache/@material-mwc-checkbox-npm-0.27.0-e837031d8e-ba53a6ea8c.zip +0 -0
- package/.yarn/cache/@material-mwc-dialog-npm-0.27.0-77c6071543-ffab528e8e.zip +0 -0
- package/.yarn/cache/@material-mwc-floating-label-npm-0.27.0-80e62b22c0-fbbf4f2e42.zip +0 -0
- package/.yarn/cache/@material-mwc-icon-button-npm-0.27.0-41f82f135b-7315c0735b.zip +0 -0
- package/.yarn/cache/@material-mwc-icon-npm-0.27.0-98c9e8509f-6dfa5115d5.zip +0 -0
- package/.yarn/cache/@material-mwc-line-ripple-npm-0.27.0-e6704221e0-6862ede0f4.zip +0 -0
- package/.yarn/cache/@material-mwc-list-npm-0.27.0-5344fc9de4-6c2ae4f1c6.zip +0 -0
- package/.yarn/cache/@material-mwc-menu-npm-0.27.0-7c2bb47797-126f733659.zip +0 -0
- package/.yarn/cache/@material-mwc-notched-outline-npm-0.27.0-0e0d1c4d5f-2739032f76.zip +0 -0
- package/.yarn/cache/@material-mwc-radio-npm-0.27.0-aa2098a280-0b0a0a6b99.zip +0 -0
- package/.yarn/cache/@material-mwc-ripple-npm-0.27.0-ed37672f08-9cd73fdfe4.zip +0 -0
- package/.yarn/cache/@material-mwc-textfield-npm-0.27.0-dabd704f55-978c893aca.zip +0 -0
- package/.yarn/cache/@material-notched-outline-npm-14.0.0-canary.53b3cad2f.0-ecacde98db-1a9f8db4d8.zip +0 -0
- package/.yarn/cache/@material-radio-npm-14.0.0-canary.53b3cad2f.0-c50de64d41-898554f2b3.zip +0 -0
- package/.yarn/cache/@material-ripple-npm-14.0.0-canary.53b3cad2f.0-49060bfe7e-08b71917e2.zip +0 -0
- package/.yarn/cache/@material-rtl-npm-14.0.0-canary.53b3cad2f.0-daca794b76-3c1b8b48c6.zip +0 -0
- package/.yarn/cache/@material-shape-npm-14.0.0-canary.53b3cad2f.0-5bcff722a6-6ad9b020c0.zip +0 -0
- package/.yarn/cache/@material-textfield-npm-14.0.0-canary.53b3cad2f.0-4414808dda-7072e3c9df.zip +0 -0
- package/.yarn/cache/@material-theme-npm-14.0.0-canary.53b3cad2f.0-9a24e7b046-fd44e92917.zip +0 -0
- package/.yarn/cache/@material-tokens-npm-14.0.0-canary.53b3cad2f.0-f1c87523da-efa909f861.zip +0 -0
- package/.yarn/cache/@material-touch-target-npm-14.0.0-canary.53b3cad2f.0-fa6a2d0875-dbc13cbe7a.zip +0 -0
- package/.yarn/cache/@material-typography-npm-14.0.0-canary.53b3cad2f.0-f4a58946f1-fa2671df40.zip +0 -0
- package/.yarn/cache/@types-trusted-types-npm-2.0.7-a07fc44f59-8e4202766a.zip +0 -0
- package/.yarn/cache/@webcomponents-webcomponentsjs-npm-2.8.0-36c07db4d2-186373c030.zip +0 -0
- package/.yarn/cache/app-datepicker-npm-6.0.0-rc.33-f74d593ddf-6490949c45.zip +0 -0
- package/.yarn/cache/argparse-npm-2.0.1-faff7999e6-83644b5649.zip +0 -0
- package/.yarn/cache/blocking-elements-npm-0.1.1-423f51c76e-9a34084405.zip +0 -0
- package/.yarn/cache/entities-npm-4.5.0-7cdb83b832-853f8ebd5b.zip +0 -0
- package/.yarn/cache/fast-deep-equal-npm-3.1.3-790edcfcf5-e21a9d8d84.zip +0 -0
- package/.yarn/cache/linkify-it-npm-5.0.0-adb5f9c96f-b0b86cadaf.zip +0 -0
- package/.yarn/cache/lit-element-npm-3.3.3-2f9f9e38c0-29a596fa55.zip +0 -0
- package/.yarn/cache/lit-element-npm-4.0.6-bfca4f9870-4f73cd1c0d.zip +0 -0
- package/.yarn/cache/lit-html-npm-2.8.0-82f88d6ebf-2d70df0724.zip +0 -0
- package/.yarn/cache/lit-html-npm-3.1.4-58e56c5010-428593679c.zip +0 -0
- package/.yarn/cache/lit-npm-2.8.0-92bb1333a4-2480e733f7.zip +0 -0
- package/.yarn/cache/lit-npm-3.1.4-b7dcc2d5a3-c6ffa5580f.zip +0 -0
- package/.yarn/cache/lit-ntml-npm-3.0.6-98ebc6c1ac-2917c778d9.zip +0 -0
- package/.yarn/cache/lodash-es-npm-4.17.21-b45832dfce-05cbffad6e.zip +0 -0
- package/.yarn/cache/markdown-it-npm-14.1.0-e337d75bfe-07296b45eb.zip +0 -0
- package/.yarn/cache/mdurl-npm-2.0.0-3259713daf-880bc289ef.zip +0 -0
- package/.yarn/cache/nodemod-npm-3.0.6-844d650911-47ffe619b3.zip +0 -0
- package/.yarn/cache/normalize-diacritics-npm-3.0.12-93e2346015-5ddc2cfaf8.zip +0 -0
- package/.yarn/cache/orderedmap-npm-2.1.1-64b8a0684f-082cf970b0.zip +0 -0
- package/.yarn/cache/parse5-npm-6.0.1-70a35a494a-7d569a176c.zip +0 -0
- package/.yarn/cache/prosemirror-commands-npm-1.5.2-27f8f3fee9-ff65063a8c.zip +0 -0
- package/.yarn/cache/prosemirror-history-npm-1.3.2-cc128c8ee6-b85fe6378a.zip +0 -0
- package/.yarn/cache/prosemirror-keymap-npm-1.2.2-efb8276b00-85fe4fc303.zip +0 -0
- package/.yarn/cache/prosemirror-markdown-npm-1.12.0-28e990f443-d7607ee1a6.zip +0 -0
- package/.yarn/cache/prosemirror-model-npm-1.19.4-4fd32211c8-12c277ed30.zip +0 -0
- package/.yarn/cache/prosemirror-model-npm-1.22.2-9238026de4-f4004a4ebe.zip +0 -0
- package/.yarn/cache/prosemirror-schema-basic-npm-1.2.2-def7bf2ec7-1f93f8678c.zip +0 -0
- package/.yarn/cache/prosemirror-schema-list-npm-1.3.0-23c1830a7e-03654e37c8.zip +0 -0
- package/.yarn/cache/prosemirror-state-npm-1.4.3-d6540e44ad-28857d935c.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.8.0-ea3ca0411f-6d16ca4f95.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.9.0-fd256f82f0-c2d63c1fb0.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.32.7-63c3e4b182-40c9038a52.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.33.9-dd77e3e48f-d3bd6cef56.zip +0 -0
- package/.yarn/cache/punycode.js-npm-2.3.1-9084ecbbf5-13466d7ed5.zip +0 -0
- package/.yarn/cache/rope-sequence-npm-1.3.4-3b09587e5f-95cca2f99a.zip +0 -0
- package/.yarn/cache/tslib-npm-2.6.3-0fd136b3be-74fce0e100.zip +0 -0
- package/.yarn/cache/uc.micro-npm-2.1.0-c45282c865-3719735824.zip +0 -0
- package/.yarn/cache/uuid-npm-9.0.1-39a8442bc6-39931f6da7.zip +0 -0
- package/.yarn/cache/w3c-keyname-npm-2.2.8-66d7d5317a-95bafa4c04.zip +0 -0
- package/.yarn/cache/wicg-inert-npm-3.1.2-786d525c4e-538c5cb7f2.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/components/common/field-with-options.d.ts +1 -1
- package/components/common/field-with-options.js.map +1 -1
- package/components/common/field.d.ts +3 -1
- package/components/common/field.js +18 -8
- package/components/common/field.js.map +1 -1
- package/components/common/utils.js.map +1 -1
- package/components/icure-button-group/index.js +8 -2
- package/components/icure-button-group/index.js.map +1 -1
- package/components/icure-date-picker/index.js +11 -4
- package/components/icure-date-picker/index.js.map +1 -1
- package/components/icure-dropdown-field/index.d.ts +3 -1
- package/components/icure-dropdown-field/index.js +42 -9
- package/components/icure-dropdown-field/index.js.map +1 -1
- package/components/icure-form/fields/button-group/checkbox.js +4 -3
- package/components/icure-form/fields/button-group/checkbox.js.map +1 -1
- package/components/icure-form/fields/button-group/radio-button.js +5 -4
- package/components/icure-form/fields/button-group/radio-button.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-picker.js +4 -3
- package/components/icure-form/fields/date-picker/date-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-time-picker.js +4 -3
- package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/time-picker.js +4 -3
- package/components/icure-form/fields/date-picker/time-picker.js.map +1 -1
- package/components/icure-form/fields/dropdown/dropdown-field.d.ts +2 -4
- package/components/icure-form/fields/dropdown/dropdown-field.js +6 -5
- package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -1
- package/components/icure-form/fields/items-list-field/items-list-field.js +4 -4
- package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -1
- package/components/icure-form/fields/label/label.js +1 -1
- package/components/icure-form/fields/label/label.js.map +1 -1
- package/components/icure-form/fields/measure-field/measure-field.js +4 -3
- package/components/icure-form/fields/measure-field/measure-field.js.map +1 -1
- package/components/icure-form/fields/number-field/number-field.js +4 -3
- package/components/icure-form/fields/number-field/number-field.js.map +1 -1
- package/components/icure-form/fields/text-field/text-field.d.ts +1 -1
- package/components/icure-form/fields/text-field/text-field.js +5 -4
- package/components/icure-form/fields/text-field/text-field.js.map +1 -1
- package/components/icure-form/fields/token-field/token-field.js +4 -4
- package/components/icure-form/fields/token-field/token-field.js.map +1 -1
- package/components/icure-form/fields/utils/index.d.ts +4 -6
- package/components/icure-form/fields/utils/index.js +1 -1
- package/components/icure-form/fields/utils/index.js.map +1 -1
- package/components/icure-form/index.d.ts +8 -8
- package/components/icure-form/index.js +17 -13
- package/components/icure-form/index.js.map +1 -1
- package/components/icure-form/renderer/form/form-selection-button.js +1 -1
- package/components/icure-form/renderer/form/form-selection-button.js.map +1 -1
- package/components/icure-form/renderer/form/form.js +67 -58
- package/components/icure-form/renderer/form/form.js.map +1 -1
- package/components/icure-form/renderer/index.d.ts +4 -6
- package/components/icure-form/renderer/index.js.map +1 -1
- package/components/icure-label/index.js +6 -1
- package/components/icure-label/index.js.map +1 -1
- package/components/icure-text-field/index.d.ts +7 -9
- package/components/icure-text-field/index.js +118 -51
- package/components/icure-text-field/index.js.map +1 -1
- package/components/icure-text-field/plugin/caret-fix-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/mask-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/regexp-plugin.js.map +1 -1
- package/components/icure-text-field/prosemirror-commands.d.ts +2 -2
- package/components/icure-text-field/prosemirror-commands.js.map +1 -1
- package/components/icure-text-field/prosemirror-utils.js.map +1 -1
- package/components/icure-text-field/schema/common-marks.js.map +1 -1
- package/components/icure-text-field/schema/measure-schema.js.map +1 -1
- package/components/icure-text-field/selection-companion.js.map +1 -1
- package/components/icure-text-field/suggestion-palette.js.map +1 -1
- package/components/model/index.d.ts +69 -137
- package/components/model/index.js +30 -103
- package/components/model/index.js.map +1 -1
- package/components/themes/icure-blue/index.d.ts +1 -0
- package/components/themes/icure-blue/index.js +321 -0
- package/components/themes/icure-blue/index.js.map +1 -0
- package/conversion/ckmeans-grouping.js.map +1 -1
- package/conversion/ckmeans.js.map +1 -1
- package/conversion/icure-convert.js.map +1 -1
- package/generic/model.d.ts +45 -1
- package/generic/model.js.map +1 -1
- package/icure/form-values-container.d.ts +42 -8
- package/icure/form-values-container.js +99 -52
- package/icure/form-values-container.js.map +1 -1
- package/icure/icure-utils.d.ts +19 -0
- package/icure/icure-utils.js +117 -0
- package/icure/icure-utils.js.map +1 -0
- package/icure/model.d.ts +1 -1
- package/icure/model.js.map +1 -1
- package/package.json +5 -7
- package/utils/code-utils.d.ts +3 -10
- package/utils/code-utils.js +3 -9
- package/utils/code-utils.js.map +1 -1
- package/utils/dates.d.ts +6 -0
- package/utils/dates.js +58 -0
- package/utils/dates.js.map +1 -0
- package/utils/fields-values-provider.d.ts +2 -1
- package/utils/fields-values-provider.js +11 -6
- package/utils/fields-values-provider.js.map +1 -1
- package/utils/form-value-container.js.map +1 -1
- package/utils/icure-utils.js.map +1 -1
- package/utils/interpreter.js +1 -2
- package/utils/interpreter.js.map +1 -1
- package/utils/languages.d.ts +1 -5
- package/utils/languages.js.map +1 -1
- package/utils/markdown.d.ts +2 -1
- package/utils/markdown.js +5 -1
- package/utils/markdown.js.map +1 -1
- package/utils/no-lodash.d.ts +3 -1
- package/utils/no-lodash.js +3 -1
- package/utils/no-lodash.js.map +1 -1
- package/utils/primitive.d.ts +0 -3
- package/utils/primitive.js +4 -59
- package/utils/primitive.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-values-container.js","sourceRoot":"","sources":["../../tmp/icure/form-values-container.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAgE;AAChE,kDAA6C;AAI7C,sDAAoE;AACpE,oDAAoD;AACpD,kDAAmG;AAEnG,MAAa,0BAA0B;IAItC,IAAI,QAAQ;;QACX,OAAO,CACN,MAAA,IAAI,CAAC,SAAS,mCACd,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,0BAA0B;aAC/C,WAAW,EAAE;aACb,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,0BAA0B,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CACzK,CAAA;IACF,CAAC;IAED;;;;;;;;;OASG;IACH,YACS,WAAmB,EAC3B,0BAAsD,EAC9C,WAQU,EAClB,OAAiB,EACT,0BAAgI,GAAG,EAAE,CAAC,EAAE,EACxI,WAAW,IAAI,EACf,kBAAsE,EAAE;QAdxE,gBAAW,GAAX,WAAW,CAAQ;QAEnB,gBAAW,GAAX,WAAW,CAQD;QAEV,4BAAuB,GAAvB,uBAAuB,CAAiH;QACxI,aAAQ,GAAR,QAAQ,CAAO;QACf,oBAAe,GAAf,eAAe,CAAyD;QAEhF,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,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,EAC5C,IAAI,CAAC,WAAW,CAChB,CAAA;YACD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAA;YACrE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,CAAA;QACjF,CAAC;KAAA;CACD;AA7VD,gEA6VC;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAgC,EAAE,KAAa,EAAE,QAAgB,EAAE,EAAe,EAAE,EAAW,EAAE,QAAwB,EAAE,EAAE;;IAC1K,MAAM,KAAK,GAAG,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAC7B,KAAK,EACL,QAAQ,EACR;QACC,EAAE,EAAE,EAAE;QACN,KAAK,EAAE,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,KAAK,mCAAI,EAAE;QACtB,OAAO,EAAE,KAAK;YACb,CAAC,CAAC;gBACA,CAAC,QAAQ,CAAC,EAAE,IAAA,kCAAsB,EAAC,QAAQ,EAAE,KAAK,CAAC;aAClD;YACH,CAAC,CAAC,SAAS;KACZ,EACD,EAAE,EACF,QAAQ,CACR,CAAA;IACD,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { Contact, Form as ICureForm, Service } from '@icure/api'\nimport { sortedBy } from '../utils/no-lodash'\nimport { FormValuesContainer, FormValuesContainerMutation, ID, Version, VersionedData } from '../generic'\nimport { ServiceMetadata } from '../icure'\nimport { FieldMetadata, FieldValue, PrimitiveType } from '../components/model'\nimport { areCodesEqual, isContentEqual } from '../utils/icure-utils'\nimport { codeStubToCode } from '../utils/code-utils'\nimport { contentToPrimitiveType, parsePrimitive, primitiveTypeToContent } from '../utils/primitive'\n\nexport class BridgedFormValuesContainer implements FormValuesContainer<FieldValue, FieldMetadata> {\n\tprivate contact: Contact\n\tprivate contactFormValuesContainer: ContactFormValuesContainer\n\tprivate _children: BridgedFormValuesContainer[] | undefined\n\tget children(): BridgedFormValuesContainer[] {\n\t\treturn (\n\t\t\tthis._children ??\n\t\t\t(this._children = this.contactFormValuesContainer\n\t\t\t\t.getChildren()\n\t\t\t\t.map((fvc) => new BridgedFormValuesContainer(this.responsible, fvc, this.interpreter, this.contact, this.dependentValuesProvider, this.language, this.changeListeners)))\n\t\t)\n\t}\n\n\t/**\n\t * Creates an instance of BridgedFormValuesContainer.\n\t * @param responsible\n\t * @param contact The displayed contact (may be in the past). === to currentContact if the contact is the contact of the day\n\t * @param contactFormValuesContainer\n\t * @param interpreter\n\t * @param dependentValuesProvider\n\t * @param language\n\t * @param changeListeners\n\t */\n\tconstructor(\n\t\tprivate responsible: string,\n\t\tcontactFormValuesContainer: ContactFormValuesContainer,\n\t\tprivate interpreter?: <\n\t\t\tT,\n\t\t\tS extends {\n\t\t\t\t[key: string | symbol]: unknown\n\t\t\t},\n\t\t>(\n\t\t\tformula: string,\n\t\t\tsandbox: S,\n\t\t) => T | undefined,\n\t\tcontact?: Contact,\n\t\tprivate dependentValuesProvider: (anchorId: string | undefined, templateId: string) => { metadata: FieldMetadata; formula: string }[] = () => [],\n\t\tprivate language = 'en',\n\t\tprivate changeListeners: ((newValue: BridgedFormValuesContainer) => void)[] = [],\n\t) {\n\t\t//Before start to broadcast changes, we need to fill in the contactFormValuesContainer with the dependent values\n\t\tthis.contactFormValuesContainer = contactFormValuesContainer\n\t\tthis.contact = contact ?? contactFormValuesContainer.currentContact\n\t\tthis.computeDependentValues()\n\t}\n\n\tgetLabel(): string {\n\t\treturn this.contactFormValuesContainer.getLabel()\n\t}\n\n\tgetFormId(): string | undefined {\n\t\treturn this.contactFormValuesContainer.getFormId()\n\t}\n\n\tgetContactFormValuesContainer() {\n\t\treturn this.contactFormValuesContainer\n\t}\n\n\tregisterChangeListener(listener: (newValue: BridgedFormValuesContainer) => void): void {\n\t\tthis.changeListeners.push(listener)\n\t}\n\n\tunregisterChangeListener(listener: (newValue: BridgedFormValuesContainer) => void): void {\n\t\tthis.changeListeners = this.changeListeners.filter((l) => l !== listener)\n\t}\n\n\tgetValues(revisionsFilter: (id: string, history: Version<FieldMetadata>[]) => (string | null)[]): VersionedData<FieldValue> {\n\t\treturn Object.entries(\n\t\t\tthis.contactFormValuesContainer.getValues((id, history) => {\n\t\t\t\treturn revisionsFilter(\n\t\t\t\t\tid,\n\t\t\t\t\thistory\n\t\t\t\t\t\t.filter(({ modified }) => !this.contact.created || !modified || modified <= this.contact.created)\n\t\t\t\t\t\t.map(({ revision, modified, value: sm }) => ({\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tmodified,\n\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\tlabel: sm.label,\n\t\t\t\t\t\t\t\towner: sm.owner,\n\t\t\t\t\t\t\t\ttags: sm.tags?.map(codeStubToCode),\n\t\t\t\t\t\t\t\tvalueDate: sm.valueDate,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t)\n\t\t\t}),\n\t\t).reduce((acc, [id, history]) => {\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[id]: history.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\trevision,\n\t\t\t\t\tmodified,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tcontent: Object.entries(s.content ?? {}).reduce((acc, [lng, cnt]) => {\n\t\t\t\t\t\t\tconst converted = contentToPrimitiveType(lng, cnt)\n\t\t\t\t\t\t\treturn converted ? { ...acc, [lng]: converted } : acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\tcodes: s.codes?.map(codeStubToCode),\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t}\n\t\t}, {} as VersionedData<FieldValue>)\n\t}\n\n\tgetMetadata(id: string, revisions: (string | null)[]): VersionedData<FieldMetadata> {\n\t\treturn Object.entries(this.contactFormValuesContainer.getMetadata(id, revisions)).reduce(\n\t\t\t(acc, [id, history]) => ({\n\t\t\t\t...acc,\n\t\t\t\t[id]: history.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\trevision,\n\t\t\t\t\tmodified,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tlabel: s.label,\n\t\t\t\t\t\towner: s.owner,\n\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t}),\n\t\t\t{},\n\t\t)\n\t}\n\n\tprivate mutateAndNotify(newContactFormValuesContainer: ContactFormValuesContainer) {\n\t\tconst newBridgedFormValueContainer = new BridgedFormValuesContainer(\n\t\t\tthis.responsible,\n\t\t\tnewContactFormValuesContainer,\n\t\t\tthis.interpreter,\n\t\t\tthis.contact === this.contactFormValuesContainer.currentContact ? newContactFormValuesContainer.currentContact : this.contact,\n\t\t\tthis.dependentValuesProvider,\n\t\t\tthis.language,\n\t\t\tthis.changeListeners,\n\t\t)\n\t\tthis.changeListeners.forEach((l) => l(newBridgedFormValueContainer))\n\t\treturn newBridgedFormValueContainer\n\t}\n\n\t//This method mutates the BridgedFormValuesContainer but can only be called from the constructor\n\tprivate computeDependentValues() {\n\t\tif (this.contactFormValuesContainer.rootForm.formTemplateId) {\n\t\t\tthis.dependentValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).forEach(({ metadata, formula }) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst currentValue = this.getVersionedValuesForKey(metadata.label)\n\t\t\t\t\tconst newValue = this.compute(formula) as FieldValue | undefined\n\t\t\t\t\tif (newValue !== undefined || currentValue != undefined) {\n\t\t\t\t\t\tconst lng = this.language ?? 'en'\n\t\t\t\t\t\tif (newValue && !newValue.content[lng] && newValue.content['*']) {\n\t\t\t\t\t\t\tnewValue.content[lng] = newValue.content['*']\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (newValue) {\n\t\t\t\t\t\t\tdelete newValue.content['*']\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst currentContact = this.contactFormValuesContainer.currentContact\n\t\t\t\t\t\tthis.contactFormValuesContainer = setValueOnContactFormValuesContainer(\n\t\t\t\t\t\t\tthis.contactFormValuesContainer,\n\t\t\t\t\t\t\tmetadata.label,\n\t\t\t\t\t\t\tlng,\n\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\tObject.keys(currentValue ?? {})[0],\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t).formValuesContainer\n\t\t\t\t\t\tif (this.contact === currentContact) {\n\t\t\t\t\t\t\tthis.contact = this.contactFormValuesContainer.currentContact\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.log(`Error while computing formula : ${formula}`, e)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tsetValue(\n\t\tlabel: string,\n\t\tlanguage: string,\n\t\tfv?: FieldValue,\n\t\tid?: string,\n\t\tmetadata?: FieldMetadata,\n\t): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, ID> {\n\t\tconst mutation = setValueOnContactFormValuesContainer(this.contactFormValuesContainer, label, language, fv, id, metadata)\n\t\treturn { result: mutation.result, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tsetMetadata(label: string, meta: FieldMetadata, id?: string | undefined): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, ID> {\n\t\tconst mutation = this.contactFormValuesContainer.setMetadata(\n\t\t\tlabel,\n\t\t\t{\n\t\t\t\tlabel: meta.label,\n\t\t\t\tresponsible: this.responsible,\n\t\t\t\towner: meta.owner,\n\t\t\t\tvalueDate: meta.valueDate,\n\t\t\t\ttags: meta.tags,\n\t\t\t},\n\t\t\tid,\n\t\t)\n\t\treturn { result: mutation.result, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tdelete(serviceId: string): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, void> {\n\t\tconst mutation = this.contactFormValuesContainer.delete(serviceId)\n\t\treturn { result: undefined, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tprivate getVersionedValuesForKey(key: string | symbol) {\n\t\treturn this.getValues((id, history) => (history?.[0]?.value?.label && key === history[0].value.label ? [history?.[0]?.revision] : []))\n\t}\n\n\tcompute<T, S extends { [key: string | symbol]: unknown }>(formula: string, sandbox?: S): T | undefined {\n\t\t// noinspection JSUnusedGlobalSymbols\n\t\tconst native = {\n\t\t\tparseInt: parseInt,\n\t\t\tparseFloat: parseFloat,\n\t\t\tDate: Date,\n\t\t\tMath: Math,\n\t\t\tNumber: Number,\n\t\t\tString: String,\n\t\t\tBoolean: Boolean,\n\t\t\tArray: Array,\n\t\t\tObject: Object,\n\t\t\tparseContent: (content?: { [key: string]: PrimitiveType }) => {\n\t\t\t\tif (!content) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tconst primitive = content[this.language] ?? content['*'] ?? content[Object.keys(content)[0]]\n\t\t\t\treturn primitive && parsePrimitive(primitive)\n\t\t\t},\n\t\t}\n\t\tconst proxy: S = new Proxy({} as S, {\n\t\t\thas: (target: S, key: string | symbol) => !!native[key] || key === 'self' || Object.keys(this.getVersionedValuesForKey(key) ?? {}).length > 0,\n\t\t\tget: (target: S, key: string | symbol) => {\n\t\t\t\tif (key === 'undefined') {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tconst nativeValue = native[key]\n\t\t\t\tif (!!nativeValue) {\n\t\t\t\t\treturn nativeValue\n\t\t\t\t}\n\t\t\t\treturn key === 'self' ? proxy : Object.values(this.getVersionedValuesForKey(key)).map((v) => v[0]?.value)\n\t\t\t},\n\t\t})\n\t\treturn this.interpreter?.(formula, sandbox ?? proxy)\n\t}\n\n\tgetChildren(): FormValuesContainer<FieldValue, FieldMetadata>[] {\n\t\treturn this.contactFormValuesContainer.getChildren().map((fvc) => new BridgedFormValuesContainer(this.responsible, fvc, this.interpreter, this.contact))\n\t}\n\n\tasync addChild(\n\t\tanchorId: string,\n\t\ttemplateId: string,\n\t\tlabel: string,\n\t): Promise<FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, BridgedFormValuesContainer>> {\n\t\tconst mutation = await this.contactFormValuesContainer.addChild(anchorId, templateId, label)\n\t\tconst newBridgedFormValueContainer = this.mutateAndNotify(mutation.formValuesContainer)\n\t\tconst newChild = newBridgedFormValueContainer.children.find((c) => c.contactFormValuesContainer === mutation.result)\n\t\tif (!newChild) {\n\t\t\tthrow new Error('Illegal state, the new child must be found')\n\t\t}\n\t\treturn { result: newChild, formValuesContainer: newBridgedFormValueContainer }\n\t}\n\n\tasync removeChild(container: BridgedFormValuesContainer): Promise<FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, void>> {\n\t\tconst mutation = await this.contactFormValuesContainer.removeChild(container.contactFormValuesContainer)\n\t\treturn { result: undefined, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n}\n\nexport class ContactFormValuesContainer implements FormValuesContainer<Service, ServiceMetadata> {\n\trootForm: ICureForm\n\tcurrentContact: Contact //The contact of the moment, used to record new modifications\n\tcontactsHistory: Contact[] //Must be sorted (most recent first), contains all the contacts linked to this form\n\tchildren: ContactFormValuesContainer[] //Direct children of the ContactFormValuesContainer\n\tserviceFactory: (label: string, serviceId?: string) => Service\n\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>\n\n\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[]\n\n\tconstructor(\n\t\trootForm: ICureForm,\n\t\tcurrentContact: Contact,\n\t\tcontactsHistory: Contact[],\n\t\tserviceFactory: (label: string, serviceId?: string) => Service,\n\t\tchildren: ContactFormValuesContainer[],\n\t\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>,\n\t\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[] = [],\n\t) {\n\t\tif (contactsHistory.includes(currentContact)) {\n\t\t\tthrow new Error('Illegal argument, the history must not contain the currentContact')\n\t\t}\n\t\tthis.rootForm = rootForm\n\t\tthis.currentContact = currentContact\n\t\tthis.contactsHistory = sortedBy(contactsHistory, 'created', 'desc')\n\t\tthis.children = children\n\t\tthis.serviceFactory = serviceFactory\n\t\tthis.formFactory = formFactory\n\t\tthis.changeListeners = changeListeners\n\t}\n\n\tregisterChildFormValuesContainer(childFVC: ContactFormValuesContainer) {\n\t\tchildFVC.registerChangeListener((newValue) => {\n\t\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\tthis.currentContact,\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children.map((c) => (c === childFVC ? newValue : c)),\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\t\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\t})\n\t}\n\n\tstatic async fromFormsHierarchy(\n\t\trootForm: ICureForm,\n\t\tcurrentContact: Contact,\n\t\tcontactsHistory: Contact[],\n\t\tserviceFactory: (label: string, serviceId?: string) => Service,\n\t\tformChildrenProvider: (parentId: string) => Promise<ICureForm[]>,\n\t\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>,\n\t\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[] = [],\n\t): Promise<ContactFormValuesContainer> {\n\t\tconst contactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\trootForm,\n\t\t\tcurrentContact,\n\t\t\tcontactsHistory,\n\t\t\tserviceFactory,\n\t\t\trootForm.id\n\t\t\t\t? await Promise.all(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tawait formChildrenProvider(rootForm.id)\n\t\t\t\t\t\t).map(\n\t\t\t\t\t\t\tasync (f) =>\n\t\t\t\t\t\t\t\t// eslint-disable-next-line max-len\n\t\t\t\t\t\t\t\tawait ContactFormValuesContainer.fromFormsHierarchy(f, currentContact, contactsHistory, serviceFactory, formChildrenProvider, formFactory),\n\t\t\t\t\t\t),\n\t\t\t\t )\n\t\t\t\t: [],\n\t\t\tformFactory,\n\n\t\t\tchangeListeners,\n\t\t)\n\t\tcontactFormValuesContainer.children.forEach((childFVC) => contactFormValuesContainer.registerChildFormValuesContainer(childFVC))\n\n\t\treturn contactFormValuesContainer\n\t}\n\n\tgetLabel(): string {\n\t\treturn this.rootForm.descr ?? ''\n\t}\n\n\tgetFormId(): string | undefined {\n\t\treturn this.rootForm?.formTemplateId\n\t}\n\n\tregisterChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void {\n\t\tthis.changeListeners.push(listener)\n\t}\n\n\tunregisterChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void {\n\t\tthis.changeListeners = this.changeListeners.filter((l) => l !== listener)\n\t}\n\n\tgetChildren(): ContactFormValuesContainer[] {\n\t\treturn this.children\n\t}\n\n\tgetValues(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<Service> {\n\t\treturn Object.entries(this.getServicesInHistory(revisionsFilter)).reduce(\n\t\t\t(acc, [id, history]) =>\n\t\t\t\thistory.length\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t[id]: [...history].sort((a, b) => (b?.modified || +new Date()) - (a?.modified || +new Date())),\n\t\t\t\t\t }\n\t\t\t\t\t: acc,\n\t\t\t{},\n\t\t)\n\t}\n\n\tgetMetadata(id: string, revisions: (string | null)[]): VersionedData<ServiceMetadata> {\n\t\treturn [this.currentContact]\n\t\t\t.concat(this.contactsHistory)\n\t\t\t.filter((ctc) => ctc.rev !== undefined && revisions.includes(ctc.rev))\n\t\t\t.reduce(\n\t\t\t\t(acc, ctc) =>\n\t\t\t\t\t(ctc.services ?? [])\n\t\t\t\t\t\t.filter((s) => s.id === id)\n\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t(acc, s) =>\n\t\t\t\t\t\t\t\ts.id\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t\t\t\t[s.id]: (acc[s.id] ?? (acc[s.id] = [])).concat({\n\t\t\t\t\t\t\t\t\t\t\t\trevision: ctc.rev ?? null,\n\t\t\t\t\t\t\t\t\t\t\t\tmodified: s.modified,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: s.label ?? s.id,\n\t\t\t\t\t\t\t\t\t\t\t\t\towner: s.author,\n\t\t\t\t\t\t\t\t\t\t\t\t\tresponsible: s.responsible,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: acc,\n\t\t\t\t\t\t\tacc,\n\t\t\t\t\t\t) ?? acc,\n\t\t\t\t{} as { [id: string]: Version<ServiceMetadata>[] },\n\t\t\t) //index services in history by id\n\t}\n\n\tsetMetadata(label: string, meta: ServiceMetadata, id?: string): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ID> {\n\t\tconst service = (id && this.getServiceInCurrentContact(id)) || this.serviceFactory(label, id)\n\t\tif (!service.id) {\n\t\t\tthrow new Error('Service id must be defined')\n\t\t}\n\t\tif (\n\t\t\t(meta.responsible && service.responsible !== meta.responsible) ||\n\t\t\t(meta.owner && service.author !== meta.owner) ||\n\t\t\t(meta.valueDate && service.valueDate !== meta.valueDate) ||\n\t\t\t(meta.codes && service.codes !== meta.codes) ||\n\t\t\t(meta.tags && service.tags !== meta.tags)\n\t\t) {\n\t\t\tconst newService = new Service({ ...service, modified: Date.now() })\n\t\t\tmeta.responsible && (newService.responsible = meta.responsible)\n\t\t\tmeta.owner && (newService.author = meta.owner)\n\t\t\tmeta.valueDate && (newService.valueDate = meta.valueDate)\n\t\t\tmeta.codes && (newService.codes = meta.codes)\n\t\t\tmeta.tags && (newService.tags = meta.tags)\n\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\t{ ...this.currentContact, services: this.currentContact.services?.map((s) => (s.id === service.id ? newService : s)) },\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\t\t\treturn { result: service.id, formValuesContainer: newFormValuesContainer }\n\t\t}\n\n\t\treturn { result: service.id, formValuesContainer: this }\n\t}\n\n\tsetValue(\n\t\tlabel: string,\n\t\tlanguage: string,\n\t\tvalue?: Service,\n\t\tid?: string,\n\t\tmetadata?: ServiceMetadata,\n\t): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ID> {\n\t\tconst service = (id && this.getServiceInCurrentContact(id)) || this.serviceFactory(label, id)\n\t\tif (!service.id) {\n\t\t\tthrow new Error('Service id must be defined')\n\t\t}\n\t\tconsole.log('Setting value of service', service.id, 'with', value, 'and metadata', metadata)\n\t\tconst newContent = value?.content?.[language]\n\t\tconst newCodes = value?.codes ?? []\n\t\tif (!isContentEqual(service.content?.[language], newContent) || (newCodes && !areCodesEqual(newCodes, service.codes ?? []))) {\n\t\t\tconst newService = new Service({ ...service, modified: Date.now() })\n\t\t\tconst newContents = newContent ? { ...(service.content || {}), [language]: newContent } : { ...(service.content || {}) }\n\t\t\tif (!newContent) {\n\t\t\t\tdelete newContents[language]\n\t\t\t}\n\n\t\t\tlet newCurrentContact: Contact\n\t\t\tif (!Object.entries(newContents).filter(([_, cnt]) => cnt !== undefined).length) {\n\t\t\t\tnewCurrentContact = {\n\t\t\t\t\t...this.currentContact,\n\t\t\t\t\tservices: (this.currentContact.services ?? []).some((s) => s.id === service.id)\n\t\t\t\t\t\t? (this.currentContact.services ?? []).filter((s) => s.id !== service.id)\n\t\t\t\t\t\t: [...(this.currentContact.services ?? [])],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewService.content = newContents\n\t\t\t\tnewService.codes = newCodes\n\n\t\t\t\tif (metadata) {\n\t\t\t\t\tnewService.responsible = metadata.responsible ?? newService.responsible\n\t\t\t\t\tnewService.author = metadata.owner ?? newService.author\n\t\t\t\t\tnewService.valueDate = metadata.valueDate ?? newService.valueDate\n\t\t\t\t\tnewService.tags = metadata.tags ?? newService.tags\n\t\t\t\t\tnewService.label = metadata.label ?? newService.label\n\t\t\t\t}\n\n\t\t\t\tnewCurrentContact = {\n\t\t\t\t\t...this.currentContact,\n\t\t\t\t\tservices: (this.currentContact.services ?? []).some((s) => s.id === service.id)\n\t\t\t\t\t\t? (this.currentContact.services ?? []).map((s) => (s.id === service.id ? newService : s))\n\t\t\t\t\t\t: [...(this.currentContact.services ?? []), newService],\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\tnewCurrentContact,\n\t\t\t\tthis.contactsHistory.map((c) => (c === this.currentContact ? newCurrentContact : c)),\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\n\t\t\treturn { result: service.id!, formValuesContainer: newFormValuesContainer }\n\t\t}\n\n\t\treturn { result: service.id, formValuesContainer: this }\n\t}\n\n\tdelete(serviceId: string): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, void> {\n\t\tconst service = this.getServiceInCurrentContact(serviceId)\n\t\tif (service) {\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\t{ ...this.currentContact, services: this.currentContact.services?.map((s) => (s.id === serviceId ? new Service({ ...service, endOfLife: Date.now() }) : s)) },\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\t\t\treturn { result: undefined, formValuesContainer: newFormValuesContainer }\n\t\t}\n\t\treturn { result: undefined, formValuesContainer: this }\n\t}\n\n\tcompute<T>(): T | undefined {\n\t\tthrow new Error('Compute not supported at contact level')\n\t}\n\n\t/** returns all services in history that match a selector\n\t *\n\t * @private\n\t * @param revisionsFilter\n\t */\n\tprivate getServicesInHistory(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<Service> {\n\t\tconst indexedServices = [this.currentContact]\n\t\t\t.concat(this.contactsHistory)\n\t\t\t.reduce(\n\t\t\t\t(acc, ctc) =>\n\t\t\t\t\tctc.services?.reduce(\n\t\t\t\t\t\t(acc, s) => (s.id ? { ...acc, [s.id]: (acc[s.id] ?? (acc[s.id] = [])).concat({ revision: ctc.rev ?? null, modified: ctc.created, value: s }) } : acc),\n\t\t\t\t\t\tacc,\n\t\t\t\t\t) ?? acc,\n\t\t\t\t{} as VersionedData<Service>,\n\t\t\t) //index services in history by id\n\t\treturn Object.entries(indexedServices)\n\t\t\t.map(([id, history]) => {\n\t\t\t\tconst keptRevisions = revisionsFilter(\n\t\t\t\t\tid,\n\t\t\t\t\thistory.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tmodified,\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tlabel: s.label ?? s.id ?? '',\n\t\t\t\t\t\t\towner: s.author,\n\t\t\t\t\t\t\tresponsible: s.responsible,\n\t\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\t\tcodes: s.codes,\n\t\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t)\n\t\t\t\treturn [id, history.filter(({ revision }) => keptRevisions.includes(revision))] as [string, Version<Service>[]]\n\t\t\t})\n\t\t\t.reduce((acc, [id, history]) => ({ ...acc, [id]: history }), {})\n\t}\n\n\tasync addChild(\n\t\tanchorId: string,\n\t\ttemplateId: string,\n\t\tlabel: string,\n\t): Promise<FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ContactFormValuesContainer>> {\n\t\tconst newForm = await this.formFactory(anchorId, templateId, label)\n\t\tconst childFVC = new ContactFormValuesContainer(newForm, this.currentContact, this.contactsHistory, this.serviceFactory, [], this.formFactory)\n\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\tthis.rootForm,\n\t\t\tthis.currentContact,\n\t\t\tthis.contactsHistory,\n\t\t\tthis.serviceFactory,\n\t\t\t[...this.children, childFVC],\n\t\t\tthis.formFactory,\n\t\t)\n\t\tnewContactFormValuesContainer.registerChildFormValuesContainer(childFVC)\n\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\treturn { result: childFVC, formValuesContainer: newContactFormValuesContainer }\n\t}\n\n\tprivate getServiceInCurrentContact(id: string): Service | undefined {\n\t\tconst service = (this.currentContact.services || [])?.find((s) => s.id === id)\n\t\treturn service ?? undefined\n\t}\n\n\tasync removeChild(container: ContactFormValuesContainer): Promise<FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, void>> {\n\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\tthis.rootForm,\n\t\t\tthis.currentContact,\n\t\t\tthis.contactsHistory,\n\t\t\tthis.serviceFactory,\n\t\t\tthis.children.filter((c) => c !== container),\n\t\t\tthis.formFactory,\n\t\t)\n\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\treturn { result: undefined, formValuesContainer: newContactFormValuesContainer }\n\t}\n}\n\nconst setValueOnContactFormValuesContainer = (cfvc: ContactFormValuesContainer, label: string, language: string, fv?: FieldValue, id?: string, metadata?: FieldMetadata) => {\n\tconst value = fv?.content[language]\n\tconst mutation = cfvc.setValue(\n\t\tlabel,\n\t\tlanguage,\n\t\t{\n\t\t\tid: id,\n\t\t\tcodes: fv?.codes ?? [],\n\t\t\tcontent: value\n\t\t\t\t? {\n\t\t\t\t\t\t[language]: primitiveTypeToContent(language, value),\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t},\n\t\tid,\n\t\tmetadata,\n\t)\n\treturn mutation\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form-values-container.js","sourceRoot":"","sources":["../../tmp/icure/form-values-container.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAgE;AAChE,kDAA6C;AAI7C,+CAA6H;AAC7H,kDAAmD;AAEnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,0BAA0B;IAItC,IAAI,QAAQ;;QACX,OAAO,CACN,MAAA,IAAI,CAAC,SAAS,mCACd,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,0BAA0B;aAC/C,WAAW,EAAE;aACb,GAAG,CACH,CAAC,GAAG,EAAE,EAAE,CACP,IAAI,0BAA0B,CAC7B,IAAI,CAAC,WAAW,EAChB,GAAG,EACH,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,uBAAuB,EAC5B,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,eAAe,CACpB,CACF,CAAC,CACH,CAAA;IACF,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACS,WAAmB,EAC3B,0BAAsD,EAC9C,WAQU,EAClB,OAAiB,EACT,0BAAgI,GAAG,EAAE,CAAC,EAAE,EACxI,qBAA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AAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAA;YACrE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,CAAA;QACjF,CAAC;KAAA;CACD;AA5VD,gEA4VC;AAED,MAAM,oCAAoC,GAAG,CAAC,IAAgC,EAAE,KAAa,EAAE,QAAgB,EAAE,EAAe,EAAE,EAAW,EAAE,QAAwB,EAAE,EAAE;;IAC1K,MAAM,KAAK,GAAG,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAC7B,KAAK,EACL,QAAQ,EACR;QACC,EAAE,EAAE,EAAE;QACN,KAAK,EAAE,MAAA,EAAE,aAAF,EAAE,uBAAF,EAAE,CAAE,KAAK,mCAAI,EAAE;QACtB,OAAO,EAAE,KAAK;YACb,CAAC,CAAC;gBACA,CAAC,QAAQ,CAAC,EAAE,IAAA,oCAAsB,EAAC,QAAQ,EAAE,KAAK,CAAC;aAClD;YACH,CAAC,CAAC,SAAS;KACZ,EACD,EAAE,EACF;QACC,KAAK,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,mCAAI,EAAE;QAC5B,WAAW,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK;QAC5B,SAAS,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS;QAC9B,IAAI,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI;KACpB,CACD,CAAA;IACD,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { Contact, Form as ICureForm, Service } from '@icure/api'\nimport { sortedBy } from '../utils/no-lodash'\nimport { FormValuesContainer, FormValuesContainerMutation, ID, Version, VersionedData } from '../generic'\nimport { ServiceMetadata } from './model'\nimport { FieldMetadata, FieldValue, PrimitiveType, Validator } from '../components/model'\nimport { areCodesEqual, codeStubToCode, contentToPrimitiveType, isContentEqual, primitiveTypeToContent } from './icure-utils'\nimport { parsePrimitive } from '../utils/primitive'\n\n/** This class is a bridge between the ICure API and the generic FormValuesContainer interface.\n * It wraps around a ContactFormValuesContainer and provides a series of services:\n * - It computes dependent values when the form is created\n * - It broadcasts changes from the wrapped ContactFormValuesContainer to its listeners\n * - It provides a way to compute formulas in a sandboxed environment\n * - It bridges the setValues and setMetadata methods with the wrapped ContactFormValuesContainer by\n * \t\t- converting the FieldValue to a Service\n * \t\t- converting the FieldMetadata to a ServiceMetadata\n * - It bridges the getValues and getMetadata methods with the wrapped ContactFormValuesContainer by\n * \t\t- converting the Service to a FieldValue\n * \t\t- converting the ServiceMetadata to a FieldMetadata\n * - It lazily creates bridges the children by\n * - lazily creating BridgedFormValuesContainer when the children of the wrapped ContactFormValuesContainer are accessed\n * - creating a new ContactFormValuesContainer and wrapping it in a BridgedFormValuesContainer when a child is added\n *\n * The icure-form typically accepts a BridgedFormValuesContainer as a prop and uses it to interact with the form.\n *\n * This class is fairly generic and can be used as an inspiration or subclassed for other bridges\n */\nexport class BridgedFormValuesContainer implements FormValuesContainer<FieldValue, FieldMetadata> {\n\tprivate contact: Contact\n\tprivate contactFormValuesContainer: ContactFormValuesContainer\n\tprivate _children: BridgedFormValuesContainer[] | undefined\n\tget children(): BridgedFormValuesContainer[] {\n\t\treturn (\n\t\t\tthis._children ??\n\t\t\t(this._children = this.contactFormValuesContainer\n\t\t\t\t.getChildren()\n\t\t\t\t.map(\n\t\t\t\t\t(fvc) =>\n\t\t\t\t\t\tnew BridgedFormValuesContainer(\n\t\t\t\t\t\t\tthis.responsible,\n\t\t\t\t\t\t\tfvc,\n\t\t\t\t\t\t\tthis.interpreter,\n\t\t\t\t\t\t\tthis.contact,\n\t\t\t\t\t\t\tthis.dependentValuesProvider,\n\t\t\t\t\t\t\tthis.validatorsProvider,\n\t\t\t\t\t\t\tthis.language,\n\t\t\t\t\t\t\tthis.changeListeners,\n\t\t\t\t\t\t),\n\t\t\t\t))\n\t\t)\n\t}\n\n\t/**\n\t * Creates an instance of BridgedFormValuesContainer.\n\t * @param responsible The id of the data owner responsible for the creation of the values\n\t * @param contact The displayed contact (may be in the past). === to currentContact if the contact is the contact of the day\n\t * @param contactFormValuesContainer The wrapped ContactFormValuesContainer\n\t * @param interpreter A function that can interpret formulas\n\t * @param dependentValuesProvider A function that provides the dependent values (computed on the basis of other values) for a given anchorId and templateId\n\t * @param validatorsProvider A function that provides the validators for a given anchorId and templateId\n\t * @param language The language in which the values are displayed\n\t * @param changeListeners The listeners that will be notified when the values change\n\t */\n\tconstructor(\n\t\tprivate responsible: string,\n\t\tcontactFormValuesContainer: ContactFormValuesContainer,\n\t\tprivate interpreter?: <\n\t\t\tT,\n\t\t\tS extends {\n\t\t\t\t[key: string | symbol]: unknown\n\t\t\t},\n\t\t>(\n\t\t\tformula: string,\n\t\t\tsandbox: S,\n\t\t) => T | undefined,\n\t\tcontact?: Contact,\n\t\tprivate dependentValuesProvider: (anchorId: string | undefined, templateId: string) => { metadata: FieldMetadata; formula: string }[] = () => [],\n\t\tprivate validatorsProvider: (anchorId: string | undefined, templateId: string) => { metadata: FieldMetadata; validators: Validator[] }[] = () => [],\n\t\tprivate language = 'en',\n\t\tprivate changeListeners: ((newValue: BridgedFormValuesContainer) => void)[] = [],\n\t) {\n\t\t//Before start to broadcast changes, we need to fill in the contactFormValuesContainer with the dependent values\n\t\tthis.contactFormValuesContainer = contactFormValuesContainer\n\t\tthis.contact = contact ?? contactFormValuesContainer.currentContact\n\t\tthis.computeDependentValues()\n\t}\n\n\tgetLabel(): string {\n\t\treturn this.contactFormValuesContainer.getLabel()\n\t}\n\n\tgetFormId(): string | undefined {\n\t\treturn this.contactFormValuesContainer.getFormId()\n\t}\n\n\tgetContactFormValuesContainer() {\n\t\treturn this.contactFormValuesContainer\n\t}\n\n\tregisterChangeListener(listener: (newValue: BridgedFormValuesContainer) => void): void {\n\t\tthis.changeListeners.push(listener)\n\t}\n\n\tunregisterChangeListener(listener: (newValue: BridgedFormValuesContainer) => void): void {\n\t\tthis.changeListeners = this.changeListeners.filter((l) => l !== listener)\n\t}\n\n\tgetValues(revisionsFilter: (id: string, history: Version<FieldMetadata>[]) => (string | null)[]): VersionedData<FieldValue> {\n\t\treturn Object.entries(\n\t\t\tthis.contactFormValuesContainer.getValues((id, history) =>\n\t\t\t\trevisionsFilter(\n\t\t\t\t\tid,\n\t\t\t\t\thistory\n\t\t\t\t\t\t.filter(({ modified }) => !this.contact.created || !modified || modified <= this.contact.created)\n\t\t\t\t\t\t.map(({ revision, modified, value: sm }) => ({\n\t\t\t\t\t\t\trevision,\n\t\t\t\t\t\t\tmodified,\n\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\tlabel: sm.label,\n\t\t\t\t\t\t\t\towner: sm.responsible,\n\t\t\t\t\t\t\t\ttags: sm.tags?.map(codeStubToCode),\n\t\t\t\t\t\t\t\tvalueDate: sm.valueDate,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t),\n\t\t).reduce((acc, [id, history]) => {\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[id]: history.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\trevision,\n\t\t\t\t\tmodified,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tcontent: Object.entries(s.content ?? {}).reduce((acc, [lng, cnt]) => {\n\t\t\t\t\t\t\tconst converted = contentToPrimitiveType(lng, cnt)\n\t\t\t\t\t\t\treturn converted ? { ...acc, [lng]: converted } : acc\n\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\tcodes: s.codes?.map(codeStubToCode),\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t}\n\t\t}, {} as VersionedData<FieldValue>)\n\t}\n\n\tgetMetadata(id: string, revisions: (string | null)[]): VersionedData<FieldMetadata> {\n\t\treturn Object.entries(this.contactFormValuesContainer.getMetadata(id, revisions)).reduce(\n\t\t\t(acc, [id, history]) => ({\n\t\t\t\t...acc,\n\t\t\t\t[id]: history.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\trevision,\n\t\t\t\t\tmodified,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tlabel: s.label,\n\t\t\t\t\t\towner: s.responsible,\n\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\t}),\n\t\t\t{},\n\t\t)\n\t}\n\n\tprivate mutateAndNotify(newContactFormValuesContainer: ContactFormValuesContainer) {\n\t\tconst newBridgedFormValueContainer = new BridgedFormValuesContainer(\n\t\t\tthis.responsible,\n\t\t\tnewContactFormValuesContainer,\n\t\t\tthis.interpreter,\n\t\t\tthis.contact === this.contactFormValuesContainer.currentContact ? newContactFormValuesContainer.currentContact : this.contact,\n\t\t\tthis.dependentValuesProvider,\n\t\t\tthis.validatorsProvider,\n\t\t\tthis.language,\n\t\t\tthis.changeListeners,\n\t\t)\n\t\tthis.changeListeners.forEach((l) => l(newBridgedFormValueContainer))\n\t\treturn newBridgedFormValueContainer\n\t}\n\n\t//This method mutates the BridgedFormValuesContainer but can only be called from the constructor\n\tprivate computeDependentValues() {\n\t\tif (this.contactFormValuesContainer.rootForm.formTemplateId) {\n\t\t\tthis.dependentValuesProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).forEach(({ metadata, formula }) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst currentValue = this.getVersionedValuesForKey(metadata.label)\n\t\t\t\t\tconst newValue = this.compute(formula) as FieldValue | undefined\n\t\t\t\t\tif (newValue !== undefined || currentValue != undefined) {\n\t\t\t\t\t\tconst lng = this.language ?? 'en'\n\t\t\t\t\t\tif (newValue && !newValue.content[lng] && newValue.content['*']) {\n\t\t\t\t\t\t\tnewValue.content[lng] = newValue.content['*']\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (newValue) {\n\t\t\t\t\t\t\tdelete newValue.content['*']\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst currentContact = this.contactFormValuesContainer.currentContact\n\t\t\t\t\t\tthis.contactFormValuesContainer = setValueOnContactFormValuesContainer(\n\t\t\t\t\t\t\tthis.contactFormValuesContainer,\n\t\t\t\t\t\t\tmetadata.label,\n\t\t\t\t\t\t\tlng,\n\t\t\t\t\t\t\tnewValue,\n\t\t\t\t\t\t\tObject.keys(currentValue ?? {})[0],\n\t\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\t).formValuesContainer\n\t\t\t\t\t\tif (this.contact === currentContact) {\n\t\t\t\t\t\t\tthis.contact = this.contactFormValuesContainer.currentContact\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.log(`Error while computing formula : ${formula}`, e)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tsetValue(\n\t\tlabel: string,\n\t\tlanguage: string,\n\t\tfv?: FieldValue,\n\t\tid?: string,\n\t\tmetadata?: FieldMetadata,\n\t): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, ID> {\n\t\tconst mutation = setValueOnContactFormValuesContainer(this.contactFormValuesContainer, label, language, fv, id, metadata)\n\t\treturn { result: mutation.result, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tsetMetadata(label: string, meta: FieldMetadata, id?: string | undefined): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, ID> {\n\t\tconst mutation = this.contactFormValuesContainer.setMetadata(\n\t\t\tlabel,\n\t\t\t{\n\t\t\t\tlabel: meta.label,\n\t\t\t\tresponsible: meta.owner,\n\t\t\t\tvalueDate: meta.valueDate,\n\t\t\t\ttags: meta.tags,\n\t\t\t},\n\t\t\tid,\n\t\t)\n\t\treturn { result: mutation.result, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tdelete(serviceId: string): FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, void> {\n\t\tconst mutation = this.contactFormValuesContainer.delete(serviceId)\n\t\treturn { result: undefined, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n\n\tprivate getVersionedValuesForKey(key: string | symbol) {\n\t\treturn this.getValues((id, history) => (history?.[0]?.value?.label && key === history[0].value.label ? [history?.[0]?.revision] : []))\n\t}\n\n\tcompute<T, S extends { [key: string | symbol]: unknown }>(formula: string, sandbox?: S): T | undefined {\n\t\t// noinspection JSUnusedGlobalSymbols\n\t\tconst native = {\n\t\t\tparseInt: parseInt,\n\t\t\tparseFloat: parseFloat,\n\t\t\tDate: Date,\n\t\t\tMath: Math,\n\t\t\tNumber: Number,\n\t\t\tString: String,\n\t\t\tBoolean: Boolean,\n\t\t\tArray: Array,\n\t\t\tObject: Object,\n\t\t\tparseContent: (content?: { [key: string]: PrimitiveType }) => {\n\t\t\t\tif (!content) {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tconst primitive = content[this.language] ?? content['*'] ?? content[Object.keys(content)[0]]\n\t\t\t\treturn primitive && parsePrimitive(primitive)\n\t\t\t},\n\t\t\tlog: console.log,\n\t\t} as { [key: string]: any }\n\t\tconst proxy: S = new Proxy({} as S, {\n\t\t\thas: (target: S, key: string | symbol) => !!native[key as string] || key === 'self' || Object.keys(this.getVersionedValuesForKey(key) ?? {}).length > 0,\n\t\t\tget: (target: S, key: string | symbol) => {\n\t\t\t\tif (key === 'undefined') {\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tconst nativeValue = native[key as string]\n\t\t\t\tif (!!nativeValue) {\n\t\t\t\t\treturn nativeValue\n\t\t\t\t}\n\t\t\t\treturn key === 'self' ? proxy : Object.values(this.getVersionedValuesForKey(key)).map((v) => v[0]?.value)\n\t\t\t},\n\t\t})\n\t\treturn this.interpreter?.(formula, sandbox ?? proxy)\n\t}\n\n\tgetChildren(): FormValuesContainer<FieldValue, FieldMetadata>[] {\n\t\treturn this.contactFormValuesContainer.getChildren().map((fvc) => new BridgedFormValuesContainer(this.responsible, fvc, this.interpreter, this.contact))\n\t}\n\n\tgetValidationErrors(): [FieldMetadata, string][] {\n\t\tif (this.contactFormValuesContainer.rootForm.formTemplateId) {\n\t\t\treturn this.validatorsProvider(this.contactFormValuesContainer.rootForm.descr, this.contactFormValuesContainer.rootForm.formTemplateId).flatMap(\n\t\t\t\t({ metadata, validators }) =>\n\t\t\t\t\tvalidators\n\t\t\t\t\t\t.map(({ validation, message }) => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\treturn this.compute(validation) ? undefined : [metadata, message]\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tconsole.log(`Error while computing validation : ${validation}`, e)\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.filter((x) => !!x) as [FieldMetadata, string][],\n\t\t\t)\n\t\t} else {\n\t\t\treturn []\n\t\t}\n\t}\n\n\tasync addChild(\n\t\tanchorId: string,\n\t\ttemplateId: string,\n\t\tlabel: string,\n\t): Promise<FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, BridgedFormValuesContainer>> {\n\t\tconst mutation = await this.contactFormValuesContainer.addChild(anchorId, templateId, label)\n\t\tconst newBridgedFormValueContainer = this.mutateAndNotify(mutation.formValuesContainer)\n\t\tconst newChild = newBridgedFormValueContainer.children.find((c) => c.contactFormValuesContainer === mutation.result)\n\t\tif (!newChild) {\n\t\t\tthrow new Error('Illegal state, the new child must be found')\n\t\t}\n\t\treturn { result: newChild, formValuesContainer: newBridgedFormValueContainer }\n\t}\n\n\tasync removeChild(container: BridgedFormValuesContainer): Promise<FormValuesContainerMutation<FieldValue, FieldMetadata, BridgedFormValuesContainer, void>> {\n\t\tconst mutation = await this.contactFormValuesContainer.removeChild(container.contactFormValuesContainer)\n\t\treturn { result: undefined, formValuesContainer: this.mutateAndNotify(mutation.formValuesContainer) }\n\t}\n}\n\n/**\n * This class is a form values container that uses a hierarchy of forms as a data source. The actual values are extracted from the services of the contacts.\n * The `currentContact` is the contact that has been selected by the user, any later contact should be ignored.\n * The `contactsHistory` is used to provide the full history of the services.\n * The hierarchy of ContactFormValuesContainer has to be maintained by the manager of the instances of this class (typically the BridgedFormValuesContainer).\n * Each ContactFormValuesContainer has a reference to its `rootForm`.\n * The `serviceFactory` and `formFactory` are used to create new services and add sub-forms.\n */\nexport class ContactFormValuesContainer implements FormValuesContainer<Service, ServiceMetadata> {\n\trootForm: ICureForm\n\tcurrentContact: Contact //The contact of the moment, used to record new modifications\n\tcontactsHistory: Contact[] //Must be sorted (most recent first), contains all the contacts linked to this form\n\tchildren: ContactFormValuesContainer[] //Direct children of the ContactFormValuesContainer\n\tserviceFactory: (label: string, serviceId?: string) => Service\n\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>\n\n\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[]\n\n\tconstructor(\n\t\trootForm: ICureForm,\n\t\tcurrentContact: Contact,\n\t\tcontactsHistory: Contact[],\n\t\tserviceFactory: (label: string, serviceId?: string) => Service,\n\t\tchildren: ContactFormValuesContainer[],\n\t\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>,\n\t\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[] = [],\n\t) {\n\t\tif (contactsHistory.includes(currentContact)) {\n\t\t\tthrow new Error('Illegal argument, the history must not contain the currentContact')\n\t\t}\n\t\tthis.rootForm = rootForm\n\t\tthis.currentContact = currentContact\n\t\tthis.contactsHistory = sortedBy(contactsHistory, 'created', 'desc')\n\t\tthis.children = children\n\t\tthis.serviceFactory = serviceFactory\n\t\tthis.formFactory = formFactory\n\t\tthis.changeListeners = changeListeners\n\t}\n\n\tregisterChildFormValuesContainer(childFVC: ContactFormValuesContainer) {\n\t\tchildFVC.registerChangeListener((newValue) => {\n\t\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\tthis.currentContact,\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children.map((c) => (c === childFVC ? newValue : c)),\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\t\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\t})\n\t}\n\n\tstatic async fromFormsHierarchy(\n\t\trootForm: ICureForm,\n\t\tcurrentContact: Contact,\n\t\tcontactsHistory: Contact[],\n\t\tserviceFactory: (label: string, serviceId?: string) => Service,\n\t\tformChildrenProvider: (parentId: string) => Promise<ICureForm[]>,\n\t\tformFactory: (anchorId: string, formTemplateId: string, label: string) => Promise<ICureForm>,\n\t\tchangeListeners: ((newValue: ContactFormValuesContainer) => void)[] = [],\n\t): Promise<ContactFormValuesContainer> {\n\t\tconst contactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\trootForm,\n\t\t\tcurrentContact,\n\t\t\tcontactsHistory,\n\t\t\tserviceFactory,\n\t\t\trootForm.id\n\t\t\t\t? await Promise.all(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tawait formChildrenProvider(rootForm.id)\n\t\t\t\t\t\t).map(\n\t\t\t\t\t\t\tasync (f) =>\n\t\t\t\t\t\t\t\t// eslint-disable-next-line max-len\n\t\t\t\t\t\t\t\tawait ContactFormValuesContainer.fromFormsHierarchy(f, currentContact, contactsHistory, serviceFactory, formChildrenProvider, formFactory),\n\t\t\t\t\t\t),\n\t\t\t\t )\n\t\t\t\t: [],\n\t\t\tformFactory,\n\n\t\t\tchangeListeners,\n\t\t)\n\t\tcontactFormValuesContainer.children.forEach((childFVC) => contactFormValuesContainer.registerChildFormValuesContainer(childFVC))\n\n\t\treturn contactFormValuesContainer\n\t}\n\n\tgetLabel(): string {\n\t\treturn this.rootForm.descr ?? ''\n\t}\n\n\tgetFormId(): string | undefined {\n\t\treturn this.rootForm?.formTemplateId\n\t}\n\n\tregisterChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void {\n\t\tthis.changeListeners.push(listener)\n\t}\n\n\tunregisterChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void {\n\t\tthis.changeListeners = this.changeListeners.filter((l) => l !== listener)\n\t}\n\n\tgetChildren(): ContactFormValuesContainer[] {\n\t\treturn this.children\n\t}\n\n\tgetValidationErrors(): [FieldMetadata, string][] {\n\t\tthrow new Error('Validation not supported at contact level')\n\t}\n\n\tgetValues(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<Service> {\n\t\treturn Object.entries(this.getServicesInHistory(revisionsFilter)).reduce(\n\t\t\t(acc, [id, history]) =>\n\t\t\t\thistory.length\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t[id]: [...history].sort((a, b) => (b?.modified || +new Date()) - (a?.modified || +new Date())),\n\t\t\t\t\t }\n\t\t\t\t\t: acc,\n\t\t\t{},\n\t\t)\n\t}\n\n\tgetMetadata(id: string, revisions: (string | null)[]): VersionedData<ServiceMetadata> {\n\t\treturn [this.currentContact]\n\t\t\t.concat(this.contactsHistory)\n\t\t\t.filter((ctc) => ctc.rev !== undefined && revisions.includes(ctc.rev))\n\t\t\t.reduce(\n\t\t\t\t(acc, ctc) =>\n\t\t\t\t\t(ctc.services ?? [])\n\t\t\t\t\t\t.filter((s) => s.id === id)\n\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t(acc, s) =>\n\t\t\t\t\t\t\t\ts.id\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t\t\t\t[s.id]: (acc[s.id] ?? (acc[s.id] = [])).concat({\n\t\t\t\t\t\t\t\t\t\t\t\trevision: ctc.rev ?? null,\n\t\t\t\t\t\t\t\t\t\t\t\tmodified: s.modified,\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: s.label ?? s.id,\n\t\t\t\t\t\t\t\t\t\t\t\t\tresponsible: s.responsible,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: acc,\n\t\t\t\t\t\t\tacc,\n\t\t\t\t\t\t) ?? acc,\n\t\t\t\t{} as { [id: string]: Version<ServiceMetadata>[] },\n\t\t\t) //index services in history by id\n\t}\n\n\tsetMetadata(label: string, meta: ServiceMetadata, id?: string): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ID> {\n\t\tconst service = (id && this.getServiceInCurrentContact(id)) || this.serviceFactory(label, id)\n\t\tif (!service.id) {\n\t\t\tthrow new Error('Service id must be defined')\n\t\t}\n\t\tif (\n\t\t\t(meta.responsible && service.responsible !== meta.responsible) ||\n\t\t\t(meta.valueDate && service.valueDate !== meta.valueDate) ||\n\t\t\t(meta.codes && service.codes !== meta.codes) ||\n\t\t\t(meta.tags && service.tags !== meta.tags)\n\t\t) {\n\t\t\tconst newService = new Service({ ...service, modified: Date.now() })\n\t\t\tmeta.responsible && (newService.responsible = meta.responsible)\n\t\t\tmeta.valueDate && (newService.valueDate = meta.valueDate)\n\t\t\tmeta.codes && (newService.codes = meta.codes)\n\t\t\tmeta.tags && (newService.tags = meta.tags)\n\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\t{ ...this.currentContact, services: this.currentContact.services?.map((s) => (s.id === service.id ? newService : s)) },\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\t\t\treturn { result: service.id, formValuesContainer: newFormValuesContainer }\n\t\t}\n\n\t\treturn { result: service.id, formValuesContainer: this }\n\t}\n\n\tsetValue(\n\t\tlabel: string,\n\t\tlanguage: string,\n\t\tvalue?: Service,\n\t\tid?: string,\n\t\tmetadata?: ServiceMetadata,\n\t): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ID> {\n\t\tconst service = (id && this.getServiceInCurrentContact(id)) || this.serviceFactory(label, id)\n\t\tif (!service.id) {\n\t\t\tthrow new Error('Service id must be defined')\n\t\t}\n\t\tconsole.log('Setting value of service', service.id, 'with', value, 'and metadata', metadata)\n\t\tconst newContent = value?.content?.[language]\n\t\tconst newCodes = value?.codes ?? []\n\t\tif (!isContentEqual(service.content?.[language], newContent) || (newCodes && !areCodesEqual(newCodes, service.codes ?? []))) {\n\t\t\tconst newService = new Service({ ...service, modified: Date.now() })\n\t\t\tconst newContents = newContent ? { ...(service.content || {}), [language]: newContent } : { ...(service.content || {}) }\n\t\t\tif (!newContent) {\n\t\t\t\tdelete newContents[language]\n\t\t\t}\n\n\t\t\tlet newCurrentContact: Contact\n\t\t\tif (!Object.entries(newContents).filter(([, cnt]) => cnt !== undefined).length) {\n\t\t\t\tnewCurrentContact = {\n\t\t\t\t\t...this.currentContact,\n\t\t\t\t\tservices: (this.currentContact.services ?? []).some((s) => s.id === service.id)\n\t\t\t\t\t\t? (this.currentContact.services ?? []).filter((s) => s.id !== service.id)\n\t\t\t\t\t\t: [...(this.currentContact.services ?? [])],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewService.content = newContents\n\t\t\t\tnewService.codes = newCodes\n\n\t\t\t\tif (metadata) {\n\t\t\t\t\tnewService.responsible = metadata.responsible ?? newService.responsible\n\t\t\t\t\tnewService.valueDate = metadata.valueDate ?? newService.valueDate\n\t\t\t\t\tnewService.tags = metadata.tags ?? newService.tags\n\t\t\t\t\tnewService.label = metadata.label ?? newService.label\n\t\t\t\t}\n\n\t\t\t\tnewCurrentContact = {\n\t\t\t\t\t...this.currentContact,\n\t\t\t\t\tservices: (this.currentContact.services ?? []).some((s) => s.id === service.id)\n\t\t\t\t\t\t? (this.currentContact.services ?? []).map((s) => (s.id === service.id ? newService : s))\n\t\t\t\t\t\t: [...(this.currentContact.services ?? []), newService],\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\tnewCurrentContact,\n\t\t\t\tthis.contactsHistory.map((c) => (c === this.currentContact ? newCurrentContact : c)),\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\n\t\t\treturn { result: service.id!, formValuesContainer: newFormValuesContainer }\n\t\t}\n\n\t\treturn { result: service.id, formValuesContainer: this }\n\t}\n\n\tdelete(serviceId: string): FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, void> {\n\t\tconst service = this.getServiceInCurrentContact(serviceId)\n\t\tif (service) {\n\t\t\tconst newFormValuesContainer = new ContactFormValuesContainer(\n\t\t\t\tthis.rootForm,\n\t\t\t\t{ ...this.currentContact, services: this.currentContact.services?.map((s) => (s.id === serviceId ? new Service({ ...service, endOfLife: Date.now() }) : s)) },\n\t\t\t\tthis.contactsHistory,\n\t\t\t\tthis.serviceFactory,\n\t\t\t\tthis.children,\n\t\t\t\tthis.formFactory,\n\n\t\t\t\tthis.changeListeners,\n\t\t\t)\n\n\t\t\tthis.changeListeners.forEach((l) => l(newFormValuesContainer))\n\t\t\treturn { result: undefined, formValuesContainer: newFormValuesContainer }\n\t\t}\n\t\treturn { result: undefined, formValuesContainer: this }\n\t}\n\n\tcompute<T>(): T | undefined {\n\t\tthrow new Error('Compute not supported at contact level')\n\t}\n\n\t/** returns all services in history that match a selector\n\t *\n\t * @private\n\t * @param revisionsFilter\n\t */\n\tprivate getServicesInHistory(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<Service> {\n\t\tconst indexedServices = [this.currentContact]\n\t\t\t.concat(this.contactsHistory)\n\t\t\t.reduce(\n\t\t\t\t(acc, ctc) =>\n\t\t\t\t\tctc.services?.reduce(\n\t\t\t\t\t\t(acc, s) => (s.id ? { ...acc, [s.id]: (acc[s.id] ?? (acc[s.id] = [])).concat({ revision: ctc.rev ?? null, modified: ctc.created, value: s }) } : acc),\n\t\t\t\t\t\tacc,\n\t\t\t\t\t) ?? acc,\n\t\t\t\t{} as VersionedData<Service>,\n\t\t\t) //index services in history by id\n\t\treturn Object.entries(indexedServices)\n\t\t\t.map(([id, history]) => {\n\t\t\t\tconst keptRevisions = revisionsFilter(\n\t\t\t\t\tid,\n\t\t\t\t\thistory.map(({ revision, modified, value: s }) => ({\n\t\t\t\t\t\trevision,\n\t\t\t\t\t\tmodified,\n\t\t\t\t\t\tvalue: {\n\t\t\t\t\t\t\tlabel: s.label ?? s.id ?? '',\n\t\t\t\t\t\t\towner: s.responsible,\n\t\t\t\t\t\t\tvalueDate: s.valueDate,\n\t\t\t\t\t\t\tcodes: s.codes,\n\t\t\t\t\t\t\ttags: s.tags,\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t\t)\n\t\t\t\treturn [id, history.filter(({ revision }) => keptRevisions.includes(revision))] as [string, Version<Service>[]]\n\t\t\t})\n\t\t\t.reduce((acc, [id, history]) => ({ ...acc, [id]: history }), {})\n\t}\n\n\tasync addChild(\n\t\tanchorId: string,\n\t\ttemplateId: string,\n\t\tlabel: string,\n\t): Promise<FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, ContactFormValuesContainer>> {\n\t\tconst newForm = await this.formFactory(anchorId, templateId, label)\n\t\tconst childFVC = new ContactFormValuesContainer(newForm, this.currentContact, this.contactsHistory, this.serviceFactory, [], this.formFactory)\n\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\tthis.rootForm,\n\t\t\tthis.currentContact,\n\t\t\tthis.contactsHistory,\n\t\t\tthis.serviceFactory,\n\t\t\t[...this.children, childFVC],\n\t\t\tthis.formFactory,\n\t\t)\n\t\tnewContactFormValuesContainer.registerChildFormValuesContainer(childFVC)\n\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\treturn { result: childFVC, formValuesContainer: newContactFormValuesContainer }\n\t}\n\n\tprivate getServiceInCurrentContact(id: string): Service | undefined {\n\t\tconst service = (this.currentContact.services || [])?.find((s) => s.id === id)\n\t\treturn service ?? undefined\n\t}\n\n\tasync removeChild(container: ContactFormValuesContainer): Promise<FormValuesContainerMutation<Service, ServiceMetadata, ContactFormValuesContainer, void>> {\n\t\tconst newContactFormValuesContainer = new ContactFormValuesContainer(\n\t\t\tthis.rootForm,\n\t\t\tthis.currentContact,\n\t\t\tthis.contactsHistory,\n\t\t\tthis.serviceFactory,\n\t\t\tthis.children.filter((c) => c !== container),\n\t\t\tthis.formFactory,\n\t\t)\n\t\tthis.changeListeners.forEach((l) => l(newContactFormValuesContainer))\n\t\treturn { result: undefined, formValuesContainer: newContactFormValuesContainer }\n\t}\n}\n\nconst setValueOnContactFormValuesContainer = (cfvc: ContactFormValuesContainer, label: string, language: string, fv?: FieldValue, id?: string, metadata?: FieldMetadata) => {\n\tconst value = fv?.content[language]\n\tconst mutation = cfvc.setValue(\n\t\tlabel,\n\t\tlanguage,\n\t\t{\n\t\t\tid: id,\n\t\t\tcodes: fv?.codes ?? [],\n\t\t\tcontent: value\n\t\t\t\t? {\n\t\t\t\t\t\t[language]: primitiveTypeToContent(language, value),\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\t},\n\t\tid,\n\t\t{\n\t\t\tlabel: metadata?.label ?? '',\n\t\t\tresponsible: metadata?.owner,\n\t\t\tvalueDate: metadata?.valueDate,\n\t\t\ttags: metadata?.tags,\n\t\t},\n\t)\n\treturn mutation\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CodeStub, Content, Service } from '@icure/api';
|
|
2
|
+
import { PrimitiveType } from '../components/model';
|
|
3
|
+
export declare function isCodeEqual(c1: CodeStub, c2: CodeStub): boolean;
|
|
4
|
+
export declare function areCodesEqual(c1s: CodeStub[], c2s: CodeStub[]): boolean;
|
|
5
|
+
export declare function isServiceEqual(svc1: Service, svc2: Service): boolean;
|
|
6
|
+
export declare function isContentEqual(content1: Content | undefined, content2: Content | undefined): boolean;
|
|
7
|
+
export declare function isServiceContentEqual(content1: {
|
|
8
|
+
[language: string]: Content;
|
|
9
|
+
}, content2: {
|
|
10
|
+
[language: string]: Content;
|
|
11
|
+
}): boolean;
|
|
12
|
+
export declare const primitiveTypeToContent: (language: string, value: PrimitiveType) => Content;
|
|
13
|
+
export declare const contentToPrimitiveType: (language: string, content: Content | undefined) => PrimitiveType | undefined;
|
|
14
|
+
export declare const codeStubToCode: (c: CodeStub) => {
|
|
15
|
+
id: string;
|
|
16
|
+
label: {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codeStubToCode = exports.contentToPrimitiveType = exports.primitiveTypeToContent = exports.isServiceContentEqual = exports.isContentEqual = exports.isServiceEqual = exports.areCodesEqual = exports.isCodeEqual = void 0;
|
|
4
|
+
function isCodeEqual(c1, c2) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const idParts1 = (_a = c1.id) === null || _a === void 0 ? void 0 : _a.split('|');
|
|
7
|
+
const idParts2 = (_b = c2.id) === null || _b === void 0 ? void 0 : _b.split('|');
|
|
8
|
+
const type1 = c1.type || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[0]);
|
|
9
|
+
const type2 = c2.type || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[0]);
|
|
10
|
+
const code1 = c1.code || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[1]);
|
|
11
|
+
const code2 = c2.code || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[1]);
|
|
12
|
+
const version1 = c1.version || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[2]);
|
|
13
|
+
const version2 = c2.version || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[2]);
|
|
14
|
+
return type1 === type2 && code1 === code2 && version1 === version2;
|
|
15
|
+
}
|
|
16
|
+
exports.isCodeEqual = isCodeEqual;
|
|
17
|
+
function areCodesEqual(c1s, c2s) {
|
|
18
|
+
return c1s.every((c1) => c2s.some((c2) => isCodeEqual(c1, c2)) || false) && c2s.every((c2) => c1s.some((c1) => isCodeEqual(c1, c2)) || false);
|
|
19
|
+
}
|
|
20
|
+
exports.areCodesEqual = areCodesEqual;
|
|
21
|
+
function isServiceEqual(svc1, svc2) {
|
|
22
|
+
return (svc1.id === svc2.id && svc1.valueDate === svc2.valueDate && areCodesEqual(svc1.codes || [], svc2.codes || []) && isServiceContentEqual(svc1.content || {}, svc2.content || {}));
|
|
23
|
+
}
|
|
24
|
+
exports.isServiceEqual = isServiceEqual;
|
|
25
|
+
function isContentEqual(content1, content2) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (!content1 && !content2) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (!content1 || !content2) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return (((!content1.binaryValue && !content2.binaryValue) || content1.binaryValue === content2.binaryValue) &&
|
|
34
|
+
(((content1.booleanValue === null || content1.booleanValue === undefined) && (content2.booleanValue === null || content2.booleanValue === undefined)) ||
|
|
35
|
+
content1.booleanValue === content2.booleanValue) &&
|
|
36
|
+
((!content1.documentId && !content2.documentId) || content1.documentId === content2.documentId) &&
|
|
37
|
+
(((content1.fuzzyDateValue === null || content1.fuzzyDateValue === undefined) && (content2.fuzzyDateValue === null || content2.fuzzyDateValue === undefined)) ||
|
|
38
|
+
content1.fuzzyDateValue === content2.fuzzyDateValue) &&
|
|
39
|
+
((!content1.instantValue && !content2.instantValue) || content1.instantValue === content2.instantValue) &&
|
|
40
|
+
((!content1.measureValue && !content2.measureValue) || content1.measureValue === content2.measureValue) &&
|
|
41
|
+
((!content1.medicationValue && !content2.medicationValue) || content1.medicationValue === content2.medicationValue) &&
|
|
42
|
+
((!content1.stringValue && !content2.stringValue) || content1.stringValue === content2.stringValue) &&
|
|
43
|
+
(((content1.numberValue === null || content1.numberValue === undefined) && (content2.numberValue === null || content2.numberValue === undefined)) ||
|
|
44
|
+
content1.numberValue === content2.numberValue) &&
|
|
45
|
+
((!content1.compoundValue && !content2.compoundValue) ||
|
|
46
|
+
((((_a = content1.compoundValue) === null || _a === void 0 ? void 0 : _a.every((s1) => { var _a; return (_a = content2.compoundValue) === null || _a === void 0 ? void 0 : _a.some((s2) => isServiceEqual(s1, s2)); })) || false) &&
|
|
47
|
+
(((_b = content2 === null || content2 === void 0 ? void 0 : content2.compoundValue) === null || _b === void 0 ? void 0 : _b.every((s2) => { var _a; return (_a = content1 === null || content1 === void 0 ? void 0 : content1.compoundValue) === null || _a === void 0 ? void 0 : _a.some((s1) => isServiceEqual(s1, s2)); })) || false))));
|
|
48
|
+
}
|
|
49
|
+
exports.isContentEqual = isContentEqual;
|
|
50
|
+
function isServiceContentEqual(content1, content2) {
|
|
51
|
+
return Object.keys(content1).reduce((isEqual, lng) => isEqual && isContentEqual(content1[lng], content2[lng]), true);
|
|
52
|
+
}
|
|
53
|
+
exports.isServiceContentEqual = isServiceContentEqual;
|
|
54
|
+
const primitiveTypeToContent = (language, value) => {
|
|
55
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (value.type === 'number' ? { numberValue: value.value } : {})), (value.type === 'measure'
|
|
56
|
+
? {
|
|
57
|
+
measureValue: {
|
|
58
|
+
value: value.value,
|
|
59
|
+
unit: value.unit,
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {})), (value.type === 'string' ? { stringValue: value.value } : {})), (value.type === 'datetime' ? { fuzzyDateValue: value.value } : {})), (value.type === 'boolean' ? { booleanValue: value.value } : {})), (value.type === 'timestamp' ? { instantValue: value.value } : {})), (value.type === 'compound'
|
|
63
|
+
? {
|
|
64
|
+
compoundValue: Object.entries(value.value).map(([label, value]) => ({
|
|
65
|
+
label,
|
|
66
|
+
content: {
|
|
67
|
+
[language]: (0, exports.primitiveTypeToContent)(language, value),
|
|
68
|
+
},
|
|
69
|
+
})),
|
|
70
|
+
}
|
|
71
|
+
: {}));
|
|
72
|
+
};
|
|
73
|
+
exports.primitiveTypeToContent = primitiveTypeToContent;
|
|
74
|
+
const contentToPrimitiveType = (language, content) => {
|
|
75
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76
|
+
if (!content) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
if (content.numberValue || content.numberValue === 0) {
|
|
80
|
+
return { type: 'number', value: content.numberValue };
|
|
81
|
+
}
|
|
82
|
+
if (((_a = content.measureValue) === null || _a === void 0 ? void 0 : _a.value) || ((_b = content.measureValue) === null || _b === void 0 ? void 0 : _b.value) === 0 || ((_d = (_c = content.measureValue) === null || _c === void 0 ? void 0 : _c.unit) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
83
|
+
return { type: 'measure', value: (_e = content.measureValue) === null || _e === void 0 ? void 0 : _e.value, unit: (_f = content.measureValue) === null || _f === void 0 ? void 0 : _f.unit };
|
|
84
|
+
}
|
|
85
|
+
if (content.stringValue) {
|
|
86
|
+
return { type: 'string', value: content.stringValue };
|
|
87
|
+
}
|
|
88
|
+
if (content.fuzzyDateValue) {
|
|
89
|
+
return { type: 'datetime', value: content.fuzzyDateValue };
|
|
90
|
+
}
|
|
91
|
+
if (content.booleanValue) {
|
|
92
|
+
return { type: 'boolean', value: content.booleanValue };
|
|
93
|
+
}
|
|
94
|
+
if (content.instantValue) {
|
|
95
|
+
return { type: 'timestamp', value: content.instantValue };
|
|
96
|
+
}
|
|
97
|
+
if (content.compoundValue) {
|
|
98
|
+
return {
|
|
99
|
+
type: 'compound',
|
|
100
|
+
value: content.compoundValue.reduce((acc, { label, content }) => {
|
|
101
|
+
const primitiveValue = (0, exports.contentToPrimitiveType)(language, content === null || content === void 0 ? void 0 : content[language]);
|
|
102
|
+
return label && primitiveValue ? Object.assign(Object.assign({}, acc), { [label]: primitiveValue }) : acc;
|
|
103
|
+
}, {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
};
|
|
108
|
+
exports.contentToPrimitiveType = contentToPrimitiveType;
|
|
109
|
+
const codeStubToCode = (c) => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
return ({
|
|
112
|
+
id: (_a = c.id) !== null && _a !== void 0 ? _a : `${c.type}|${c.code}|${c.version}`,
|
|
113
|
+
label: (_b = c.label) !== null && _b !== void 0 ? _b : {},
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
exports.codeStubToCode = codeStubToCode;
|
|
117
|
+
//# sourceMappingURL=icure-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icure-utils.js","sourceRoot":"","sources":["../../tmp/icure/icure-utils.ts"],"names":[],"mappings":";;;AAGA,SAAgB,WAAW,CAAC,EAAY,EAAE,EAAY;;IACrD,MAAM,QAAQ,GAAG,MAAA,EAAE,CAAC,EAAE,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClC,MAAM,QAAQ,GAAG,MAAA,EAAE,CAAC,EAAE,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAA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,SAAS,CAAA;AACjB,CAAC,CAAA;AAjCY,QAAA,sBAAsB,0BAiClC;AACM,MAAM,cAAc,GAAG,CAAC,CAAW,EAAE,EAAE;;IAAC,OAAA,CAAC;QAC/C,EAAE,EAAE,MAAA,CAAC,CAAC,EAAE,mCAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE;QAC9C,KAAK,EAAE,MAAA,CAAC,CAAC,KAAK,mCAAI,EAAE;KACpB,CAAC,CAAA;CAAA,CAAA;AAHW,QAAA,cAAc,kBAGzB","sourcesContent":["import { CodeStub, Content, Service } from '@icure/api'\nimport { BooleanType, CompoundType, DateTimeType, MeasureType, NumberType, PrimitiveType, StringType, TimestampType } from '../components/model'\n\nexport function isCodeEqual(c1: CodeStub, c2: CodeStub): boolean {\n\tconst idParts1 = c1.id?.split('|')\n\tconst idParts2 = c2.id?.split('|')\n\tconst type1 = c1.type || idParts1?.[0]\n\tconst type2 = c2.type || idParts2?.[0]\n\tconst code1 = c1.code || idParts1?.[1]\n\tconst code2 = c2.code || idParts2?.[1]\n\tconst version1 = c1.version || idParts1?.[2]\n\tconst version2 = c2.version || idParts2?.[2]\n\treturn type1 === type2 && code1 === code2 && version1 === version2\n}\n\nexport function areCodesEqual(c1s: CodeStub[], c2s: CodeStub[]): boolean {\n\treturn c1s.every((c1) => c2s.some((c2) => isCodeEqual(c1, c2)) || false) && c2s.every((c2) => c1s.some((c1) => isCodeEqual(c1, c2)) || false)\n}\n\nexport function isServiceEqual(svc1: Service, svc2: Service): boolean {\n\treturn (\n\t\tsvc1.id === svc2.id && svc1.valueDate === svc2.valueDate && areCodesEqual(svc1.codes || [], svc2.codes || []) && isServiceContentEqual(svc1.content || {}, svc2.content || {})\n\t)\n}\n\nexport function isContentEqual(content1: Content | undefined, content2: Content | undefined): boolean {\n\tif (!content1 && !content2) {\n\t\treturn true\n\t}\n\tif (!content1 || !content2) {\n\t\treturn false\n\t}\n\treturn (\n\t\t((!content1.binaryValue && !content2.binaryValue) || content1.binaryValue === content2.binaryValue) &&\n\t\t(((content1.booleanValue === null || content1.booleanValue === undefined) && (content2.booleanValue === null || content2.booleanValue === undefined)) ||\n\t\t\tcontent1.booleanValue === content2.booleanValue) &&\n\t\t((!content1.documentId && !content2.documentId) || content1.documentId === content2.documentId) &&\n\t\t(((content1.fuzzyDateValue === null || content1.fuzzyDateValue === undefined) && (content2.fuzzyDateValue === null || content2.fuzzyDateValue === undefined)) ||\n\t\t\tcontent1.fuzzyDateValue === content2.fuzzyDateValue) &&\n\t\t((!content1.instantValue && !content2.instantValue) || content1.instantValue === content2.instantValue) &&\n\t\t((!content1.measureValue && !content2.measureValue) || content1.measureValue === content2.measureValue) &&\n\t\t((!content1.medicationValue && !content2.medicationValue) || content1.medicationValue === content2.medicationValue) &&\n\t\t((!content1.stringValue && !content2.stringValue) || content1.stringValue === content2.stringValue) &&\n\t\t(((content1.numberValue === null || content1.numberValue === undefined) && (content2.numberValue === null || content2.numberValue === undefined)) ||\n\t\t\tcontent1.numberValue === content2.numberValue) &&\n\t\t((!content1.compoundValue && !content2.compoundValue) ||\n\t\t\t((content1.compoundValue?.every((s1) => content2.compoundValue?.some((s2) => isServiceEqual(s1, s2))) || false) &&\n\t\t\t\t(content2?.compoundValue?.every((s2) => content1?.compoundValue?.some((s1) => isServiceEqual(s1, s2))) || false)))\n\t)\n}\n\nexport function isServiceContentEqual(content1: { [language: string]: Content }, content2: { [language: string]: Content }): boolean {\n\treturn Object.keys(content1).reduce((isEqual, lng) => isEqual && isContentEqual(content1[lng], content2[lng]), true as boolean)\n}\n\nexport const primitiveTypeToContent = (language: string, value: PrimitiveType): Content => {\n\treturn {\n\t\t...(value.type === 'number' ? { numberValue: (value as NumberType).value } : {}),\n\t\t...(value.type === 'measure'\n\t\t\t? {\n\t\t\t\t\tmeasureValue: {\n\t\t\t\t\t\tvalue: (value as MeasureType).value,\n\t\t\t\t\t\tunit: (value as MeasureType).unit,\n\t\t\t\t\t},\n\t\t\t }\n\t\t\t: {}),\n\t\t...(value.type === 'string' ? { stringValue: (value as StringType).value } : {}),\n\t\t...(value.type === 'datetime' ? { fuzzyDateValue: (value as DateTimeType).value } : {}),\n\t\t...(value.type === 'boolean' ? { booleanValue: (value as BooleanType).value } : {}),\n\t\t...(value.type === 'timestamp' ? { instantValue: (value as TimestampType).value } : {}),\n\t\t...(value.type === 'compound'\n\t\t\t? {\n\t\t\t\t\tcompoundValue: Object.entries((value as CompoundType).value).map(([label, value]) => ({\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t[language]: primitiveTypeToContent(language, value),\n\t\t\t\t\t\t},\n\t\t\t\t\t})),\n\t\t\t }\n\t\t\t: {}),\n\t}\n}\nexport const contentToPrimitiveType = (language: string, content: Content | undefined): PrimitiveType | undefined => {\n\tif (!content) {\n\t\treturn undefined\n\t}\n\tif (content.numberValue || content.numberValue === 0) {\n\t\treturn { type: 'number', value: content.numberValue }\n\t}\n\tif (content.measureValue?.value || content.measureValue?.value === 0 || content.measureValue?.unit?.length) {\n\t\treturn { type: 'measure', value: content.measureValue?.value, unit: content.measureValue?.unit }\n\t}\n\tif (content.stringValue) {\n\t\treturn { type: 'string', value: content.stringValue }\n\t}\n\tif (content.fuzzyDateValue) {\n\t\treturn { type: 'datetime', value: content.fuzzyDateValue }\n\t}\n\tif (content.booleanValue) {\n\t\treturn { type: 'boolean', value: content.booleanValue }\n\t}\n\tif (content.instantValue) {\n\t\treturn { type: 'timestamp', value: content.instantValue }\n\t}\n\tif (content.compoundValue) {\n\t\treturn {\n\t\t\ttype: 'compound',\n\t\t\tvalue: content.compoundValue.reduce((acc: { [label: string]: PrimitiveType }, { label, content }) => {\n\t\t\t\tconst primitiveValue = contentToPrimitiveType(language, content?.[language])\n\t\t\t\treturn label && primitiveValue ? { ...acc, [label]: primitiveValue } : acc\n\t\t\t}, {}),\n\t\t}\n\t}\n\n\treturn undefined\n}\nexport const codeStubToCode = (c: CodeStub) => ({\n\tid: c.id ?? `${c.type}|${c.code}|${c.version}`,\n\tlabel: c.label ?? {},\n})\n"]}
|
package/icure/model.d.ts
CHANGED
package/icure/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../tmp/icure/model.ts"],"names":[],"mappings":"","sourcesContent":["import { CodeStub } from '@icure/api'\n\nexport interface ServiceMetadata {\n\tlabel: string\n\tindex?: number\n\tvalueDate?: number\n\
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../tmp/icure/model.ts"],"names":[],"mappings":"","sourcesContent":["import { CodeStub } from '@icure/api'\n\nexport interface ServiceMetadata {\n\tlabel: string\n\tindex?: number\n\tvalueDate?: number\n\tauthor?: string\n\tresponsible?: string\n\tcodes?: CodeStub[]\n\ttags?: CodeStub[]\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icure/form",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@types/node": "^18.16.3",
|
|
9
8
|
"@webcomponents/webcomponentsjs": "^2.7.0",
|
|
10
9
|
"app-datepicker": "^6.0.0-rc.33",
|
|
11
10
|
"fast-deep-equal": "^3.1.3",
|
|
12
|
-
"lit": "^3.1.
|
|
13
|
-
"markdown-it": "^14.
|
|
11
|
+
"lit": "^3.1.3",
|
|
12
|
+
"markdown-it": "^14.1.0",
|
|
14
13
|
"orderedmap": "2.1.1",
|
|
15
14
|
"prosemirror-commands": "1.5.2",
|
|
16
15
|
"prosemirror-history": "1.3.2",
|
|
@@ -22,11 +21,10 @@
|
|
|
22
21
|
"prosemirror-state": "1.4.3",
|
|
23
22
|
"prosemirror-transform": "1.8.0",
|
|
24
23
|
"prosemirror-view": "1.32.7",
|
|
25
|
-
"uuid": "^9.0.1"
|
|
26
|
-
"yaml": "2.3.4"
|
|
24
|
+
"uuid": "^9.0.1"
|
|
27
25
|
},
|
|
28
26
|
"author": "",
|
|
29
27
|
"license": "GPL-3.0",
|
|
30
28
|
"bugs": null,
|
|
31
29
|
"homepage": null
|
|
32
|
-
}
|
|
30
|
+
}
|
package/utils/code-utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CodeStub } from '@icure/api';
|
|
1
|
+
import { Code, Field, SortOptions } from '../components/model';
|
|
3
2
|
/**
|
|
4
3
|
* Maps the options defined in a field into a list of codes
|
|
5
4
|
*
|
|
@@ -7,12 +6,6 @@ import { CodeStub } from '@icure/api';
|
|
|
7
6
|
* @param field
|
|
8
7
|
* @param translationProvider
|
|
9
8
|
*/
|
|
10
|
-
export declare const optionMapper: (language: string, field: Field, translationProvider?: (
|
|
9
|
+
export declare const optionMapper: (language: string, field: Field, translationProvider?: (language: string, text: string) => string) => Code[];
|
|
11
10
|
export declare const sortCodes: (codes: Code[], language: string, sortOptions?: SortOptions) => Code[];
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const codeStubToCode: (c: CodeStub) => {
|
|
14
|
-
id: string;
|
|
15
|
-
label: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
11
|
+
export declare const filterAndSortOptionsFromFieldDefinition: (language: string, fg: Field, translationProvider: ((language: string, text: string) => string) | undefined, terms?: string[]) => Promise<Code[]>;
|
package/utils/code-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.filterAndSortOptionsFromFieldDefinition = exports.sortCodes = exports.optionMapper = void 0;
|
|
4
4
|
const utils_1 = require("../components/common/utils");
|
|
5
5
|
/**
|
|
6
6
|
* Maps the options defined in a field into a list of codes
|
|
@@ -25,12 +25,6 @@ const sortCodes = (codes, language, sortOptions) => (sortOptions === null || sor
|
|
|
25
25
|
? codes.sort((0, utils_1.defaultCodesComparator)(language, (sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.sort) === 'asc', (sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.promotions) ? (0, utils_1.makePromoter)(sortOptions.promotions.split(/ ?, ?/)) : utils_1.defaultCodePromoter))
|
|
26
26
|
: codes;
|
|
27
27
|
exports.sortCodes = sortCodes;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
.split(/\s+/)
|
|
31
|
-
.map((st) => st.toLowerCase())
|
|
32
|
-
.every((st) => x.label[language].toLowerCase().includes(st))), language, fg.sortOptions));
|
|
33
|
-
exports.filerAndSortOptionsFromFieldDefinition = filerAndSortOptionsFromFieldDefinition;
|
|
34
|
-
const codeStubToCode = (c) => { var _a, _b; return ({ id: (_a = c.id) !== null && _a !== void 0 ? _a : `${c.type}|${c.code}|${c.version}`, label: (_b = c.label) !== null && _b !== void 0 ? _b : {} }); };
|
|
35
|
-
exports.codeStubToCode = codeStubToCode;
|
|
28
|
+
const filterAndSortOptionsFromFieldDefinition = (language, fg, translationProvider, terms) => Promise.resolve((0, exports.sortCodes)((0, exports.optionMapper)(language, fg, translationProvider).filter((x) => (terms !== null && terms !== void 0 ? terms : []).map((st) => st.toLowerCase()).every((st) => x.label[language].toLowerCase().includes(st))), language, fg.sortOptions));
|
|
29
|
+
exports.filterAndSortOptionsFromFieldDefinition = filterAndSortOptionsFromFieldDefinition;
|
|
36
30
|
//# sourceMappingURL=code-utils.js.map
|
package/utils/code-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-utils.js","sourceRoot":"","sources":["../../tmp/utils/code-utils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"code-utils.js","sourceRoot":"","sources":["../../tmp/utils/code-utils.ts"],"names":[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GAAG,CACtD,QAAgB,EAChB,EAAS,EACT,mBAA6E,EAC7E,KAAgB,EACf,EAAE,CACH,OAAO,CAAC,OAAO,CACd,IAAA,iBAAS,EACR,IAAA,oBAAY,EAAC,QAAQ,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EACtK,QAAQ,EACR,EAAE,CAAC,WAAW,CACd,CACD,CAAA;AAZW,QAAA,uCAAuC,2CAYlD","sourcesContent":["import { Code, Field, SortOptions } from '../components/model'\nimport { defaultCodePromoter, defaultCodesComparator, makePromoter } from '../components/common/utils'\n\n/**\n * Maps the options defined in a field into a list of codes\n *\n * @param language\n * @param field\n * @param translationProvider\n */\nexport const optionMapper = (language: string, field: Field, translationProvider?: (language: string, text: string) => string): Code[] =>\n\tObject.keys(field?.options ?? []).map((optionKey) => {\n\t\tconst text: string = (field?.options?.[optionKey] as string) ?? ''\n\t\treturn {\n\t\t\tid: optionKey,\n\t\t\tlabel: { [language]: translationProvider ? translationProvider(language, text) : text },\n\t\t}\n\t})\n\nexport const sortCodes = (codes: Code[], language: string, sortOptions?: SortOptions) =>\n\tsortOptions?.sort && sortOptions?.sort !== 'natural'\n\t\t? codes.sort(defaultCodesComparator(language, sortOptions?.sort === 'asc', sortOptions?.promotions ? makePromoter(sortOptions.promotions.split(/ ?, ?/)) : defaultCodePromoter))\n\t\t: codes\n\nexport const filterAndSortOptionsFromFieldDefinition = (\n\tlanguage: string,\n\tfg: Field,\n\ttranslationProvider: ((language: string, text: string) => string) | undefined,\n\tterms?: string[],\n) =>\n\tPromise.resolve(\n\t\tsortCodes(\n\t\t\toptionMapper(language, fg, translationProvider).filter((x) => (terms ?? []).map((st) => st.toLowerCase()).every((st) => x.label[language].toLowerCase().includes(st))),\n\t\t\tlanguage,\n\t\t\tfg.sortOptions,\n\t\t),\n\t)\n"]}
|
package/utils/dates.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function anyDateToDate(dateOrEpochOrLongCalendar?: Date | number | undefined): Date | undefined;
|
|
2
|
+
export declare function dateToFuzzyDate(date: Date): number;
|
|
3
|
+
export declare function anyDateToFuzzyDate(dateOrEpochOrLongCalendar: Date | number): number | undefined;
|
|
4
|
+
export declare function currentTime(): string;
|
|
5
|
+
export declare function currentDate(): string;
|
|
6
|
+
export declare function currentDateTime(): string;
|
package/utils/dates.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.currentDateTime = exports.currentDate = exports.currentTime = exports.anyDateToFuzzyDate = exports.dateToFuzzyDate = exports.anyDateToDate = void 0;
|
|
7
|
+
const parse_1 = __importDefault(require("date-fns/parse"));
|
|
8
|
+
function anyDateToDate(dateOrEpochOrLongCalendar) {
|
|
9
|
+
if (dateOrEpochOrLongCalendar === undefined) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (dateOrEpochOrLongCalendar instanceof Date) {
|
|
13
|
+
return anyDateToDate(+dateOrEpochOrLongCalendar);
|
|
14
|
+
}
|
|
15
|
+
if (!dateOrEpochOrLongCalendar && dateOrEpochOrLongCalendar !== 0) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (dateOrEpochOrLongCalendar >= 18000101 && dateOrEpochOrLongCalendar < 25400000) {
|
|
19
|
+
return (0, parse_1.default)('' + dateOrEpochOrLongCalendar, 'yyyyMMdd', new Date());
|
|
20
|
+
}
|
|
21
|
+
else if (dateOrEpochOrLongCalendar >= 18000101000000) {
|
|
22
|
+
return (0, parse_1.default)('' + dateOrEpochOrLongCalendar, 'yyyyMMddHHmmss', new Date());
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return new Date(dateOrEpochOrLongCalendar);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.anyDateToDate = anyDateToDate;
|
|
29
|
+
function dateToFuzzyDate(date) {
|
|
30
|
+
return parseInt(`${date.getFullYear()}${(date.getMonth() + 1).toString().padStart(2, '0')}${date.getDate().toString().padStart(2, '0')}${date.getHours().toString().padStart(2, '0')}${date
|
|
31
|
+
.getMinutes()
|
|
32
|
+
.toString()
|
|
33
|
+
.padStart(2, '0')}:)${date.getSeconds().toString().padStart(2, '0')}`);
|
|
34
|
+
}
|
|
35
|
+
exports.dateToFuzzyDate = dateToFuzzyDate;
|
|
36
|
+
function anyDateToFuzzyDate(dateOrEpochOrLongCalendar) {
|
|
37
|
+
const date = anyDateToDate(dateOrEpochOrLongCalendar);
|
|
38
|
+
if (!date) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return dateToFuzzyDate(date);
|
|
42
|
+
}
|
|
43
|
+
exports.anyDateToFuzzyDate = anyDateToFuzzyDate;
|
|
44
|
+
function currentTime() {
|
|
45
|
+
const now = new Date();
|
|
46
|
+
return `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`;
|
|
47
|
+
}
|
|
48
|
+
exports.currentTime = currentTime;
|
|
49
|
+
function currentDate() {
|
|
50
|
+
const now = new Date();
|
|
51
|
+
return `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`;
|
|
52
|
+
}
|
|
53
|
+
exports.currentDate = currentDate;
|
|
54
|
+
function currentDateTime() {
|
|
55
|
+
return `${currentDate()} ${currentTime()}`;
|
|
56
|
+
}
|
|
57
|
+
exports.currentDateTime = currentDateTime;
|
|
58
|
+
//# sourceMappingURL=dates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.js","sourceRoot":"","sources":["../../tmp/utils/dates.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAkC;AAElC,SAAgB,aAAa,CAAC,yBAAqD;IAClF,IAAI,yBAAyB,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAA;IACjB,CAAC;IACD,IAAI,yBAAyB,YAAY,IAAI,EAAE,CAAC;QAC/C,OAAO,aAAa,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACjD,CAAC;IACD,IAAI,CAAC,yBAAyB,IAAI,yBAAyB,KAAK,CAAC,EAAE,CAAC;QACnE,OAAO,SAAS,CAAA;IACjB,CAAC;IACD,IAAI,yBAAyB,IAAI,QAAQ,IAAI,yBAAyB,GAAG,QAAQ,EAAE,CAAC;QACnF,OAAO,IAAA,eAAK,EAAC,EAAE,GAAG,yBAAyB,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IACrE,CAAC;SAAM,IAAI,yBAAyB,IAAI,cAAc,EAAE,CAAC;QACxD,OAAO,IAAA,eAAK,EAAC,EAAE,GAAG,yBAAyB,EAAE,gBAAgB,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;IAC3E,CAAC;SAAM,CAAC;QACP,OAAO,IAAI,IAAI,CAAC,yBAAyB,CAAC,CAAA;IAC3C,CAAC;AACF,CAAC;AAjBD,sCAiBC;AAED,SAAgB,eAAe,CAAC,IAAU;IACzC,OAAO,QAAQ,CACd,GAAG,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CA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,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,CAAA;AAC/H,CAAC;AAHD,kCAGC;AAED,SAAgB,eAAe;IAC9B,OAAO,GAAG,WAAW,EAAE,IAAI,WAAW,EAAE,EAAE,CAAA;AAC3C,CAAC;AAFD,0CAEC","sourcesContent":["import parse from 'date-fns/parse'\n\nexport function anyDateToDate(dateOrEpochOrLongCalendar?: Date | number | undefined): Date | undefined {\n\tif (dateOrEpochOrLongCalendar === undefined) {\n\t\treturn undefined\n\t}\n\tif (dateOrEpochOrLongCalendar instanceof Date) {\n\t\treturn anyDateToDate(+dateOrEpochOrLongCalendar)\n\t}\n\tif (!dateOrEpochOrLongCalendar && dateOrEpochOrLongCalendar !== 0) {\n\t\treturn undefined\n\t}\n\tif (dateOrEpochOrLongCalendar >= 18000101 && dateOrEpochOrLongCalendar < 25400000) {\n\t\treturn parse('' + dateOrEpochOrLongCalendar, 'yyyyMMdd', new Date())\n\t} else if (dateOrEpochOrLongCalendar >= 18000101000000) {\n\t\treturn parse('' + dateOrEpochOrLongCalendar, 'yyyyMMddHHmmss', new Date())\n\t} else {\n\t\treturn new Date(dateOrEpochOrLongCalendar)\n\t}\n}\n\nexport function dateToFuzzyDate(date: Date): number {\n\treturn parseInt(\n\t\t`${date.getFullYear()}${(date.getMonth() + 1).toString().padStart(2, '0')}${date.getDate().toString().padStart(2, '0')}${date.getHours().toString().padStart(2, '0')}${date\n\t\t\t.getMinutes()\n\t\t\t.toString()\n\t\t\t.padStart(2, '0')}:)${date.getSeconds().toString().padStart(2, '0')}`,\n\t)\n}\n\nexport function anyDateToFuzzyDate(dateOrEpochOrLongCalendar: Date | number) {\n\tconst date = anyDateToDate(dateOrEpochOrLongCalendar)\n\tif (!date) {\n\t\treturn undefined\n\t}\n\treturn dateToFuzzyDate(date)\n}\n\nexport function currentTime() {\n\tconst now = new Date()\n\treturn `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`\n}\n\nexport function currentDate() {\n\tconst now = new Date()\n\treturn `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`\n}\n\nexport function currentDateTime() {\n\treturn `${currentDate()} ${currentTime()}`\n}\n"]}
|