@icure/form 1.0.2 → 1.0.6
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/{lib/components → components}/iqr-form/fields/datePicker.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/datePicker.js +0 -0
- package/{lib/components → components}/iqr-form/fields/dateTimePicker.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/dateTimePicker.js +0 -0
- package/{lib/components → components}/iqr-form/fields/measureField.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/measureField.js +0 -0
- package/{lib/components → components}/iqr-form/fields/multipleChoice.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/multipleChoice.js +0 -0
- package/{lib/components → components}/iqr-form/fields/numberField.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/numberField.js +0 -0
- package/{lib/components → components}/iqr-form/fields/textfield.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/textfield.js +0 -0
- package/{lib/components → components}/iqr-form/fields/timePicker.d.ts +0 -0
- package/{lib/components → components}/iqr-form/fields/timePicker.js +0 -0
- package/{lib/components → components}/iqr-form/index.d.ts +0 -0
- package/{lib/components → components}/iqr-form/index.js +59 -6
- package/{lib/components → components}/iqr-form/model/index.d.ts +0 -0
- package/{lib/components → components}/iqr-form/model/index.js +2 -2
- package/{lib/components → components}/iqr-form/renderer/cards.d.ts +0 -0
- package/{lib/components → components}/iqr-form/renderer/cards.js +2 -1
- package/{lib/components → components}/iqr-form/renderer/form.d.ts +0 -0
- package/{lib → components}/iqr-form/renderer/form.js +2 -1
- package/{lib/components → components}/iqr-form/renderer/index.d.ts +0 -0
- package/{lib/components → components}/iqr-form/renderer/index.js +0 -0
- package/{lib/components → components}/iqr-text-field/index.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/index.js +751 -7
- package/{lib/components → components}/iqr-text-field/plugin/caret-fix-plugin.d.ts +0 -0
- package/{lib → components}/iqr-text-field/plugin/caret-fix-plugin.js +2 -1
- package/{lib/components → components}/iqr-text-field/plugin/has-content-class-plugin.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/plugin/has-content-class-plugin.js +2 -1
- package/{lib/components → components}/iqr-text-field/plugin/mask-plugin.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/plugin/mask-plugin.js +2 -1
- package/{lib/components → components}/iqr-text-field/plugin/regexp-plugin.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/plugin/regexp-plugin.js +2 -1
- package/{lib/components → components}/iqr-text-field/prosemirror-commands.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/prosemirror-commands.js +0 -0
- package/{lib/components → components}/iqr-text-field/prosemirror-utils.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/prosemirror-utils.js +0 -0
- package/{lib/components → components}/iqr-text-field/schema/common-marks.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/common-marks.js +0 -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 +0 -0
- 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 +0 -0
- package/{lib/components → components}/iqr-text-field/schema/index.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/index.js +0 -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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/{lib/components → components}/iqr-text-field/schema/utils.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/schema/utils.js +0 -0
- package/{lib/components → components}/iqr-text-field/selection-companion.d.ts +0 -0
- package/{lib/components → components}/iqr-text-field/selection-companion.js +0 -0
- package/{lib/components → components}/iqr-text-field/suggestion-palette.d.ts +0 -0
- package/{lib → components}/iqr-text-field/suggestion-palette.js +5 -5
- package/{lib/index.d.ts → index.d.ts} +0 -0
- package/{lib/index.js → index.js} +0 -0
- package/package.json +14 -47
- package/.idea/inspectionProfiles/Project_Default.xml +0 -73
- package/.idea/iqr-text-field.iml +0 -9
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/lib/components/iqr-form/renderer/form.js +0 -44
- package/lib/components/iqr-text-field/plugin/caret-fix-plugin.js +0 -23
- package/lib/components/iqr-text-field/suggestion-palette.js +0 -139
- package/lib/iqr-form/fields/datePicker.d.ts +0 -8
- package/lib/iqr-form/fields/datePicker.js +0 -42
- package/lib/iqr-form/fields/dateTimePicker.d.ts +0 -8
- package/lib/iqr-form/fields/dateTimePicker.js +0 -42
- package/lib/iqr-form/fields/measureField.d.ts +0 -8
- package/lib/iqr-form/fields/measureField.js +0 -42
- package/lib/iqr-form/fields/multipleChoice.d.ts +0 -8
- package/lib/iqr-form/fields/multipleChoice.js +0 -42
- package/lib/iqr-form/fields/numberField.d.ts +0 -8
- package/lib/iqr-form/fields/numberField.js +0 -42
- package/lib/iqr-form/fields/textfield.d.ts +0 -1
- package/lib/iqr-form/fields/textfield.js +0 -86
- package/lib/iqr-form/fields/timePicker.d.ts +0 -8
- package/lib/iqr-form/fields/timePicker.js +0 -42
- package/lib/iqr-form/index.d.ts +0 -7
- package/lib/iqr-form/index.js +0 -83
- package/lib/iqr-form/model/index.d.ts +0 -78
- package/lib/iqr-form/model/index.js +0 -114
- package/lib/iqr-form/renderer/cards.d.ts +0 -2
- package/lib/iqr-form/renderer/cards.js +0 -43
- package/lib/iqr-form/renderer/form.d.ts +0 -2
- package/lib/iqr-form/renderer/index.d.ts +0 -3
- package/lib/iqr-form/renderer/index.js +0 -2
- package/lib/iqr-text-field/index.d.ts +0 -2
- package/lib/iqr-text-field/index.js +0 -335
- package/lib/iqr-text-field/plugin/caret-fix-plugin.d.ts +0 -2
- package/lib/iqr-text-field/plugin/has-content-class-plugin.d.ts +0 -2
- package/lib/iqr-text-field/plugin/has-content-class-plugin.js +0 -18
- package/lib/iqr-text-field/plugin/mask-plugin.d.ts +0 -2
- package/lib/iqr-text-field/plugin/mask-plugin.js +0 -143
- package/lib/iqr-text-field/plugin/regexp-plugin.d.ts +0 -2
- package/lib/iqr-text-field/plugin/regexp-plugin.js +0 -46
- package/lib/iqr-text-field/prosemirror-commands.d.ts +0 -4
- package/lib/iqr-text-field/prosemirror-commands.js +0 -52
- package/lib/iqr-text-field/prosemirror-utils.d.ts +0 -5
- package/lib/iqr-text-field/prosemirror-utils.js +0 -15
- package/lib/iqr-text-field/schema/common-marks.d.ts +0 -10
- package/lib/iqr-text-field/schema/common-marks.js +0 -90
- package/lib/iqr-text-field/schema/date-time-schema.d.ts +0 -7
- package/lib/iqr-text-field/schema/date-time-schema.js +0 -88
- package/lib/iqr-text-field/schema/decimal-schema.d.ts +0 -3
- package/lib/iqr-text-field/schema/decimal-schema.js +0 -27
- package/lib/iqr-text-field/schema/index.d.ts +0 -11
- package/lib/iqr-text-field/schema/index.js +0 -18
- package/lib/iqr-text-field/schema/markdown-schema.d.ts +0 -8
- package/lib/iqr-text-field/schema/markdown-schema.js +0 -139
- package/lib/iqr-text-field/schema/measure-schema.d.ts +0 -3
- package/lib/iqr-text-field/schema/measure-schema.js +0 -35
- package/lib/iqr-text-field/schema/token-schema.d.ts +0 -6
- package/lib/iqr-text-field/schema/token-schema.js +0 -36
- package/lib/iqr-text-field/schema/utils.d.ts +0 -11
- package/lib/iqr-text-field/schema/utils.js +0 -11
- package/lib/iqr-text-field/selection-companion.d.ts +0 -11
- package/lib/iqr-text-field/selection-companion.js +0 -52
- package/lib/iqr-text-field/suggestion-palette.d.ts +0 -33
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unwrapFrom = exports.wrapInIfNeeded = void 0;
|
|
4
|
-
const prosemirror_transform_1 = require("prosemirror-transform");
|
|
5
|
-
const prosemirror_model_1 = require("prosemirror-model");
|
|
6
|
-
const prosemirror_state_1 = require("prosemirror-state");
|
|
7
|
-
// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
8
|
-
// Wrap the selection in a node of the given type with the given
|
|
9
|
-
// attributes.
|
|
10
|
-
function wrapInIfNeeded(nodeType, attrs) {
|
|
11
|
-
return function (state, dispatch) {
|
|
12
|
-
var _a, _b;
|
|
13
|
-
const { $from, $to, to } = state.selection;
|
|
14
|
-
const range = $from.blockRange($to);
|
|
15
|
-
if (!range) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
let same = range.$from.sharedDepth(to);
|
|
19
|
-
if (same) {
|
|
20
|
-
const pos = $from.before(same);
|
|
21
|
-
if (((_b = (_a = prosemirror_state_1.NodeSelection.create(state.doc, pos).$from) === null || _a === void 0 ? void 0 : _a.node()) === null || _b === void 0 ? void 0 : _b.type) === nodeType) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const wrapping = range && prosemirror_transform_1.findWrapping(range, nodeType, attrs);
|
|
26
|
-
if (!wrapping)
|
|
27
|
-
return false;
|
|
28
|
-
if (dispatch)
|
|
29
|
-
dispatch(state.tr.wrap(range, wrapping).scrollIntoView());
|
|
30
|
-
return true;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
exports.wrapInIfNeeded = wrapInIfNeeded;
|
|
34
|
-
// :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
35
|
-
// Wrap the selection in a node of the given type with the given
|
|
36
|
-
// attributes.
|
|
37
|
-
function unwrapFrom(nodeType) {
|
|
38
|
-
return function (state, dispatch) {
|
|
39
|
-
const { $from, $to } = state.selection;
|
|
40
|
-
const range = $from.blockRange($to);
|
|
41
|
-
const depth = range && prosemirror_transform_1.liftTarget(range);
|
|
42
|
-
if (depth === null || depth === undefined) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
|
|
46
|
-
const frag = prosemirror_model_1.Fragment.from($from.node());
|
|
47
|
-
if (dispatch)
|
|
48
|
-
dispatch(state.tr.replaceRange(gapStart, gapEnd, new prosemirror_model_1.Slice(frag, 0, 0)).scrollIntoView());
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.unwrapFrom = unwrapFrom;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasMark = void 0;
|
|
4
|
-
function hasMark(ms, mark) {
|
|
5
|
-
if (!ms) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
if (!!ms.get) {
|
|
9
|
-
return !!(ms.get(mark));
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return !!ms[mark];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.hasMark = hasMark;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { MarkSpec } from "prosemirror-model";
|
|
2
|
-
export declare const colors: {
|
|
3
|
-
[key: string]: [string, string];
|
|
4
|
-
};
|
|
5
|
-
export declare function getMarks(contentProvider: (codes: {
|
|
6
|
-
type: string;
|
|
7
|
-
code: string;
|
|
8
|
-
}[]) => string, colorProvider: (type: string, code: string, isCode: boolean) => string): {
|
|
9
|
-
[key: string]: MarkSpec;
|
|
10
|
-
};
|
|
@@ -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,7 +0,0 @@
|
|
|
1
|
-
import { SchemaSpec } from 'prosemirror-model';
|
|
2
|
-
export declare type DateSchema = 'date';
|
|
3
|
-
export declare type TimeSchema = 'time';
|
|
4
|
-
export declare type DateTimeSchema = 'date-time';
|
|
5
|
-
export declare function getDateSpec(): SchemaSpec;
|
|
6
|
-
export declare function getTimeSpec(): SchemaSpec;
|
|
7
|
-
export declare function getDateTimeSpec(): SchemaSpec;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDateTimeSpec = exports.getTimeSpec = exports.getDateSpec = void 0;
|
|
4
|
-
function getDateSpec() {
|
|
5
|
-
return {
|
|
6
|
-
topNode: 'paragraph',
|
|
7
|
-
nodes: {
|
|
8
|
-
paragraph: {
|
|
9
|
-
content: 'date',
|
|
10
|
-
},
|
|
11
|
-
date: {
|
|
12
|
-
content: 'inline*',
|
|
13
|
-
group: 'block',
|
|
14
|
-
parseDOM: [{ tag: 'span' }],
|
|
15
|
-
toDOM() {
|
|
16
|
-
return ['span', 0];
|
|
17
|
-
},
|
|
18
|
-
regexp: '[0-9]',
|
|
19
|
-
mask: '--/--/----'
|
|
20
|
-
},
|
|
21
|
-
text: {
|
|
22
|
-
group: 'inline'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
marks: {}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.getDateSpec = getDateSpec;
|
|
29
|
-
function getTimeSpec() {
|
|
30
|
-
return {
|
|
31
|
-
topNode: 'paragraph',
|
|
32
|
-
nodes: {
|
|
33
|
-
paragraph: {
|
|
34
|
-
content: 'time',
|
|
35
|
-
},
|
|
36
|
-
time: {
|
|
37
|
-
content: 'inline*',
|
|
38
|
-
group: 'block',
|
|
39
|
-
parseDOM: [{ tag: 'span' }],
|
|
40
|
-
toDOM() {
|
|
41
|
-
return ['span', 0];
|
|
42
|
-
},
|
|
43
|
-
regexp: '[0-9]',
|
|
44
|
-
mask: '--:--:--'
|
|
45
|
-
},
|
|
46
|
-
text: {
|
|
47
|
-
group: 'inline'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
marks: {}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.getTimeSpec = getTimeSpec;
|
|
54
|
-
function getDateTimeSpec() {
|
|
55
|
-
return {
|
|
56
|
-
topNode: 'paragraph',
|
|
57
|
-
nodes: {
|
|
58
|
-
paragraph: {
|
|
59
|
-
content: 'date time',
|
|
60
|
-
},
|
|
61
|
-
date: {
|
|
62
|
-
content: 'inline*',
|
|
63
|
-
group: 'block',
|
|
64
|
-
parseDOM: [{ tag: 'span' }],
|
|
65
|
-
toDOM() {
|
|
66
|
-
return ['span', { class: 'date' }, 0];
|
|
67
|
-
},
|
|
68
|
-
regexp: '[0-9]',
|
|
69
|
-
mask: '--/--/----'
|
|
70
|
-
},
|
|
71
|
-
time: {
|
|
72
|
-
content: 'inline*',
|
|
73
|
-
group: 'block',
|
|
74
|
-
parseDOM: [{ tag: 'span' }],
|
|
75
|
-
toDOM() {
|
|
76
|
-
return ['span', { class: 'time' }, 0];
|
|
77
|
-
},
|
|
78
|
-
regexp: '[0-9]',
|
|
79
|
-
mask: '--:--:--'
|
|
80
|
-
},
|
|
81
|
-
text: {
|
|
82
|
-
group: 'inline'
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
marks: {}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
exports.getDateTimeSpec = getDateTimeSpec;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDecimalSpec = void 0;
|
|
4
|
-
function getDecimalSpec() {
|
|
5
|
-
return {
|
|
6
|
-
topNode: 'paragraph',
|
|
7
|
-
nodes: {
|
|
8
|
-
paragraph: {
|
|
9
|
-
content: 'decimal',
|
|
10
|
-
},
|
|
11
|
-
decimal: {
|
|
12
|
-
content: 'inline*',
|
|
13
|
-
group: 'block',
|
|
14
|
-
parseDOM: [{ tag: 'span' }],
|
|
15
|
-
toDOM() {
|
|
16
|
-
return ['span', 0];
|
|
17
|
-
},
|
|
18
|
-
regexp: '[,. 0-9-]'
|
|
19
|
-
},
|
|
20
|
-
text: {
|
|
21
|
-
group: 'inline'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
marks: {}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.getDecimalSpec = getDecimalSpec;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
|
-
import { DocumentSchema, InlineSchema, StyledSchema } from "./markdown-schema";
|
|
3
|
-
import { DateSchema, DateTimeSchema, TimeSchema } from "./date-time-schema";
|
|
4
|
-
import { TokensSchema } from "./token-schema";
|
|
5
|
-
import { MeasureSchema } from "./measure-schema";
|
|
6
|
-
import { DecimalSchema } from "./decimal-schema";
|
|
7
|
-
export declare type IqrTextFieldSchema = DocumentSchema | TokensSchema | StyledSchema | InlineSchema | DateSchema | TimeSchema | DateTimeSchema | DecimalSchema | MeasureSchema;
|
|
8
|
-
export declare function createSchema(type: IqrTextFieldSchema, colorProvider: (type: string, code: string, isCode: boolean) => string, contentProvider: (codes: {
|
|
9
|
-
type: string;
|
|
10
|
-
code: string;
|
|
11
|
-
}[]) => string): Schema<any, any>;
|
|
@@ -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;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SchemaSpec } from 'prosemirror-model';
|
|
2
|
-
export declare type DocumentSchema = 'text-document';
|
|
3
|
-
export declare type InlineSchema = 'styled-text' | 'text' | 'text-with-codes' | 'styled-text-with-codes';
|
|
4
|
-
export declare type StyledSchema = 'text-document' | 'styled-text' | 'styled-text-with-codes';
|
|
5
|
-
export declare function getMarkdownSpec(type: DocumentSchema | InlineSchema, contentProvider: (codes: {
|
|
6
|
-
type: string;
|
|
7
|
-
code: string;
|
|
8
|
-
}[]) => string, colorProvider: (type: string, code: string, isCode: boolean) => string): SchemaSpec;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMarkdownSpec = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const common_marks_1 = require("./common-marks");
|
|
6
|
-
function getMarkdownSpec(type, contentProvider, colorProvider) {
|
|
7
|
-
const nodesSelector = (key, spec) => {
|
|
8
|
-
// noinspection RedundantConditionalExpressionJS
|
|
9
|
-
return (key === 'paragraph') ? true :
|
|
10
|
-
((spec.group === 'block' || ['doc', 'list_item', 'hard_break', 'image'].includes(key)) && type !== 'text-document') ? false : true;
|
|
11
|
-
};
|
|
12
|
-
const marksSelector = (key) => {
|
|
13
|
-
// noinspection RedundantConditionalExpressionJS
|
|
14
|
-
return (key !== 'link' && ['text-document', 'styled-text', 'styled-text-with-codes'].includes(type)) ? true :
|
|
15
|
-
(key === 'link' && ['text-document', 'text-with-codes', 'styled-text-with-codes']) ? true : false;
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
topNode: type === 'text-document' ? 'doc' : 'paragraph',
|
|
19
|
-
nodes: utils_1.reduceNodes({
|
|
20
|
-
doc: {
|
|
21
|
-
content: 'block+'
|
|
22
|
-
},
|
|
23
|
-
paragraph: {
|
|
24
|
-
content: 'inline*',
|
|
25
|
-
group: 'block',
|
|
26
|
-
parseDOM: [{ tag: 'p' }],
|
|
27
|
-
toDOM() {
|
|
28
|
-
return ['p', 0];
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
blockquote: {
|
|
32
|
-
content: 'block+',
|
|
33
|
-
group: 'block',
|
|
34
|
-
parseDOM: [{ tag: 'blockquote' }],
|
|
35
|
-
toDOM() {
|
|
36
|
-
return ['blockquote', 0];
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
horizontal_rule: {
|
|
40
|
-
group: 'block',
|
|
41
|
-
parseDOM: [{ tag: 'hr' }],
|
|
42
|
-
toDOM() {
|
|
43
|
-
return ['div', ['hr']];
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
heading: {
|
|
47
|
-
attrs: { level: { default: 1 } },
|
|
48
|
-
content: '(text | image)*',
|
|
49
|
-
group: 'block',
|
|
50
|
-
defining: true,
|
|
51
|
-
parseDOM: [{ tag: 'h1', attrs: { level: 1 } },
|
|
52
|
-
{ tag: 'h2', attrs: { level: 2 } },
|
|
53
|
-
{ tag: 'h3', attrs: { level: 3 } },
|
|
54
|
-
{ tag: 'h4', attrs: { level: 4 } },
|
|
55
|
-
{ tag: 'h5', attrs: { level: 5 } },
|
|
56
|
-
{ tag: 'h6', attrs: { level: 6 } }],
|
|
57
|
-
toDOM(node) {
|
|
58
|
-
return ['h' + node.attrs.level, 0];
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
ordered_list: {
|
|
62
|
-
content: 'list_item+',
|
|
63
|
-
group: 'block',
|
|
64
|
-
attrs: { order: { default: 1 }, tight: { default: false } },
|
|
65
|
-
parseDOM: [{
|
|
66
|
-
tag: 'ol',
|
|
67
|
-
getAttrs(dom) {
|
|
68
|
-
const el = dom;
|
|
69
|
-
return {
|
|
70
|
-
order: el.hasAttribute('start') ? +(el.getAttribute('start') || 0) : 1,
|
|
71
|
-
tight: el.hasAttribute('data-tight')
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}],
|
|
75
|
-
toDOM(node) {
|
|
76
|
-
return ['ol', {
|
|
77
|
-
start: node.attrs.order === 1 ? null : node.attrs.order,
|
|
78
|
-
'data-tight': node.attrs.tight ? 'true' : null
|
|
79
|
-
}, 0];
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
bullet_list: {
|
|
83
|
-
content: 'list_item+',
|
|
84
|
-
group: 'block',
|
|
85
|
-
attrs: { tight: { default: false } },
|
|
86
|
-
parseDOM: [{ tag: 'ul', getAttrs: dom => ({ tight: dom.hasAttribute('data-tight') }) }],
|
|
87
|
-
toDOM(node) {
|
|
88
|
-
return ['ul', { 'data-tight': node.attrs.tight ? 'true' : null }, 0];
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
list_item: {
|
|
92
|
-
content: 'paragraph block*',
|
|
93
|
-
defining: true,
|
|
94
|
-
parseDOM: [{ tag: 'li' }],
|
|
95
|
-
toDOM() {
|
|
96
|
-
return ['li', 0];
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
text: {
|
|
100
|
-
group: 'inline'
|
|
101
|
-
},
|
|
102
|
-
image: {
|
|
103
|
-
inline: true,
|
|
104
|
-
attrs: {
|
|
105
|
-
src: {},
|
|
106
|
-
alt: { default: null },
|
|
107
|
-
title: { default: null }
|
|
108
|
-
},
|
|
109
|
-
group: 'inline',
|
|
110
|
-
draggable: true,
|
|
111
|
-
parseDOM: [{
|
|
112
|
-
tag: 'img[src]',
|
|
113
|
-
getAttrs(dom) {
|
|
114
|
-
const el = dom;
|
|
115
|
-
return {
|
|
116
|
-
src: el.getAttribute('src'),
|
|
117
|
-
title: el.getAttribute('title'),
|
|
118
|
-
alt: el.getAttribute('alt')
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}],
|
|
122
|
-
toDOM(node) {
|
|
123
|
-
return ['img', node.attrs];
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
hard_break: {
|
|
127
|
-
inline: true,
|
|
128
|
-
group: 'inline',
|
|
129
|
-
selectable: false,
|
|
130
|
-
parseDOM: [{ tag: 'br' }],
|
|
131
|
-
toDOM() {
|
|
132
|
-
return ['br'];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, nodesSelector),
|
|
136
|
-
marks: utils_1.reduceMarks(common_marks_1.getMarks(contentProvider, colorProvider), marksSelector)
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
exports.getMarkdownSpec = getMarkdownSpec;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMeasureSpec = void 0;
|
|
4
|
-
function getMeasureSpec() {
|
|
5
|
-
return {
|
|
6
|
-
topNode: 'paragraph',
|
|
7
|
-
nodes: {
|
|
8
|
-
paragraph: {
|
|
9
|
-
content: 'decimal unit',
|
|
10
|
-
},
|
|
11
|
-
decimal: {
|
|
12
|
-
content: 'inline*',
|
|
13
|
-
group: 'block',
|
|
14
|
-
parseDOM: [{ tag: 'span' }],
|
|
15
|
-
toDOM() {
|
|
16
|
-
return ['span', { class: 'measure' }, 0];
|
|
17
|
-
},
|
|
18
|
-
regexp: '[,.0-9-]'
|
|
19
|
-
},
|
|
20
|
-
unit: {
|
|
21
|
-
content: 'inline*',
|
|
22
|
-
group: 'block',
|
|
23
|
-
parseDOM: [{ tag: 'span' }],
|
|
24
|
-
toDOM() {
|
|
25
|
-
return ['span', { class: 'unit' }, 0];
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
text: {
|
|
29
|
-
group: 'inline'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
marks: {}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.getMeasureSpec = getMeasureSpec;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SchemaSpec } from 'prosemirror-model';
|
|
2
|
-
export declare type TokensSchema = 'tokens-list' | 'styled-tokens-list' | 'tokens-list-with-codes' | 'styled-tokens-list-with-codes';
|
|
3
|
-
export declare function getTokensSpec(type: TokensSchema, contentProvider: (codes: {
|
|
4
|
-
type: string;
|
|
5
|
-
code: string;
|
|
6
|
-
}[]) => string, colorProvider: (type: string, code: string, isCode: boolean) => string): SchemaSpec;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTokensSpec = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const common_marks_1 = require("./common-marks");
|
|
6
|
-
function getTokensSpec(type, contentProvider, colorProvider) {
|
|
7
|
-
const marksSelector = (key) => {
|
|
8
|
-
// noinspection RedundantConditionalExpressionJS
|
|
9
|
-
return (key !== 'link' && ['styled-tokens-list', 'styled-tokens-list-with-codes'].includes(type)) ? true :
|
|
10
|
-
(key === 'link' && ['tokens-list-with-codes', 'styled-text-with-codes']) ? true : false;
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
nodes: utils_1.reduceNodes({
|
|
14
|
-
doc: {
|
|
15
|
-
content: 'token+',
|
|
16
|
-
parseDOM: [{ tag: 'ul' }],
|
|
17
|
-
toDOM() {
|
|
18
|
-
return ['ul', 0];
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
token: {
|
|
22
|
-
content: 'inline*',
|
|
23
|
-
group: 'block',
|
|
24
|
-
parseDOM: [{ tag: 'li' }],
|
|
25
|
-
toDOM() {
|
|
26
|
-
return ['li', 0];
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
text: {
|
|
30
|
-
group: 'inline'
|
|
31
|
-
}
|
|
32
|
-
}),
|
|
33
|
-
marks: utils_1.reduceMarks(common_marks_1.getMarks(contentProvider, colorProvider), marksSelector)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.getTokensSpec = getTokensSpec;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MarkSpec, NodeSpec } from "prosemirror-model";
|
|
2
|
-
export declare function reduceNodes(nodes: {
|
|
3
|
-
[key: string]: NodeSpec;
|
|
4
|
-
}, selector?: (key: string, spec: NodeSpec) => boolean): {
|
|
5
|
-
[key: string]: NodeSpec;
|
|
6
|
-
};
|
|
7
|
-
export declare function reduceMarks(marks: {
|
|
8
|
-
[key: string]: MarkSpec;
|
|
9
|
-
}, selector?: (key: string, spec: MarkSpec) => boolean): {
|
|
10
|
-
[key: string]: MarkSpec;
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reduceMarks = exports.reduceNodes = void 0;
|
|
4
|
-
function reduceNodes(nodes, selector = () => true) {
|
|
5
|
-
return Object.keys(nodes).reduce((r, k) => selector(k, nodes[k]) ? Object.assign(r, { [k]: nodes[k] }) : r, {});
|
|
6
|
-
}
|
|
7
|
-
exports.reduceNodes = reduceNodes;
|
|
8
|
-
function reduceMarks(marks, selector = () => true) {
|
|
9
|
-
return Object.keys(marks).reduce((r, k) => selector(k, marks[k]) ? Object.assign(r, { [k]: marks[k] }) : r, {});
|
|
10
|
-
}
|
|
11
|
-
exports.reduceMarks = reduceMarks;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EditorView } from "prosemirror-view";
|
|
2
|
-
import { EditorState } from "prosemirror-state";
|
|
3
|
-
export declare class SelectionCompanion {
|
|
4
|
-
private readonly companion;
|
|
5
|
-
private delay;
|
|
6
|
-
private lastTime;
|
|
7
|
-
constructor(view: EditorView, delay: () => boolean);
|
|
8
|
-
update(view: EditorView, lastState?: EditorState): void;
|
|
9
|
-
private display;
|
|
10
|
-
destroy(): void;
|
|
11
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SelectionCompanion = void 0;
|
|
4
|
-
class SelectionCompanion {
|
|
5
|
-
constructor(view, delay) {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
this.delay = () => false;
|
|
8
|
-
this.lastTime = 0;
|
|
9
|
-
this.companion = document.createElement("div");
|
|
10
|
-
this.companion.className = "companion";
|
|
11
|
-
(_b = (_a = view.dom) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.appendChild(this.companion);
|
|
12
|
-
this.delay = delay;
|
|
13
|
-
this.update(view, undefined);
|
|
14
|
-
}
|
|
15
|
-
update(view, lastState) {
|
|
16
|
-
let state = view.state;
|
|
17
|
-
// Don't do anything if the document/selection didn't change
|
|
18
|
-
if (lastState && lastState.doc.eq(state.doc) &&
|
|
19
|
-
lastState.selection.eq(state.selection)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
// Hide the companion if the selection is empty
|
|
23
|
-
if (state.selection.empty) {
|
|
24
|
-
this.companion.style.display = "none";
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
// Otherwise, reposition it and update its content
|
|
28
|
-
const { to } = state.selection;
|
|
29
|
-
// These are in screen coordinates
|
|
30
|
-
const end = view.coordsAtPos(to);
|
|
31
|
-
this.display(end, (this.lastTime = +new Date()));
|
|
32
|
-
}
|
|
33
|
-
display(pos, time) {
|
|
34
|
-
var _a;
|
|
35
|
-
if (time !== this.lastTime)
|
|
36
|
-
return;
|
|
37
|
-
if (this.delay()) {
|
|
38
|
-
setTimeout(() => this.display(pos, time), 100);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
this.companion.style.display = "";
|
|
42
|
-
const box = (_a = this.companion.offsetParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
43
|
-
if (box) {
|
|
44
|
-
this.companion.style.left = pos.right + "px";
|
|
45
|
-
this.companion.style.top = (pos.top + box.top - 20) + "px";
|
|
46
|
-
this.companion.style.height = (pos.bottom - pos.top) + "px";
|
|
47
|
-
this.companion.textContent = "+";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
destroy() { this.companion.remove(); }
|
|
51
|
-
}
|
|
52
|
-
exports.SelectionCompanion = SelectionCompanion;
|