@icure/form 1.0.5 → 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/{lib/components → components}/index.d.ts +0 -0
- package/{lib/components → components}/index.js +0 -0
- package/components/iqr-form/fields/datePicker.d.ts +10 -0
- package/{lib/components → components}/iqr-form/fields/datePicker.js +26 -12
- package/components/iqr-form/fields/dateTimePicker.d.ts +10 -0
- package/{lib/components → components}/iqr-form/fields/dateTimePicker.js +18 -12
- package/components/iqr-form/fields/measureField.d.ts +8 -0
- package/{lib/components → components}/iqr-form/fields/measureField.js +13 -12
- package/components/iqr-form/fields/multipleChoice.d.ts +8 -0
- package/{lib/components → components}/iqr-form/fields/multipleChoice.js +13 -12
- package/components/iqr-form/fields/numberField.d.ts +8 -0
- package/{lib/components → components}/iqr-form/fields/numberField.js +13 -12
- package/{lib/components → components}/iqr-form/fields/textfield.d.ts +0 -0
- package/components/iqr-form/fields/textfield.js +138 -0
- package/components/iqr-form/fields/timePicker.d.ts +10 -0
- package/{lib/components → components}/iqr-form/fields/timePicker.js +18 -12
- package/{lib/components → components}/iqr-form/index.d.ts +0 -0
- package/{lib/components → components}/iqr-form/index.js +30 -25
- package/{lib/components → components}/iqr-form/model/index.d.ts +36 -18
- package/{lib/components → components}/iqr-form/model/index.js +9 -4
- package/{lib/components → components}/iqr-form/renderer/cards.d.ts +1 -1
- package/components/iqr-form/renderer/cards.js +54 -0
- package/{lib/components → components}/iqr-form/renderer/form.d.ts +1 -1
- package/components/iqr-form/renderer/form.js +91 -0
- package/components/iqr-form/renderer/index.d.ts +6 -0
- package/components/iqr-form/renderer/index.js +2 -0
- 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/{lib/components/iqr-form/renderer/index.js → components/iqr-form-loader/models.js} +0 -0
- package/components/iqr-text-field/index.d.ts +26 -0
- package/{lib/components → components}/iqr-text-field/index.js +316 -171
- package/components/iqr-text-field/plugin/caret-fix-plugin.d.ts +2 -0
- package/{lib/components → components}/iqr-text-field/plugin/caret-fix-plugin.js +10 -6
- package/components/iqr-text-field/plugin/has-content-class-plugin.d.ts +2 -0
- package/{lib/components → components}/iqr-text-field/plugin/has-content-class-plugin.js +7 -5
- package/components/iqr-text-field/plugin/mask-plugin.d.ts +2 -0
- package/{lib/components → components}/iqr-text-field/plugin/mask-plugin.js +19 -12
- package/components/iqr-text-field/plugin/regexp-plugin.d.ts +2 -0
- package/{lib/components → components}/iqr-text-field/plugin/regexp-plugin.js +7 -4
- package/components/iqr-text-field/prosemirror-commands.d.ts +6 -0
- package/{lib/components → components}/iqr-text-field/prosemirror-commands.js +4 -3
- package/{lib/components → components}/iqr-text-field/prosemirror-utils.d.ts +1 -1
- package/{lib/components → components}/iqr-text-field/prosemirror-utils.js +1 -1
- package/{lib/components → components}/iqr-text-field/schema/common-marks.d.ts +1 -1
- package/components/iqr-text-field/schema/common-marks.js +93 -0
- package/{lib/components → components}/iqr-text-field/schema/date-time-schema.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/date-time-schema.js +13 -13
- package/{lib/components → components}/iqr-text-field/schema/decimal-schema.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/decimal-schema.js +4 -4
- package/{lib/components → components}/iqr-text-field/schema/index.d.ts +6 -6
- package/components/iqr-text-field/schema/index.js +25 -0
- package/{lib/components → components}/iqr-text-field/schema/markdown-schema.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/markdown-schema.js +65 -32
- package/{lib/components → components}/iqr-text-field/schema/measure-schema.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/measure-schema.js +5 -5
- package/{lib/components → components}/iqr-text-field/schema/token-schema.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/token-schema.js +10 -7
- package/{lib/components → components}/iqr-text-field/schema/utils.d.ts +1 -1
- package/{lib/components → components}/iqr-text-field/schema/utils.js +2 -2
- package/{lib/components → components}/iqr-text-field/selection-companion.d.ts +2 -2
- package/{lib/components → 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/{lib/components → components}/iqr-text-field/suggestion-palette.d.ts +11 -15
- package/{lib/components → components}/iqr-text-field/suggestion-palette.js +41 -24
- package/{lib/index.d.ts → index.d.ts} +0 -0
- package/{lib/index.js → index.js} +0 -0
- package/package.json +13 -47
- 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
- package/lib/components/iqr-form/fields/datePicker.d.ts +0 -8
- package/lib/components/iqr-form/fields/dateTimePicker.d.ts +0 -8
- package/lib/components/iqr-form/fields/measureField.d.ts +0 -8
- package/lib/components/iqr-form/fields/multipleChoice.d.ts +0 -8
- package/lib/components/iqr-form/fields/numberField.d.ts +0 -8
- package/lib/components/iqr-form/fields/textfield.js +0 -86
- package/lib/components/iqr-form/fields/timePicker.d.ts +0 -8
- package/lib/components/iqr-form/renderer/cards.js +0 -44
- package/lib/components/iqr-form/renderer/form.js +0 -45
- package/lib/components/iqr-form/renderer/index.d.ts +0 -3
- package/lib/components/iqr-text-field/index.d.ts +0 -2
- package/lib/components/iqr-text-field/plugin/caret-fix-plugin.d.ts +0 -2
- package/lib/components/iqr-text-field/plugin/has-content-class-plugin.d.ts +0 -2
- package/lib/components/iqr-text-field/plugin/mask-plugin.d.ts +0 -2
- package/lib/components/iqr-text-field/plugin/regexp-plugin.d.ts +0 -2
- package/lib/components/iqr-text-field/prosemirror-commands.d.ts +0 -4
- package/lib/components/iqr-text-field/schema/common-marks.js +0 -90
- package/lib/components/iqr-text-field/schema/index.js +0 -18
package/package.json
CHANGED
|
@@ -1,60 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icure/form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"
|
|
7
|
-
"start": "webpack-dev-server --env.mode development",
|
|
8
|
-
"build": "node lit-inject-scss.js src tmp && tsc",
|
|
9
|
-
"dist": "webpack --env.mode production",
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [],
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "ISC",
|
|
6
|
+
"types": null,
|
|
15
7
|
"dependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@webcomponents/webcomponentsjs": "^2.4.4",
|
|
8
|
+
"@webcomponents/webcomponentsjs": "^2.5.0",
|
|
18
9
|
"fast-deep-equal": "^3.1.3",
|
|
19
|
-
"lit
|
|
20
|
-
"prosemirror-commands": "^1.1.
|
|
10
|
+
"lit": "^2.0.0-rc.2",
|
|
11
|
+
"prosemirror-commands": "^1.1.7",
|
|
21
12
|
"prosemirror-history": "^1.1.3",
|
|
22
13
|
"prosemirror-keymap": "^1.1.4",
|
|
23
|
-
"prosemirror-markdown": "^1.5.
|
|
24
|
-
"prosemirror-model": "^1.
|
|
14
|
+
"prosemirror-markdown": "^1.5.1",
|
|
15
|
+
"prosemirror-model": "^1.14.1",
|
|
25
16
|
"prosemirror-schema-basic": "^1.1.2",
|
|
26
17
|
"prosemirror-schema-list": "^1.1.4",
|
|
27
18
|
"prosemirror-state": "^1.3.4",
|
|
28
|
-
"prosemirror-view": "^1.
|
|
29
|
-
"yaml": "^1.10.
|
|
19
|
+
"prosemirror-view": "^1.18.4",
|
|
20
|
+
"yaml": "^1.10.2"
|
|
30
21
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"@types/prosemirror-keymap": "^1.0.3",
|
|
36
|
-
"@types/prosemirror-markdown": "^1.0.3",
|
|
37
|
-
"@types/prosemirror-schema-basic": "^1.0.1",
|
|
38
|
-
"@types/prosemirror-schema-list": "^1.0.1",
|
|
39
|
-
"@types/prosemirror-state": "^1.2.6",
|
|
40
|
-
"@types/prosemirror-view": "^1.15.1",
|
|
41
|
-
"assert": "^2.0.0",
|
|
42
|
-
"babel": "^6.23.0",
|
|
43
|
-
"babel-preset-es2017": "^6.24.1",
|
|
44
|
-
"copy-webpack-plugin": "^6.2.0",
|
|
45
|
-
"css-loader": "^5.0.1",
|
|
46
|
-
"extract-loader": "^5.1.0",
|
|
47
|
-
"html-webpack-plugin": "^4.5.0",
|
|
48
|
-
"lit-scss-loader": "^1.0.1",
|
|
49
|
-
"minisearch": "^3.0.2",
|
|
50
|
-
"mocha": "^8.2.1",
|
|
51
|
-
"sass": "^1.32.2",
|
|
52
|
-
"sass-loader": "^10.1.1",
|
|
53
|
-
"ts-loader": "^8.0.4",
|
|
54
|
-
"ts-node": "^9.1.1",
|
|
55
|
-
"typescript": "^4.0.3",
|
|
56
|
-
"webpack": "^4.44.2",
|
|
57
|
-
"webpack-cli": "^3.3.12",
|
|
58
|
-
"webpack-dev-server": "^3.11.0"
|
|
59
|
-
}
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "GPL-3.0",
|
|
24
|
+
"bugs": null,
|
|
25
|
+
"homepage": null
|
|
60
26
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CodeStub, Contact, Content, Service } from '@icure/api';
|
|
2
|
+
import { Field } from '../components/iqr-form/model';
|
|
3
|
+
import { ServicesHistory } from '../components/iqr-form-loader';
|
|
4
|
+
import { FormValuesContainer } from '../components/iqr-form-loader';
|
|
5
|
+
import { VersionedMeta, VersionedValue } from '../components';
|
|
6
|
+
export declare function fuzzyDate(epochOrLongCalendar?: number): Date | undefined;
|
|
7
|
+
export declare function isCodeEqual(c1: CodeStub, c2: CodeStub): boolean;
|
|
8
|
+
export declare function areCodesEqual(c1s: CodeStub[], c2s: CodeStub[]): boolean;
|
|
9
|
+
export declare function isServiceEqual(svc1: Service, svc2: Service): boolean;
|
|
10
|
+
export declare function isContentEqual(content1: Content, content2: Content): boolean;
|
|
11
|
+
export declare function isServiceContentEqual(content1: {
|
|
12
|
+
[language: string]: Content;
|
|
13
|
+
}, content2: {
|
|
14
|
+
[language: string]: Content;
|
|
15
|
+
}): boolean;
|
|
16
|
+
export declare function convertServicesToVersionedValues(versions: ServicesHistory, extractValueFromContent: (content: Content) => string): VersionedValue[];
|
|
17
|
+
export declare function convertServicesToVersionedMetas(versions: ServicesHistory): VersionedMeta[];
|
|
18
|
+
export declare function getVersions(formsValueContainer: FormValuesContainer, field: Field): ServicesHistory;
|
|
19
|
+
export declare function setServices(ctc: Contact, newServices: Service[], modifiedServices: Service[]): Contact;
|
|
@@ -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;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class DatePicker extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class DateTimePicker extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class MeasureField extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class MultipleChoice extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class NumberField extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const lit_element_1 = require("lit-element");
|
|
13
|
-
require("../../iqr-text-field");
|
|
14
|
-
class Textfield extends lit_element_1.LitElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
this.label = '';
|
|
18
|
-
this.multiline = false;
|
|
19
|
-
this.rows = 1;
|
|
20
|
-
this.grows = false;
|
|
21
|
-
this.labelPosition = undefined;
|
|
22
|
-
this.suggestionStopWords = new Set();
|
|
23
|
-
this.linksProvider = () => Promise.resolve(undefined);
|
|
24
|
-
this.suggestionProvider = () => [];
|
|
25
|
-
this.codeColorProvider = () => 'XI';
|
|
26
|
-
this.linkColorProvider = () => 'cat1';
|
|
27
|
-
this.codeContentProvider = (codes) => codes.map(c => c.code).join(',');
|
|
28
|
-
}
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [lit_element_1.css `
|
|
31
|
-
:host {
|
|
32
|
-
}
|
|
33
|
-
`];
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
return lit_element_1.html `
|
|
37
|
-
<iqr-text-field labelPosition=${this.labelPosition} ?multiline="${this.multiline}" label="${this.label}" ?suggestions=${!!this.suggestionProvider} ?links=${!!this.linksProvider}
|
|
38
|
-
.linksProvider=${this.linksProvider} .suggestionProvider=${this.suggestionProvider} .codeColorProvider=${this.codeColorProvider} .linkColorProvider=${this.linkColorProvider} .codeContentProvider=${this.codeContentProvider}></iqr-text-field>
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
__decorate([
|
|
43
|
-
lit_element_1.property(),
|
|
44
|
-
__metadata("design:type", String)
|
|
45
|
-
], Textfield.prototype, "label", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
lit_element_1.property(),
|
|
48
|
-
__metadata("design:type", Boolean)
|
|
49
|
-
], Textfield.prototype, "multiline", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
lit_element_1.property(),
|
|
52
|
-
__metadata("design:type", Number)
|
|
53
|
-
], Textfield.prototype, "rows", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
lit_element_1.property(),
|
|
56
|
-
__metadata("design:type", Boolean)
|
|
57
|
-
], Textfield.prototype, "grows", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
lit_element_1.property(),
|
|
60
|
-
__metadata("design:type", String)
|
|
61
|
-
], Textfield.prototype, "labelPosition", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
lit_element_1.property(),
|
|
64
|
-
__metadata("design:type", Set)
|
|
65
|
-
], Textfield.prototype, "suggestionStopWords", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
lit_element_1.property(),
|
|
68
|
-
__metadata("design:type", Function)
|
|
69
|
-
], Textfield.prototype, "linksProvider", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
lit_element_1.property(),
|
|
72
|
-
__metadata("design:type", Function)
|
|
73
|
-
], Textfield.prototype, "suggestionProvider", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
lit_element_1.property(),
|
|
76
|
-
__metadata("design:type", Function)
|
|
77
|
-
], Textfield.prototype, "codeColorProvider", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
lit_element_1.property(),
|
|
80
|
-
__metadata("design:type", Function)
|
|
81
|
-
], Textfield.prototype, "linkColorProvider", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
lit_element_1.property(),
|
|
84
|
-
__metadata("design:type", Function)
|
|
85
|
-
], Textfield.prototype, "codeContentProvider", void 0);
|
|
86
|
-
customElements.define('iqr-form-textfield', Textfield);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit-element';
|
|
2
|
-
import '../../iqr-text-field';
|
|
3
|
-
export declare class TimePicker extends LitElement {
|
|
4
|
-
label: string;
|
|
5
|
-
labelPosition?: string;
|
|
6
|
-
static get styles(): import("lit-element").CSSResult[];
|
|
7
|
-
render(): import("lit-element").TemplateResult;
|
|
8
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.render = void 0;
|
|
4
|
-
const lit_element_1 = require("lit-element");
|
|
5
|
-
const model_1 = require("../model");
|
|
6
|
-
const render = (form, props, state, setState) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const h = function (level, content) {
|
|
9
|
-
return level === 1 ? lit_element_1.html `<h1>${content}</h1>` :
|
|
10
|
-
level === 2 ? lit_element_1.html `<h2>${content}</h2>` :
|
|
11
|
-
level === 3 ? lit_element_1.html `<h3>${content}</h3>` :
|
|
12
|
-
level === 4 ? lit_element_1.html `<h4>${content}</h4>` :
|
|
13
|
-
level === 5 ? lit_element_1.html `<h5>${content}</h5>` :
|
|
14
|
-
lit_element_1.html `<h6>${content}</h6>`;
|
|
15
|
-
};
|
|
16
|
-
const renderFieldOrGroup = function (fg, level) {
|
|
17
|
-
var _a;
|
|
18
|
-
return fg instanceof model_1.Group ? lit_element_1.html `
|
|
19
|
-
<div class="group">
|
|
20
|
-
${h(level, lit_element_1.html `${fg.group}`)}
|
|
21
|
-
${(_a = fg.fields) === null || _a === void 0 ? void 0 : _a.map(f => renderFieldOrGroup(f, level + 1))}` :
|
|
22
|
-
lit_element_1.html `${fg.type === 'textfield' ? lit_element_1.html `<iqr-form-textfield label="${fg.field}" multiline="${(fg.rows || 0) > 1 || fg.grows}" rows="${fg.rows || 1}" grows="${fg.grows || false}"></iqr-form-textfield>` :
|
|
23
|
-
fg.type === 'measure-field' ? lit_element_1.html `<iqr-form-measure-field label="${fg.field}"></iqr-form-measure-field>` :
|
|
24
|
-
fg.type === 'number-field' ? lit_element_1.html `<iqr-form-number-field label="${fg.field}"></iqr-form-number-field>` :
|
|
25
|
-
fg.type === 'date-picker' ? lit_element_1.html `<iqr-form-date-picker label="${fg.field}"></iqr-form-date-picker>` :
|
|
26
|
-
fg.type === 'time-picker' ? lit_element_1.html `<iqr-form-time-picker label="${fg.field}"></iqr-form-time-picker>` :
|
|
27
|
-
fg.type === 'date-time-picker' ? lit_element_1.html `<iqr-form-date-time-picker label="${fg.field}"></iqr-form-date-time-picker>` :
|
|
28
|
-
fg.type === 'multiple-choice' ? lit_element_1.html `<iqr-form-multiple-choice label="${fg.field}"></iqr-form-multiple-choice>` : ''}
|
|
29
|
-
</div>`;
|
|
30
|
-
};
|
|
31
|
-
return lit_element_1.html `
|
|
32
|
-
<div class="iqr-form">
|
|
33
|
-
${(_a = form === null || form === void 0 ? void 0 : form.sections) === null || _a === void 0 ? void 0 : _a.map(s => {
|
|
34
|
-
var _a;
|
|
35
|
-
return lit_element_1.html `
|
|
36
|
-
<h2>${s.section}</h2>
|
|
37
|
-
${s.description ? lit_element_1.html `<p>${s.description}</p>` : ''}
|
|
38
|
-
${(_a = s.fields) === null || _a === void 0 ? void 0 : _a.map(f => renderFieldOrGroup(f, 3))}
|
|
39
|
-
`;
|
|
40
|
-
})}
|
|
41
|
-
</div>
|
|
42
|
-
`;
|
|
43
|
-
};
|
|
44
|
-
exports.render = render;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.render = void 0;
|
|
4
|
-
const lit_element_1 = require("lit-element");
|
|
5
|
-
const model_1 = require("../model");
|
|
6
|
-
const render = (form, props, state, setState) => {
|
|
7
|
-
var _a;
|
|
8
|
-
const h = function (level, content) {
|
|
9
|
-
return level === 1 ? lit_element_1.html `<h1>${content}</h1>` :
|
|
10
|
-
level === 2 ? lit_element_1.html `<h2>${content}</h2>` :
|
|
11
|
-
level === 3 ? lit_element_1.html `<h3>${content}</h3>` :
|
|
12
|
-
level === 4 ? lit_element_1.html `<h4>${content}</h4>` :
|
|
13
|
-
level === 5 ? lit_element_1.html `<h5>${content}</h5>` :
|
|
14
|
-
lit_element_1.html `<h6>${content}</h6>`;
|
|
15
|
-
};
|
|
16
|
-
const renderFieldOrGroup = function (fg, level) {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f;
|
|
18
|
-
return fg instanceof model_1.Group ? lit_element_1.html `
|
|
19
|
-
<div class="group">
|
|
20
|
-
${h(level, lit_element_1.html `${fg.group}`)}
|
|
21
|
-
${(_a = fg.fields) === null || _a === void 0 ? void 0 : _a.map(f => renderFieldOrGroup(f, level + 1))}` :
|
|
22
|
-
lit_element_1.html `${fg.type === 'textfield' ? lit_element_1.html `<iqr-form-textfield labelPosition=${props.labelPosition} label="${fg.field}" multiline="${(fg.rows || 0) > 1 || fg.grows}" rows="${fg.rows || 1}" grows="${fg.grows || false}"
|
|
23
|
-
.linksProvider=${(_b = fg.options) === null || _b === void 0 ? void 0 : _b.linksProvider} .suggestionProvider=${(_c = fg.options) === null || _c === void 0 ? void 0 : _c.suggestionProvider} .codeColorProvider=${(_d = fg.options) === null || _d === void 0 ? void 0 : _d.codeColorProvider} .linkColorProvider=${(_e = fg.options) === null || _e === void 0 ? void 0 : _e.linkColorProvider} .codeContentProvider=${(_f = fg.options) === null || _f === void 0 ? void 0 : _f.codeContentProvider}></iqr-form-textfield>` :
|
|
24
|
-
fg.type === 'measure-field' ? lit_element_1.html `<iqr-form-measure-field labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-measure-field>` :
|
|
25
|
-
fg.type === 'number-field' ? lit_element_1.html `<iqr-form-number-field labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-number-field>` :
|
|
26
|
-
fg.type === 'date-picker' ? lit_element_1.html `<iqr-form-date-picker labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-date-picker>` :
|
|
27
|
-
fg.type === 'time-picker' ? lit_element_1.html `<iqr-form-time-picker labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-time-picker>` :
|
|
28
|
-
fg.type === 'date-time-picker' ? lit_element_1.html `<iqr-form-date-time-picker labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-date-time-picker>` :
|
|
29
|
-
fg.type === 'multiple-choice' ? lit_element_1.html `<iqr-form-multiple-choice labelPosition=${props.labelPosition} label="${fg.field}"></iqr-form-multiple-choice>` : ''}
|
|
30
|
-
</div>`;
|
|
31
|
-
};
|
|
32
|
-
return lit_element_1.html `
|
|
33
|
-
<div class="iqr-form">
|
|
34
|
-
${(_a = form === null || form === void 0 ? void 0 : form.sections) === null || _a === void 0 ? void 0 : _a.map(s => {
|
|
35
|
-
var _a;
|
|
36
|
-
return lit_element_1.html `
|
|
37
|
-
<h2>${s.section}</h2>
|
|
38
|
-
${s.description ? lit_element_1.html `<p>${s.description}</p>` : ''}
|
|
39
|
-
${(_a = s.fields) === null || _a === void 0 ? void 0 : _a.map(f => renderFieldOrGroup(f, 3))}
|
|
40
|
-
`;
|
|
41
|
-
})}
|
|
42
|
-
</div>
|
|
43
|
-
`;
|
|
44
|
-
};
|
|
45
|
-
exports.render = render;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { NodeType } from "prosemirror-model";
|
|
2
|
-
import { EditorState, Transaction } from "prosemirror-state";
|
|
3
|
-
export declare function wrapInIfNeeded(nodeType: NodeType, attrs?: any): (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
4
|
-
export declare function unwrapFrom(nodeType: NodeType): (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMarks = exports.colors = void 0;
|
|
4
|
-
exports.colors = {
|
|
5
|
-
'I': ['#F44336', 'white'],
|
|
6
|
-
'II': ['#E91E63', 'white'],
|
|
7
|
-
'III': ['#9C27B0', 'white'],
|
|
8
|
-
'IV': ['#673AB7', 'white'],
|
|
9
|
-
'V': ['#009688', 'white'],
|
|
10
|
-
'VI': ['#4CAF50', 'white'],
|
|
11
|
-
'VII': ['#8BC34A', 'white'],
|
|
12
|
-
'VIII': ['#03A9F4', 'white'],
|
|
13
|
-
'IX': ['#00BCD4', 'white'],
|
|
14
|
-
'X': ['#FFC107', 'black'],
|
|
15
|
-
'XI': ['#FF9800', 'black'],
|
|
16
|
-
'XII': ['#FF5722', 'white'],
|
|
17
|
-
'XIII': ['#795548', 'white'],
|
|
18
|
-
'XIV': ['#3949AB', 'white'],
|
|
19
|
-
'XV': ['#C0CA33', 'black'],
|
|
20
|
-
'XVI': ['#07F87F', 'black'],
|
|
21
|
-
'XVII': ['#FF6262', 'white'],
|
|
22
|
-
'XVIII': ['#718792', 'white'],
|
|
23
|
-
'XIX': ['#00ECB9', 'black'],
|
|
24
|
-
'XX': ['#FF20A3', 'black'],
|
|
25
|
-
'XXI': ['#FFCE38', 'black'],
|
|
26
|
-
'XXII': ['#721F01', 'white']
|
|
27
|
-
};
|
|
28
|
-
const getColor = (c) => exports.colors[c] || [c, 'white'];
|
|
29
|
-
function getMarks(contentProvider, colorProvider) {
|
|
30
|
-
return {
|
|
31
|
-
em: {
|
|
32
|
-
parseDOM: [{ tag: 'i' }, { tag: 'em' },
|
|
33
|
-
{ style: 'font-style', getAttrs: value => value === 'italic' && null }],
|
|
34
|
-
toDOM() {
|
|
35
|
-
return ['em'];
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
strong: {
|
|
39
|
-
parseDOM: [{ tag: 'b' }, { tag: 'strong' }, { style: 'font-weight', getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null }],
|
|
40
|
-
toDOM() {
|
|
41
|
-
return ['strong'];
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
link: {
|
|
45
|
-
attrs: {
|
|
46
|
-
href: {},
|
|
47
|
-
title: { default: null }
|
|
48
|
-
},
|
|
49
|
-
inclusive: false,
|
|
50
|
-
parseDOM: [{
|
|
51
|
-
tag: 'span[data-href]',
|
|
52
|
-
getAttrs(dom) {
|
|
53
|
-
const el = dom;
|
|
54
|
-
return { href: el.dataset.href, title: el.dataset.title };
|
|
55
|
-
}
|
|
56
|
-
}],
|
|
57
|
-
toDOM(node) {
|
|
58
|
-
const urls = node.attrs.href;
|
|
59
|
-
if (urls) {
|
|
60
|
-
const refs = urls.split(',').map(url => {
|
|
61
|
-
let pos = url.indexOf('://');
|
|
62
|
-
const protocol = url.substring(0, pos);
|
|
63
|
-
const code = url.substring(pos + 3);
|
|
64
|
-
let parts = protocol.split('-');
|
|
65
|
-
const category = parts[0];
|
|
66
|
-
const type = parts[1];
|
|
67
|
-
return { category, type, code };
|
|
68
|
-
});
|
|
69
|
-
const codes = refs.filter(x => x.category === 'c');
|
|
70
|
-
const ilinks = refs.filter(x => x.category === 'i');
|
|
71
|
-
const classes = (refs.some(x => x.category === 'x') ? ['ext-link'] : []).concat(codes.length ? [`code-count-${codes.length}`] : []);
|
|
72
|
-
const dataAttributes = (codes.length ? [{ 'data-content': contentProvider(codes) }] : [])
|
|
73
|
-
.concat(ilinks.map((c, idx) => ({ [`data-link-color-${idx}`]: colorProvider(c.type, c.code, false) })));
|
|
74
|
-
const styles = codes.map((c, idx) => {
|
|
75
|
-
const color = getColor(colorProvider(c.type, c.code, true));
|
|
76
|
-
return (`--bg-code-color-${idx + 1}: ${color[0]}; --text-code-color-${idx + 1}: ${color[1]};`);
|
|
77
|
-
});
|
|
78
|
-
return ['span', dataAttributes.reduce((acc, da) => Object.assign(da, acc), {
|
|
79
|
-
['data-href']: node.attrs.href,
|
|
80
|
-
['data-title']: node.attrs.title,
|
|
81
|
-
'class': classes.join(' '),
|
|
82
|
-
'style': styles.join('')
|
|
83
|
-
})];
|
|
84
|
-
}
|
|
85
|
-
return ['span', { ['data-href']: node.attrs.href, ['data-title']: node.attrs.title }];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
exports.getMarks = getMarks;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSchema = void 0;
|
|
4
|
-
const prosemirror_model_1 = require("prosemirror-model");
|
|
5
|
-
const markdown_schema_1 = require("./markdown-schema");
|
|
6
|
-
const date_time_schema_1 = require("./date-time-schema");
|
|
7
|
-
const token_schema_1 = require("./token-schema");
|
|
8
|
-
const measure_schema_1 = require("./measure-schema");
|
|
9
|
-
const decimal_schema_1 = require("./decimal-schema");
|
|
10
|
-
function createSchema(type, colorProvider, contentProvider) {
|
|
11
|
-
return new prosemirror_model_1.Schema(type === 'decimal' ? decimal_schema_1.getDecimalSpec() :
|
|
12
|
-
type === 'measure' ? measure_schema_1.getMeasureSpec() :
|
|
13
|
-
type === 'date' ? date_time_schema_1.getDateSpec() :
|
|
14
|
-
type === 'time' ? date_time_schema_1.getTimeSpec() :
|
|
15
|
-
type === 'date-time' ? date_time_schema_1.getDateTimeSpec() :
|
|
16
|
-
type === 'tokens-list' || type === 'styled-tokens-list' || type === 'tokens-list-with-codes' || type === 'styled-tokens-list-with-codes' ? token_schema_1.getTokensSpec(type, contentProvider, colorProvider) : markdown_schema_1.getMarkdownSpec(type, contentProvider, colorProvider));
|
|
17
|
-
}
|
|
18
|
-
exports.createSchema = createSchema;
|