@icure/form 2.0.10 → 2.0.11
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/components/common/field-with-options.js +5 -9
- package/components/common/field-with-options.js.map +1 -1
- package/components/common/field.js +21 -25
- package/components/common/field.js.map +1 -1
- package/components/common/index.js +1 -17
- package/components/common/index.js.map +1 -1
- package/components/common/metadata-buttons-bar.js +54 -58
- package/components/common/metadata-buttons-bar.js.map +1 -1
- package/components/common/styles/paths.js +10 -13
- package/components/common/styles/paths.js.map +1 -1
- package/components/common/utils.js +10 -20
- package/components/common/utils.js.map +1 -1
- package/components/icure-button/index.js +15 -19
- package/components/icure-button/index.js.map +1 -1
- package/components/icure-button-group/index.js +22 -26
- package/components/icure-button-group/index.js.map +1 -1
- package/components/icure-date-picker/index.js +27 -31
- package/components/icure-date-picker/index.js.map +1 -1
- package/components/icure-dropdown-field/index.js +21 -25
- package/components/icure-dropdown-field/index.js.map +1 -1
- package/components/icure-form/fields/button/button.js +13 -17
- package/components/icure-form/fields/button/button.js.map +1 -1
- package/components/icure-form/fields/button/index.js +1 -17
- package/components/icure-form/fields/button/index.js.map +1 -1
- package/components/icure-form/fields/button-group/checkbox.js +10 -14
- package/components/icure-form/fields/button-group/checkbox.js.map +1 -1
- package/components/icure-form/fields/button-group/index.js +2 -18
- package/components/icure-form/fields/button-group/index.js.map +1 -1
- package/components/icure-form/fields/button-group/radio-button.js +10 -14
- package/components/icure-form/fields/button-group/radio-button.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-picker.js +8 -12
- package/components/icure-form/fields/date-picker/date-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/date-time-picker.js +8 -12
- package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -1
- package/components/icure-form/fields/date-picker/index.js +3 -19
- package/components/icure-form/fields/date-picker/index.js.map +1 -1
- package/components/icure-form/fields/date-picker/time-picker.js +8 -12
- package/components/icure-form/fields/date-picker/time-picker.js.map +1 -1
- package/components/icure-form/fields/dropdown/dropdown-field.js +10 -14
- package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -1
- package/components/icure-form/fields/dropdown/index.js +1 -17
- package/components/icure-form/fields/dropdown/index.js.map +1 -1
- package/components/icure-form/fields/index.js +10 -26
- package/components/icure-form/fields/index.js.map +1 -1
- package/components/icure-form/fields/items-list-field/index.js +1 -17
- 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 +7 -11
- package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -1
- package/components/icure-form/fields/label/index.js +1 -17
- package/components/icure-form/fields/label/index.js.map +1 -1
- package/components/icure-form/fields/label/label.js +11 -15
- package/components/icure-form/fields/label/label.js.map +1 -1
- package/components/icure-form/fields/measure-field/index.js +1 -17
- package/components/icure-form/fields/measure-field/index.js.map +1 -1
- package/components/icure-form/fields/measure-field/measure-field.js +8 -12
- package/components/icure-form/fields/measure-field/measure-field.js.map +1 -1
- package/components/icure-form/fields/number-field/index.js +1 -17
- package/components/icure-form/fields/number-field/index.js.map +1 -1
- package/components/icure-form/fields/number-field/number-field.js +8 -12
- package/components/icure-form/fields/number-field/number-field.js.map +1 -1
- package/components/icure-form/fields/text-field/index.js +1 -17
- package/components/icure-form/fields/text-field/index.js.map +1 -1
- package/components/icure-form/fields/text-field/text-field.js +20 -24
- package/components/icure-form/fields/text-field/text-field.js.map +1 -1
- package/components/icure-form/fields/token-field/index.js +1 -17
- package/components/icure-form/fields/token-field/index.js.map +1 -1
- package/components/icure-form/fields/token-field/token-field.js +8 -12
- package/components/icure-form/fields/token-field/token-field.js.map +1 -1
- package/components/icure-form/fields/utils/index.js +5 -13
- package/components/icure-form/fields/utils/index.js.map +1 -1
- package/components/icure-form/index.js +28 -32
- package/components/icure-form/index.js.map +1 -1
- package/components/icure-form/renderer/form/form-selection-button.js +15 -19
- package/components/icure-form/renderer/form/form-selection-button.js.map +1 -1
- package/components/icure-form/renderer/form/form.js +123 -127
- package/components/icure-form/renderer/form/form.js.map +1 -1
- package/components/icure-form/renderer/index.js +1 -2
- package/components/icure-label/index.js +13 -17
- package/components/icure-label/index.js.map +1 -1
- package/components/icure-text-field/index.js +98 -106
- package/components/icure-text-field/index.js.map +1 -1
- package/components/icure-text-field/plugin/caret-fix-plugin.js +3 -7
- package/components/icure-text-field/plugin/caret-fix-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/has-content-class-plugin.js +3 -7
- package/components/icure-text-field/plugin/has-content-class-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/mask-plugin.js +7 -11
- package/components/icure-text-field/plugin/mask-plugin.js.map +1 -1
- package/components/icure-text-field/plugin/regexp-plugin.js +5 -9
- package/components/icure-text-field/plugin/regexp-plugin.js.map +1 -1
- package/components/icure-text-field/prosemirror-commands.js +10 -15
- package/components/icure-text-field/prosemirror-commands.js.map +1 -1
- package/components/icure-text-field/prosemirror-utils.js +1 -5
- package/components/icure-text-field/prosemirror-utils.js.map +1 -1
- package/components/icure-text-field/schema/common-marks.js +3 -7
- package/components/icure-text-field/schema/common-marks.js.map +1 -1
- package/components/icure-text-field/schema/date-time-schema.js +3 -9
- package/components/icure-text-field/schema/date-time-schema.js.map +1 -1
- package/components/icure-text-field/schema/decimal-schema.js +1 -5
- package/components/icure-text-field/schema/decimal-schema.js.map +1 -1
- package/components/icure-text-field/schema/index.js +17 -21
- package/components/icure-text-field/schema/index.js.map +1 -1
- package/components/icure-text-field/schema/items-list-schema.js +3 -7
- package/components/icure-text-field/schema/items-list-schema.js.map +1 -1
- package/components/icure-text-field/schema/markdown-schema.js +5 -9
- package/components/icure-text-field/schema/markdown-schema.js.map +1 -1
- package/components/icure-text-field/schema/measure-schema.js +6 -12
- package/components/icure-text-field/schema/measure-schema.js.map +1 -1
- package/components/icure-text-field/schema/token-schema.js +5 -9
- package/components/icure-text-field/schema/token-schema.js.map +1 -1
- package/components/icure-text-field/schema/utils.js +2 -7
- package/components/icure-text-field/schema/utils.js.map +1 -1
- package/components/icure-text-field/selection-companion.js +1 -5
- package/components/icure-text-field/selection-companion.js.map +1 -1
- package/components/icure-text-field/suggestion-palette.js +3 -10
- package/components/icure-text-field/suggestion-palette.js.map +1 -1
- package/components/index.js +5 -21
- package/components/index.js.map +1 -1
- package/components/model/index.js +22 -46
- package/components/model/index.js.map +1 -1
- package/components/themes/default/index.js +30 -32
- package/components/themes/default/index.js.map +1 -1
- package/components/themes/icure-blue/index.js +45 -47
- package/components/themes/icure-blue/index.js.map +1 -1
- package/components/themes/kendo/index.js +45 -47
- package/components/themes/kendo/index.js.map +1 -1
- package/conversion/ckmeans-grouping.js +3 -10
- package/conversion/ckmeans-grouping.js.map +1 -1
- package/conversion/ckmeans.js +1 -3
- package/conversion/ckmeans.js.map +1 -1
- package/conversion/icure-convert.js +18 -22
- package/conversion/icure-convert.js.map +1 -1
- package/generic/index.js +1 -17
- package/generic/index.js.map +1 -1
- package/generic/model.js +1 -2
- package/icure/form-values-container.js +26 -31
- package/icure/form-values-container.js.map +1 -1
- package/icure/icure-utils.js +10 -21
- package/icure/icure-utils.js.map +1 -1
- package/icure/index.js +2 -18
- package/icure/index.js.map +1 -1
- package/icure/model.js +1 -2
- package/index.js +1 -17
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/code-utils.js +11 -19
- package/utils/code-utils.js.map +1 -1
- package/utils/dates.js +9 -21
- package/utils/dates.js.map +1 -1
- package/utils/fields-values-provider.js +8 -17
- package/utils/fields-values-provider.js.map +1 -1
- package/utils/form-value-container.js +3 -7
- package/utils/form-value-container.js.map +1 -1
- package/utils/interpreter.js +1 -5
- package/utils/interpreter.js.map +1 -1
- package/utils/languages.js +3 -8
- package/utils/languages.js.map +1 -1
- package/utils/markdown.js +6 -11
- package/utils/markdown.js.map +1 -1
- package/utils/no-lodash.js +3 -9
- package/utils/no-lodash.js.map +1 -1
- package/utils/primitive.js +7 -12
- package/utils/primitive.js.map +1 -1
- package/.yarn/cache/@lit-labs-ssr-dom-shim-npm-1.2.1-d14ce3e3e5-5667c44f58.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.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/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.23.0-57eb718541-f5ab1593cb.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.36.0-830888802f-38986f55e4.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.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/icure-text-field/schema/items-list.d.ts +0 -3
- package/components/icure-text-field/schema/items-list.js +0 -31
- package/components/icure-text-field/schema/items-list.js.map +0 -1
- package/components/themes/ehr-lite/index.d.ts +0 -1
- package/components/themes/ehr-lite/index.js +0 -321
- package/components/themes/ehr-lite/index.js.map +0 -1
- package/utils/icure-utils.d.ts +0 -16
- package/utils/icure-utils.js +0 -105
- package/utils/icure-utils.js.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const icure_label_1 = require("../../icure-label");
|
|
9
|
-
const icure_text_field_1 = require("../../icure-text-field");
|
|
1
|
+
import { CheckBox, DatePicker, DateTimePicker, DropdownField, ItemsListField, Label, Button, MeasureField, NumberField, RadioButton, TextField, TimePicker, TokenField, } from '../../icure-form/fields';
|
|
2
|
+
import { IcureButtonGroup } from '../../icure-button-group';
|
|
3
|
+
import { IcureDatePickerField } from '../../icure-date-picker';
|
|
4
|
+
import { IcureDropdownField } from '../../icure-dropdown-field';
|
|
5
|
+
import { IcureForm } from '../../icure-form';
|
|
6
|
+
import { IcureLabel } from '../../icure-label';
|
|
7
|
+
import { IcureTextField, MetadataButtonBarWrapper } from '../../icure-text-field';
|
|
10
8
|
// @ts-ignore
|
|
11
|
-
|
|
12
|
-
const kendoCss =
|
|
9
|
+
import { css } from 'lit';
|
|
10
|
+
const kendoCss = css `.icure-text-field,
|
|
13
11
|
.icure-button-group {
|
|
14
12
|
padding-top: 16px;
|
|
15
13
|
width: 100%;
|
|
@@ -229,65 +227,65 @@ app-date-picker {
|
|
|
229
227
|
flex: 1 1 auto;
|
|
230
228
|
width: auto;
|
|
231
229
|
}`;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
class KendoIcureButtonGroup extends
|
|
230
|
+
import { MetadataButtonBar } from '../../common/metadata-buttons-bar';
|
|
231
|
+
import { IcureButton } from '../../icure-button';
|
|
232
|
+
import { FormSelectionButton } from '../../icure-form/renderer/form/form-selection-button';
|
|
233
|
+
class KendoIcureButtonGroup extends IcureButtonGroup {
|
|
236
234
|
static get styles() {
|
|
237
|
-
return [...
|
|
235
|
+
return [...IcureButtonGroup.styles, kendoCss];
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
|
-
class KendoIcureDatePickerField extends
|
|
238
|
+
class KendoIcureDatePickerField extends IcureDatePickerField {
|
|
241
239
|
static get styles() {
|
|
242
|
-
return [...
|
|
240
|
+
return [...IcureDatePickerField.styles, kendoCss];
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
|
-
class KendoIcureDropdownField extends
|
|
243
|
+
class KendoIcureDropdownField extends IcureDropdownField {
|
|
246
244
|
static get styles() {
|
|
247
|
-
return [...
|
|
245
|
+
return [...IcureDropdownField.styles, kendoCss];
|
|
248
246
|
}
|
|
249
247
|
}
|
|
250
|
-
class KendoIcureForm extends
|
|
248
|
+
class KendoIcureForm extends IcureForm {
|
|
251
249
|
static get styles() {
|
|
252
|
-
return [...
|
|
250
|
+
return [...IcureForm.styles, kendoCss];
|
|
253
251
|
}
|
|
254
252
|
}
|
|
255
|
-
class KendoIcureLabel extends
|
|
253
|
+
class KendoIcureLabel extends IcureLabel {
|
|
256
254
|
static get styles() {
|
|
257
|
-
return [...
|
|
255
|
+
return [...IcureLabel.styles, kendoCss];
|
|
258
256
|
}
|
|
259
257
|
}
|
|
260
|
-
class KendoIcureButton extends
|
|
258
|
+
class KendoIcureButton extends IcureButton {
|
|
261
259
|
static get styles() {
|
|
262
|
-
return [...
|
|
260
|
+
return [...IcureButton.styles, kendoCss];
|
|
263
261
|
}
|
|
264
262
|
}
|
|
265
|
-
class KendoIcureTextField extends
|
|
263
|
+
class KendoIcureTextField extends IcureTextField {
|
|
266
264
|
static get styles() {
|
|
267
|
-
return [...
|
|
265
|
+
return [...IcureTextField.styles, kendoCss];
|
|
268
266
|
}
|
|
269
267
|
}
|
|
270
|
-
class KendoLabel extends
|
|
268
|
+
class KendoLabel extends Label {
|
|
271
269
|
static get styles() {
|
|
272
|
-
return [...
|
|
270
|
+
return [...Label.styles, kendoCss];
|
|
273
271
|
}
|
|
274
272
|
}
|
|
275
|
-
class KendoMetadataButtonBar extends
|
|
273
|
+
class KendoMetadataButtonBar extends MetadataButtonBar {
|
|
276
274
|
static get styles() {
|
|
277
|
-
return [...
|
|
275
|
+
return [...MetadataButtonBar.styles, kendoCss];
|
|
278
276
|
}
|
|
279
277
|
}
|
|
280
|
-
class KendoButton extends
|
|
278
|
+
class KendoButton extends Button {
|
|
281
279
|
static get styles() {
|
|
282
|
-
return [...
|
|
280
|
+
return [...Button.styles, kendoCss];
|
|
283
281
|
}
|
|
284
282
|
}
|
|
285
283
|
customElements.define('icure-metadata-buttons-bar', KendoMetadataButtonBar);
|
|
286
|
-
customElements.define('icure-metadata-buttons-bar-wrapper',
|
|
287
|
-
customElements.define('icure-form-checkbox',
|
|
288
|
-
customElements.define('icure-form-date-picker',
|
|
289
|
-
customElements.define('icure-form-date-time-picker',
|
|
290
|
-
customElements.define('icure-form-dropdown-field',
|
|
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);
|
|
291
289
|
customElements.define('icure-button-group', KendoIcureButtonGroup);
|
|
292
290
|
customElements.define('icure-date-picker-field', KendoIcureDatePickerField);
|
|
293
291
|
customElements.define('icure-dropdown-field', KendoIcureDropdownField);
|
|
@@ -295,14 +293,14 @@ customElements.define('icure-form', KendoIcureForm);
|
|
|
295
293
|
customElements.define('icure-label', KendoIcureLabel);
|
|
296
294
|
customElements.define('icure-button', KendoIcureButton);
|
|
297
295
|
customElements.define('icure-text-field', KendoIcureTextField);
|
|
298
|
-
customElements.define('icure-form-items-list-field',
|
|
296
|
+
customElements.define('icure-form-items-list-field', ItemsListField);
|
|
299
297
|
customElements.define('icure-form-label', KendoLabel);
|
|
300
298
|
customElements.define('icure-form-button', KendoButton);
|
|
301
|
-
customElements.define('icure-form-measure-field',
|
|
302
|
-
customElements.define('icure-form-number-field',
|
|
303
|
-
customElements.define('icure-form-radio-button',
|
|
304
|
-
customElements.define('icure-form-text-field',
|
|
305
|
-
customElements.define('icure-form-time-picker',
|
|
306
|
-
customElements.define('icure-form-token-field',
|
|
307
|
-
customElements.define('form-selection-button',
|
|
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);
|
|
308
306
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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,wCAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAClD,CAAC;CACD;AACD,MAAM,uBAAwB,SAAQ,yCAAkB;IACvD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,yCAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACD;AACD,MAAM,cAAe,SAAQ,sBAAS;IACrC,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,sBAAS,CAAC,MAAM,EAAE,QAAQ,CAA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\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,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,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c,CAAC,MAAM,CAAC,yBAAyB,EAAE,yBAAyB,CAAC,CAAA;AAC3E,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,CAAA;AACtE,cAAc,CAAC,MAAM,CAAC,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,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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) => {
|
|
1
|
+
import ckmeans from './ckmeans';
|
|
2
|
+
export const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots) => {
|
|
9
3
|
if (!data.length) {
|
|
10
4
|
return { centroids: [], clusters: [] };
|
|
11
5
|
}
|
|
@@ -17,7 +11,7 @@ const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots)
|
|
|
17
11
|
while (isNotStable) {
|
|
18
12
|
history.push(k);
|
|
19
13
|
isNotStable = false;
|
|
20
|
-
clusters = (
|
|
14
|
+
clusters = ckmeans(data, k);
|
|
21
15
|
if (clusters.find((c) => !c.length)) {
|
|
22
16
|
isNotStable = true;
|
|
23
17
|
k--;
|
|
@@ -49,5 +43,4 @@ const cluster = (data, maxDistanceInCluster, minDistanceBetweenClusters, slots)
|
|
|
49
43
|
}
|
|
50
44
|
return { centroids: centroids, clusters: clusters };
|
|
51
45
|
};
|
|
52
|
-
exports.cluster = cluster;
|
|
53
46
|
//# sourceMappingURL=ckmeans-grouping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ckmeans-grouping.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans-grouping.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAE/B,MAAM,CAAC,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,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,iFAAiF;IAE3I,MAAM,OAAO,GAAG,EAAE,CAAA;IAClB,IAAI,WAAW,GAAG,IAAI,CAAA;IACtB,IAAI,SAAS,GAAa,EAAE,CAAA;IAC5B,IAAI,QAAQ,GAAe,EAAE,CAAA;IAC7B,OAAO,WAAW,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACf,WAAW,GAAG,KAAK,CAAA;QACnB,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QAC3B,IAAI,QA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AE,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","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,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* For a sorted input, counting the number of unique values
|
|
5
3
|
* is possible in constant time and constant memory. This is
|
|
@@ -283,5 +281,5 @@ const ckmeans = (x, nClusters) => {
|
|
|
283
281
|
}
|
|
284
282
|
return clusters;
|
|
285
283
|
};
|
|
286
|
-
|
|
284
|
+
export default ckmeans;
|
|
287
285
|
//# 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,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,IAA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U,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IACnD,uBAAuB;IACvB,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IAE5D,uEAAuE;IACvE,mEAAmE;IACnE,+DAA+D;IAC/D,sCAAsC;IACtC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,CAAA;IAE7C,wEAAwE;IACxE,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"]}
|
|
1
|
+
{"version":3,"file":"ckmeans.js","sourceRoot":"","sources":["../../tmp/conversion/ckmeans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,SAAS,iBAAiB,CAAC,CAAQ;IAClC,I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D;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,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,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const model_1 = require("../components/model");
|
|
5
|
-
const ckmeans_grouping_1 = require("./ckmeans-grouping");
|
|
6
|
-
function convertLegacy(form, formsLibrary) {
|
|
1
|
+
import { Button, CheckBox, DatePicker, DateTimePicker, DropdownField, Form, ItemsListField, MeasureField, NumberField, Section, Subform, TextField, TokenField, } from '../components/model';
|
|
2
|
+
import { cluster } from './ckmeans-grouping';
|
|
3
|
+
export function convertLegacy(form, formsLibrary) {
|
|
7
4
|
var _a, _b;
|
|
8
5
|
const TOTAL_COLUMNS = 24;
|
|
9
|
-
const makeTextField = (formData, width, height) => { var _a; return new
|
|
10
|
-
const makeItemsListField = (formData, width, height) => { var _a; return new
|
|
11
|
-
const makeTokenField = (formData, width, height) => { var _a; return new
|
|
12
|
-
const makeCheckBox = (formData, width, height) => { var _a, _b; return new
|
|
13
|
-
const makeMeasureField = (formData, width, height) => { var _a; return new
|
|
14
|
-
const makeNumberField = (formData, width, height) => { var _a; return new
|
|
6
|
+
const makeTextField = (formData, width, height) => { var _a; return new TextField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
7
|
+
const makeItemsListField = (formData, width, height) => { var _a; return new ItemsListField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
8
|
+
const makeTokenField = (formData, width, height) => { var _a; return new TokenField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
9
|
+
const makeCheckBox = (formData, width, height) => { var _a, _b; return new CheckBox((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, options: { [(_b = formData.label) !== null && _b !== void 0 ? _b : '']: formData.label }, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
10
|
+
const makeMeasureField = (formData, width, height) => { var _a; return new MeasureField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
11
|
+
const makeNumberField = (formData, width, height) => { var _a; return new NumberField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
15
12
|
const makeDateTimeField = (formData, width, height) => {
|
|
16
13
|
var _a, _b, _c;
|
|
17
14
|
return ((_a = formData.editor) === null || _a === void 0 ? void 0 : _a.displayTime)
|
|
18
|
-
? new
|
|
19
|
-
: new
|
|
15
|
+
? new DateTimePicker((_b = formData.name) !== null && _b !== void 0 ? _b : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })
|
|
16
|
+
: new DatePicker((_c = formData.name) !== null && _c !== void 0 ? _c : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined });
|
|
20
17
|
};
|
|
21
18
|
const makeDropdownField = (formData, width, height) => {
|
|
22
19
|
var _a, _b, _c;
|
|
23
|
-
return new
|
|
20
|
+
return new DropdownField((_a = formData.name) !== null && _a !== void 0 ? _a : '', {
|
|
24
21
|
shortLabel: formData.label,
|
|
25
22
|
span: width,
|
|
26
23
|
options: ((_b = formData.editor) === null || _b === void 0 ? void 0 : _b.menuOptions)
|
|
@@ -37,19 +34,19 @@ function convertLegacy(form, formsLibrary) {
|
|
|
37
34
|
}
|
|
38
35
|
return convertLegacy(subForm, formsLibrary);
|
|
39
36
|
});
|
|
40
|
-
return new
|
|
37
|
+
return new Subform((_c = formData.name) !== null && _c !== void 0 ? _c : '', subForms.reduce((acc, sf) => (Object.assign(Object.assign({}, acc), { [sf.form]: sf })), {}), {
|
|
41
38
|
shortLabel: formData.label,
|
|
42
39
|
span: width,
|
|
43
40
|
rowSpan: height,
|
|
44
41
|
});
|
|
45
42
|
};
|
|
46
|
-
const makeActionButton = (formData, width, height) => { var _a; return new
|
|
43
|
+
const makeActionButton = (formData, width, height) => { var _a; return new Button((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
47
44
|
// noinspection UnnecessaryLocalVariableJS
|
|
48
|
-
const translated = new
|
|
45
|
+
const translated = new Form((_a = (form.group ? `${form.group}/${form.name}` : form.name)) !== null && _a !== void 0 ? _a : 'Unknown', ((_b = form.sections) !== null && _b !== void 0 ? _b : []).map((section) => {
|
|
49
46
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
50
47
|
const fld = ((_a = section.formColumns) !== null && _a !== void 0 ? _a : []).flatMap((column) => { var _a; return (_a = column.formDataList) !== null && _a !== void 0 ? _a : []; });
|
|
51
48
|
const sortedList = fld.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = a.editor) === null || _a === void 0 ? void 0 : _a.top) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = b.editor) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0); });
|
|
52
|
-
const rowClusters =
|
|
49
|
+
const rowClusters = cluster(fld.map((f) => { var _a, _b; return (_b = (_a = f.editor) === null || _a === void 0 ? void 0 : _a.top) !== null && _b !== void 0 ? _b : 0; }), 5, 16);
|
|
53
50
|
const rows = rowClusters.clusters;
|
|
54
51
|
const intraCentroids = rowClusters.centroids.map((v, idx, centroids) => (idx > 0 ? v - centroids[idx - 1] : 0)).filter((x) => x > 0);
|
|
55
52
|
const meanHeightWithOutliers = intraCentroids.reduce((sum, v) => v + sum, 0) / intraCentroids.length;
|
|
@@ -68,7 +65,7 @@ function convertLegacy(form, formsLibrary) {
|
|
|
68
65
|
const leftSide = (_c = (_b = leftMostField.editor) === null || _b === void 0 ? void 0 : _b.left) !== null && _c !== void 0 ? _c : 0;
|
|
69
66
|
const formWidth = ((_e = (_d = rightMostField === null || rightMostField === void 0 ? void 0 : rightMostField.editor) === null || _d === void 0 ? void 0 : _d.left) !== null && _e !== void 0 ? _e : 0) + ((_g = (_f = rightMostField === null || rightMostField === void 0 ? void 0 : rightMostField.editor) === null || _f === void 0 ? void 0 : _f.width) !== null && _g !== void 0 ? _g : 1024) - leftSide;
|
|
70
67
|
const interColumnsDistance = formWidth / TOTAL_COLUMNS;
|
|
71
|
-
const columns =
|
|
68
|
+
const columns = cluster(fld.map((f) => { var _a, _b, _c, _d; return ((_b = (_a = f.editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = f.editor) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 0) - leftSide; }), formWidth / (TOTAL_COLUMNS * 2), Math.ceil((formWidth !== null && formWidth !== void 0 ? formWidth : 1024) / (TOTAL_COLUMNS * 4)), Math.max(Math.min(TOTAL_COLUMNS, fld.length / 2), 1));
|
|
72
69
|
const columnsWidth = columns.centroids.map((v, idx, t) => { var _a; return v - ((_a = t[idx - 1]) !== null && _a !== void 0 ? _a : 0); });
|
|
73
70
|
const acc = columnsWidth.map(() => 1);
|
|
74
71
|
while (acc.reduce((s, v) => s + v, 0) < TOTAL_COLUMNS) {
|
|
@@ -86,7 +83,7 @@ function convertLegacy(form, formsLibrary) {
|
|
|
86
83
|
const columnsRoundedWidth = acc;
|
|
87
84
|
const columnsAccumulatedWidth = columnsRoundedWidth.reduce((acc, v) => { var _a; return [...acc, ((_a = acc[acc.length - 1]) !== null && _a !== void 0 ? _a : 0) + v]; }, []);
|
|
88
85
|
const columnsAccumulatedWidthWithInterColumns = columnsAccumulatedWidth.map((v) => v * interColumnsDistance);
|
|
89
|
-
return new
|
|
86
|
+
return new Section('Main', formDataClusters.flatMap((formDataRow) => {
|
|
90
87
|
const cols = formDataRow
|
|
91
88
|
.map((formData) => {
|
|
92
89
|
return columnsAccumulatedWidth[columnsAccumulatedWidthWithInterColumns.reduce(([idx, min], x, n) => {
|
|
@@ -161,5 +158,4 @@ function convertLegacy(form, formsLibrary) {
|
|
|
161
158
|
}), form.guid);
|
|
162
159
|
return translated;
|
|
163
160
|
}
|
|
164
|
-
exports.convertLegacy = convertLegacy;
|
|
165
161
|
//# sourceMappingURL=icure-convert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icure-convert.js","sourceRoot":"","sources":["../../tmp/conversion/icure-convert.ts"],"names":[],"mappings":";;;AACA,+CAe4B;AAE5B,yDAA4C;AAE5C,SAAgB,aAAa,CAAC,IAAgB,EAAE,YAA0B;;IACzE,MAAM,aAAa,GAAG,EAAE,CAAA;IACxB,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAE,KAAa,EAAE,MAAc,EAAE,EAAE,WACjF,OAAA,IAAI,iBAAS,CAAC,MAAA,QAAQ,CAAC,IAAI,mCAAI,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA,EAAA,CAAA;IAC1H,MAAM,kBAAkB,GAAG,CAAC,QAAwB,EAAE,KAAa,EAAE,MAAc,EAAE,EAAE,WACtF,OAAA,IAAI,sBAAc,CAAC,MAAA,QAAQ,CAAC,IAAI,mCAAI,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAA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,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;qBAChC,GAAG,CAAC,CAAC,QAAwB,EAAE,KAAK,EAAE,EAAE;;oBACxC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,GAAG,CAAA;oBACvC,GAAG,IAAI,KAAK,CAAA;oBACZ,OAAO,MAAA,MACN;wBACC,YAAY,EAAE,aAAa;wBAC3B,cAAc,EAAE,YAAY;wBAC5B,aAAa,EAAE,gBAAgB;wBAC/B,YAAY,EAAE,eAAe;wBAC7B,eAAe,EAAE,iBAAiB;wBAClC,cAAc,EAAE,iBAAiB;wBACjC,iBAAiB,EAAE,kBAAkB;wBACrC,gBAAgB,EAAE,cAAc;wBAChC,aAAa,EAAE,WAAW;wBAC1B,YAAY,EAAE,gBAAgB;qBAE/B,EAAC,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,GAAG,mCAAI,EAAE,CAAC,mDAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;gBACvH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CACF,CAAA;IACF,CAAC,CAAC,EACF,IAAI,CAAC,IAAI,CACT,CAAA;IACD,OAAO,UAAU,CAAA;AAClB,CAAC;AAhND,sCAgNC","sourcesContent":["import { FormLayout } from '@icure/api'\nimport {\n\tButton,\n\tCheckBox,\n\tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tField,\n\tForm,\n\tItemsListField,\n\tMeasureField,\n\tNumberField,\n\tSection,\n\tSubform,\n\tTextField,\n\tTokenField,\n} from '../components/model'\nimport { FormLayoutData } from '@icure/api/icc-api/model/FormLayoutData'\nimport { cluster } from './ckmeans-grouping'\n\nexport function convertLegacy(form: FormLayout, formsLibrary: FormLayout[]): Form {\n\tconst TOTAL_COLUMNS = 24\n\tconst makeTextField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew TextField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeItemsListField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew ItemsListField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeTokenField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew TokenField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeCheckBox = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew CheckBox(formData.name ?? '', { shortLabel: formData.label, options: { [formData.label ?? '']: formData.label }, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeMeasureField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew MeasureField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeNumberField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew NumberField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeDateTimeField = (formData: FormLayoutData, width: number, height: number) =>\n\t\t(formData.editor as any)?.displayTime\n\t\t\t? new DateTimePicker(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\t\t\t: new DatePicker(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\n\tconst makeDropdownField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew DropdownField(formData.name ?? '', {\n\t\t\tshortLabel: formData.label,\n\t\t\tspan: width,\n\t\t\toptions: (formData.editor as any)?.menuOptions\n\t\t\t\t? (formData.editor as any)?.menuOptions.reduce(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tacc: {\n\t\t\t\t\t\t\t\t[key: string]: unknown\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tv: string,\n\t\t\t\t\t\t) => ({ ...acc, [`LEGACY|${v}|1`]: v }),\n\t\t\t\t\t\t{},\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t})\n\n\tconst makeSubForm = (formData: FormLayoutData, width: number, height: number) => {\n\t\tconst subForms = ((formData.editor as any)?.optionalFormGuids as string[])?.map((guid: string) => {\n\t\t\tconst subForm = formsLibrary.find((it) => it.guid === guid)\n\t\t\tif (!subForm) {\n\t\t\t\tthrow new Error(`Cannot find subform ${guid}`)\n\t\t\t}\n\t\t\treturn convertLegacy(subForm as FormLayout, formsLibrary)\n\t\t})\n\t\treturn new Subform(\n\t\t\tformData.name ?? '',\n\t\t\tsubForms.reduce((acc, sf) => ({ ...acc, [sf.form]: sf }), {}),\n\t\t\t{\n\t\t\t\tshortLabel: formData.label,\n\t\t\t\tspan: width,\n\t\t\t\trowSpan: height,\n\t\t\t},\n\t\t)\n\t}\n\n\tconst makeActionButton = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew Button(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\n\t// noinspection UnnecessaryLocalVariableJS\n\tconst translated = new Form(\n\t\t(form.group ? `${form.group}/${form.name}` : form.name) ?? 'Unknown',\n\t\t(form.sections ?? []).map((section) => {\n\t\t\tconst fld = (section.formColumns ?? []).flatMap((column) => column.formDataList ?? [])\n\t\t\tconst sortedList = fld.sort((a, b) => (a.editor?.top ?? 0) - (b.editor?.top ?? 0))\n\n\t\t\tconst rowClusters = cluster(\n\t\t\t\tfld.map((f) => f.editor?.top ?? 0),\n\t\t\t\t5,\n\t\t\t\t16,\n\t\t\t)\n\t\t\tconst rows = rowClusters.clusters\n\n\t\t\tconst intraCentroids = rowClusters.centroids.map((v, idx, centroids) => (idx > 0 ? v - centroids[idx - 1] : 0)).filter((x) => x > 0)\n\t\t\tconst meanHeightWithOutliers = intraCentroids.reduce((sum, v) => v + sum, 0) / intraCentroids.length\n\t\t\tconst intraCentroidsWithoutOutliers = intraCentroids.filter((x) => x < meanHeightWithOutliers * 2)\n\t\t\tconst meanHeight = intraCentroidsWithoutOutliers.reduce((sum, v) => v + sum, 0) / intraCentroidsWithoutOutliers.length\n\n\t\t\tconst formDataClusters = sortedList\n\t\t\t\t.reduce(\n\t\t\t\t\t(cs, fd) => {\n\t\t\t\t\t\tcs[rows.findIndex((c) => c.includes(fd.editor?.top ?? 0))].push(fd)\n\t\t\t\t\t\treturn cs\n\t\t\t\t\t},\n\t\t\t\t\tnew Array(rows.length).fill(null).map(() => [] as FormLayoutData[]),\n\t\t\t\t)\n\t\t\t\t.map((c) => c.sort((a, b) => (a.editor?.left ?? 0) - (b.editor?.left ?? 0)))\n\n\t\t\tconst leftMostField = sortedList.filter((f) => !f.subForm).reduce((a, b) => ((a.editor?.left ?? 0) < (b.editor?.left ?? 0) ? a : b))\n\t\t\tconst rightMostField = sortedList\n\t\t\t\t.filter((f) => !f.subForm)\n\t\t\t\t.reduce((a, b) => ((a.editor?.left ?? 0) + (a.editor?.width ?? 0) < (b.editor?.left ?? 0) + (b.editor?.width ?? 0) ? b : a))\n\n\t\t\tconst leftSide = leftMostField.editor?.left ?? 0\n\t\t\tconst formWidth = (rightMostField?.editor?.left ?? 0) + (rightMostField?.editor?.width ?? 1024) - leftSide\n\t\t\tconst interColumnsDistance = formWidth / TOTAL_COLUMNS\n\t\t\tconst columns = cluster(\n\t\t\t\tfld.map((f) => (f.editor?.left ?? 0) + (f.editor?.width ?? 0) - leftSide),\n\t\t\t\tformWidth / (TOTAL_COLUMNS * 2),\n\t\t\t\tMath.ceil((formWidth ?? 1024) / (TOTAL_COLUMNS * 4)),\n\t\t\t\tMath.max(Math.min(TOTAL_COLUMNS, fld.length / 2), 1),\n\t\t\t)\n\t\t\tconst columnsWidth = columns.centroids.map((v, idx, t) => v - (t[idx - 1] ?? 0))\n\n\t\t\tconst acc = columnsWidth.map(() => 1)\n\t\t\twhile (acc.reduce((s, v) => s + v, 0) < TOTAL_COLUMNS) {\n\t\t\t\tconst idx = acc.reduce(\n\t\t\t\t\t(s: [number | undefined, number], size: number, idx: number): [number | undefined, number] => {\n\t\t\t\t\t\tconst diff = size * interColumnsDistance - columnsWidth[idx]\n\t\t\t\t\t\treturn diff < 0 && -diff > s[1] ? [idx, -diff] : s\n\t\t\t\t\t},\n\t\t\t\t\t[undefined, 0],\n\t\t\t\t)\n\t\t\t\tconst selected = idx[0]\n\t\t\t\tif (selected === undefined) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tacc[selected]++\n\t\t\t}\n\t\t\t// noinspection UnnecessaryLocalVariableJS\n\t\t\tconst columnsRoundedWidth = acc\n\n\t\t\tconst columnsAccumulatedWidth = columnsRoundedWidth.reduce((acc, v) => [...acc, (acc[acc.length - 1] ?? 0) + v], [])\n\t\t\tconst columnsAccumulatedWidthWithInterColumns = columnsAccumulatedWidth.map((v) => v * interColumnsDistance)\n\n\t\t\treturn new Section(\n\t\t\t\t'Main',\n\t\t\t\tformDataClusters.flatMap((formDataRow: FormLayoutData[]) => {\n\t\t\t\t\tconst cols = formDataRow\n\t\t\t\t\t\t.map((formData: FormLayoutData) => {\n\t\t\t\t\t\t\treturn columnsAccumulatedWidth[\n\t\t\t\t\t\t\t\tcolumnsAccumulatedWidthWithInterColumns.reduce(\n\t\t\t\t\t\t\t\t\t([idx, min]: [number, number], x, n) => {\n\t\t\t\t\t\t\t\t\t\tconst right = (formData.editor?.left ?? 0) + (formData.editor?.width ?? 0) - leftSide\n\t\t\t\t\t\t\t\t\t\treturn Math.abs(x - right) < min ? [n, Math.abs(x - right)] : [idx, min]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[0, 99999],\n\t\t\t\t\t\t\t\t)[0]\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.map((x, idx, cols) => {\n\t\t\t\t\t\t\t//Try to solve inverted positions in columns by adding or removing one column\n\t\t\t\t\t\t\tconst prev = cols[idx - 1] ?? 0\n\t\t\t\t\t\t\tconst next = cols[idx + 1] ?? TOTAL_COLUMNS\n\t\t\t\t\t\t\treturn x > prev + 1 && x >= next - 1 ? x - 1 : x === prev ? x + 1 : x\n\t\t\t\t\t\t})\n\t\t\t\t\tconst subRows = cols.reduce((acc, v, idx, cols) => {\n\t\t\t\t\t\tif (idx === 0) {\n\t\t\t\t\t\t\treturn [[[idx, v]]]\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet row = 0\n\t\t\t\t\t\twhile (row < acc.length && acc[row][acc[row].length - 1][1] > v) {\n\t\t\t\t\t\t\trow++\n\t\t\t\t\t\t}\n\t\t\t\t\t\t;(acc[row] ?? (acc[row] = [])).push([idx, v] as [number, number])\n\t\t\t\t\t\treturn acc\n\t\t\t\t\t}, [] as [number, number][][])\n\n\t\t\t\t\treturn subRows.flatMap((subRow) => {\n\t\t\t\t\t\tconst acc = subRow.map((x) => x[1])\n\t\t\t\t\t\twhile (acc[acc.length - 1] < TOTAL_COLUMNS) {\n\t\t\t\t\t\t\tconst idx = acc.reduce(\n\t\t\t\t\t\t\t\t([minIdx, min]: [number | undefined, number], size: number, idx: number, columns: number[]): [number | undefined, number] => {\n\t\t\t\t\t\t\t\t\tconst scenario = columns.map((x, cidx) => (cidx === idx ? x + 1 : x))\n\t\t\t\t\t\t\t\t\tconst penalty = scenario.reduce((acc, v) => {\n\t\t\t\t\t\t\t\t\t\tconst right = (formDataRow[subRow[idx][0]].editor?.left ?? 0) + (formDataRow[subRow[idx][0]].editor?.width ?? 0) - leftSide\n\t\t\t\t\t\t\t\t\t\treturn acc + Math.abs(v * interColumnsDistance - right)\n\t\t\t\t\t\t\t\t\t}, 0)\n\t\t\t\t\t\t\t\t\treturn penalty < min ? [idx, penalty] : [minIdx, min]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[undefined, 999999],\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst selected = idx[0]\n\t\t\t\t\t\t\tif (selected === undefined) {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (let i = selected; i < acc.length; i++) {\n\t\t\t\t\t\t\t\tacc[i]++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst expandedCols = acc\n\t\t\t\t\t\tlet idx = 0\n\t\t\t\t\t\treturn subRow\n\t\t\t\t\t\t\t.map(([idx]) => formDataRow[idx])\n\t\t\t\t\t\t\t.map((formData: FormLayoutData, index) => {\n\t\t\t\t\t\t\t\tconst width = expandedCols[index] - idx\n\t\t\t\t\t\t\t\tidx += width\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tStringEditor: makeTextField,\n\t\t\t\t\t\t\t\t\t\tCheckBoxEditor: makeCheckBox,\n\t\t\t\t\t\t\t\t\t\tMeasureEditor: makeMeasureField,\n\t\t\t\t\t\t\t\t\t\tNumberEditor: makeNumberField,\n\t\t\t\t\t\t\t\t\t\tPopupMenuEditor: makeDropdownField,\n\t\t\t\t\t\t\t\t\t\tDateTimeEditor: makeDateTimeField,\n\t\t\t\t\t\t\t\t\t\tStringTableEditor: makeItemsListField,\n\t\t\t\t\t\t\t\t\t\tTokenFieldEditor: makeTokenField,\n\t\t\t\t\t\t\t\t\t\tSubFormEditor: makeSubForm,\n\t\t\t\t\t\t\t\t\t\tActionButton: makeActionButton,\n\t\t\t\t\t\t\t\t\t} as { [key: string]: (fd: FormLayoutData, w: number, h: number) => Field | Subform }\n\t\t\t\t\t\t\t\t)[formData.editor?.key ?? '']?.(formData, width, Math.max(1, Math.floor((formData.editor?.height ?? 0) / meanHeight)))\n\t\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t}),\n\t\tform.guid,\n\t)\n\treturn translated\n}\n"]}
|
|
1
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AY;wBAC5B,aAAa,EAAE,gBAAgB;wBAC/B,YAAY,EAAE,eAAe;wBAC7B,eAAe,EAAE,iBAAiB;wBAClC,cAAc,EAAE,iBAAiB;wBACjC,iBAAiB,EAAE,kBAAkB;wBACrC,gBAAgB,EAAE,cAAc;wBAChC,aAAa,EAAE,WAAW;wBAC1B,YAAY,EAAE,gBAAgB;qBAE/B,EAAC,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,GAAG,mCAAI,EAAE,CAAC,mDAAG,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;gBACvH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACH,CAAC,CAAC,CACF,CAAA;IACF,CAAC,CAAC,EACF,IAAI,CAAC,IAAI,CACT,CAAA;IACD,OAAO,UAAU,CAAA;AAClB,CAAC","sourcesContent":["import { FormLayout } from '@icure/api'\nimport {\n\tButton,\n\tCheckBox,\n\tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tField,\n\tForm,\n\tItemsListField,\n\tMeasureField,\n\tNumberField,\n\tSection,\n\tSubform,\n\tTextField,\n\tTokenField,\n} from '../components/model'\nimport { FormLayoutData } from '@icure/api/icc-api/model/FormLayoutData'\nimport { cluster } from './ckmeans-grouping'\n\nexport function convertLegacy(form: FormLayout, formsLibrary: FormLayout[]): Form {\n\tconst TOTAL_COLUMNS = 24\n\tconst makeTextField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew TextField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeItemsListField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew ItemsListField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeTokenField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew TokenField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeCheckBox = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew CheckBox(formData.name ?? '', { shortLabel: formData.label, options: { [formData.label ?? '']: formData.label }, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeMeasureField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew MeasureField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeNumberField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew NumberField(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\tconst makeDateTimeField = (formData: FormLayoutData, width: number, height: number) =>\n\t\t(formData.editor as any)?.displayTime\n\t\t\t? new DateTimePicker(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\t\t\t: new DatePicker(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\n\tconst makeDropdownField = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew DropdownField(formData.name ?? '', {\n\t\t\tshortLabel: formData.label,\n\t\t\tspan: width,\n\t\t\toptions: (formData.editor as any)?.menuOptions\n\t\t\t\t? (formData.editor as any)?.menuOptions.reduce(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tacc: {\n\t\t\t\t\t\t\t\t[key: string]: unknown\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tv: string,\n\t\t\t\t\t\t) => ({ ...acc, [`LEGACY|${v}|1`]: v }),\n\t\t\t\t\t\t{},\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t})\n\n\tconst makeSubForm = (formData: FormLayoutData, width: number, height: number) => {\n\t\tconst subForms = ((formData.editor as any)?.optionalFormGuids as string[])?.map((guid: string) => {\n\t\t\tconst subForm = formsLibrary.find((it) => it.guid === guid)\n\t\t\tif (!subForm) {\n\t\t\t\tthrow new Error(`Cannot find subform ${guid}`)\n\t\t\t}\n\t\t\treturn convertLegacy(subForm as FormLayout, formsLibrary)\n\t\t})\n\t\treturn new Subform(\n\t\t\tformData.name ?? '',\n\t\t\tsubForms.reduce((acc, sf) => ({ ...acc, [sf.form]: sf }), {}),\n\t\t\t{\n\t\t\t\tshortLabel: formData.label,\n\t\t\t\tspan: width,\n\t\t\t\trowSpan: height,\n\t\t\t},\n\t\t)\n\t}\n\n\tconst makeActionButton = (formData: FormLayoutData, width: number, height: number) =>\n\t\tnew Button(formData.name ?? '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })\n\n\t// noinspection UnnecessaryLocalVariableJS\n\tconst translated = new Form(\n\t\t(form.group ? `${form.group}/${form.name}` : form.name) ?? 'Unknown',\n\t\t(form.sections ?? []).map((section) => {\n\t\t\tconst fld = (section.formColumns ?? []).flatMap((column) => column.formDataList ?? [])\n\t\t\tconst sortedList = fld.sort((a, b) => (a.editor?.top ?? 0) - (b.editor?.top ?? 0))\n\n\t\t\tconst rowClusters = cluster(\n\t\t\t\tfld.map((f) => f.editor?.top ?? 0),\n\t\t\t\t5,\n\t\t\t\t16,\n\t\t\t)\n\t\t\tconst rows = rowClusters.clusters\n\n\t\t\tconst intraCentroids = rowClusters.centroids.map((v, idx, centroids) => (idx > 0 ? v - centroids[idx - 1] : 0)).filter((x) => x > 0)\n\t\t\tconst meanHeightWithOutliers = intraCentroids.reduce((sum, v) => v + sum, 0) / intraCentroids.length\n\t\t\tconst intraCentroidsWithoutOutliers = intraCentroids.filter((x) => x < meanHeightWithOutliers * 2)\n\t\t\tconst meanHeight = intraCentroidsWithoutOutliers.reduce((sum, v) => v + sum, 0) / intraCentroidsWithoutOutliers.length\n\n\t\t\tconst formDataClusters = sortedList\n\t\t\t\t.reduce(\n\t\t\t\t\t(cs, fd) => {\n\t\t\t\t\t\tcs[rows.findIndex((c) => c.includes(fd.editor?.top ?? 0))].push(fd)\n\t\t\t\t\t\treturn cs\n\t\t\t\t\t},\n\t\t\t\t\tnew Array(rows.length).fill(null).map(() => [] as FormLayoutData[]),\n\t\t\t\t)\n\t\t\t\t.map((c) => c.sort((a, b) => (a.editor?.left ?? 0) - (b.editor?.left ?? 0)))\n\n\t\t\tconst leftMostField = sortedList.filter((f) => !f.subForm).reduce((a, b) => ((a.editor?.left ?? 0) < (b.editor?.left ?? 0) ? a : b))\n\t\t\tconst rightMostField = sortedList\n\t\t\t\t.filter((f) => !f.subForm)\n\t\t\t\t.reduce((a, b) => ((a.editor?.left ?? 0) + (a.editor?.width ?? 0) < (b.editor?.left ?? 0) + (b.editor?.width ?? 0) ? b : a))\n\n\t\t\tconst leftSide = leftMostField.editor?.left ?? 0\n\t\t\tconst formWidth = (rightMostField?.editor?.left ?? 0) + (rightMostField?.editor?.width ?? 1024) - leftSide\n\t\t\tconst interColumnsDistance = formWidth / TOTAL_COLUMNS\n\t\t\tconst columns = cluster(\n\t\t\t\tfld.map((f) => (f.editor?.left ?? 0) + (f.editor?.width ?? 0) - leftSide),\n\t\t\t\tformWidth / (TOTAL_COLUMNS * 2),\n\t\t\t\tMath.ceil((formWidth ?? 1024) / (TOTAL_COLUMNS * 4)),\n\t\t\t\tMath.max(Math.min(TOTAL_COLUMNS, fld.length / 2), 1),\n\t\t\t)\n\t\t\tconst columnsWidth = columns.centroids.map((v, idx, t) => v - (t[idx - 1] ?? 0))\n\n\t\t\tconst acc = columnsWidth.map(() => 1)\n\t\t\twhile (acc.reduce((s, v) => s + v, 0) < TOTAL_COLUMNS) {\n\t\t\t\tconst idx = acc.reduce(\n\t\t\t\t\t(s: [number | undefined, number], size: number, idx: number): [number | undefined, number] => {\n\t\t\t\t\t\tconst diff = size * interColumnsDistance - columnsWidth[idx]\n\t\t\t\t\t\treturn diff < 0 && -diff > s[1] ? [idx, -diff] : s\n\t\t\t\t\t},\n\t\t\t\t\t[undefined, 0],\n\t\t\t\t)\n\t\t\t\tconst selected = idx[0]\n\t\t\t\tif (selected === undefined) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tacc[selected]++\n\t\t\t}\n\t\t\t// noinspection UnnecessaryLocalVariableJS\n\t\t\tconst columnsRoundedWidth = acc\n\n\t\t\tconst columnsAccumulatedWidth = columnsRoundedWidth.reduce((acc, v) => [...acc, (acc[acc.length - 1] ?? 0) + v], [])\n\t\t\tconst columnsAccumulatedWidthWithInterColumns = columnsAccumulatedWidth.map((v) => v * interColumnsDistance)\n\n\t\t\treturn new Section(\n\t\t\t\t'Main',\n\t\t\t\tformDataClusters.flatMap((formDataRow: FormLayoutData[]) => {\n\t\t\t\t\tconst cols = formDataRow\n\t\t\t\t\t\t.map((formData: FormLayoutData) => {\n\t\t\t\t\t\t\treturn columnsAccumulatedWidth[\n\t\t\t\t\t\t\t\tcolumnsAccumulatedWidthWithInterColumns.reduce(\n\t\t\t\t\t\t\t\t\t([idx, min]: [number, number], x, n) => {\n\t\t\t\t\t\t\t\t\t\tconst right = (formData.editor?.left ?? 0) + (formData.editor?.width ?? 0) - leftSide\n\t\t\t\t\t\t\t\t\t\treturn Math.abs(x - right) < min ? [n, Math.abs(x - right)] : [idx, min]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t[0, 99999],\n\t\t\t\t\t\t\t\t)[0]\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.map((x, idx, cols) => {\n\t\t\t\t\t\t\t//Try to solve inverted positions in columns by adding or removing one column\n\t\t\t\t\t\t\tconst prev = cols[idx - 1] ?? 0\n\t\t\t\t\t\t\tconst next = cols[idx + 1] ?? TOTAL_COLUMNS\n\t\t\t\t\t\t\treturn x > prev + 1 && x >= next - 1 ? x - 1 : x === prev ? x + 1 : x\n\t\t\t\t\t\t})\n\t\t\t\t\tconst subRows = cols.reduce((acc, v, idx, cols) => {\n\t\t\t\t\t\tif (idx === 0) {\n\t\t\t\t\t\t\treturn [[[idx, v]]]\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet row = 0\n\t\t\t\t\t\twhile (row < acc.length && acc[row][acc[row].length - 1][1] > v) {\n\t\t\t\t\t\t\trow++\n\t\t\t\t\t\t}\n\t\t\t\t\t\t;(acc[row] ?? (acc[row] = [])).push([idx, v] as [number, number])\n\t\t\t\t\t\treturn acc\n\t\t\t\t\t}, [] as [number, number][][])\n\n\t\t\t\t\treturn subRows.flatMap((subRow) => {\n\t\t\t\t\t\tconst acc = subRow.map((x) => x[1])\n\t\t\t\t\t\twhile (acc[acc.length - 1] < TOTAL_COLUMNS) {\n\t\t\t\t\t\t\tconst idx = acc.reduce(\n\t\t\t\t\t\t\t\t([minIdx, min]: [number | undefined, number], size: number, idx: number, columns: number[]): [number | undefined, number] => {\n\t\t\t\t\t\t\t\t\tconst scenario = columns.map((x, cidx) => (cidx === idx ? x + 1 : x))\n\t\t\t\t\t\t\t\t\tconst penalty = scenario.reduce((acc, v) => {\n\t\t\t\t\t\t\t\t\t\tconst right = (formDataRow[subRow[idx][0]].editor?.left ?? 0) + (formDataRow[subRow[idx][0]].editor?.width ?? 0) - leftSide\n\t\t\t\t\t\t\t\t\t\treturn acc + Math.abs(v * interColumnsDistance - right)\n\t\t\t\t\t\t\t\t\t}, 0)\n\t\t\t\t\t\t\t\t\treturn penalty < min ? [idx, penalty] : [minIdx, min]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t[undefined, 999999],\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst selected = idx[0]\n\t\t\t\t\t\t\tif (selected === undefined) {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor (let i = selected; i < acc.length; i++) {\n\t\t\t\t\t\t\t\tacc[i]++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst expandedCols = acc\n\t\t\t\t\t\tlet idx = 0\n\t\t\t\t\t\treturn subRow\n\t\t\t\t\t\t\t.map(([idx]) => formDataRow[idx])\n\t\t\t\t\t\t\t.map((formData: FormLayoutData, index) => {\n\t\t\t\t\t\t\t\tconst width = expandedCols[index] - idx\n\t\t\t\t\t\t\t\tidx += width\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tStringEditor: makeTextField,\n\t\t\t\t\t\t\t\t\t\tCheckBoxEditor: makeCheckBox,\n\t\t\t\t\t\t\t\t\t\tMeasureEditor: makeMeasureField,\n\t\t\t\t\t\t\t\t\t\tNumberEditor: makeNumberField,\n\t\t\t\t\t\t\t\t\t\tPopupMenuEditor: makeDropdownField,\n\t\t\t\t\t\t\t\t\t\tDateTimeEditor: makeDateTimeField,\n\t\t\t\t\t\t\t\t\t\tStringTableEditor: makeItemsListField,\n\t\t\t\t\t\t\t\t\t\tTokenFieldEditor: makeTokenField,\n\t\t\t\t\t\t\t\t\t\tSubFormEditor: makeSubForm,\n\t\t\t\t\t\t\t\t\t\tActionButton: makeActionButton,\n\t\t\t\t\t\t\t\t\t} as { [key: string]: (fd: FormLayoutData, w: number, h: number) => Field | Subform }\n\t\t\t\t\t\t\t\t)[formData.editor?.key ?? '']?.(formData, width, Math.max(1, Math.floor((formData.editor?.height ?? 0) / meanHeight)))\n\t\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t}),\n\t\tform.guid,\n\t)\n\treturn translated\n}\n"]}
|
package/generic/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
export * from './model';
|
|
18
2
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../tmp/generic/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA","sourcesContent":["export * from './model'\n"]}
|
package/generic/model.js
CHANGED