@icure/form 1.0.8 → 1.0.9
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/iqr-form/fields/datePicker.d.ts +5 -3
- package/components/iqr-form/fields/datePicker.js +26 -12
- package/components/iqr-form/fields/dateTimePicker.d.ts +5 -3
- package/components/iqr-form/fields/dateTimePicker.js +18 -12
- package/components/iqr-form/fields/measureField.d.ts +3 -3
- package/components/iqr-form/fields/measureField.js +13 -12
- package/components/iqr-form/fields/multipleChoice.d.ts +3 -3
- package/components/iqr-form/fields/multipleChoice.js +13 -12
- package/components/iqr-form/fields/numberField.d.ts +3 -3
- package/components/iqr-form/fields/numberField.js +13 -12
- package/components/iqr-form/fields/textfield.js +79 -27
- package/components/iqr-form/fields/timePicker.d.ts +5 -3
- package/components/iqr-form/fields/timePicker.js +18 -12
- package/components/iqr-form/index.js +27 -22
- package/components/iqr-form/model/index.d.ts +36 -18
- package/components/iqr-form/model/index.js +8 -3
- package/components/iqr-form/renderer/cards.d.ts +1 -1
- package/components/iqr-form/renderer/cards.js +39 -29
- package/components/iqr-form/renderer/form.d.ts +1 -1
- package/components/iqr-form/renderer/form.js +78 -32
- package/components/iqr-form/renderer/index.d.ts +6 -3
- package/components/iqr-form-loader/fieldsValuesProviders.d.ts +13 -0
- package/components/iqr-form-loader/fieldsValuesProviders.js +46 -0
- package/components/iqr-form-loader/formValuesContainer.d.ts +33 -0
- package/components/iqr-form-loader/formValuesContainer.js +110 -0
- package/components/iqr-form-loader/index.d.ts +3 -0
- package/components/iqr-form-loader/index.js +15 -0
- package/components/iqr-form-loader/models.d.ts +14 -0
- package/components/iqr-form-loader/models.js +2 -0
- package/components/iqr-text-field/index.d.ts +26 -2
- package/components/iqr-text-field/index.js +316 -170
- package/components/iqr-text-field/plugin/caret-fix-plugin.d.ts +1 -1
- package/components/iqr-text-field/plugin/caret-fix-plugin.js +10 -6
- package/components/iqr-text-field/plugin/has-content-class-plugin.d.ts +1 -1
- package/components/iqr-text-field/plugin/has-content-class-plugin.js +7 -5
- package/components/iqr-text-field/plugin/mask-plugin.d.ts +1 -1
- package/components/iqr-text-field/plugin/mask-plugin.js +19 -12
- package/components/iqr-text-field/plugin/regexp-plugin.d.ts +1 -1
- package/components/iqr-text-field/plugin/regexp-plugin.js +7 -4
- package/components/iqr-text-field/prosemirror-commands.d.ts +5 -3
- package/components/iqr-text-field/prosemirror-commands.js +4 -3
- package/components/iqr-text-field/prosemirror-utils.d.ts +1 -1
- package/components/iqr-text-field/prosemirror-utils.js +1 -1
- package/components/iqr-text-field/schema/common-marks.d.ts +1 -1
- package/components/iqr-text-field/schema/common-marks.js +49 -46
- package/components/iqr-text-field/schema/date-time-schema.js +13 -13
- package/components/iqr-text-field/schema/decimal-schema.js +4 -4
- package/components/iqr-text-field/schema/index.d.ts +6 -6
- package/components/iqr-text-field/schema/index.js +13 -6
- package/components/iqr-text-field/schema/markdown-schema.js +65 -32
- package/components/iqr-text-field/schema/measure-schema.js +5 -5
- package/components/iqr-text-field/schema/token-schema.js +10 -7
- package/components/iqr-text-field/schema/utils.d.ts +1 -1
- package/components/iqr-text-field/schema/utils.js +2 -2
- package/components/iqr-text-field/selection-companion.d.ts +2 -2
- package/components/iqr-text-field/selection-companion.js +13 -12
- package/components/iqr-text-field/styles/paths.d.ts +5 -0
- package/components/iqr-text-field/styles/paths.js +36 -0
- package/components/iqr-text-field/suggestion-palette.d.ts +11 -15
- package/components/iqr-text-field/suggestion-palette.js +38 -21
- package/package.json +3 -4
- package/utils/icure-utils.d.ts +19 -0
- package/utils/icure-utils.js +105 -0
- package/utils/languages.d.ts +8 -0
- package/utils/languages.js +14 -0
- package/utils/no-lodash.d.ts +5 -0
- package/utils/no-lodash.js +19 -0
|
@@ -0,0 +1,105 @@
|
|
|
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.setServices = exports.getVersions = exports.convertServicesToVersionedMetas = exports.convertServicesToVersionedValues = exports.isServiceContentEqual = exports.isContentEqual = exports.isServiceEqual = exports.areCodesEqual = exports.isCodeEqual = exports.fuzzyDate = void 0;
|
|
7
|
+
const parse_1 = __importDefault(require("date-fns/parse"));
|
|
8
|
+
const api_1 = require("@icure/api");
|
|
9
|
+
function fuzzyDate(epochOrLongCalendar) {
|
|
10
|
+
if (!epochOrLongCalendar && epochOrLongCalendar !== 0) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (epochOrLongCalendar >= 18000101 && epochOrLongCalendar < 25400000) {
|
|
14
|
+
return parse_1.default('' + epochOrLongCalendar, 'YYYYMMDD', new Date());
|
|
15
|
+
}
|
|
16
|
+
else if (epochOrLongCalendar >= 18000101000000) {
|
|
17
|
+
return parse_1.default('' + epochOrLongCalendar, 'YYYYMMDDHHmmss', new Date());
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return new Date(epochOrLongCalendar);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.fuzzyDate = fuzzyDate;
|
|
24
|
+
function isCodeEqual(c1, c2) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const idParts1 = (_a = c1.id) === null || _a === void 0 ? void 0 : _a.split('|');
|
|
27
|
+
const idParts2 = (_b = c2.id) === null || _b === void 0 ? void 0 : _b.split('|');
|
|
28
|
+
const type1 = c1.type || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[0]);
|
|
29
|
+
const type2 = c2.type || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[0]);
|
|
30
|
+
const code1 = c1.code || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[1]);
|
|
31
|
+
const code2 = c2.code || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[1]);
|
|
32
|
+
const version1 = c1.version || (idParts1 === null || idParts1 === void 0 ? void 0 : idParts1[2]);
|
|
33
|
+
const version2 = c2.version || (idParts2 === null || idParts2 === void 0 ? void 0 : idParts2[2]);
|
|
34
|
+
return type1 === type2 && code1 === code2 && version1 === version2;
|
|
35
|
+
}
|
|
36
|
+
exports.isCodeEqual = isCodeEqual;
|
|
37
|
+
function areCodesEqual(c1s, c2s) {
|
|
38
|
+
return c1s.every((c1) => c2s.some((c2) => isCodeEqual(c1, c2)) || false) && c2s.every((c2) => c1s.some((c1) => isCodeEqual(c1, c2)) || false);
|
|
39
|
+
}
|
|
40
|
+
exports.areCodesEqual = areCodesEqual;
|
|
41
|
+
function isServiceEqual(svc1, svc2) {
|
|
42
|
+
return (svc1.id === svc2.id && svc1.valueDate === svc2.valueDate && areCodesEqual(svc1.codes || [], svc2.codes || []) && isServiceContentEqual(svc1.content || {}, svc2.content || {}));
|
|
43
|
+
}
|
|
44
|
+
exports.isServiceEqual = isServiceEqual;
|
|
45
|
+
function isContentEqual(content1, content2) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return (((!content1.binaryValue && !content2.binaryValue) || content1.binaryValue === content2.binaryValue) &&
|
|
48
|
+
(((content1.booleanValue === null || content1.booleanValue === undefined) && (content2.booleanValue === null || content2.booleanValue === undefined)) ||
|
|
49
|
+
content1.booleanValue === content2.booleanValue) &&
|
|
50
|
+
((!content1.documentId && !content2.documentId) || content1.documentId === content2.documentId) &&
|
|
51
|
+
(((content1.fuzzyDateValue === null || content1.fuzzyDateValue === undefined) && (content2.fuzzyDateValue === null || content2.fuzzyDateValue === undefined)) ||
|
|
52
|
+
content1.fuzzyDateValue === content2.fuzzyDateValue) &&
|
|
53
|
+
((!content1.instantValue && !content2.instantValue) || content1.instantValue === content2.instantValue) &&
|
|
54
|
+
((!content1.measureValue && !content2.measureValue) || content1.measureValue === content2.measureValue) &&
|
|
55
|
+
((!content1.medicationValue && !content2.medicationValue) || content1.medicationValue === content2.medicationValue) &&
|
|
56
|
+
((!content1.stringValue && !content2.stringValue) || content1.stringValue === content2.stringValue) &&
|
|
57
|
+
(((content1.numberValue === null || content1.numberValue === undefined) && (content2.numberValue === null || content2.numberValue === undefined)) ||
|
|
58
|
+
content1.numberValue === content2.numberValue) &&
|
|
59
|
+
((!content1.compoundValue && !content2.compoundValue) ||
|
|
60
|
+
((((_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) &&
|
|
61
|
+
(((_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))));
|
|
62
|
+
}
|
|
63
|
+
exports.isContentEqual = isContentEqual;
|
|
64
|
+
function isServiceContentEqual(content1, content2) {
|
|
65
|
+
return Object.keys(content1).reduce((isEqual, lng) => isEqual && isContentEqual(content1[lng], content2[lng]), true);
|
|
66
|
+
}
|
|
67
|
+
exports.isServiceContentEqual = isServiceContentEqual;
|
|
68
|
+
function convertServicesToVersionedValues(versions, extractValueFromContent) {
|
|
69
|
+
return Object.entries(versions).map(([key, value]) => ({
|
|
70
|
+
id: key,
|
|
71
|
+
versions: value.map((s) => {
|
|
72
|
+
var _a, _b, _c;
|
|
73
|
+
return ({
|
|
74
|
+
revision: '' + ((_a = s.service) === null || _a === void 0 ? void 0 : _a.modified),
|
|
75
|
+
modified: ((_b = s.service) === null || _b === void 0 ? void 0 : _b.modified) || 0,
|
|
76
|
+
value: Object.entries(((_c = s.service) === null || _c === void 0 ? void 0 : _c.content) || {}).reduce((acc, [lng, content]) => (Object.assign(Object.assign({}, acc), { [lng]: extractValueFromContent(content) })), {}),
|
|
77
|
+
});
|
|
78
|
+
}),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
exports.convertServicesToVersionedValues = convertServicesToVersionedValues;
|
|
82
|
+
function convertServicesToVersionedMetas(versions) {
|
|
83
|
+
return Object.entries(versions).map(([key, value]) => ({
|
|
84
|
+
id: key,
|
|
85
|
+
metas: value.map((s) => {
|
|
86
|
+
var _a, _b, _c, _d, _e;
|
|
87
|
+
return ({
|
|
88
|
+
revision: '' + ((_a = s.service) === null || _a === void 0 ? void 0 : _a.modified),
|
|
89
|
+
modified: ((_b = s.service) === null || _b === void 0 ? void 0 : _b.modified) || 0,
|
|
90
|
+
valueDate: (_c = s.service) === null || _c === void 0 ? void 0 : _c.valueDate,
|
|
91
|
+
owner: ((_d = s.service) === null || _d === void 0 ? void 0 : _d.responsible) ? { id: (_e = s.service) === null || _e === void 0 ? void 0 : _e.responsible } : undefined,
|
|
92
|
+
});
|
|
93
|
+
}),
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
exports.convertServicesToVersionedMetas = convertServicesToVersionedMetas;
|
|
97
|
+
function getVersions(formsValueContainer, field) {
|
|
98
|
+
return ((formsValueContainer === null || formsValueContainer === void 0 ? void 0 : formsValueContainer.getVersions((svc) => { var _a; return ((_a = field.tags) === null || _a === void 0 ? void 0 : _a.length) ? field.tags.every((t) => (svc.tags || []).some((tt) => api_1.normalizeCode(tt).id === t)) : svc.label === field.label(); })) || {});
|
|
99
|
+
}
|
|
100
|
+
exports.getVersions = getVersions;
|
|
101
|
+
function setServices(ctc, newServices, modifiedServices) {
|
|
102
|
+
var _a;
|
|
103
|
+
return new api_1.Contact(Object.assign(Object.assign({}, ctc), { services: newServices.concat(((_a = ctc.services) === null || _a === void 0 ? void 0 : _a.map((s) => modifiedServices.find((r) => r.id === s.id) || s)) || []) }));
|
|
104
|
+
}
|
|
105
|
+
exports.setServices = setServices;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.languageName = exports.languages = void 0;
|
|
4
|
+
exports.languages = {
|
|
5
|
+
en: 'English',
|
|
6
|
+
fr: 'French',
|
|
7
|
+
es: 'Spanish',
|
|
8
|
+
nl: 'Dutch',
|
|
9
|
+
de: 'German',
|
|
10
|
+
};
|
|
11
|
+
function languageName(iso) {
|
|
12
|
+
return exports.languages[iso] || iso;
|
|
13
|
+
}
|
|
14
|
+
exports.languageName = languageName;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function groupBy<K, I extends string | number>(items: K[], grouper: (item: K) => I): {
|
|
2
|
+
[key: I]: K;
|
|
3
|
+
};
|
|
4
|
+
export declare function sortedBy<K>(items: K[], key: string, direction?: string): K[];
|
|
5
|
+
export declare function sorted<K>(items: K[], direction?: string): K[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sorted = exports.sortedBy = exports.groupBy = void 0;
|
|
4
|
+
function groupBy(items, grouper) {
|
|
5
|
+
return items.reduce((r, v, i, a, k = grouper(v)) => {
|
|
6
|
+
;
|
|
7
|
+
(r[k] || (r[k] = [])).push(v);
|
|
8
|
+
return r;
|
|
9
|
+
}, {});
|
|
10
|
+
}
|
|
11
|
+
exports.groupBy = groupBy;
|
|
12
|
+
function sortedBy(items, key, direction = 'asc') {
|
|
13
|
+
return items.concat().sort(direction === 'asc' ? (a, b) => (a[key] > b[key] ? 1 : b[key] > a[key] ? -1 : 0) : (a, b) => (a[key] < b[key] ? 1 : b[key] < a[key] ? -1 : 0));
|
|
14
|
+
}
|
|
15
|
+
exports.sortedBy = sortedBy;
|
|
16
|
+
function sorted(items, direction = 'asc') {
|
|
17
|
+
return items.concat().sort(direction === 'asc' ? (a, b) => (a > b ? 1 : b > a ? -1 : 0) : (a, b) => (a < b ? 1 : b < a ? -1 : 0));
|
|
18
|
+
}
|
|
19
|
+
exports.sorted = sorted;
|