@icure/form 2.0.8 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/cache/@babel-runtime-npm-7.26.0-9afa3c4ef6-c8e2c0504a.zip +0 -0
- package/.yarn/cache/@lit-labs-ssr-dom-shim-npm-1.3.0-6bfa115c08-c2003e8bb6.zip +0 -0
- package/.yarn/cache/date-fns-npm-2.30.0-895c790e0f-f7be015232.zip +0 -0
- package/.yarn/cache/prosemirror-model-npm-1.24.1-6467e55b40-386076e2ff.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.37.2-1bde3a1540-1db70cab86.zip +0 -0
- package/.yarn/cache/regenerator-runtime-npm-0.14.1-a6c97c609a-9f57c93277.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/components/common/utils.js +1 -1
- package/components/common/utils.js.map +1 -1
- package/icure/form-values-container.d.ts +14 -14
- package/icure/form-values-container.js +18 -15
- package/icure/form-values-container.js.map +1 -1
- package/icure/icure-utils.d.ts +7 -7
- package/icure/icure-utils.js +7 -6
- package/icure/icure-utils.js.map +1 -1
- package/icure/model.d.ts +1 -1
- package/icure/model.js.map +1 -1
- package/package.json +2 -1
- package/utils/code-utils.d.ts +10 -1
- package/utils/code-utils.js +43 -3
- package/utils/code-utils.js.map +1 -1
- package/.yarn/cache/@lit-labs-ssr-dom-shim-npm-1.2.1-d14ce3e3e5-5667c44f58.zip +0 -0
- package/.yarn/cache/prosemirror-model-npm-1.23.0-57eb718541-f5ab1593cb.zip +0 -0
- package/.yarn/cache/prosemirror-view-npm-1.36.0-830888802f-38986f55e4.zip +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/conversion/icure-convert.d.ts +0 -3
- package/conversion/icure-convert.js +0 -165
- package/conversion/icure-convert.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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tmp/components/themes/ehr-lite/index.ts"],"names":[],"mappings":";;AAAA,oDAagC;AAChC,iEAA2D;AAC3D,+DAA8D;AAC9D,qEAA+D;AAC/D,iDAA4C;AAC5C,mDAA8C;AAC9C,6DAAuD;AAEvD,aAAa;AACb,6BAA0B;AAC1B,MAAM,UAAU,GAAG,IAAA,SAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+PpB,CAAA;AACF,MAAM,uBAAwB,SAAQ,qCAAgB;IACrD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,qCAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAChD,CAAC;CACD;AACD,MAAM,2BAA4B,SAAQ,wCAAoB;IAC7D,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,wCAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpD,CAAC;CACD;AACD,MAAM,yBAA0B,SAAQ,yCAAkB;IACzD,MAAM,KAAK,MAAM;QAChB,OAAO,CAAC,GAAG,yCAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAClD,CAAC;CACD;AACD,MAAM,gBAAiB,SAAQ,sBAAS;IACvC,MAAM,KAAK,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,CAAC,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAA;AACvD,cAAc,CAAC,MAAM,CAAC,0BAA0B,EAAE,qBAAY,CAAC,CAAA;AAC/D,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,oBAAW,CAAC,CAAA;AAC7D,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,oBAAW,CAAC,CAAA;AAC7D,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,kBAAS,CAAC,CAAA;AACzD,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,mBAAU,CAAC,CAAA;AAC3D,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,mBAAU,CAAC,CAAA","sourcesContent":["import {\n\tCheckBox,\n\tDatePicker,\n\tDateTimePicker,\n\tDropdownField,\n\tItemsListField,\n\tLabel,\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 } from '../../icure-text-field'\n\n// @ts-ignore\nimport { css } from 'lit';\nconst ehrLiteCss = css`.icure-form {\n row-gap: 24px;\n}\n\n.icure-text-field, .icure-button-group {\n width: 100%;\n}\n.icure-text-field > .icure-label, .icure-button-group > .icure-label {\n color: #1D2235;\n font-size: 14px;\n font-weight: 400;\n}\n.icure-text-field > .icure-label > span, .icure-button-group > .icure-label > span {\n display: block;\n word-wrap: break-word;\n overflow: auto;\n font-weight: 400;\n}\n.icure-text-field > .icure-input, .icure-button-group > .icure-input {\n flex: 1 1 auto;\n width: auto;\n}\n.icure-text-field > .icure-label, .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, .icure-button-group .icure-input,\n.icure-button-group .input-container {\n cursor: pointer;\n border-radius: 6px;\n padding: 4px 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: 13px;\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: #DDE3E7;\n color: #1D2235;\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, .icure-button-group .icure-input:focus, .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: 0px 0px 0px 2px rgba(61, 135, 197, 0.2);\n border-color: #084B83;\n}\n.icure-text-field .icure-input:hover,\n.icure-text-field .input-container:hover, .icure-button-group .icure-input:hover,\n.icure-button-group .input-container:hover {\n border-color: #084B83;\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, .icure-button-group .icure-input:hover:focus, .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: 0px 0px 0px 2px rgba(61, 135, 197, 0.2);\n border-color: #084B83;\n}\n.icure-text-field .icure-input .ProseMirror,\n.icure-text-field .input-container .ProseMirror, .icure-button-group .icure-input .ProseMirror,\n.icure-button-group .input-container .ProseMirror {\n padding: 0;\n font-size: 13px;\n line-height: 1.4em;\n color: #1D2235;\n}\n.icure-text-field .icure-input .ProseMirror .date,\n.icure-text-field .input-container .ProseMirror .date, .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, .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, .icure-text-field .icure-input .ProseMirror:hover,\n.icure-text-field .input-container .ProseMirror:focus .focused,\n.icure-text-field .input-container .ProseMirror:hover, .icure-button-group .icure-input .ProseMirror:focus .focused, .icure-button-group .icure-input .ProseMirror:hover,\n.icure-button-group .input-container .ProseMirror:focus .focused,\n.icure-button-group .input-container .ProseMirror:hover {\n border-color: #084B83;\n}\n.icure-text-field .icure-input > svg,\n.icure-text-field .input-container > svg, .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, .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, .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, .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, .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, .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\ninput[type=radio] {\n margin-top: -1px;\n vertical-align: middle;\n}\n\n.icure-checkbox:hover {\n border-color: #DCE7F2;\n}\n.icure-checkbox:checked {\n accent-color: #084B83;\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 + 5px);\n left: 9px;\n color: #1D2235;\n align-items: center;\n height: 28px;\n max-width: 85%;\n min-width: 0;\n padding-bottom: 8px;\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 gap: 6px;\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 + 5px);\n left: 9px;\n transition: transform 0.2s ease-out, color 0.2s ease-out;\n color: #1D2235;\n display: flex;\n align-items: center;\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}\n\n.icure-input #editor {\n color: #1D2235;\n}\n.icure-input #editor.tokens-list .ProseMirror li, .icure-input #editor.styled-tokens-list .ProseMirror li {\n background-color: #DCE7F2;\n}\n.icure-input #editor.tokens-list .ProseMirror li span:after, .icure-input #editor.styled-tokens-list .ProseMirror li span:after {\n background: transparent url(\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxu cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSJPdXRsaW5lIiB2aWV3 Qm94PSIwIDAgMjQgMjQiIHN0cm9rZT0iIzg4ODg4OCIgZmlsbD0iIzg4ODg4OCIg d2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiPjxwYXRoIGQ9Ik0xNiw4YTEsMSwwLDAs MC0xLjQxNCwwTDEyLDEwLjU4Niw5LjQxNCw4QTEsMSwwLDAsMCw4LDkuNDE0TDEw LjU4NiwxMiw4LDE0LjU4NkExLDEsMCwwLDAsOS40MTQsMTZMMTIsMTMuNDE0LDE0 LjU4NiwxNkExLDEsMCwwLDAsMTYsMTQuNTg2TDEzLjQxNCwxMiwxNiw5LjQxNEEx LDEsMCwwLDAsMTYsOFoiLz48cGF0aCBkPSJNMTIsMEExMiwxMiwwLDEsMCwyNCwx MiwxMi4wMTMsMTIuMDEzLDAsMCwwLDEyLDBabTAsMjJBMTAsMTAsMCwxLDEsMjIs MTIsMTAuMDExLDEwLjAxMSwwLDAsMSwxMiwyMloiLz48L3N2Zz4K\") no-repeat center/16px;\n}\n.icure-input #editor.items-list .ProseMirror li {\n border-bottom: 1px dotted #8DA6BF;\n}\n.icure-input .extra {\n padding-right: 0;\n}\n.icure-input .select-arrow {\n opacity: 1;\n}\n.icure-input .select-arrow svg {\n width: 15px;\n height: 15px;\n}\n.icure-input .select-arrow svg path {\n fill: #9CA8B2;\n}\n.icure-input .options {\n padding: 2px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n border-radius: 6px;\n background: white;\n box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.12), 0px 6px 16px 0px rgba(0, 0, 0, 0.08), 0px 9px 28px 0px rgba(0, 0, 0, 0.05);\n}\n.icure-input .options .option {\n height: auto;\n min-height: unset;\n display: flex;\n padding: 8px;\n align-items: center;\n align-self: stretch;\n border-radius: 4px;\n background: white;\n color: #1D2235;\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n cursor: pointer;\n}\n.icure-input .options .option:hover {\n background: #DCE7F2;\n color: #084B83;\n}\n.icure-input:hover .select-arrow svg path, .icure-input:focus .select-arrow svg path {\n fill: #084B83;\n}` \nclass EhrLiteIcureButtonGroup extends IcureButtonGroup {\n\tstatic get styles() {\n\t\treturn [...IcureButtonGroup.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteIcureDatePickerField extends IcureDatePickerField {\n\tstatic get styles() {\n\t\treturn [...IcureDatePickerField.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteIcureDropdownField extends IcureDropdownField {\n\tstatic get styles() {\n\t\treturn [...IcureDropdownField.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteIcureForm extends IcureForm {\n\tstatic get styles() {\n\t\treturn [...IcureForm.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteIcureLabel extends IcureLabel {\n\tstatic get styles() {\n\t\treturn [...IcureLabel.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteIcureTextField extends IcureTextField {\n\tstatic get styles() {\n\t\treturn [...IcureTextField.styles, ehrLiteCss]\n\t}\n}\nclass EhrLiteLabel extends Label {\n\tstatic get styles() {\n\t\treturn [...Label.styles, ehrLiteCss]\n\t}\n}\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', EhrLiteIcureButtonGroup)\ncustomElements.define('icure-date-picker-field', EhrLiteIcureDatePickerField)\ncustomElements.define('icure-dropdown-field', EhrLiteIcureDropdownField)\ncustomElements.define('icure-form', EhrLiteIcureForm)\ncustomElements.define('icure-label', EhrLiteIcureLabel)\ncustomElements.define('icure-text-field', EhrLiteIcureTextField)\ncustomElements.define('icure-form-items-list-field', ItemsListField)\ncustomElements.define('icure-form-label', EhrLiteLabel)\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)\n"]}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertLegacy = void 0;
|
|
4
|
-
const model_1 = require("../components/model");
|
|
5
|
-
const ckmeans_grouping_1 = require("./ckmeans-grouping");
|
|
6
|
-
function convertLegacy(form, formsLibrary) {
|
|
7
|
-
var _a, _b;
|
|
8
|
-
const TOTAL_COLUMNS = 24;
|
|
9
|
-
const makeTextField = (formData, width, height) => { var _a; return new model_1.TextField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
10
|
-
const makeItemsListField = (formData, width, height) => { var _a; return new model_1.ItemsListField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
11
|
-
const makeTokenField = (formData, width, height) => { var _a; return new model_1.TokenField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
12
|
-
const makeCheckBox = (formData, width, height) => { var _a, _b; return new model_1.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 }); };
|
|
13
|
-
const makeMeasureField = (formData, width, height) => { var _a; return new model_1.MeasureField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
14
|
-
const makeNumberField = (formData, width, height) => { var _a; return new model_1.NumberField((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
15
|
-
const makeDateTimeField = (formData, width, height) => {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
return ((_a = formData.editor) === null || _a === void 0 ? void 0 : _a.displayTime)
|
|
18
|
-
? new model_1.DateTimePicker((_b = formData.name) !== null && _b !== void 0 ? _b : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined })
|
|
19
|
-
: new model_1.DatePicker((_c = formData.name) !== null && _c !== void 0 ? _c : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined });
|
|
20
|
-
};
|
|
21
|
-
const makeDropdownField = (formData, width, height) => {
|
|
22
|
-
var _a, _b, _c;
|
|
23
|
-
return new model_1.DropdownField((_a = formData.name) !== null && _a !== void 0 ? _a : '', {
|
|
24
|
-
shortLabel: formData.label,
|
|
25
|
-
span: width,
|
|
26
|
-
options: ((_b = formData.editor) === null || _b === void 0 ? void 0 : _b.menuOptions)
|
|
27
|
-
? (_c = formData.editor) === null || _c === void 0 ? void 0 : _c.menuOptions.reduce((acc, v) => (Object.assign(Object.assign({}, acc), { [`LEGACY|${v}|1`]: v })), {})
|
|
28
|
-
: undefined,
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
const makeSubForm = (formData, width, height) => {
|
|
32
|
-
var _a, _b, _c;
|
|
33
|
-
const subForms = (_b = (_a = formData.editor) === null || _a === void 0 ? void 0 : _a.optionalFormGuids) === null || _b === void 0 ? void 0 : _b.map((guid) => {
|
|
34
|
-
const subForm = formsLibrary.find((it) => it.guid === guid);
|
|
35
|
-
if (!subForm) {
|
|
36
|
-
throw new Error(`Cannot find subform ${guid}`);
|
|
37
|
-
}
|
|
38
|
-
return convertLegacy(subForm, formsLibrary);
|
|
39
|
-
});
|
|
40
|
-
return new model_1.Subform((_c = formData.name) !== null && _c !== void 0 ? _c : '', subForms.reduce((acc, sf) => (Object.assign(Object.assign({}, acc), { [sf.form]: sf })), {}), {
|
|
41
|
-
shortLabel: formData.label,
|
|
42
|
-
span: width,
|
|
43
|
-
rowSpan: height,
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
const makeActionButton = (formData, width, height) => { var _a; return new model_1.Button((_a = formData.name) !== null && _a !== void 0 ? _a : '', { shortLabel: formData.label, span: width, rowSpan: height > 1 ? height : undefined }); };
|
|
47
|
-
// noinspection UnnecessaryLocalVariableJS
|
|
48
|
-
const translated = new model_1.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
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
50
|
-
const fld = ((_a = section.formColumns) !== null && _a !== void 0 ? _a : []).flatMap((column) => { var _a; return (_a = column.formDataList) !== null && _a !== void 0 ? _a : []; });
|
|
51
|
-
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 = (0, ckmeans_grouping_1.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
|
-
const rows = rowClusters.clusters;
|
|
54
|
-
const intraCentroids = rowClusters.centroids.map((v, idx, centroids) => (idx > 0 ? v - centroids[idx - 1] : 0)).filter((x) => x > 0);
|
|
55
|
-
const meanHeightWithOutliers = intraCentroids.reduce((sum, v) => v + sum, 0) / intraCentroids.length;
|
|
56
|
-
const intraCentroidsWithoutOutliers = intraCentroids.filter((x) => x < meanHeightWithOutliers * 2);
|
|
57
|
-
const meanHeight = intraCentroidsWithoutOutliers.reduce((sum, v) => v + sum, 0) / intraCentroidsWithoutOutliers.length;
|
|
58
|
-
const formDataClusters = sortedList
|
|
59
|
-
.reduce((cs, fd) => {
|
|
60
|
-
cs[rows.findIndex((c) => { var _a, _b; return c.includes((_b = (_a = fd.editor) === null || _a === void 0 ? void 0 : _a.top) !== null && _b !== void 0 ? _b : 0); })].push(fd);
|
|
61
|
-
return cs;
|
|
62
|
-
}, new Array(rows.length).fill(null).map(() => []))
|
|
63
|
-
.map((c) => c.sort((a, b) => { var _a, _b, _c, _d; return ((_b = (_a = a.editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = b.editor) === null || _c === void 0 ? void 0 : _c.left) !== null && _d !== void 0 ? _d : 0); }));
|
|
64
|
-
const leftMostField = sortedList.filter((f) => !f.subForm).reduce((a, b) => { var _a, _b, _c, _d; return (((_b = (_a = a.editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) < ((_d = (_c = b.editor) === null || _c === void 0 ? void 0 : _c.left) !== null && _d !== void 0 ? _d : 0) ? a : b); });
|
|
65
|
-
const rightMostField = sortedList
|
|
66
|
-
.filter((f) => !f.subForm)
|
|
67
|
-
.reduce((a, b) => { var _a, _b, _c, _d, _e, _f, _g, _h; return (((_b = (_a = a.editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = a.editor) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 0) < ((_f = (_e = b.editor) === null || _e === void 0 ? void 0 : _e.left) !== null && _f !== void 0 ? _f : 0) + ((_h = (_g = b.editor) === null || _g === void 0 ? void 0 : _g.width) !== null && _h !== void 0 ? _h : 0) ? b : a); });
|
|
68
|
-
const leftSide = (_c = (_b = leftMostField.editor) === null || _b === void 0 ? void 0 : _b.left) !== null && _c !== void 0 ? _c : 0;
|
|
69
|
-
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
|
-
const interColumnsDistance = formWidth / TOTAL_COLUMNS;
|
|
71
|
-
const columns = (0, ckmeans_grouping_1.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
|
-
const columnsWidth = columns.centroids.map((v, idx, t) => { var _a; return v - ((_a = t[idx - 1]) !== null && _a !== void 0 ? _a : 0); });
|
|
73
|
-
const acc = columnsWidth.map(() => 1);
|
|
74
|
-
while (acc.reduce((s, v) => s + v, 0) < TOTAL_COLUMNS) {
|
|
75
|
-
const idx = acc.reduce((s, size, idx) => {
|
|
76
|
-
const diff = size * interColumnsDistance - columnsWidth[idx];
|
|
77
|
-
return diff < 0 && -diff > s[1] ? [idx, -diff] : s;
|
|
78
|
-
}, [undefined, 0]);
|
|
79
|
-
const selected = idx[0];
|
|
80
|
-
if (selected === undefined) {
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
acc[selected]++;
|
|
84
|
-
}
|
|
85
|
-
// noinspection UnnecessaryLocalVariableJS
|
|
86
|
-
const columnsRoundedWidth = acc;
|
|
87
|
-
const columnsAccumulatedWidth = columnsRoundedWidth.reduce((acc, v) => { var _a; return [...acc, ((_a = acc[acc.length - 1]) !== null && _a !== void 0 ? _a : 0) + v]; }, []);
|
|
88
|
-
const columnsAccumulatedWidthWithInterColumns = columnsAccumulatedWidth.map((v) => v * interColumnsDistance);
|
|
89
|
-
return new model_1.Section('Main', formDataClusters.flatMap((formDataRow) => {
|
|
90
|
-
const cols = formDataRow
|
|
91
|
-
.map((formData) => {
|
|
92
|
-
return columnsAccumulatedWidth[columnsAccumulatedWidthWithInterColumns.reduce(([idx, min], x, n) => {
|
|
93
|
-
var _a, _b, _c, _d;
|
|
94
|
-
const right = ((_b = (_a = formData.editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = formData.editor) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 0) - leftSide;
|
|
95
|
-
return Math.abs(x - right) < min ? [n, Math.abs(x - right)] : [idx, min];
|
|
96
|
-
}, [0, 99999])[0]];
|
|
97
|
-
})
|
|
98
|
-
.map((x, idx, cols) => {
|
|
99
|
-
var _a, _b;
|
|
100
|
-
//Try to solve inverted positions in columns by adding or removing one column
|
|
101
|
-
const prev = (_a = cols[idx - 1]) !== null && _a !== void 0 ? _a : 0;
|
|
102
|
-
const next = (_b = cols[idx + 1]) !== null && _b !== void 0 ? _b : TOTAL_COLUMNS;
|
|
103
|
-
return x > prev + 1 && x >= next - 1 ? x - 1 : x === prev ? x + 1 : x;
|
|
104
|
-
});
|
|
105
|
-
const subRows = cols.reduce((acc, v, idx, cols) => {
|
|
106
|
-
var _a;
|
|
107
|
-
if (idx === 0) {
|
|
108
|
-
return [[[idx, v]]];
|
|
109
|
-
}
|
|
110
|
-
let row = 0;
|
|
111
|
-
while (row < acc.length && acc[row][acc[row].length - 1][1] > v) {
|
|
112
|
-
row++;
|
|
113
|
-
}
|
|
114
|
-
;
|
|
115
|
-
((_a = acc[row]) !== null && _a !== void 0 ? _a : (acc[row] = [])).push([idx, v]);
|
|
116
|
-
return acc;
|
|
117
|
-
}, []);
|
|
118
|
-
return subRows.flatMap((subRow) => {
|
|
119
|
-
const acc = subRow.map((x) => x[1]);
|
|
120
|
-
while (acc[acc.length - 1] < TOTAL_COLUMNS) {
|
|
121
|
-
const idx = acc.reduce(([minIdx, min], size, idx, columns) => {
|
|
122
|
-
const scenario = columns.map((x, cidx) => (cidx === idx ? x + 1 : x));
|
|
123
|
-
const penalty = scenario.reduce((acc, v) => {
|
|
124
|
-
var _a, _b, _c, _d;
|
|
125
|
-
const right = ((_b = (_a = formDataRow[subRow[idx][0]].editor) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = formDataRow[subRow[idx][0]].editor) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 0) - leftSide;
|
|
126
|
-
return acc + Math.abs(v * interColumnsDistance - right);
|
|
127
|
-
}, 0);
|
|
128
|
-
return penalty < min ? [idx, penalty] : [minIdx, min];
|
|
129
|
-
}, [undefined, 999999]);
|
|
130
|
-
const selected = idx[0];
|
|
131
|
-
if (selected === undefined) {
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
for (let i = selected; i < acc.length; i++) {
|
|
135
|
-
acc[i]++;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const expandedCols = acc;
|
|
139
|
-
let idx = 0;
|
|
140
|
-
return subRow
|
|
141
|
-
.map(([idx]) => formDataRow[idx])
|
|
142
|
-
.map((formData, index) => {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f;
|
|
144
|
-
const width = expandedCols[index] - idx;
|
|
145
|
-
idx += width;
|
|
146
|
-
return (_d = (_a = {
|
|
147
|
-
StringEditor: makeTextField,
|
|
148
|
-
CheckBoxEditor: makeCheckBox,
|
|
149
|
-
MeasureEditor: makeMeasureField,
|
|
150
|
-
NumberEditor: makeNumberField,
|
|
151
|
-
PopupMenuEditor: makeDropdownField,
|
|
152
|
-
DateTimeEditor: makeDateTimeField,
|
|
153
|
-
StringTableEditor: makeItemsListField,
|
|
154
|
-
TokenFieldEditor: makeTokenField,
|
|
155
|
-
SubFormEditor: makeSubForm,
|
|
156
|
-
ActionButton: makeActionButton,
|
|
157
|
-
})[(_c = (_b = formData.editor) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.call(_a, formData, width, Math.max(1, Math.floor(((_f = (_e = formData.editor) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : 0) / meanHeight)));
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}));
|
|
161
|
-
}), form.guid);
|
|
162
|
-
return translated;
|
|
163
|
-
}
|
|
164
|
-
exports.convertLegacy = convertLegacy;
|
|
165
|
-
//# sourceMappingURL=icure-convert.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA,EAAA,CAAA;IAC/H,MAAM,cAAc,GAAG,CAAC,QAAwB,EAAE,KAAa,EAAE,MAAc,EAAE,EAAE,WAClF,OAAA,IAAI,kBAAU,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,EAA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Ac,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"]}
|
package/utils/icure-utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CodeStub, Content, Service } from '@icure/api';
|
|
2
|
-
export declare function anyDateToDate(dateOrEpochOrLongCalendar?: Date | number): Date | undefined;
|
|
3
|
-
export declare function dateToFuzzyDate(date: Date): number;
|
|
4
|
-
export declare function anyDateToFuzzyDate(dateOrEpochOrLongCalendar: Date | number): number | undefined;
|
|
5
|
-
export declare function currentTime(): string;
|
|
6
|
-
export declare function currentDate(): string;
|
|
7
|
-
export declare function currentDateTime(): string;
|
|
8
|
-
export declare function isCodeEqual(c1: CodeStub, c2: CodeStub): boolean;
|
|
9
|
-
export declare function areCodesEqual(c1s: CodeStub[], c2s: CodeStub[]): boolean;
|
|
10
|
-
export declare function isServiceEqual(svc1: Service, svc2: Service): boolean;
|
|
11
|
-
export declare function isContentEqual(content1: Content | undefined, content2: Content | undefined): boolean;
|
|
12
|
-
export declare function isServiceContentEqual(content1: {
|
|
13
|
-
[language: string]: Content;
|
|
14
|
-
}, content2: {
|
|
15
|
-
[language: string]: Content;
|
|
16
|
-
}): boolean;
|
package/utils/icure-utils.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isServiceContentEqual = exports.isContentEqual = exports.isServiceEqual = exports.areCodesEqual = exports.isCodeEqual = exports.currentDateTime = exports.currentDate = exports.currentTime = exports.anyDateToFuzzyDate = exports.dateToFuzzyDate = exports.anyDateToDate = void 0;
|
|
7
|
-
const parse_1 = __importDefault(require("date-fns/parse"));
|
|
8
|
-
function anyDateToDate(dateOrEpochOrLongCalendar) {
|
|
9
|
-
if (dateOrEpochOrLongCalendar instanceof Date) {
|
|
10
|
-
return anyDateToDate(+dateOrEpochOrLongCalendar);
|
|
11
|
-
}
|
|
12
|
-
if (!dateOrEpochOrLongCalendar && dateOrEpochOrLongCalendar !== 0) {
|
|
13
|
-
return undefined;
|
|
14
|
-
}
|
|
15
|
-
if (dateOrEpochOrLongCalendar >= 18000101 && dateOrEpochOrLongCalendar < 25400000) {
|
|
16
|
-
return (0, parse_1.default)('' + dateOrEpochOrLongCalendar, 'yyyyMMdd', new Date());
|
|
17
|
-
}
|
|
18
|
-
else if (dateOrEpochOrLongCalendar >= 18000101000000) {
|
|
19
|
-
return (0, parse_1.default)('' + dateOrEpochOrLongCalendar, 'yyyyMMddHHmmss', new Date());
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return new Date(dateOrEpochOrLongCalendar);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.anyDateToDate = anyDateToDate;
|
|
26
|
-
function dateToFuzzyDate(date) {
|
|
27
|
-
return parseInt(`${date.getFullYear()}${(date.getMonth() + 1).toString().padStart(2, '0')}${date.getDate().toString().padStart(2, '0')}${date.getHours().toString().padStart(2, '0')}:${date
|
|
28
|
-
.getMinutes()
|
|
29
|
-
.toString()
|
|
30
|
-
.padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`);
|
|
31
|
-
}
|
|
32
|
-
exports.dateToFuzzyDate = dateToFuzzyDate;
|
|
33
|
-
function anyDateToFuzzyDate(dateOrEpochOrLongCalendar) {
|
|
34
|
-
const date = anyDateToDate(dateOrEpochOrLongCalendar);
|
|
35
|
-
if (!date) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
return dateToFuzzyDate(date);
|
|
39
|
-
}
|
|
40
|
-
exports.anyDateToFuzzyDate = anyDateToFuzzyDate;
|
|
41
|
-
function currentTime() {
|
|
42
|
-
const now = new Date();
|
|
43
|
-
return `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`;
|
|
44
|
-
}
|
|
45
|
-
exports.currentTime = currentTime;
|
|
46
|
-
function currentDate() {
|
|
47
|
-
const now = new Date();
|
|
48
|
-
return `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`;
|
|
49
|
-
}
|
|
50
|
-
exports.currentDate = currentDate;
|
|
51
|
-
function currentDateTime() {
|
|
52
|
-
return `${currentDate()} ${currentTime()}`;
|
|
53
|
-
}
|
|
54
|
-
exports.currentDateTime = currentDateTime;
|
|
55
|
-
function isCodeEqual(c1, c2) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
const idParts1 = (_a = c1.id) === null || _a === void 0 ? void 0 : _a.split('|');
|
|
58
|
-
const idParts2 = (_b = c2.id) === null || _b === void 0 ? void 0 : _b.split('|');
|
|
59
|
-
const type1 = c1.type || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[0]);
|
|
60
|
-
const type2 = c2.type || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[0]);
|
|
61
|
-
const code1 = c1.code || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[1]);
|
|
62
|
-
const code2 = c2.code || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[1]);
|
|
63
|
-
const version1 = c1.version || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[2]);
|
|
64
|
-
const version2 = c2.version || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[2]);
|
|
65
|
-
return type1 === type2 && code1 === code2 && version1 === version2;
|
|
66
|
-
}
|
|
67
|
-
exports.isCodeEqual = isCodeEqual;
|
|
68
|
-
function areCodesEqual(c1s, c2s) {
|
|
69
|
-
return c1s.every((c1) => c2s.some((c2) => isCodeEqual(c1, c2)) || false) && c2s.every((c2) => c1s.some((c1) => isCodeEqual(c1, c2)) || false);
|
|
70
|
-
}
|
|
71
|
-
exports.areCodesEqual = areCodesEqual;
|
|
72
|
-
function isServiceEqual(svc1, svc2) {
|
|
73
|
-
return (svc1.id === svc2.id && svc1.valueDate === svc2.valueDate && areCodesEqual(svc1.codes || [], svc2.codes || []) && isServiceContentEqual(svc1.content || {}, svc2.content || {}));
|
|
74
|
-
}
|
|
75
|
-
exports.isServiceEqual = isServiceEqual;
|
|
76
|
-
function isContentEqual(content1, content2) {
|
|
77
|
-
var _a, _b;
|
|
78
|
-
if (!content1 && !content2) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
if (!content1 || !content2) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
return (((!content1.binaryValue && !content2.binaryValue) || content1.binaryValue === content2.binaryValue) &&
|
|
85
|
-
(((content1.booleanValue === null || content1.booleanValue === undefined) && (content2.booleanValue === null || content2.booleanValue === undefined)) ||
|
|
86
|
-
content1.booleanValue === content2.booleanValue) &&
|
|
87
|
-
((!content1.documentId && !content2.documentId) || content1.documentId === content2.documentId) &&
|
|
88
|
-
(((content1.fuzzyDateValue === null || content1.fuzzyDateValue === undefined) && (content2.fuzzyDateValue === null || content2.fuzzyDateValue === undefined)) ||
|
|
89
|
-
content1.fuzzyDateValue === content2.fuzzyDateValue) &&
|
|
90
|
-
((!content1.instantValue && !content2.instantValue) || content1.instantValue === content2.instantValue) &&
|
|
91
|
-
((!content1.measureValue && !content2.measureValue) || content1.measureValue === content2.measureValue) &&
|
|
92
|
-
((!content1.medicationValue && !content2.medicationValue) || content1.medicationValue === content2.medicationValue) &&
|
|
93
|
-
((!content1.stringValue && !content2.stringValue) || content1.stringValue === content2.stringValue) &&
|
|
94
|
-
(((content1.numberValue === null || content1.numberValue === undefined) && (content2.numberValue === null || content2.numberValue === undefined)) ||
|
|
95
|
-
content1.numberValue === content2.numberValue) &&
|
|
96
|
-
((!content1.compoundValue && !content2.compoundValue) ||
|
|
97
|
-
((((_a = content1.compoundValue) === null || _a === void 0 ? void 0 : _a.every((s1) => { var _a; return (_a = content2.compoundValue) === null || _a === void 0 ? void 0 : _a.some((s2) => isServiceEqual(s1, s2)); })) || false) &&
|
|
98
|
-
(((_b = content2 === null || content2 === void 0 ? void 0 : content2.compoundValue) === null || _b === void 0 ? void 0 : _b.every((s2) => { var _a; return (_a = content1 === null || content1 === void 0 ? void 0 : content1.compoundValue) === null || _a === void 0 ? void 0 : _a.some((s1) => isServiceEqual(s1, s2)); })) || false))));
|
|
99
|
-
}
|
|
100
|
-
exports.isContentEqual = isContentEqual;
|
|
101
|
-
function isServiceContentEqual(content1, content2) {
|
|
102
|
-
return Object.keys(content1).reduce((isEqual, lng) => isEqual && isContentEqual(content1[lng], content2[lng]), true);
|
|
103
|
-
}
|
|
104
|
-
exports.isServiceContentEqual = isServiceContentEqual;
|
|
105
|
-
//# sourceMappingURL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AAQ,CAAC,WAAW,CAAC;QAC/C,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;YACpD,CAAC,CAAC,CAAA,MAAA,QAAQ,CAAC,aAAa,0CAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,WAAC,OAAA,MAAA,QAAQ,CAAC,aAAa,0CAAE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA,EAAA,CAAC,KAAI,KAAK,CAAC;gBAC9G,CAAC,CAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,0CAAE,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,WAAC,OAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,0CAAE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA,EAAA,CAAC,KAAI,KAAK,CAAC,CAAC,CAAC,CACpH,CAAA;AACF,CAAC;AAxBD,wCAwBC;AAED,SAAgB,qBAAqB,CAAC,QAAyC,EAAE,QAAyC;IACzH,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAe,CAAC,CAAA;AAChI,CAAC;AAFD,sDAEC","sourcesContent":["import parse from 'date-fns/parse'\nimport { CodeStub, Content, Service } from '@icure/api'\n\nexport function anyDateToDate(dateOrEpochOrLongCalendar?: Date | number): Date | undefined {\n\tif (dateOrEpochOrLongCalendar instanceof Date) {\n\t\treturn anyDateToDate(+dateOrEpochOrLongCalendar)\n\t}\n\tif (!dateOrEpochOrLongCalendar && dateOrEpochOrLongCalendar !== 0) {\n\t\treturn undefined\n\t}\n\tif (dateOrEpochOrLongCalendar >= 18000101 && dateOrEpochOrLongCalendar < 25400000) {\n\t\treturn parse('' + dateOrEpochOrLongCalendar, 'yyyyMMdd', new Date())\n\t} else if (dateOrEpochOrLongCalendar >= 18000101000000) {\n\t\treturn parse('' + dateOrEpochOrLongCalendar, 'yyyyMMddHHmmss', new Date())\n\t} else {\n\t\treturn new Date(dateOrEpochOrLongCalendar)\n\t}\n}\n\nexport function dateToFuzzyDate(date: Date): number {\n\treturn parseInt(\n\t\t`${date.getFullYear()}${(date.getMonth() + 1).toString().padStart(2, '0')}${date.getDate().toString().padStart(2, '0')}${date.getHours().toString().padStart(2, '0')}:${date\n\t\t\t.getMinutes()\n\t\t\t.toString()\n\t\t\t.padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`,\n\t)\n}\n\nexport function anyDateToFuzzyDate(dateOrEpochOrLongCalendar: Date | number) {\n\tconst date = anyDateToDate(dateOrEpochOrLongCalendar)\n\tif (!date) {\n\t\treturn undefined\n\t}\n\treturn dateToFuzzyDate(date)\n}\n\nexport function currentTime() {\n\tconst now = new Date()\n\treturn `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`\n}\n\nexport function currentDate() {\n\tconst now = new Date()\n\treturn `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`\n}\n\nexport function currentDateTime() {\n\treturn `${currentDate()} ${currentTime()}`\n}\n\nexport function isCodeEqual(c1: CodeStub, c2: CodeStub): boolean {\n\tconst idParts1 = c1.id?.split('|')\n\tconst idParts2 = c2.id?.split('|')\n\tconst type1 = c1.type || idParts1?.[0]\n\tconst type2 = c2.type || idParts2?.[0]\n\tconst code1 = c1.code || idParts1?.[1]\n\tconst code2 = c2.code || idParts2?.[1]\n\tconst version1 = c1.version || idParts1?.[2]\n\tconst version2 = c2.version || idParts2?.[2]\n\treturn type1 === type2 && code1 === code2 && version1 === version2\n}\n\nexport function areCodesEqual(c1s: CodeStub[], c2s: CodeStub[]): boolean {\n\treturn c1s.every((c1) => c2s.some((c2) => isCodeEqual(c1, c2)) || false) && c2s.every((c2) => c1s.some((c1) => isCodeEqual(c1, c2)) || false)\n}\n\nexport function isServiceEqual(svc1: Service, svc2: Service): boolean {\n\treturn (\n\t\tsvc1.id === svc2.id && svc1.valueDate === svc2.valueDate && areCodesEqual(svc1.codes || [], svc2.codes || []) && isServiceContentEqual(svc1.content || {}, svc2.content || {})\n\t)\n}\n\nexport function isContentEqual(content1: Content | undefined, content2: Content | undefined): boolean {\n\tif (!content1 && !content2) {\n\t\treturn true\n\t}\n\tif (!content1 || !content2) {\n\t\treturn false\n\t}\n\treturn (\n\t\t((!content1.binaryValue && !content2.binaryValue) || content1.binaryValue === content2.binaryValue) &&\n\t\t(((content1.booleanValue === null || content1.booleanValue === undefined) && (content2.booleanValue === null || content2.booleanValue === undefined)) ||\n\t\t\tcontent1.booleanValue === content2.booleanValue) &&\n\t\t((!content1.documentId && !content2.documentId) || content1.documentId === content2.documentId) &&\n\t\t(((content1.fuzzyDateValue === null || content1.fuzzyDateValue === undefined) && (content2.fuzzyDateValue === null || content2.fuzzyDateValue === undefined)) ||\n\t\t\tcontent1.fuzzyDateValue === content2.fuzzyDateValue) &&\n\t\t((!content1.instantValue && !content2.instantValue) || content1.instantValue === content2.instantValue) &&\n\t\t((!content1.measureValue && !content2.measureValue) || content1.measureValue === content2.measureValue) &&\n\t\t((!content1.medicationValue && !content2.medicationValue) || content1.medicationValue === content2.medicationValue) &&\n\t\t((!content1.stringValue && !content2.stringValue) || content1.stringValue === content2.stringValue) &&\n\t\t(((content1.numberValue === null || content1.numberValue === undefined) && (content2.numberValue === null || content2.numberValue === undefined)) ||\n\t\t\tcontent1.numberValue === content2.numberValue) &&\n\t\t((!content1.compoundValue && !content2.compoundValue) ||\n\t\t\t((content1.compoundValue?.every((s1) => content2.compoundValue?.some((s2) => isServiceEqual(s1, s2))) || false) &&\n\t\t\t\t(content2?.compoundValue?.every((s2) => content1?.compoundValue?.some((s1) => isServiceEqual(s1, s2))) || false)))\n\t)\n}\n\nexport function isServiceContentEqual(content1: { [language: string]: Content }, content2: { [language: string]: Content }): boolean {\n\treturn Object.keys(content1).reduce((isEqual, lng) => isEqual && isContentEqual(content1[lng], content2[lng]), true as boolean)\n}\n"]}
|