@icure/form 2.0.11 → 3.0.2
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/@babel-runtime-npm-7.26.9-8369ff039f-838492d8a9.zip +0 -0
- package/.yarn/cache/@icure-motss-app-datepicker-npm-6.0.0-rc.36-66219db2d1-5f34375d97.zip +0 -0
- package/.yarn/cache/@lit-labs-ssr-dom-shim-npm-1.3.0-6bfa115c08-c2003e8bb6.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/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/date-fns-npm-2.30.0-895c790e0f-f7be015232.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.1.1-bb20932b82-74d0f2d6fb.zip +0 -0
- package/.yarn/cache/lit-html-npm-2.8.0-82f88d6ebf-2d70df0724.zip +0 -0
- package/.yarn/cache/lit-html-npm-3.2.1-1662fc597d-1bacd9f8b2.zip +0 -0
- package/.yarn/cache/lit-npm-2.8.0-92bb1333a4-2480e733f7.zip +0 -0
- package/.yarn/cache/lit-npm-3.2.1-27cb5b7782-ee22bbc53d.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/orderedmap-npm-2.1.1-64b8a0684f-082cf970b0.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.24.1-6467e55b40-386076e2ff.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.10.2-1c2da9123e-93b0c03aff.zip +0 -0
- package/.yarn/cache/prosemirror-transform-npm-1.8.0-ea3ca0411f-6d16ca4f95.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.32.7-63c3e4b182-40c9038a52.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.38.0-9061dc9cf4-0d0f17c1b2.zip +0 -0
- package/.yarn/cache/punycode.js-npm-2.3.1-9084ecbbf5-13466d7ed5.zip +0 -0
- package/.yarn/cache/regenerator-runtime-npm-0.14.1-a6c97c609a-9f57c93277.zip +0 -0
- package/.yarn/cache/rope-sequence-npm-1.3.4-3b09587e5f-95cca2f99a.zip +0 -0
- package/.yarn/cache/tslib-npm-2.8.1-66590b21b8-e4aba30e63.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.3-38590e83f2-45b3cfec63.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/components/common/field-with-options.js +9 -5
- package/components/common/field-with-options.js.map +1 -1
- package/components/common/field.js +25 -21
- package/components/common/field.js.map +1 -1
- package/components/common/index.js +17 -1
- package/components/common/index.js.map +1 -1
- package/components/common/metadata-buttons-bar.d.ts +1 -1
- package/components/common/metadata-buttons-bar.js +58 -65
- package/components/common/metadata-buttons-bar.js.map +1 -1
- package/components/common/styles/paths.js +13 -10
- package/components/common/styles/paths.js.map +1 -1
- package/components/common/utils.js +21 -11
- package/components/common/utils.js.map +1 -1
- package/components/icure-button/index.js +19 -15
- package/components/icure-button/index.js.map +1 -1
- package/components/icure-button-group/index.js +26 -22
- package/components/icure-button-group/index.js.map +1 -1
- package/components/icure-date-picker/index.d.ts +2 -2
- package/components/icure-date-picker/index.js +31 -27
- package/components/icure-date-picker/index.js.map +1 -1
- package/components/icure-dropdown-field/index.js +25 -21
- package/components/icure-dropdown-field/index.js.map +1 -1
- package/components/icure-form/fields/button/button.js +17 -13
- package/components/icure-form/fields/button/button.js.map +1 -1
- package/components/icure-form/fields/button/index.js +17 -1
- package/components/icure-form/fields/button/index.js.map +1 -1
- package/components/icure-form/fields/button-group/checkbox.js +14 -10
- package/components/icure-form/fields/button-group/checkbox.js.map +1 -1
- package/components/icure-form/fields/button-group/index.js +18 -2
- package/components/icure-form/fields/button-group/index.js.map +1 -1
- package/components/icure-form/fields/button-group/radio-button.js +14 -10
- package/components/icure-form/fields/button-group/radio-button.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-picker.js +12 -8
- package/components/icure-form/fields/date-picker/date-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-time-picker.js +12 -8
- package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/index.js +19 -3
- package/components/icure-form/fields/date-picker/index.js.map +1 -1
- package/components/icure-form/fields/date-picker/time-picker.js +12 -8
- package/components/icure-form/fields/date-picker/time-picker.js.map +1 -1
- package/components/icure-form/fields/dropdown/dropdown-field.js +14 -10
- package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -1
- package/components/icure-form/fields/dropdown/index.js +17 -1
- package/components/icure-form/fields/dropdown/index.js.map +1 -1
- package/components/icure-form/fields/index.js +26 -10
- package/components/icure-form/fields/index.js.map +1 -1
- package/components/icure-form/fields/items-list-field/index.js +17 -1
- package/components/icure-form/fields/items-list-field/index.js.map +1 -1
- package/components/icure-form/fields/items-list-field/items-list-field.js +11 -7
- package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -1
- package/components/icure-form/fields/label/index.js +17 -1
- package/components/icure-form/fields/label/index.js.map +1 -1
- package/components/icure-form/fields/label/label.js +15 -11
- package/components/icure-form/fields/label/label.js.map +1 -1
- package/components/icure-form/fields/measure-field/index.js +17 -1
- package/components/icure-form/fields/measure-field/index.js.map +1 -1
- package/components/icure-form/fields/measure-field/measure-field.js +12 -8
- package/components/icure-form/fields/measure-field/measure-field.js.map +1 -1
- package/components/icure-form/fields/number-field/index.js +17 -1
- package/components/icure-form/fields/number-field/index.js.map +1 -1
- package/components/icure-form/fields/number-field/number-field.js +12 -8
- package/components/icure-form/fields/number-field/number-field.js.map +1 -1
- package/components/icure-form/fields/text-field/index.js +17 -1
- package/components/icure-form/fields/text-field/index.js.map +1 -1
- package/components/icure-form/fields/text-field/text-field.js +24 -20
- package/components/icure-form/fields/text-field/text-field.js.map +1 -1
- package/components/icure-form/fields/token-field/index.js +17 -1
- package/components/icure-form/fields/token-field/index.js.map +1 -1
- package/components/icure-form/fields/token-field/token-field.js +12 -8
- package/components/icure-form/fields/token-field/token-field.js.map +1 -1
- package/components/icure-form/fields/utils/index.js +13 -5
- package/components/icure-form/fields/utils/index.js.map +1 -1
- package/components/icure-form/index.js +32 -28
- package/components/icure-form/index.js.map +1 -1
- package/components/icure-form/renderer/form/form-selection-button.js +19 -15
- package/components/icure-form/renderer/form/form-selection-button.js.map +1 -1
- package/components/icure-form/renderer/form/form.js +127 -123
- package/components/icure-form/renderer/form/form.js.map +1 -1
- package/components/icure-form/renderer/index.js +2 -1
- package/components/icure-label/index.js +17 -13
- package/components/icure-label/index.js.map +1 -1
- package/components/icure-text-field/index.js +106 -98
- package/components/icure-text-field/index.js.map +1 -1
- package/components/icure-text-field/plugin/caret-fix-plugin.js +7 -3
- package/components/icure-text-field/plugin/caret-fix-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/has-content-class-plugin.js +7 -3
- package/components/icure-text-field/plugin/has-content-class-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/mask-plugin.js +11 -7
- package/components/icure-text-field/plugin/mask-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/regexp-plugin.js +9 -5
- package/components/icure-text-field/plugin/regexp-plugin.js.map +1 -1
- package/components/icure-text-field/prosemirror-commands.js +15 -10
- package/components/icure-text-field/prosemirror-commands.js.map +1 -1
- package/components/icure-text-field/prosemirror-utils.js +5 -1
- package/components/icure-text-field/prosemirror-utils.js.map +1 -1
- package/components/icure-text-field/schema/common-marks.js +7 -3
- package/components/icure-text-field/schema/common-marks.js.map +1 -1
- package/components/icure-text-field/schema/date-time-schema.js +9 -3
- package/components/icure-text-field/schema/date-time-schema.js.map +1 -1
- package/components/icure-text-field/schema/decimal-schema.js +5 -1
- package/components/icure-text-field/schema/decimal-schema.js.map +1 -1
- package/components/icure-text-field/schema/index.js +21 -17
- package/components/icure-text-field/schema/index.js.map +1 -1
- package/components/icure-text-field/schema/items-list-schema.js +7 -3
- package/components/icure-text-field/schema/items-list-schema.js.map +1 -1
- package/components/icure-text-field/schema/markdown-schema.js +9 -5
- package/components/icure-text-field/schema/markdown-schema.js.map +1 -1
- package/components/icure-text-field/schema/measure-schema.js +12 -6
- package/components/icure-text-field/schema/measure-schema.js.map +1 -1
- package/components/icure-text-field/schema/token-schema.js +9 -5
- package/components/icure-text-field/schema/token-schema.js.map +1 -1
- package/components/icure-text-field/schema/utils.js +7 -2
- package/components/icure-text-field/schema/utils.js.map +1 -1
- package/components/icure-text-field/selection-companion.js +5 -1
- package/components/icure-text-field/selection-companion.js.map +1 -1
- package/components/icure-text-field/suggestion-palette.js +10 -3
- package/components/icure-text-field/suggestion-palette.js.map +1 -1
- package/components/index.js +21 -5
- package/components/index.js.map +1 -1
- package/components/model/index.js +46 -22
- package/components/model/index.js.map +1 -1
- package/components/themes/default/index.js +32 -30
- package/components/themes/default/index.js.map +1 -1
- package/components/themes/icure-blue/index.js +47 -45
- package/components/themes/icure-blue/index.js.map +1 -1
- package/components/themes/kendo/index.js +47 -45
- package/components/themes/kendo/index.js.map +1 -1
- package/conversion/ckmeans-grouping.js +10 -3
- package/conversion/ckmeans-grouping.js.map +1 -1
- package/conversion/ckmeans.js +3 -1
- package/conversion/ckmeans.js.map +1 -1
- package/generic/index.js +17 -1
- package/generic/index.js.map +1 -1
- package/generic/model.js +2 -1
- package/icure/form-values-container.d.ts +14 -14
- package/icure/form-values-container.js +45 -37
- package/icure/form-values-container.js.map +1 -1
- package/icure/icure-utils.d.ts +7 -7
- package/icure/icure-utils.js +28 -16
- package/icure/icure-utils.js.map +1 -1
- package/icure/index.js +18 -2
- package/icure/index.js.map +1 -1
- package/icure/model.d.ts +1 -1
- package/icure/model.js +2 -1
- package/icure/model.js.map +1 -1
- package/index.js +17 -1
- package/index.js.map +1 -1
- package/package.json +3 -2
- package/utils/code-utils.d.ts +10 -1
- package/utils/code-utils.js +59 -11
- package/utils/code-utils.js.map +1 -1
- package/utils/dates.js +21 -9
- package/utils/dates.js.map +1 -1
- package/utils/fields-values-provider.js +17 -8
- package/utils/fields-values-provider.js.map +1 -1
- package/utils/form-value-container.js +7 -3
- package/utils/form-value-container.js.map +1 -1
- package/utils/interpreter.js +5 -1
- package/utils/interpreter.js.map +1 -1
- package/utils/languages.js +8 -3
- package/utils/languages.js.map +1 -1
- package/utils/markdown.js +11 -6
- package/utils/markdown.js.map +1 -1
- package/utils/no-lodash.js +9 -3
- package/utils/no-lodash.js.map +1 -1
- package/utils/primitive.js +12 -7
- package/utils/primitive.js.map +1 -1
- package/conversion/icure-convert.d.ts +0 -3
- package/conversion/icure-convert.js +0 -161
- package/conversion/icure-convert.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fields_1 = require("../../icure-form/fields");
|
|
4
|
+
const icure_button_group_1 = require("../../icure-button-group");
|
|
5
|
+
const icure_date_picker_1 = require("../../icure-date-picker");
|
|
6
|
+
const icure_dropdown_field_1 = require("../../icure-dropdown-field");
|
|
7
|
+
const icure_form_1 = require("../../icure-form");
|
|
8
|
+
const icure_label_1 = require("../../icure-label");
|
|
9
|
+
const icure_text_field_1 = require("../../icure-text-field");
|
|
8
10
|
// @ts-ignore
|
|
9
|
-
|
|
10
|
-
const kendoCss = css `.icure-text-field,
|
|
11
|
+
const lit_1 = require("lit");
|
|
12
|
+
const kendoCss = (0, lit_1.css) `.icure-text-field,
|
|
11
13
|
.icure-button-group {
|
|
12
14
|
padding-top: 16px;
|
|
13
15
|
width: 100%;
|
|
@@ -227,65 +229,65 @@ app-date-picker {
|
|
|
227
229
|
flex: 1 1 auto;
|
|
228
230
|
width: auto;
|
|
229
231
|
}`;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
class KendoIcureButtonGroup extends IcureButtonGroup {
|
|
232
|
+
const metadata_buttons_bar_1 = require("../../common/metadata-buttons-bar");
|
|
233
|
+
const icure_button_1 = require("../../icure-button");
|
|
234
|
+
const form_selection_button_1 = require("../../icure-form/renderer/form/form-selection-button");
|
|
235
|
+
class KendoIcureButtonGroup extends icure_button_group_1.IcureButtonGroup {
|
|
234
236
|
static get styles() {
|
|
235
|
-
return [...IcureButtonGroup.styles, kendoCss];
|
|
237
|
+
return [...icure_button_group_1.IcureButtonGroup.styles, kendoCss];
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
|
-
class KendoIcureDatePickerField extends IcureDatePickerField {
|
|
240
|
+
class KendoIcureDatePickerField extends icure_date_picker_1.IcureDatePickerField {
|
|
239
241
|
static get styles() {
|
|
240
|
-
return [...IcureDatePickerField.styles, kendoCss];
|
|
242
|
+
return [...icure_date_picker_1.IcureDatePickerField.styles, kendoCss];
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
|
-
class KendoIcureDropdownField extends IcureDropdownField {
|
|
245
|
+
class KendoIcureDropdownField extends icure_dropdown_field_1.IcureDropdownField {
|
|
244
246
|
static get styles() {
|
|
245
|
-
return [...IcureDropdownField.styles, kendoCss];
|
|
247
|
+
return [...icure_dropdown_field_1.IcureDropdownField.styles, kendoCss];
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
|
-
class KendoIcureForm extends IcureForm {
|
|
250
|
+
class KendoIcureForm extends icure_form_1.IcureForm {
|
|
249
251
|
static get styles() {
|
|
250
|
-
return [...IcureForm.styles, kendoCss];
|
|
252
|
+
return [...icure_form_1.IcureForm.styles, kendoCss];
|
|
251
253
|
}
|
|
252
254
|
}
|
|
253
|
-
class KendoIcureLabel extends IcureLabel {
|
|
255
|
+
class KendoIcureLabel extends icure_label_1.IcureLabel {
|
|
254
256
|
static get styles() {
|
|
255
|
-
return [...IcureLabel.styles, kendoCss];
|
|
257
|
+
return [...icure_label_1.IcureLabel.styles, kendoCss];
|
|
256
258
|
}
|
|
257
259
|
}
|
|
258
|
-
class KendoIcureButton extends IcureButton {
|
|
260
|
+
class KendoIcureButton extends icure_button_1.IcureButton {
|
|
259
261
|
static get styles() {
|
|
260
|
-
return [...IcureButton.styles, kendoCss];
|
|
262
|
+
return [...icure_button_1.IcureButton.styles, kendoCss];
|
|
261
263
|
}
|
|
262
264
|
}
|
|
263
|
-
class KendoIcureTextField extends IcureTextField {
|
|
265
|
+
class KendoIcureTextField extends icure_text_field_1.IcureTextField {
|
|
264
266
|
static get styles() {
|
|
265
|
-
return [...IcureTextField.styles, kendoCss];
|
|
267
|
+
return [...icure_text_field_1.IcureTextField.styles, kendoCss];
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
|
-
class KendoLabel extends Label {
|
|
270
|
+
class KendoLabel extends fields_1.Label {
|
|
269
271
|
static get styles() {
|
|
270
|
-
return [...Label.styles, kendoCss];
|
|
272
|
+
return [...fields_1.Label.styles, kendoCss];
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
|
-
class KendoMetadataButtonBar extends MetadataButtonBar {
|
|
275
|
+
class KendoMetadataButtonBar extends metadata_buttons_bar_1.MetadataButtonBar {
|
|
274
276
|
static get styles() {
|
|
275
|
-
return [...MetadataButtonBar.styles, kendoCss];
|
|
277
|
+
return [...metadata_buttons_bar_1.MetadataButtonBar.styles, kendoCss];
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
|
-
class KendoButton extends Button {
|
|
280
|
+
class KendoButton extends fields_1.Button {
|
|
279
281
|
static get styles() {
|
|
280
|
-
return [...Button.styles, kendoCss];
|
|
282
|
+
return [...fields_1.Button.styles, kendoCss];
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
customElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar);
|
|
284
|
-
customElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper);
|
|
285
|
-
customElements.define('icure-form-checkbox', CheckBox);
|
|
286
|
-
customElements.define('icure-form-date-picker', DatePicker);
|
|
287
|
-
customElements.define('icure-form-date-time-picker', DateTimePicker);
|
|
288
|
-
customElements.define('icure-form-dropdown-field', DropdownField);
|
|
286
|
+
customElements.define('icure-metadata-buttons-bar-wrapper', icure_text_field_1.MetadataButtonBarWrapper);
|
|
287
|
+
customElements.define('icure-form-checkbox', fields_1.CheckBox);
|
|
288
|
+
customElements.define('icure-form-date-picker', fields_1.DatePicker);
|
|
289
|
+
customElements.define('icure-form-date-time-picker', fields_1.DateTimePicker);
|
|
290
|
+
customElements.define('icure-form-dropdown-field', fields_1.DropdownField);
|
|
289
291
|
customElements.define('icure-button-group', KendoIcureButtonGroup);
|
|
290
292
|
customElements.define('icure-date-picker-field', KendoIcureDatePickerField);
|
|
291
293
|
customElements.define('icure-dropdown-field', KendoIcureDropdownField);
|
|
@@ -293,14 +295,14 @@ customElements.define('icure-form', KendoIcureForm);
|
|
|
293
295
|
customElements.define('icure-label', KendoIcureLabel);
|
|
294
296
|
customElements.define('icure-button', KendoIcureButton);
|
|
295
297
|
customElements.define('icure-text-field', KendoIcureTextField);
|
|
296
|
-
customElements.define('icure-form-items-list-field', ItemsListField);
|
|
298
|
+
customElements.define('icure-form-items-list-field', fields_1.ItemsListField);
|
|
297
299
|
customElements.define('icure-form-label', KendoLabel);
|
|
298
300
|
customElements.define('icure-form-button', KendoButton);
|
|
299
|
-
customElements.define('icure-form-measure-field', MeasureField);
|
|
300
|
-
customElements.define('icure-form-number-field', NumberField);
|
|
301
|
-
customElements.define('icure-form-radio-button', RadioButton);
|
|
302
|
-
customElements.define('icure-form-text-field', TextField);
|
|
303
|
-
customElements.define('icure-form-time-picker', TimePicker);
|
|
304
|
-
customElements.define('icure-form-token-field', TokenField);
|
|
305
|
-
customElements.define('form-selection-button', FormSelectionButton);
|
|
301
|
+
customElements.define('icure-form-measure-field', fields_1.MeasureField);
|
|
302
|
+
customElements.define('icure-form-number-field', fields_1.NumberField);
|
|
303
|
+
customElements.define('icure-form-radio-button', fields_1.RadioButton);
|
|
304
|
+
customElements.define('icure-form-text-field', fields_1.TextField);
|
|
305
|
+
customElements.define('icure-form-time-picker', fields_1.TimePicker);
|
|
306
|
+
customElements.define('icure-form-token-field', fields_1.TokenField);
|
|
307
|
+
customElements.define('form-selection-button', form_selection_button_1.FormSelectionButton);
|
|
306
308
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tmp/components/themes/kendo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,KAAK,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,GACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AAEjF,aAAa;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;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,YAAY,EAAE,cAAc,CAAC,CAAA;AACnD,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,CAAA;AACrD,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;AACvD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAA;AAC9D,cAAc,CAAC,MAAM,CAAC,6BAA6B,EAAE,cAAc,CAAC,CAAA;AACpE,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAA;AACrD,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA;AACvD,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAA;AAC/D,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,WAAW,CAAC,CAAA;AAC7D,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,WAAW,CAAC,CAAA;AAC7D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAA;AACzD,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAA;AAC3D,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAA;AAC3D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAA","sourcesContent":["import {\n\tCheckBox,\n\tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tItemsListField,\n\tLabel,\n\tButton,\n\tMeasureField,\n\tNumberField,\n\tRadioButton,\n\tTextField,\n\tTimePicker,\n\tTokenField,\n} from '../../icure-form/fields'\nimport { IcureButtonGroup } from '../../icure-button-group'\nimport { IcureDatePickerField } from '../../icure-date-picker'\nimport { IcureDropdownField } from '../../icure-dropdown-field'\nimport { IcureForm } from '../../icure-form'\nimport { IcureLabel } from '../../icure-label'\nimport { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field'\n\n// @ts-ignore\nimport { css } from 'lit';\nconst kendoCss = css`.icure-text-field,\n.icure-button-group {\n padding-top: 16px;\n width: 100%;\n}\n.icure-text-field .icure-label,\n.icure-button-group .icure-label {\n color: #656565;\n font-size: 14px;\n font-weight: 500;\n display: inline !important;\n white-space: initial !important;\n overflow: initial !important;\n word-wrap: normal !important;\n word-break: break-word;\n}\n.icure-text-field > .icure-input,\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}\n.icure-text-field > .icure-label,\n.icure-button-group > .icure-label {\n transform: translate(0, 0) scale(1);\n}\n.icure-text-field .icure-input,\n.icure-text-field .input-container,\n.icure-button-group .icure-input,\n.icure-button-group .input-container {\n border-radius: 2px;\n padding: 0 8px;\n width: 100%;\n box-sizing: border-box;\n border-width: 1px;\n border-style: solid;\n outline: 0;\n font: inherit;\n font-size: 14px;\n line-height: 1.4em;\n display: flex;\n align-items: center;\n vertical-align: middle;\n position: relative;\n -webkit-appearance: none;\n background-color: #ffffff;\n border-color: rgba(0, 0, 0, 0.08);\n color: #656565;\n box-sizing: border-box;\n}\n.icure-text-field .icure-input:focus, .icure-text-field .icure-input:focus-within,\n.icure-text-field .input-container:focus,\n.icure-text-field .input-container:focus-within,\n.icure-button-group .icure-input:focus,\n.icure-button-group .icure-input:focus-within,\n.icure-button-group .input-container:focus,\n.icure-button-group .input-container:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input:hover,\n.icure-text-field .input-container:hover,\n.icure-button-group .icure-input:hover,\n.icure-button-group .input-container:hover {\n border-color: rgba(0, 0, 0, 0.15);\n box-shadow: none;\n}\n.icure-text-field .icure-input:hover:focus, .icure-text-field .icure-input:hover:focus-within,\n.icure-text-field .input-container:hover:focus,\n.icure-text-field .input-container:hover:focus-within,\n.icure-button-group .icure-input:hover:focus,\n.icure-button-group .icure-input:hover:focus-within,\n.icure-button-group .input-container:hover:focus,\n.icure-button-group .input-container:hover:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input .ProseMirror,\n.icure-text-field .input-container .ProseMirror,\n.icure-button-group .icure-input .ProseMirror,\n.icure-button-group .input-container .ProseMirror {\n padding: 0;\n font-size: 14px;\n line-height: 1.4em;\n color: #656565;\n}\n.icure-text-field .icure-input .ProseMirror .date,\n.icure-text-field .input-container .ProseMirror .date,\n.icure-button-group .icure-input .ProseMirror .date,\n.icure-button-group .input-container .ProseMirror .date {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror .time,\n.icure-text-field .input-container .ProseMirror .time,\n.icure-button-group .icure-input .ProseMirror .time,\n.icure-button-group .input-container .ProseMirror .time {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror:focus .focused,\n.icure-text-field .input-container .ProseMirror:focus .focused,\n.icure-button-group .icure-input .ProseMirror:focus .focused,\n.icure-button-group .input-container .ProseMirror:focus .focused {\n background-color: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n border-color: rgba(0, 0, 0, 0.1);\n}\n.icure-text-field .icure-input > svg,\n.icure-text-field .input-container > svg,\n.icure-button-group .icure-input > svg,\n.icure-button-group .input-container > svg {\n opacity: 0.5;\n}\n.icure-text-field .icure-input > svg path,\n.icure-text-field .input-container > svg path,\n.icure-button-group .icure-input > svg path,\n.icure-button-group .input-container > svg path {\n fill: #656565;\n}\n.icure-text-field .icure-input .extra,\n.icure-text-field .input-container .extra,\n.icure-button-group .icure-input .extra,\n.icure-button-group .input-container .extra {\n height: 20px;\n}\n.icure-text-field .icure-input .extra > .info,\n.icure-text-field .input-container .extra > .info,\n.icure-button-group .icure-input .extra > .info,\n.icure-button-group .input-container .extra > .info {\n color: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path,\n.icure-text-field .input-container .extra .buttons-container .btn svg path,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path,\n.icure-button-group .input-container .extra .buttons-container .btn svg path {\n fill: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-text-field .input-container .extra .buttons-container .btn svg path:hover,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-button-group .input-container .extra .buttons-container .btn svg path:hover {\n fill: #656565;\n opacity: 1;\n}\n.icure-text-field .icure-input .extra > .options > .selected,\n.icure-text-field .input-container .extra > .options > .selected,\n.icure-button-group .icure-input .extra > .options > .selected,\n.icure-button-group .input-container .extra > .options > .selected {\n color: white;\n background-color: #06a070;\n border-radius: 0 !important;\n}\n\ninput[type=radio] {\n margin-top: -1px;\n vertical-align: middle;\n}\n\n.icure-checkbox:checked {\n accent-color: #06a070;\n}\n\napp-date-picker {\n --app-primary: #06a070;\n --app-hover: #06a070;\n --app-selected-hover: #06a070;\n}\n\n.icure-button-group > .icure-label {\n z-index: 1;\n pointer-events: none;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n color: #656565;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > .icure-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > div {\n display: grid;\n}\n.icure-button-group > div > div {\n display: flex;\n align-items: center;\n}\n.icure-button-group > div > div > .icure-button-group-label {\n z-index: 1;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n transition: transform 0.2s ease-out, color 0.2s ease-out;\n color: #656565;\n display: flex;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > div > div > .icure-button-group-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}` \nimport { MetadataButtonBar } from '../../common/metadata-buttons-bar'\nimport { IcureButton } from '../../icure-button'\nimport { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button'\n\nclass KendoIcureButtonGroup extends IcureButtonGroup {\n\tstatic get styles() {\n\t\treturn [...IcureButtonGroup.styles, kendoCss]\n\t}\n}\nclass KendoIcureDatePickerField extends IcureDatePickerField {\n\tstatic get styles() {\n\t\treturn [...IcureDatePickerField.styles, kendoCss]\n\t}\n}\nclass KendoIcureDropdownField extends IcureDropdownField {\n\tstatic get styles() {\n\t\treturn [...IcureDropdownField.styles, kendoCss]\n\t}\n}\nclass KendoIcureForm extends IcureForm {\n\tstatic get styles() {\n\t\treturn [...IcureForm.styles, kendoCss]\n\t}\n}\nclass KendoIcureLabel extends IcureLabel {\n\tstatic get styles() {\n\t\treturn [...IcureLabel.styles, kendoCss]\n\t}\n}\nclass KendoIcureButton extends IcureButton {\n\tstatic get styles() {\n\t\treturn [...IcureButton.styles, kendoCss]\n\t}\n}\nclass KendoIcureTextField extends IcureTextField {\n\tstatic get styles() {\n\t\treturn [...IcureTextField.styles, kendoCss]\n\t}\n}\nclass KendoLabel extends Label {\n\tstatic get styles() {\n\t\treturn [...Label.styles, kendoCss]\n\t}\n}\nclass KendoMetadataButtonBar extends MetadataButtonBar {\n\tstatic get styles() {\n\t\treturn [...MetadataButtonBar.styles, kendoCss]\n\t}\n}\nclass KendoButton extends Button {\n\tstatic get styles() {\n\t\treturn [...Button.styles, kendoCss]\n\t}\n}\n\ncustomElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar)\ncustomElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper)\n\ncustomElements.define('icure-form-checkbox', CheckBox)\ncustomElements.define('icure-form-date-picker', DatePicker)\ncustomElements.define('icure-form-date-time-picker', DateTimePicker)\ncustomElements.define('icure-form-dropdown-field', DropdownField)\ncustomElements.define('icure-button-group', KendoIcureButtonGroup)\ncustomElements.define('icure-date-picker-field', KendoIcureDatePickerField)\ncustomElements.define('icure-dropdown-field', KendoIcureDropdownField)\ncustomElements.define('icure-form', KendoIcureForm)\ncustomElements.define('icure-label', KendoIcureLabel)\ncustomElements.define('icure-button', KendoIcureButton)\ncustomElements.define('icure-text-field', KendoIcureTextField)\ncustomElements.define('icure-form-items-list-field', ItemsListField)\ncustomElements.define('icure-form-label', KendoLabel)\ncustomElements.define('icure-form-button', KendoButton)\ncustomElements.define('icure-form-measure-field', MeasureField)\ncustomElements.define('icure-form-number-field', NumberField)\ncustomElements.define('icure-form-radio-button', RadioButton)\ncustomElements.define('icure-form-text-field', TextField)\ncustomElements.define('icure-form-time-picker', TimePicker)\ncustomElements.define('icure-form-token-field', TokenField)\ncustomElements.define('form-selection-button', FormSelectionButton)\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tmp/components/themes/kendo/index.ts"],"names":[],"mappings":";;AAAA,oDAcgC;AAChC,iEAA2D;AAC3D,+DAA8D;AAC9D,qEAA+D;AAC/D,iDAA4C;AAC5C,mDAA8C;AAC9C,6DAAiF;AAEjF,aAAa;AACb,6BAA0B;AAC1B,MAAM,QAAQ,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2NlB,CAAA;AACF,4EAAqE;AACrE,qDAAgD;AAChD,gGAA0F;AAE1F,MAAM,qBAAsB,SAAQ,qCAAgB;IACnD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,qCAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC9C,CAAC;CACD;AACD,MAAM,yBAA0B,SAAQ,wCAAoB;IAC3D,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,wCA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BAAS,CAAC,CAAA;AACzD,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,mBAAU,CAAC,CAAA;AAC3D,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,mBAAU,CAAC,CAAA;AAC3D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,2CAAmB,CAAC,CAAA","sourcesContent":["import {\n\tCheckBox,\n\tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tItemsListField,\n\tLabel,\n\tButton,\n\tMeasureField,\n\tNumberField,\n\tRadioButton,\n\tTextField,\n\tTimePicker,\n\tTokenField,\n} from '../../icure-form/fields'\nimport { IcureButtonGroup } from '../../icure-button-group'\nimport { IcureDatePickerField } from '../../icure-date-picker'\nimport { IcureDropdownField } from '../../icure-dropdown-field'\nimport { IcureForm } from '../../icure-form'\nimport { IcureLabel } from '../../icure-label'\nimport { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field'\n\n// @ts-ignore\nimport { css } from 'lit';\nconst kendoCss = css`.icure-text-field,\n.icure-button-group {\n padding-top: 16px;\n width: 100%;\n}\n.icure-text-field .icure-label,\n.icure-button-group .icure-label {\n color: #656565;\n font-size: 14px;\n font-weight: 500;\n display: inline !important;\n white-space: initial !important;\n overflow: initial !important;\n word-wrap: normal !important;\n word-break: break-word;\n}\n.icure-text-field > .icure-input,\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}\n.icure-text-field > .icure-label,\n.icure-button-group > .icure-label {\n transform: translate(0, 0) scale(1);\n}\n.icure-text-field .icure-input,\n.icure-text-field .input-container,\n.icure-button-group .icure-input,\n.icure-button-group .input-container {\n border-radius: 2px;\n padding: 0 8px;\n width: 100%;\n box-sizing: border-box;\n border-width: 1px;\n border-style: solid;\n outline: 0;\n font: inherit;\n font-size: 14px;\n line-height: 1.4em;\n display: flex;\n align-items: center;\n vertical-align: middle;\n position: relative;\n -webkit-appearance: none;\n background-color: #ffffff;\n border-color: rgba(0, 0, 0, 0.08);\n color: #656565;\n box-sizing: border-box;\n}\n.icure-text-field .icure-input:focus, .icure-text-field .icure-input:focus-within,\n.icure-text-field .input-container:focus,\n.icure-text-field .input-container:focus-within,\n.icure-button-group .icure-input:focus,\n.icure-button-group .icure-input:focus-within,\n.icure-button-group .input-container:focus,\n.icure-button-group .input-container:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input:hover,\n.icure-text-field .input-container:hover,\n.icure-button-group .icure-input:hover,\n.icure-button-group .input-container:hover {\n border-color: rgba(0, 0, 0, 0.15);\n box-shadow: none;\n}\n.icure-text-field .icure-input:hover:focus, .icure-text-field .icure-input:hover:focus-within,\n.icure-text-field .input-container:hover:focus,\n.icure-text-field .input-container:hover:focus-within,\n.icure-button-group .icure-input:hover:focus,\n.icure-button-group .icure-input:hover:focus-within,\n.icure-button-group .input-container:hover:focus,\n.icure-button-group .input-container:hover:focus-within {\n box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.06);\n}\n.icure-text-field .icure-input .ProseMirror,\n.icure-text-field .input-container .ProseMirror,\n.icure-button-group .icure-input .ProseMirror,\n.icure-button-group .input-container .ProseMirror {\n padding: 0;\n font-size: 14px;\n line-height: 1.4em;\n color: #656565;\n}\n.icure-text-field .icure-input .ProseMirror .date,\n.icure-text-field .input-container .ProseMirror .date,\n.icure-button-group .icure-input .ProseMirror .date,\n.icure-button-group .input-container .ProseMirror .date {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror .time,\n.icure-text-field .input-container .ProseMirror .time,\n.icure-button-group .icure-input .ProseMirror .time,\n.icure-button-group .input-container .ProseMirror .time {\n padding: 1px;\n}\n.icure-text-field .icure-input .ProseMirror:focus .focused,\n.icure-text-field .input-container .ProseMirror:focus .focused,\n.icure-button-group .icure-input .ProseMirror:focus .focused,\n.icure-button-group .input-container .ProseMirror:focus .focused {\n background-color: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n border-color: rgba(0, 0, 0, 0.1);\n}\n.icure-text-field .icure-input > svg,\n.icure-text-field .input-container > svg,\n.icure-button-group .icure-input > svg,\n.icure-button-group .input-container > svg {\n opacity: 0.5;\n}\n.icure-text-field .icure-input > svg path,\n.icure-text-field .input-container > svg path,\n.icure-button-group .icure-input > svg path,\n.icure-button-group .input-container > svg path {\n fill: #656565;\n}\n.icure-text-field .icure-input .extra,\n.icure-text-field .input-container .extra,\n.icure-button-group .icure-input .extra,\n.icure-button-group .input-container .extra {\n height: 20px;\n}\n.icure-text-field .icure-input .extra > .info,\n.icure-text-field .input-container .extra > .info,\n.icure-button-group .icure-input .extra > .info,\n.icure-button-group .input-container .extra > .info {\n color: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path,\n.icure-text-field .input-container .extra .buttons-container .btn svg path,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path,\n.icure-button-group .input-container .extra .buttons-container .btn svg path {\n fill: #656565;\n opacity: 0.5;\n}\n.icure-text-field .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-text-field .input-container .extra .buttons-container .btn svg path:hover,\n.icure-button-group .icure-input .extra .buttons-container .btn svg path:hover,\n.icure-button-group .input-container .extra .buttons-container .btn svg path:hover {\n fill: #656565;\n opacity: 1;\n}\n.icure-text-field .icure-input .extra > .options > .selected,\n.icure-text-field .input-container .extra > .options > .selected,\n.icure-button-group .icure-input .extra > .options > .selected,\n.icure-button-group .input-container .extra > .options > .selected {\n color: white;\n background-color: #06a070;\n border-radius: 0 !important;\n}\n\ninput[type=radio] {\n margin-top: -1px;\n vertical-align: middle;\n}\n\n.icure-checkbox:checked {\n accent-color: #06a070;\n}\n\napp-date-picker {\n --app-primary: #06a070;\n --app-hover: #06a070;\n --app-selected-hover: #06a070;\n}\n\n.icure-button-group > .icure-label {\n z-index: 1;\n pointer-events: none;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n color: #656565;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > .icure-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > div {\n display: grid;\n}\n.icure-button-group > div > div {\n display: flex;\n align-items: center;\n}\n.icure-button-group > div > div > .icure-button-group-label {\n z-index: 1;\n line-height: 1.4em;\n cursor: text;\n font-size: 14px;\n top: calc(1.4em + 1px);\n left: 9px;\n transition: transform 0.2s ease-out, color 0.2s ease-out;\n color: #656565;\n display: flex;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n}\n.icure-button-group > div > div > .icure-button-group-label > span {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding-right: 8px;\n}\n.icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}` \nimport { MetadataButtonBar } from '../../common/metadata-buttons-bar'\nimport { IcureButton } from '../../icure-button'\nimport { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button'\n\nclass KendoIcureButtonGroup extends IcureButtonGroup {\n\tstatic get styles() {\n\t\treturn [...IcureButtonGroup.styles, kendoCss]\n\t}\n}\nclass KendoIcureDatePickerField extends IcureDatePickerField {\n\tstatic get styles() {\n\t\treturn [...IcureDatePickerField.styles, kendoCss]\n\t}\n}\nclass KendoIcureDropdownField extends IcureDropdownField {\n\tstatic get styles() {\n\t\treturn [...IcureDropdownField.styles, kendoCss]\n\t}\n}\nclass KendoIcureForm extends IcureForm {\n\tstatic get styles() {\n\t\treturn [...IcureForm.styles, kendoCss]\n\t}\n}\nclass KendoIcureLabel extends IcureLabel {\n\tstatic get styles() {\n\t\treturn [...IcureLabel.styles, kendoCss]\n\t}\n}\nclass KendoIcureButton extends IcureButton {\n\tstatic get styles() {\n\t\treturn [...IcureButton.styles, kendoCss]\n\t}\n}\nclass KendoIcureTextField extends IcureTextField {\n\tstatic get styles() {\n\t\treturn [...IcureTextField.styles, kendoCss]\n\t}\n}\nclass KendoLabel extends Label {\n\tstatic get styles() {\n\t\treturn [...Label.styles, kendoCss]\n\t}\n}\nclass KendoMetadataButtonBar extends MetadataButtonBar {\n\tstatic get styles() {\n\t\treturn [...MetadataButtonBar.styles, kendoCss]\n\t}\n}\nclass KendoButton extends Button {\n\tstatic get styles() {\n\t\treturn [...Button.styles, kendoCss]\n\t}\n}\n\ncustomElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar)\ncustomElements.define('icure-metadata-buttons-bar-wrapper', MetadataButtonBarWrapper)\n\ncustomElements.define('icure-form-checkbox', CheckBox)\ncustomElements.define('icure-form-date-picker', DatePicker)\ncustomElements.define('icure-form-date-time-picker', DateTimePicker)\ncustomElements.define('icure-form-dropdown-field', DropdownField)\ncustomElements.define('icure-button-group', KendoIcureButtonGroup)\ncustomElements.define('icure-date-picker-field', KendoIcureDatePickerField)\ncustomElements.define('icure-dropdown-field', KendoIcureDropdownField)\ncustomElements.define('icure-form', KendoIcureForm)\ncustomElements.define('icure-label', KendoIcureLabel)\ncustomElements.define('icure-button', KendoIcureButton)\ncustomElements.define('icure-text-field', KendoIcureTextField)\ncustomElements.define('icure-form-items-list-field', ItemsListField)\ncustomElements.define('icure-form-label', KendoLabel)\ncustomElements.define('icure-form-button', KendoButton)\ncustomElements.define('icure-form-measure-field', MeasureField)\ncustomElements.define('icure-form-number-field', NumberField)\ncustomElements.define('icure-form-radio-button', RadioButton)\ncustomElements.define('icure-form-text-field', TextField)\ncustomElements.define('icure-form-time-picker', TimePicker)\ncustomElements.define('icure-form-token-field', TokenField)\ncustomElements.define('form-selection-button', FormSelectionButton)\n"]}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.cluster = void 0;
|
|
7
|
+
const ckmeans_1 = __importDefault(require("./ckmeans"));
|
|
8
|
+
const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots) => {
|
|
3
9
|
if (!data.length) {
|
|
4
10
|
return { centroids: [], clusters: [] };
|
|
5
11
|
}
|
|
@@ -11,7 +17,7 @@ export const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters,
|
|
|
11
17
|
while (isNotStable) {
|
|
12
18
|
history.push(k);
|
|
13
19
|
isNotStable = false;
|
|
14
|
-
clusters =
|
|
20
|
+
clusters = (0, ckmeans_1.default)(data, k);
|
|
15
21
|
if (clusters.find((c) => !c.length)) {
|
|
16
22
|
isNotStable = true;
|
|
17
23
|
k--;
|
|
@@ -43,4 +49,5 @@ export const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters,
|
|
|
43
49
|
}
|
|
44
50
|
return { centroids: centroids, clusters: clusters };
|
|
45
51
|
};
|
|
52
|
+
exports.cluster = cluster;
|
|
46
53
|
//# sourceMappingURL=ckmeans-grouping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA+B;AAExB,MAAM,OAAO,GAAG,CAAC,IAAc,EAAE,oBAA4B,EAAE,0BAAkC,EAAE,KAAc,EAAE,EAAE;IAC3H,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;IACvC,CAAC;IAED,IAAI,CAAC,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,M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AAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;oBAC9B,WAAW,GAAG,IAAI,CAAA;oBAClB,CAAC,EAAE,CAAA;gBACJ,CAAC;gBACD,MAAK;YACN,CAAC;QACF,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YACjB,SAAQ;QACT,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC5F,IAAI,WAAW,GAAG,oBAAoB,EAAE,CAAC;gBACxC,WAAW,GAAG,IAAI,CAAA;gBAClB,CAAC,EAAE,CAAA;gBACH,MAAK;YACN,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACpD,CAAC,CAAA;AA9CY,QAAA,OAAO,WA8CnB","sourcesContent":["import ckmeans from './ckmeans'\n\nexport const cluster = (data: number[], maxDistanceInCluster: number, minDistanceBetweenClusters: number, slots?: number) => {\n\tif (!data.length) {\n\t\treturn { centroids: [], clusters: [] }\n\t}\n\n\tlet k = slots ?? Math.max(Math.round(data.length / 5), 1) //Initialise k to a number of clusters equals to 1/5 of the number of data points\n\n\tconst history = []\n\tlet isNotStable = true\n\tlet centroids: number[] = []\n\tlet clusters: number[][] = []\n\twhile (isNotStable) {\n\t\thistory.push(k)\n\t\tisNotStable = false\n\t\tclusters = ckmeans(data, k)\n\t\tif (clusters.find((c) => !c.length)) {\n\t\t\tisNotStable = true\n\t\t\tk--\n\t\t\tcontinue\n\t\t}\n\t\tcentroids = clusters.map((a) => a.reduce((v, s) => s + v, 0) / a.length)\n\t\tconst positions = centroids.sort((a, b) => a - b)\n\n\t\tfor (let i = 0; i < positions.length - 1; i++) {\n\t\t\tconst dist = Math.abs(positions[i] - positions[i + 1])\n\t\t\tif (dist < minDistanceBetweenClusters) {\n\t\t\t\tif (!history.includes(k - 1)) {\n\t\t\t\t\tisNotStable = true\n\t\t\t\t\tk--\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (isNotStable) {\n\t\t\tcontinue\n\t\t}\n\t\tfor (let i = 0; i < clusters.length; i++) {\n\t\t\tconst maxDistance = clusters[i].reduce((s, v) => Math.max(s, Math.abs(v - centroids[i])), 0)\n\t\t\tif (maxDistance > maxDistanceInCluster) {\n\t\t\t\tisNotStable = true\n\t\t\t\tk++\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn { centroids: centroids, clusters: clusters }\n}\n"]}
|
package/conversion/ckmeans.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
/**
|
|
2
4
|
* For a sorted input, counting the number of unique values
|
|
3
5
|
* is possible in constant time and constant memory. This is
|
|
@@ -281,5 +283,5 @@ const ckmeans = (x, nClusters) => {
|
|
|
281
283
|
}
|
|
282
284
|
return clusters;
|
|
283
285
|
};
|
|
284
|
-
|
|
286
|
+
exports.default = ckmeans;
|
|
285
287
|
//# sourceMappingURL=ckmeans.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckmeans.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,SAAS,iBAAiB,CAAC,CAAQ;IAClC,IAAI,gBAAgB,GAAG,CAAC,EACvB,aAAa,GAAG,SAAS,CAAA;IAC1B,KAAK,IAAI,CAAC,GAA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AG,CAAC,CAAC,CAAA;QAE/D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YACjB,YAAY,GAAG,WAAW,GAAG,CAAC,CAAA;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA;AAED,eAAe,OAAO,CAAA","sourcesContent":["/**\n * For a sorted input, counting the number of unique values\n * is possible in constant time and constant memory. This is\n * a simple implementation of the algorithm.\n *\n * Values are compared with `===`, so objects and non-primitive objects\n * are not handled in any special way.\n *\n * @param {Array<*>} x an array of any kind of value\n * @returns {number} count of unique values\n * @example\n * uniqueCountSorted([1, 2, 3]); // => 3\n * uniqueCountSorted([1, 1, 1]); // => 1\n */\nfunction uniqueCountSorted(x: any[]) {\n\tlet uniqueValueCount = 0,\n\t\tlastSeenValue = undefined\n\tfor (let i = 0; i < x.length; i++) {\n\t\tif (i === 0 || x[i] !== lastSeenValue) {\n\t\t\tlastSeenValue = x[i]\n\t\t\tuniqueValueCount++\n\t\t}\n\t}\n\treturn uniqueValueCount\n}\n\n/**\n * Sort an array of numbers by their numeric value, ensuring that the\n * array is not changed in place.\n *\n * This is necessary because the default behavior of .sort\n * in JavaScript is to sort arrays as string values\n *\n * [1, 10, 12, 102, 20].sort()\n * // output\n * [1, 10, 102, 12, 20]\n *\n * @param {Array<number>} x input array\n * @return {Array<number>} sorted array\n * @private\n * @example\n * numericSort([3, 2, 1]) // => [1, 2, 3]\n */\nfunction numericSort(x: number[]): number[] {\n\treturn (\n\t\tx\n\t\t\t// ensure the array is not changed in-place\n\t\t\t.slice()\n\t\t\t// comparator function that treats input as numeric\n\t\t\t.sort(function (a, b) {\n\t\t\t\treturn a - b\n\t\t\t})\n\t)\n}\n\n/**\n * Create a new column x row matrix.\n *\n * @private\n * @param {number} span\n * @param {number} rows\n * @return {Array<Array<number>>} matrix\n * @example\n * makeMatrix(10, 10);\n */\nfunction makeMatrix(span: number, rows: number) {\n\tconst matrix = []\n\tfor (let i = 0; i < span; i++) {\n\t\tconst column = []\n\t\tfor (let j = 0; j < rows; j++) {\n\t\t\tcolumn.push(0)\n\t\t}\n\t\tmatrix.push(column)\n\t}\n\treturn matrix\n}\n\n/**\n * Generates incrementally computed values based on the sums and sums of\n * squares for the data array\n *\n * @private\n * @param {number} j\n * @param {number} i\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n * @return {number}\n * @example\n * ssq(0, 1, [-1, 0, 2], [1, 1, 5]);\n */\nfunction ssq(j: number, i: number, sums: number[], sumsOfSquares: number[]) {\n\tlet sji // s(j, i)\n\tif (j > 0) {\n\t\tconst muji = (sums[i] - sums[j - 1]) / (i - j + 1) // mu(j, i)\n\t\tsji = sumsOfSquares[i] - sumsOfSquares[j - 1] - (i - j + 1) * muji * muji\n\t} else {\n\t\tsji = sumsOfSquares[i] - (sums[i] * sums[i]) / (i + 1)\n\t}\n\tif (sji < 0) {\n\t\treturn 0\n\t}\n\treturn sji\n}\n\n/**\n * Function that recursively divides and conquers computations\n * for cluster j\n *\n * @private\n * @param {number} iMin Minimum index in cluster to be computed\n * @param {number} iMax Maximum index in cluster to be computed\n * @param {number} cluster Index of the cluster currently being computed\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n */\nfunction fillMatrixColumn(iMin: number, iMax: number, cluster: number, matrix: number[][], backtrackMatrix: number[][], sums: number[], sumsOfSquares: number[]) {\n\tif (iMin > iMax) {\n\t\treturn\n\t}\n\n\t// Start at midpoint between iMin and iMax\n\tconst i = Math.floor((iMin + iMax) / 2)\n\n\tmatrix[cluster][i] = matrix[cluster - 1][i - 1]\n\tbacktrackMatrix[cluster][i] = i\n\n\tlet jlow = cluster // the lower end for j\n\n\tif (iMin > cluster) {\n\t\tjlow = Math.max(jlow, backtrackMatrix[cluster][iMin - 1] || 0)\n\t}\n\tjlow = Math.max(jlow, backtrackMatrix[cluster - 1][i] || 0)\n\n\tlet jhigh = i - 1 // the upper end for j\n\tif (iMax < matrix[0].length - 1) {\n\t\tjhigh = Math.min(jhigh, backtrackMatrix[cluster][iMax + 1] || 0)\n\t}\n\n\tlet sji\n\tlet sjlowi\n\tlet ssqjlow\n\tlet ssqj\n\tfor (let j = jhigh; j >= jlow; --j) {\n\t\tsji = ssq(j, i, sums, sumsOfSquares)\n\n\t\tif (sji + matrix[cluster - 1][jlow - 1] >= matrix[cluster][i]) {\n\t\t\tbreak\n\t\t}\n\n\t\t// Examine the lower bound of the cluster border\n\t\tsjlowi = ssq(jlow, i, sums, sumsOfSquares)\n\n\t\tssqjlow = sjlowi + matrix[cluster - 1][jlow - 1]\n\n\t\tif (ssqjlow < matrix[cluster][i]) {\n\t\t\t// Shrink the lower bound\n\t\t\tmatrix[cluster][i] = ssqjlow\n\t\t\tbacktrackMatrix[cluster][i] = jlow\n\t\t}\n\t\tjlow++\n\n\t\tssqj = sji + matrix[cluster - 1][j - 1]\n\t\tif (ssqj < matrix[cluster][i]) {\n\t\t\tmatrix[cluster][i] = ssqj\n\t\t\tbacktrackMatrix[cluster][i] = j\n\t\t}\n\t}\n\n\tfillMatrixColumn(iMin, i - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\tfillMatrixColumn(i + 1, iMax, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n}\n\n/**\n * Initializes the main matrices used in Ckmeans and kicks\n * off the divide and conquer cluster computation strategy\n *\n * @private\n * @param {Array<number>} data sorted array of values\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n */\nfunction fillMatrices(data: number[], matrix: number[][], backtrackMatrix: number[][]) {\n\tconst nValues = matrix[0].length\n\n\t// Shift values by the median to improve numeric stability\n\tconst shift = data[Math.floor(nValues / 2)]\n\n\t// Cumulative sum and cumulative sum of squares for all values in data array\n\tconst sums = [] as number[]\n\tconst sumsOfSquares = [] as number[]\n\n\t// Initialize first column in matrix & backtrackMatrix\n\tfor (let i = 0, shiftedValue; i < nValues; ++i) {\n\t\tshiftedValue = data[i] - shift\n\t\tif (i === 0) {\n\t\t\tsums.push(shiftedValue)\n\t\t\tsumsOfSquares.push(shiftedValue * shiftedValue)\n\t\t} else {\n\t\t\tsums.push(sums[i - 1] + shiftedValue)\n\t\t\tsumsOfSquares.push(sumsOfSquares[i - 1] + shiftedValue * shiftedValue)\n\t\t}\n\n\t\t// Initialize for cluster = 0\n\t\tmatrix[0][i] = ssq(0, i, sums, sumsOfSquares)\n\t\tbacktrackMatrix[0][i] = 0\n\t}\n\n\t// Initialize the rest of the span\n\tlet iMin\n\tfor (let cluster = 1; cluster < matrix.length; ++cluster) {\n\t\tif (cluster < matrix.length - 1) {\n\t\t\tiMin = cluster\n\t\t} else {\n\t\t\t// No need to compute matrix[K-1][0] ... matrix[K-1][N-2]\n\t\t\tiMin = nValues - 1\n\t\t}\n\n\t\tfillMatrixColumn(iMin, nValues - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\t}\n}\n\n/**\n * Ckmeans clustering is an improvement on heuristic-based clustering\n * approaches like Jenks. The algorithm was developed in\n * [Haizhou Wang and Mingzhou Song](http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Wang+Song.pdf)\n * as a [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) approach\n * to the problem of clustering numeric data into groups with the least\n * within-group sum-of-squared-deviations.\n *\n * Minimizing the difference within groups - what Wang & Song refer to as\n * `withinss`, or within sum-of-squares, means that groups are optimally\n * homogenous within and the data is split into representative groups.\n * This is very useful for visualization, where you may want to represent\n * a continuous variable in discrete color or style groups. This function\n * can provide groups that emphasize differences between data.\n *\n * Being a dynamic approach, this algorithm is based on two matrices that\n * store incrementally-computed values for squared deviations and backtracking\n * indexes.\n *\n * This implementation is based on Ckmeans 3.4.6, which introduced a new divide\n * and conquer approach that improved runtime from O(kn^2) to O(kn log(n)).\n *\n * Unlike the [original implementation](https://cran.r-project.org/web/packages/Ckmeans.1d.dp/index.html),\n * this implementation does not include any code to automatically determine\n * the optimal number of clusters: this information needs to be explicitly\n * provided.\n *\n * ### References\n * _Ckmeans.1d.dp: Optimal k-means Clustering in One Dimension by Dynamic\n * Programming_ Haizhou Wang and Mingzhou Song ISSN 2073-4859\n *\n * from The R Journal Vol. 3/2, December 2011\n * @param {Array<number>} x input data, as an array of number values\n * @param {number} nClusters number of desired classes. This cannot be\n * greater than the number of values in the data array.\n * @returns {Array<Array<number>>} clustered input\n * @throws {Error} if the number of requested clusters is higher than the size of the data\n * @example\n * ckmeans([-1, 2, -1, 2, 4, 5, 6, -1, 2, -1], 3);\n * // The input, clustered into groups of similar numbers.\n * //= [[-1, -1, -1, -1], [2, 2, 2], [4, 5, 6]]);\n */\nconst ckmeans = (x: number[], nClusters: number): number[][] => {\n\tif (nClusters > x.length) {\n\t\tthrow new Error('cannot generate more classes than there are data values')\n\t}\n\n\tconst sorted = numericSort(x)\n\t// we'll use this as the maximum number of clusters\n\tconst uniqueCount = uniqueCountSorted(sorted)\n\n\t// if all of the input values are identical, there's one cluster\n\t// with all of the input in it.\n\tif (uniqueCount === 1) {\n\t\treturn [sorted]\n\t}\n\n\t// named 'S' originally\n\tconst matrix = makeMatrix(nClusters, sorted.length)\n\t// named 'J' originally\n\tconst backtrackMatrix = makeMatrix(nClusters, sorted.length)\n\n\t// This is a dynamic programming way to solve the problem of minimizing\n\t// within-cluster sum of squares. It's similar to linear regression\n\t// in this way, and this calculation incrementally computes the\n\t// sum of squares that are later read.\n\tfillMatrices(sorted, matrix, backtrackMatrix)\n\n\t// The real work of Ckmeans clustering happens in the matrix generation:\n\t// the generated matrices encode all possible clustering combinations, and\n\t// once they're generated we can solve for the best clustering groups\n\t// very quickly.\n\tconst clusters = []\n\tlet clusterRight = backtrackMatrix[0].length - 1\n\n\t// Backtrack the clusters from the dynamic programming matrix. This\n\t// starts at the bottom-right corner of the matrix (if the top-left is 0, 0),\n\t// and moves the cluster target with the loop.\n\tfor (let cluster = backtrackMatrix.length - 1; cluster >= 0; cluster--) {\n\t\tconst clusterLeft = backtrackMatrix[cluster][clusterRight]\n\n\t\t// fill the cluster from the sorted input by taking a slice of the\n\t\t// array. the backtrack matrix makes this easy - it stores the\n\t\t// indexes where the cluster should start and end.\n\t\tclusters[cluster] = sorted.slice(clusterLeft, clusterRight + 1)\n\n\t\tif (cluster > 0) {\n\t\t\tclusterRight = clusterLeft - 1\n\t\t}\n\t}\n\n\treturn clusters\n}\n\nexport default ckmeans\n"]}
|
|
1
|
+
{"version":3,"file":"ckmeans.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;GAaG;AACH,SAAS,iBAAiB,CAAC,CAAQ;IAClC,IAAI,gBAAgB,GAAG,CAAC,EACvB,aAAa,GAAG,SAAS,CAAA;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,aAAa,EAAE,CAAC;YACvC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;YACpB,gBAAgB,EAAE,CAAA;QACnB,CAAC;IACF,CAAC;IACD,OAAO,gBAAgB,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,WAAW,CAAC,CAAW;IAC/B,OAAO,CACN,CAAC;QACA,2CAA2C;SAC1C,KAAK,EAAE;QACR,mDAAmD;SAClD,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,CAAA;IACb,CAAC,CAAC,CACH,CAAA;AACF,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC7C,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,E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,0EAA0E;IAC1E,qEAAqE;IACrE,gBAAgB;IAChB,MAAM,QAAQ,GAAG,EAAE,CAAA;IACnB,IAAI,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;IAEhD,mEAAmE;IACnE,6EAA6E;IAC7E,8CAA8C;IAC9C,KAAK,IAAI,OAAO,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;QACxE,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAA;QAE1D,kEAAkE;QAClE,8DAA8D;QAC9D,kDAAkD;QAClD,QAAQ,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,CAAC,CAAC,CAAA;QAE/D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YACjB,YAAY,GAAG,WAAW,GAAG,CAAC,CAAA;QAC/B,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC,CAAA;AAED,kBAAe,OAAO,CAAA","sourcesContent":["/**\n * For a sorted input, counting the number of unique values\n * is possible in constant time and constant memory. This is\n * a simple implementation of the algorithm.\n *\n * Values are compared with `===`, so objects and non-primitive objects\n * are not handled in any special way.\n *\n * @param {Array<*>} x an array of any kind of value\n * @returns {number} count of unique values\n * @example\n * uniqueCountSorted([1, 2, 3]); // => 3\n * uniqueCountSorted([1, 1, 1]); // => 1\n */\nfunction uniqueCountSorted(x: any[]) {\n\tlet uniqueValueCount = 0,\n\t\tlastSeenValue = undefined\n\tfor (let i = 0; i < x.length; i++) {\n\t\tif (i === 0 || x[i] !== lastSeenValue) {\n\t\t\tlastSeenValue = x[i]\n\t\t\tuniqueValueCount++\n\t\t}\n\t}\n\treturn uniqueValueCount\n}\n\n/**\n * Sort an array of numbers by their numeric value, ensuring that the\n * array is not changed in place.\n *\n * This is necessary because the default behavior of .sort\n * in JavaScript is to sort arrays as string values\n *\n * [1, 10, 12, 102, 20].sort()\n * // output\n * [1, 10, 102, 12, 20]\n *\n * @param {Array<number>} x input array\n * @return {Array<number>} sorted array\n * @private\n * @example\n * numericSort([3, 2, 1]) // => [1, 2, 3]\n */\nfunction numericSort(x: number[]): number[] {\n\treturn (\n\t\tx\n\t\t\t// ensure the array is not changed in-place\n\t\t\t.slice()\n\t\t\t// comparator function that treats input as numeric\n\t\t\t.sort(function (a, b) {\n\t\t\t\treturn a - b\n\t\t\t})\n\t)\n}\n\n/**\n * Create a new column x row matrix.\n *\n * @private\n * @param {number} span\n * @param {number} rows\n * @return {Array<Array<number>>} matrix\n * @example\n * makeMatrix(10, 10);\n */\nfunction makeMatrix(span: number, rows: number) {\n\tconst matrix = []\n\tfor (let i = 0; i < span; i++) {\n\t\tconst column = []\n\t\tfor (let j = 0; j < rows; j++) {\n\t\t\tcolumn.push(0)\n\t\t}\n\t\tmatrix.push(column)\n\t}\n\treturn matrix\n}\n\n/**\n * Generates incrementally computed values based on the sums and sums of\n * squares for the data array\n *\n * @private\n * @param {number} j\n * @param {number} i\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n * @return {number}\n * @example\n * ssq(0, 1, [-1, 0, 2], [1, 1, 5]);\n */\nfunction ssq(j: number, i: number, sums: number[], sumsOfSquares: number[]) {\n\tlet sji // s(j, i)\n\tif (j > 0) {\n\t\tconst muji = (sums[i] - sums[j - 1]) / (i - j + 1) // mu(j, i)\n\t\tsji = sumsOfSquares[i] - sumsOfSquares[j - 1] - (i - j + 1) * muji * muji\n\t} else {\n\t\tsji = sumsOfSquares[i] - (sums[i] * sums[i]) / (i + 1)\n\t}\n\tif (sji < 0) {\n\t\treturn 0\n\t}\n\treturn sji\n}\n\n/**\n * Function that recursively divides and conquers computations\n * for cluster j\n *\n * @private\n * @param {number} iMin Minimum index in cluster to be computed\n * @param {number} iMax Maximum index in cluster to be computed\n * @param {number} cluster Index of the cluster currently being computed\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n * @param {Array<number>} sums\n * @param {Array<number>} sumsOfSquares\n */\nfunction fillMatrixColumn(iMin: number, iMax: number, cluster: number, matrix: number[][], backtrackMatrix: number[][], sums: number[], sumsOfSquares: number[]) {\n\tif (iMin > iMax) {\n\t\treturn\n\t}\n\n\t// Start at midpoint between iMin and iMax\n\tconst i = Math.floor((iMin + iMax) / 2)\n\n\tmatrix[cluster][i] = matrix[cluster - 1][i - 1]\n\tbacktrackMatrix[cluster][i] = i\n\n\tlet jlow = cluster // the lower end for j\n\n\tif (iMin > cluster) {\n\t\tjlow = Math.max(jlow, backtrackMatrix[cluster][iMin - 1] || 0)\n\t}\n\tjlow = Math.max(jlow, backtrackMatrix[cluster - 1][i] || 0)\n\n\tlet jhigh = i - 1 // the upper end for j\n\tif (iMax < matrix[0].length - 1) {\n\t\tjhigh = Math.min(jhigh, backtrackMatrix[cluster][iMax + 1] || 0)\n\t}\n\n\tlet sji\n\tlet sjlowi\n\tlet ssqjlow\n\tlet ssqj\n\tfor (let j = jhigh; j >= jlow; --j) {\n\t\tsji = ssq(j, i, sums, sumsOfSquares)\n\n\t\tif (sji + matrix[cluster - 1][jlow - 1] >= matrix[cluster][i]) {\n\t\t\tbreak\n\t\t}\n\n\t\t// Examine the lower bound of the cluster border\n\t\tsjlowi = ssq(jlow, i, sums, sumsOfSquares)\n\n\t\tssqjlow = sjlowi + matrix[cluster - 1][jlow - 1]\n\n\t\tif (ssqjlow < matrix[cluster][i]) {\n\t\t\t// Shrink the lower bound\n\t\t\tmatrix[cluster][i] = ssqjlow\n\t\t\tbacktrackMatrix[cluster][i] = jlow\n\t\t}\n\t\tjlow++\n\n\t\tssqj = sji + matrix[cluster - 1][j - 1]\n\t\tif (ssqj < matrix[cluster][i]) {\n\t\t\tmatrix[cluster][i] = ssqj\n\t\t\tbacktrackMatrix[cluster][i] = j\n\t\t}\n\t}\n\n\tfillMatrixColumn(iMin, i - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\tfillMatrixColumn(i + 1, iMax, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n}\n\n/**\n * Initializes the main matrices used in Ckmeans and kicks\n * off the divide and conquer cluster computation strategy\n *\n * @private\n * @param {Array<number>} data sorted array of values\n * @param {Array<Array<number>>} matrix\n * @param {Array<Array<number>>} backtrackMatrix\n */\nfunction fillMatrices(data: number[], matrix: number[][], backtrackMatrix: number[][]) {\n\tconst nValues = matrix[0].length\n\n\t// Shift values by the median to improve numeric stability\n\tconst shift = data[Math.floor(nValues / 2)]\n\n\t// Cumulative sum and cumulative sum of squares for all values in data array\n\tconst sums = [] as number[]\n\tconst sumsOfSquares = [] as number[]\n\n\t// Initialize first column in matrix & backtrackMatrix\n\tfor (let i = 0, shiftedValue; i < nValues; ++i) {\n\t\tshiftedValue = data[i] - shift\n\t\tif (i === 0) {\n\t\t\tsums.push(shiftedValue)\n\t\t\tsumsOfSquares.push(shiftedValue * shiftedValue)\n\t\t} else {\n\t\t\tsums.push(sums[i - 1] + shiftedValue)\n\t\t\tsumsOfSquares.push(sumsOfSquares[i - 1] + shiftedValue * shiftedValue)\n\t\t}\n\n\t\t// Initialize for cluster = 0\n\t\tmatrix[0][i] = ssq(0, i, sums, sumsOfSquares)\n\t\tbacktrackMatrix[0][i] = 0\n\t}\n\n\t// Initialize the rest of the span\n\tlet iMin\n\tfor (let cluster = 1; cluster < matrix.length; ++cluster) {\n\t\tif (cluster < matrix.length - 1) {\n\t\t\tiMin = cluster\n\t\t} else {\n\t\t\t// No need to compute matrix[K-1][0] ... matrix[K-1][N-2]\n\t\t\tiMin = nValues - 1\n\t\t}\n\n\t\tfillMatrixColumn(iMin, nValues - 1, cluster, matrix, backtrackMatrix, sums, sumsOfSquares)\n\t}\n}\n\n/**\n * Ckmeans clustering is an improvement on heuristic-based clustering\n * approaches like Jenks. The algorithm was developed in\n * [Haizhou Wang and Mingzhou Song](http://journal.r-project.org/archive/2011-2/RJournal_2011-2_Wang+Song.pdf)\n * as a [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) approach\n * to the problem of clustering numeric data into groups with the least\n * within-group sum-of-squared-deviations.\n *\n * Minimizing the difference within groups - what Wang & Song refer to as\n * `withinss`, or within sum-of-squares, means that groups are optimally\n * homogenous within and the data is split into representative groups.\n * This is very useful for visualization, where you may want to represent\n * a continuous variable in discrete color or style groups. This function\n * can provide groups that emphasize differences between data.\n *\n * Being a dynamic approach, this algorithm is based on two matrices that\n * store incrementally-computed values for squared deviations and backtracking\n * indexes.\n *\n * This implementation is based on Ckmeans 3.4.6, which introduced a new divide\n * and conquer approach that improved runtime from O(kn^2) to O(kn log(n)).\n *\n * Unlike the [original implementation](https://cran.r-project.org/web/packages/Ckmeans.1d.dp/index.html),\n * this implementation does not include any code to automatically determine\n * the optimal number of clusters: this information needs to be explicitly\n * provided.\n *\n * ### References\n * _Ckmeans.1d.dp: Optimal k-means Clustering in One Dimension by Dynamic\n * Programming_ Haizhou Wang and Mingzhou Song ISSN 2073-4859\n *\n * from The R Journal Vol. 3/2, December 2011\n * @param {Array<number>} x input data, as an array of number values\n * @param {number} nClusters number of desired classes. This cannot be\n * greater than the number of values in the data array.\n * @returns {Array<Array<number>>} clustered input\n * @throws {Error} if the number of requested clusters is higher than the size of the data\n * @example\n * ckmeans([-1, 2, -1, 2, 4, 5, 6, -1, 2, -1], 3);\n * // The input, clustered into groups of similar numbers.\n * //= [[-1, -1, -1, -1], [2, 2, 2], [4, 5, 6]]);\n */\nconst ckmeans = (x: number[], nClusters: number): number[][] => {\n\tif (nClusters > x.length) {\n\t\tthrow new Error('cannot generate more classes than there are data values')\n\t}\n\n\tconst sorted = numericSort(x)\n\t// we'll use this as the maximum number of clusters\n\tconst uniqueCount = uniqueCountSorted(sorted)\n\n\t// if all of the input values are identical, there's one cluster\n\t// with all of the input in it.\n\tif (uniqueCount === 1) {\n\t\treturn [sorted]\n\t}\n\n\t// named 'S' originally\n\tconst matrix = makeMatrix(nClusters, sorted.length)\n\t// named 'J' originally\n\tconst backtrackMatrix = makeMatrix(nClusters, sorted.length)\n\n\t// This is a dynamic programming way to solve the problem of minimizing\n\t// within-cluster sum of squares. It's similar to linear regression\n\t// in this way, and this calculation incrementally computes the\n\t// sum of squares that are later read.\n\tfillMatrices(sorted, matrix, backtrackMatrix)\n\n\t// The real work of Ckmeans clustering happens in the matrix generation:\n\t// the generated matrices encode all possible clustering combinations, and\n\t// once they're generated we can solve for the best clustering groups\n\t// very quickly.\n\tconst clusters = []\n\tlet clusterRight = backtrackMatrix[0].length - 1\n\n\t// Backtrack the clusters from the dynamic programming matrix. This\n\t// starts at the bottom-right corner of the matrix (if the top-left is 0, 0),\n\t// and moves the cluster target with the loop.\n\tfor (let cluster = backtrackMatrix.length - 1; cluster >= 0; cluster--) {\n\t\tconst clusterLeft = backtrackMatrix[cluster][clusterRight]\n\n\t\t// fill the cluster from the sorted input by taking a slice of the\n\t\t// array. the backtrack matrix makes this easy - it stores the\n\t\t// indexes where the cluster should start and end.\n\t\tclusters[cluster] = sorted.slice(clusterLeft, clusterRight + 1)\n\n\t\tif (cluster > 0) {\n\t\t\tclusterRight = clusterLeft - 1\n\t\t}\n\t}\n\n\treturn clusters\n}\n\nexport default ckmeans\n"]}
|
package/generic/index.js
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./model"), exports);
|
|
2
18
|
//# sourceMappingURL=index.js.map
|
package/generic/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tmp/generic/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tmp/generic/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB","sourcesContent":["export * from './model'\n"]}
|
package/generic/model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DecryptedContact, DecryptedForm as CardinalForm, DecryptedService } from '@icure/cardinal-sdk';
|
|
2
2
|
import { FormValuesContainer, Version, VersionedData } from '../generic';
|
|
3
3
|
import { ServiceMetadata } from './model';
|
|
4
4
|
import { FieldMetadata, FieldValue, Validator } from '../components/model';
|
|
@@ -49,7 +49,7 @@ export declare class BridgedFormValuesContainer implements FormValuesContainer<F
|
|
|
49
49
|
constructor(responsible: string, contactFormValuesContainer: ContactFormValuesContainer, interpreter?: (<T, S extends {
|
|
50
50
|
[key: string]: unknown;
|
|
51
51
|
[key: symbol]: unknown;
|
|
52
|
-
}>(formula: string, sandbox: S) => T | undefined) | undefined, contact?:
|
|
52
|
+
}>(formula: string, sandbox: S) => T | undefined) | undefined, contact?: DecryptedContact, initialValuesProvider?: (anchorId?: string, templateId?: string) => {
|
|
53
53
|
metadata: FieldMetadata;
|
|
54
54
|
revisionsFilter: (id: string, history: Version<FieldMetadata>[]) => (string | null)[];
|
|
55
55
|
formula: string;
|
|
@@ -91,13 +91,13 @@ export declare class BridgedFormValuesContainer implements FormValuesContainer<F
|
|
|
91
91
|
* Each ContactFormValuesContainer has a reference to its `rootForm`.
|
|
92
92
|
* The `serviceFactory` and `formFactory` are used to create new services and add sub-forms.
|
|
93
93
|
*/
|
|
94
|
-
export declare class ContactFormValuesContainer implements FormValuesContainer<
|
|
95
|
-
rootForm:
|
|
96
|
-
currentContact:
|
|
97
|
-
contactsHistory:
|
|
94
|
+
export declare class ContactFormValuesContainer implements FormValuesContainer<DecryptedService, ServiceMetadata> {
|
|
95
|
+
rootForm: CardinalForm;
|
|
96
|
+
currentContact: DecryptedContact;
|
|
97
|
+
contactsHistory: DecryptedContact[];
|
|
98
98
|
children: ContactFormValuesContainer[];
|
|
99
|
-
serviceFactory: (label: string, serviceId?: string) =>
|
|
100
|
-
formFactory: (parentId: string, anchorId: string, formTemplateId: string, label: string) => Promise<
|
|
99
|
+
serviceFactory: (label: string, serviceId?: string) => DecryptedService;
|
|
100
|
+
formFactory: (parentId: string, anchorId: string, formTemplateId: string, label: string) => Promise<CardinalForm>;
|
|
101
101
|
formRecycler: (formId: string) => Promise<void>;
|
|
102
102
|
changeListeners: ((newValue: ContactFormValuesContainer) => void)[];
|
|
103
103
|
private _id;
|
|
@@ -107,25 +107,25 @@ export declare class ContactFormValuesContainer implements FormValuesContainer<S
|
|
|
107
107
|
/**
|
|
108
108
|
* Returns a contact that combines the content of the contact in this form with the content of all contents stored in the children
|
|
109
109
|
*/
|
|
110
|
-
coordinatedContact():
|
|
110
|
+
coordinatedContact(): DecryptedContact;
|
|
111
111
|
/**
|
|
112
112
|
* Returns a contact that combines the content of the contact in this form with the content of all contents stored in the children
|
|
113
113
|
*/
|
|
114
|
-
allForms():
|
|
115
|
-
constructor(rootForm:
|
|
114
|
+
allForms(): CardinalForm[];
|
|
115
|
+
constructor(rootForm: CardinalForm, currentContact: DecryptedContact, contactsHistory: DecryptedContact[], serviceFactory: (label: string, serviceId?: string) => DecryptedService, children: ContactFormValuesContainer[], formFactory: (parentId: string, anchorId: string, formTemplateId: string, label: string) => Promise<CardinalForm>, formRecycler: (formId: string) => Promise<void>, changeListeners?: ((newValue: ContactFormValuesContainer) => void)[], initialised?: boolean);
|
|
116
116
|
synchronise(): this;
|
|
117
117
|
registerChildFormValuesContainer(childFormValueContainer: ContactFormValuesContainer): void;
|
|
118
|
-
static fromFormsHierarchy(rootForm:
|
|
118
|
+
static fromFormsHierarchy(rootForm: CardinalForm, currentContact: DecryptedContact, contactsHistory: DecryptedContact[], serviceFactory: (label: string, serviceId?: string) => DecryptedService, formChildrenProvider: (parentId: string | undefined) => Promise<CardinalForm[]>, formFactory: (parentId: string, anchorId: string, formTemplateId: string, label: string) => Promise<CardinalForm>, formRecycler: (formId: string) => Promise<void>, changeListeners?: ((newValue: ContactFormValuesContainer) => void)[]): Promise<ContactFormValuesContainer>;
|
|
119
119
|
getLabel(): string;
|
|
120
120
|
getFormId(): string | undefined;
|
|
121
121
|
registerChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void;
|
|
122
122
|
unregisterChangeListener(listener: (newValue: ContactFormValuesContainer) => void): void;
|
|
123
123
|
getChildren(): ContactFormValuesContainer[];
|
|
124
124
|
getValidationErrors(): [FieldMetadata, string][];
|
|
125
|
-
getValues(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<
|
|
125
|
+
getValues(revisionsFilter: (id: string, history: Version<ServiceMetadata>[]) => (string | null)[]): VersionedData<DecryptedService>;
|
|
126
126
|
getMetadata(id: string, revisions: (string | null)[]): VersionedData<ServiceMetadata>;
|
|
127
127
|
setMetadata(meta: ServiceMetadata, id?: string): void;
|
|
128
|
-
setValue(label: string, language: string, value?:
|
|
128
|
+
setValue(label: string, language: string, value?: DecryptedService, id?: string, metadata?: ServiceMetadata, changeListenersOverrider?: (fvc: ContactFormValuesContainer) => void): void;
|
|
129
129
|
delete(serviceId: string): void;
|
|
130
130
|
compute<T>(): T | undefined;
|
|
131
131
|
/** returns all services in history that match a selector
|