@ni/nimble-components 20.15.0 → 20.16.0
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/dist/all-components-bundle.js +12525 -11724
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2993 -2857
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/label-provider/table/index.d.ts +6 -0
- package/dist/esm/label-provider/table/index.js +9 -1
- package/dist/esm/label-provider/table/index.js.map +1 -1
- package/dist/esm/label-provider/table/label-token-defaults.js +2 -0
- package/dist/esm/label-provider/table/label-token-defaults.js.map +1 -1
- package/dist/esm/label-provider/table/label-tokens.d.ts +2 -0
- package/dist/esm/label-provider/table/label-tokens.js +8 -0
- package/dist/esm/label-provider/table/label-tokens.js.map +1 -1
- package/dist/esm/patterns/expand-collapse/styles.d.ts +1 -0
- package/dist/esm/patterns/expand-collapse/styles.js +27 -0
- package/dist/esm/patterns/expand-collapse/styles.js.map +1 -0
- package/dist/esm/rich-text/base/index.d.ts +36 -0
- package/dist/esm/rich-text/base/index.js +73 -0
- package/dist/esm/rich-text/base/index.js.map +1 -0
- package/dist/esm/rich-text/editor/index.d.ts +25 -27
- package/dist/esm/rich-text/editor/index.js +95 -173
- package/dist/esm/rich-text/editor/index.js.map +1 -1
- package/dist/esm/rich-text/editor/models/create-tiptap-editor.d.ts +3 -0
- package/dist/esm/rich-text/editor/models/create-tiptap-editor.js +228 -0
- package/dist/esm/rich-text/editor/models/create-tiptap-editor.js.map +1 -0
- package/dist/esm/rich-text/editor/styles.js +9 -1
- package/dist/esm/rich-text/editor/styles.js.map +1 -1
- package/dist/esm/rich-text/editor/template.js +2 -2
- package/dist/esm/rich-text/editor/template.js.map +1 -1
- package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.d.ts +4 -0
- package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +24 -4
- package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
- package/dist/esm/rich-text/editor/testing/types.d.ts +15 -0
- package/dist/esm/rich-text/editor/testing/types.js.map +1 -1
- package/dist/esm/rich-text/editor/types.d.ts +1 -0
- package/dist/esm/rich-text/editor/types.js +1 -0
- package/dist/esm/rich-text/editor/types.js.map +1 -1
- package/dist/esm/rich-text/models/configuration.d.ts +10 -0
- package/dist/esm/rich-text/models/configuration.js +15 -0
- package/dist/esm/rich-text/models/configuration.js.map +1 -0
- package/dist/esm/rich-text/models/editor-configuration.d.ts +10 -0
- package/dist/esm/rich-text/models/editor-configuration.js +14 -0
- package/dist/esm/rich-text/models/editor-configuration.js.map +1 -0
- package/dist/esm/rich-text/models/markdown-parser-mention-configuration.d.ts +2 -2
- package/dist/esm/rich-text/models/markdown-parser-mention-configuration.js +5 -1
- package/dist/esm/rich-text/models/markdown-parser-mention-configuration.js.map +1 -1
- package/dist/esm/rich-text/models/markdown-parser.d.ts +8 -1
- package/dist/esm/rich-text/models/markdown-parser.js +20 -4
- package/dist/esm/rich-text/models/markdown-parser.js.map +1 -1
- package/dist/esm/rich-text/models/markdown-serializer.d.ts +4 -3
- package/dist/esm/rich-text/models/markdown-serializer.js +16 -5
- package/dist/esm/rich-text/models/markdown-serializer.js.map +1 -1
- package/dist/esm/rich-text/models/mention-extension-configuration.d.ts +15 -0
- package/dist/esm/rich-text/models/mention-extension-configuration.js +18 -0
- package/dist/esm/rich-text/models/mention-extension-configuration.js.map +1 -0
- package/dist/esm/rich-text/viewer/index.d.ts +5 -23
- package/dist/esm/rich-text/viewer/index.js +13 -61
- package/dist/esm/rich-text/viewer/index.js.map +1 -1
- package/dist/esm/rich-text/viewer/styles.js +2 -1
- package/dist/esm/rich-text/viewer/styles.js.map +1 -1
- package/dist/esm/rich-text-mention/base/index.d.ts +17 -16
- package/dist/esm/rich-text-mention/base/index.js +34 -20
- package/dist/esm/rich-text-mention/base/index.js.map +1 -1
- package/dist/esm/rich-text-mention/base/models/mention-internals.d.ts +9 -4
- package/dist/esm/rich-text-mention/base/models/mention-internals.js +6 -2
- package/dist/esm/rich-text-mention/base/models/mention-internals.js.map +1 -1
- package/dist/esm/rich-text-mention/base/models/mention-validator.d.ts +3 -5
- package/dist/esm/rich-text-mention/base/models/mention-validator.js +6 -10
- package/dist/esm/rich-text-mention/base/models/mention-validator.js.map +1 -1
- package/dist/esm/rich-text-mention/base/template.d.ts +1 -1
- package/dist/esm/rich-text-mention/base/template.js +1 -1
- package/dist/esm/rich-text-mention/base/template.js.map +1 -1
- package/dist/esm/rich-text-mention/base/types.d.ts +10 -0
- package/dist/esm/rich-text-mention/base/types.js +2 -0
- package/dist/esm/rich-text-mention/base/types.js.map +1 -0
- package/dist/esm/rich-text-mention/users/index.d.ts +2 -3
- package/dist/esm/rich-text-mention/users/index.js +1 -6
- package/dist/esm/rich-text-mention/users/index.js.map +1 -1
- package/dist/esm/rich-text-mention/{base → users}/models/mapping-user-config.d.ts +1 -1
- package/dist/esm/rich-text-mention/{base → users}/models/mapping-user-config.js +1 -1
- package/dist/esm/rich-text-mention/users/models/mapping-user-config.js.map +1 -0
- package/dist/esm/rich-text-mention/users/models/rich-text-mention-users-validator.d.ts +4 -2
- package/dist/esm/rich-text-mention/users/models/rich-text-mention-users-validator.js +11 -2
- package/dist/esm/rich-text-mention/users/models/rich-text-mention-users-validator.js.map +1 -1
- package/dist/esm/rich-text-mention/users/view/styles.js +8 -3
- package/dist/esm/rich-text-mention/users/view/styles.js.map +1 -1
- package/dist/esm/table/components/cell/styles.js +2 -2
- package/dist/esm/table/components/cell/styles.js.map +1 -1
- package/dist/esm/table/components/group-row/styles.js +3 -22
- package/dist/esm/table/components/group-row/styles.js.map +1 -1
- package/dist/esm/table/components/group-row/template.js +2 -1
- package/dist/esm/table/components/group-row/template.js.map +1 -1
- package/dist/esm/table/components/row/index.d.ts +12 -0
- package/dist/esm/table/components/row/index.js +37 -4
- package/dist/esm/table/components/row/index.js.map +1 -1
- package/dist/esm/table/components/row/styles.js +20 -1
- package/dist/esm/table/components/row/styles.js.map +1 -1
- package/dist/esm/table/components/row/template.js +28 -7
- package/dist/esm/table/components/row/template.js.map +1 -1
- package/dist/esm/table/index.js +4 -3
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/types.d.ts +8 -0
- package/package.json +3 -1
- package/dist/esm/rich-text-mention/base/models/mapping-user-config.js.map +0 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RichTextMention } from '../../rich-text-mention/base';
|
|
3
|
-
import { MarkdownParserMentionConfiguration } from '../models/markdown-parser-mention-configuration';
|
|
1
|
+
import { RichText } from '../base';
|
|
4
2
|
declare global {
|
|
5
3
|
interface HTMLElementTagNameMap {
|
|
6
4
|
'nimble-rich-text-viewer': RichTextViewer;
|
|
@@ -9,7 +7,7 @@ declare global {
|
|
|
9
7
|
/**
|
|
10
8
|
* A nimble styled rich text viewer
|
|
11
9
|
*/
|
|
12
|
-
export declare class RichTextViewer extends
|
|
10
|
+
export declare class RichTextViewer extends RichText {
|
|
13
11
|
/**
|
|
14
12
|
*
|
|
15
13
|
* @public
|
|
@@ -20,19 +18,7 @@ export declare class RichTextViewer extends FoundationElement {
|
|
|
20
18
|
* @internal
|
|
21
19
|
*/
|
|
22
20
|
viewer: HTMLDivElement;
|
|
23
|
-
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
mentionElements: RichTextMention[];
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
mentionInternalsConfig: MarkdownParserMentionConfiguration[];
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
readonly childItems: Element[];
|
|
35
|
-
private mentionInternalsNotifiers;
|
|
21
|
+
private mentionedHrefs;
|
|
36
22
|
/**
|
|
37
23
|
* @internal
|
|
38
24
|
*/
|
|
@@ -44,12 +30,8 @@ export declare class RichTextViewer extends FoundationElement {
|
|
|
44
30
|
/**
|
|
45
31
|
* @internal
|
|
46
32
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
private updateMentionsFromChildItems;
|
|
50
|
-
private observeMentions;
|
|
51
|
-
private removeMentionObservers;
|
|
52
|
-
private updateMentionInternalsConfig;
|
|
33
|
+
configurationChanged(): void;
|
|
34
|
+
getMentionedHrefs(): string[];
|
|
53
35
|
private updateView;
|
|
54
36
|
}
|
|
55
37
|
export declare const richTextViewerTag: string;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { DesignSystem
|
|
3
|
-
import {
|
|
2
|
+
import { DesignSystem } from '@microsoft/fast-foundation';
|
|
3
|
+
import { observable } from '@microsoft/fast-element';
|
|
4
4
|
import { template } from './template';
|
|
5
5
|
import { styles } from './styles';
|
|
6
6
|
import { RichTextMarkdownParser } from '../models/markdown-parser';
|
|
7
|
-
import {
|
|
8
|
-
import { MentionInternals } from '../../rich-text-mention/base/models/mention-internals';
|
|
9
|
-
import { MarkdownParserMentionConfiguration } from '../models/markdown-parser-mention-configuration';
|
|
7
|
+
import { RichText } from '../base';
|
|
10
8
|
/**
|
|
11
9
|
* A nimble styled rich text viewer
|
|
12
10
|
*/
|
|
13
|
-
export class RichTextViewer extends
|
|
11
|
+
export class RichTextViewer extends RichText {
|
|
14
12
|
constructor() {
|
|
15
13
|
super(...arguments);
|
|
16
14
|
/**
|
|
@@ -19,19 +17,7 @@ export class RichTextViewer extends FoundationElement {
|
|
|
19
17
|
* Markdown string to render its corresponding rich text content in the component.
|
|
20
18
|
*/
|
|
21
19
|
this.markdown = '';
|
|
22
|
-
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
this.mentionElements = [];
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
this.mentionInternalsConfig = [];
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
this.childItems = [];
|
|
34
|
-
this.mentionInternalsNotifiers = [];
|
|
20
|
+
this.mentionedHrefs = [];
|
|
35
21
|
}
|
|
36
22
|
/**
|
|
37
23
|
* @internal
|
|
@@ -49,64 +35,30 @@ export class RichTextViewer extends FoundationElement {
|
|
|
49
35
|
/**
|
|
50
36
|
* @internal
|
|
51
37
|
*/
|
|
52
|
-
|
|
53
|
-
if (source instanceof MentionInternals && typeof args === 'string') {
|
|
54
|
-
this.updateMentionInternalsConfig();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
childItemsChanged() {
|
|
58
|
-
void this.updateMentionsFromChildItems();
|
|
59
|
-
}
|
|
60
|
-
async updateMentionsFromChildItems() {
|
|
61
|
-
const definedElements = this.childItems.map(async (item) => (item.matches(':not(:defined)')
|
|
62
|
-
? customElements.whenDefined(item.localName)
|
|
63
|
-
: Promise.resolve()));
|
|
64
|
-
await Promise.all(definedElements);
|
|
65
|
-
this.mentionElements = this.childItems.filter((x) => x instanceof RichTextMention);
|
|
66
|
-
this.observeMentions();
|
|
67
|
-
this.updateMentionInternalsConfig();
|
|
68
|
-
}
|
|
69
|
-
observeMentions() {
|
|
70
|
-
this.removeMentionObservers();
|
|
71
|
-
for (const mention of this.mentionElements) {
|
|
72
|
-
const notifierInternals = Observable.getNotifier(mention.mentionInternals);
|
|
73
|
-
notifierInternals.subscribe(this);
|
|
74
|
-
this.mentionInternalsNotifiers.push(notifierInternals);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
removeMentionObservers() {
|
|
78
|
-
this.mentionInternalsNotifiers.forEach(notifier => {
|
|
79
|
-
notifier.unsubscribe(this);
|
|
80
|
-
});
|
|
81
|
-
this.mentionInternalsNotifiers = [];
|
|
82
|
-
}
|
|
83
|
-
updateMentionInternalsConfig() {
|
|
84
|
-
// TODO: Add a rich text validator to check if the `mentionElements` contains duplicate configuration element
|
|
85
|
-
// For example, having two `nimble-rich-text-mention-users` within the children of rich text viewer or editor is an invalid configuration
|
|
86
|
-
this.mentionInternalsConfig = this.mentionElements
|
|
87
|
-
.filter(mention => mention.mentionInternals.validConfiguration)
|
|
88
|
-
.map(mention => new MarkdownParserMentionConfiguration(mention.mentionInternals));
|
|
38
|
+
configurationChanged() {
|
|
89
39
|
this.updateView();
|
|
90
40
|
}
|
|
41
|
+
getMentionedHrefs() {
|
|
42
|
+
return Array.from(this.mentionedHrefs);
|
|
43
|
+
}
|
|
91
44
|
updateView() {
|
|
92
45
|
if (!this.$fastController.isConnected) {
|
|
93
46
|
return;
|
|
94
47
|
}
|
|
95
48
|
if (this.markdown) {
|
|
96
|
-
const
|
|
97
|
-
this.viewer.replaceChildren(
|
|
49
|
+
const parseResult = RichTextMarkdownParser.parseMarkdownToDOM(this.markdown, this.configuration?.parserMentionConfig);
|
|
50
|
+
this.viewer.replaceChildren(parseResult.fragment);
|
|
51
|
+
this.mentionedHrefs = parseResult.mentionedHrefs;
|
|
98
52
|
}
|
|
99
53
|
else {
|
|
100
54
|
this.viewer.innerHTML = '';
|
|
55
|
+
this.mentionedHrefs = [];
|
|
101
56
|
}
|
|
102
57
|
}
|
|
103
58
|
}
|
|
104
59
|
__decorate([
|
|
105
60
|
observable
|
|
106
61
|
], RichTextViewer.prototype, "markdown", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
observable
|
|
109
|
-
], RichTextViewer.prototype, "childItems", void 0);
|
|
110
62
|
const nimbleRichTextViewer = RichTextViewer.compose({
|
|
111
63
|
baseName: 'rich-text-viewer',
|
|
112
64
|
template,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAA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,oBAAoB,GAAG,cAAc,CAAC,OAAO,CAAC;IAChD,QAAQ,EAAE,kBAAkB;IAC5B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import { bodyFont, bodyFontColor, linkFontColor } from '../../theme-provider/design-tokens';
|
|
3
|
+
import { bodyFont, bodyFontColor, linkFontColor, mentionFontColor } from '../../theme-provider/design-tokens';
|
|
4
4
|
export const styles = css `
|
|
5
5
|
${display('flex')}
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@ export const styles = css `
|
|
|
11
11
|
width: auto;
|
|
12
12
|
overflow: auto;
|
|
13
13
|
height: 100%;
|
|
14
|
+
--ni-nimble-private-mention-font-color: ${mentionFontColor};
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.viewer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EACnB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;gBAGL,QAAQ;;iBAEP,aAAa;;;;kDAIoB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;MAwB5D;AACE,gLAAgL,CAAC,EACrL;;;;;MAKE;AACE;;;;;;;GAOG,CAAC,EACR;;iBAEa,aAAa;;CAE7B,CAAC"}
|
|
@@ -4,19 +4,14 @@ import type { MappingConfig } from './models/mapping-config';
|
|
|
4
4
|
import type { RichTextMentionValidator, RichTextMentionValidity } from './models/mention-validator';
|
|
5
5
|
import { MentionInternals, MentionInternalsOptions } from './models/mention-internals';
|
|
6
6
|
import { Mapping } from '../../mapping/base';
|
|
7
|
-
export declare type MappingConfigs = ReadonlyMap<string, MappingConfig>;
|
|
8
|
-
export interface RichTextMentionConfig {
|
|
9
|
-
mappingConfigs: MappingConfigs;
|
|
10
|
-
}
|
|
11
7
|
/**
|
|
12
8
|
* The base class for Mention configuration
|
|
13
9
|
*/
|
|
14
|
-
export declare abstract class RichTextMention<
|
|
15
|
-
]> = RichTextMentionValidator<[]>> extends FoundationElement implements Subscriber {
|
|
10
|
+
export declare abstract class RichTextMention<TValidator extends RichTextMentionValidator = RichTextMentionValidator> extends FoundationElement implements Subscriber {
|
|
16
11
|
/**
|
|
17
12
|
* @internal
|
|
18
13
|
*/
|
|
19
|
-
readonly mentionInternals: MentionInternals
|
|
14
|
+
readonly mentionInternals: MentionInternals;
|
|
20
15
|
/** @internal */
|
|
21
16
|
readonly validator: TValidator;
|
|
22
17
|
/**
|
|
@@ -26,24 +21,30 @@ export declare abstract class RichTextMention<TMentionConfig extends RichTextMen
|
|
|
26
21
|
/** @internal */
|
|
27
22
|
mappingNotifiers: Notifier[];
|
|
28
23
|
/** @internal */
|
|
29
|
-
|
|
24
|
+
mappingElements: Mapping<unknown>[];
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
30
28
|
checkValidity(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
31
32
|
get validity(): RichTextMentionValidity;
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
emitMentionUpdate(filter: string): void;
|
|
32
37
|
/**
|
|
33
38
|
* @internal
|
|
34
39
|
*/
|
|
35
40
|
handleChange(source: unknown, args: unknown): void;
|
|
36
41
|
protected abstract createValidator(): TValidator;
|
|
37
42
|
protected abstract getMentionInternalsOptions(): MentionInternalsOptions;
|
|
38
|
-
protected abstract createMentionConfig(mappingConfigs: MappingConfigs): TMentionConfig;
|
|
39
43
|
protected abstract createMappingConfig(mapping: Mapping<unknown>): MappingConfig;
|
|
40
44
|
private getMappingConfigs;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
private updateMentionConfig;
|
|
45
|
-
private mappingsChanged;
|
|
45
|
+
private updateMappingConfigs;
|
|
46
|
+
private mappingElementsChanged;
|
|
46
47
|
private patternChanged;
|
|
47
|
-
private
|
|
48
|
-
private
|
|
48
|
+
private removeMappingElementObservers;
|
|
49
|
+
private observeMappingElements;
|
|
49
50
|
}
|
|
@@ -12,31 +12,48 @@ export class RichTextMention extends FoundationElement {
|
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
this.mentionInternals = new MentionInternals(this.getMentionInternalsOptions())
|
|
15
|
+
this.mentionInternals = new MentionInternals(this.getMentionInternalsOptions(), (filter) => {
|
|
16
|
+
this.emitMentionUpdate(filter);
|
|
17
|
+
});
|
|
16
18
|
/** @internal */
|
|
17
19
|
this.validator = this.createValidator();
|
|
18
20
|
/** @internal */
|
|
19
21
|
this.mappingNotifiers = [];
|
|
20
22
|
/** @internal */
|
|
21
|
-
this.
|
|
23
|
+
this.mappingElements = [];
|
|
22
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
23
28
|
checkValidity() {
|
|
24
29
|
return this.mentionInternals.validConfiguration;
|
|
25
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
26
34
|
get validity() {
|
|
27
35
|
return this.validator.getValidity();
|
|
28
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
emitMentionUpdate(filter) {
|
|
41
|
+
const mentionUpdateEventDetails = {
|
|
42
|
+
filter
|
|
43
|
+
};
|
|
44
|
+
this.$emit('mention-update', mentionUpdateEventDetails);
|
|
45
|
+
}
|
|
29
46
|
/**
|
|
30
47
|
* @internal
|
|
31
48
|
*/
|
|
32
49
|
handleChange(source, args) {
|
|
33
50
|
if (source instanceof Mapping && typeof args === 'string') {
|
|
34
|
-
this.
|
|
51
|
+
this.updateMappingConfigs();
|
|
35
52
|
}
|
|
36
53
|
}
|
|
37
54
|
getMappingConfigs() {
|
|
38
55
|
const mappingConfigs = new Map();
|
|
39
|
-
this.
|
|
56
|
+
this.mappingElements.forEach(mapping => {
|
|
40
57
|
const href = mapping.key ?? undefined;
|
|
41
58
|
if (href === undefined || typeof href !== 'string') {
|
|
42
59
|
throw Error('mentionHref was invalid for type. Validation should have prevented this.');
|
|
@@ -46,32 +63,29 @@ export class RichTextMention extends FoundationElement {
|
|
|
46
63
|
});
|
|
47
64
|
return mappingConfigs;
|
|
48
65
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.validator.validate(this.mappings, this.pattern);
|
|
54
|
-
this.mentionInternals.mentionConfig = this.validator.isValid()
|
|
55
|
-
? this.createMentionConfig(this.getMappingConfigs())
|
|
66
|
+
updateMappingConfigs() {
|
|
67
|
+
this.validator.validate(this.mappingElements, this.pattern);
|
|
68
|
+
this.mentionInternals.mappingConfigs = this.validator.isValid()
|
|
69
|
+
? this.getMappingConfigs()
|
|
56
70
|
: undefined;
|
|
57
71
|
}
|
|
58
|
-
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
72
|
+
mappingElementsChanged() {
|
|
73
|
+
this.updateMappingConfigs();
|
|
74
|
+
this.observeMappingElements();
|
|
61
75
|
}
|
|
62
76
|
patternChanged() {
|
|
77
|
+
this.validator.validate(this.mappingElements, this.pattern);
|
|
63
78
|
this.mentionInternals.pattern = this.pattern;
|
|
64
|
-
this.updateMentionConfig();
|
|
65
79
|
}
|
|
66
|
-
|
|
80
|
+
removeMappingElementObservers() {
|
|
67
81
|
this.mappingNotifiers.forEach(notifier => {
|
|
68
82
|
notifier.unsubscribe(this);
|
|
69
83
|
});
|
|
70
84
|
this.mappingNotifiers = [];
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
for (const mapping of this.
|
|
86
|
+
observeMappingElements() {
|
|
87
|
+
this.removeMappingElementObservers();
|
|
88
|
+
for (const mapping of this.mappingElements) {
|
|
75
89
|
const notifier = Observable.getNotifier(mapping);
|
|
76
90
|
notifier.subscribe(this);
|
|
77
91
|
this.mappingNotifiers.push(notifier);
|
|
@@ -83,5 +97,5 @@ __decorate([
|
|
|
83
97
|
], RichTextMention.prototype, "pattern", void 0);
|
|
84
98
|
__decorate([
|
|
85
99
|
observable
|
|
86
|
-
], RichTextMention.prototype, "
|
|
100
|
+
], RichTextMention.prototype, "mappingElements", void 0);
|
|
87
101
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/base/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,IAAI,EAEJ,UAAU,EACV,UAAU,EAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,OAAO,EACH,gBAAgB,EAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MA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AAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEO,sBAAsB;QAC1B,IAAI,CAAC,6BAA6B,EAAE,CAAC;QAErC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,eAAe,EAAE;YACxC,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACjD,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACxC;IACL,CAAC;CACJ;AAlGG;IADC,IAAI;gDACmB;AAOxB;IADC,UAAU;wDACqC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MappingConfigs, MentionUpdateEmitter } from '../types';
|
|
1
2
|
export interface MentionInternalsOptions {
|
|
2
3
|
readonly icon: string;
|
|
3
4
|
readonly character: string;
|
|
@@ -6,11 +7,11 @@ export interface MentionInternalsOptions {
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal mention state
|
|
8
9
|
*/
|
|
9
|
-
export declare class MentionInternals
|
|
10
|
+
export declare class MentionInternals {
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Mappings configured for the mention node
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
mappingConfigs?: MappingConfigs;
|
|
14
15
|
/**
|
|
15
16
|
* Whether this mention has a valid configuration.
|
|
16
17
|
*/
|
|
@@ -31,5 +32,9 @@ export declare class MentionInternals<TMentionConfig> {
|
|
|
31
32
|
* Mention view element to render in rich text components
|
|
32
33
|
*/
|
|
33
34
|
readonly viewElement: string;
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Function to invoke to emit a mention-update event
|
|
37
|
+
*/
|
|
38
|
+
readonly mentionUpdateEmitter: MentionUpdateEmitter;
|
|
39
|
+
constructor(options: MentionInternalsOptions, mentionUpdateEmitter: MentionUpdateEmitter);
|
|
35
40
|
}
|
|
@@ -4,7 +4,7 @@ import { observable } from '@microsoft/fast-element';
|
|
|
4
4
|
* Internal mention state
|
|
5
5
|
*/
|
|
6
6
|
export class MentionInternals {
|
|
7
|
-
constructor(options) {
|
|
7
|
+
constructor(options, mentionUpdateEmitter) {
|
|
8
8
|
/**
|
|
9
9
|
* Whether this mention has a valid configuration.
|
|
10
10
|
*/
|
|
@@ -12,12 +12,16 @@ export class MentionInternals {
|
|
|
12
12
|
this.icon = options.icon;
|
|
13
13
|
this.character = options.character;
|
|
14
14
|
this.viewElement = options.viewElement;
|
|
15
|
+
this.mentionUpdateEmitter = mentionUpdateEmitter;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
__decorate([
|
|
18
19
|
observable
|
|
19
|
-
], MentionInternals.prototype, "
|
|
20
|
+
], MentionInternals.prototype, "mappingConfigs", void 0);
|
|
20
21
|
__decorate([
|
|
21
22
|
observable
|
|
22
23
|
], MentionInternals.prototype, "validConfiguration", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
observable
|
|
26
|
+
], MentionInternals.prototype, "pattern", void 0);
|
|
23
27
|
//# sourceMappingURL=mention-internals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mention-internals.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/base/models/mention-internals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"mention-internals.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/base/models/mention-internals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAuCzB,YACI,OAAgC,EAChC,oBAA0C;QAlC9C;;WAEG;QAEI,uBAAkB,GAAG,IAAI,CAAC;QAgC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACrD,CAAC;CACJ;AA3CG;IADC,UAAU;wDAC4B;AAMvC;IADC,UAAU;4DACsB;AAMjC;IADC,UAAU;iDACa"}
|
|
@@ -4,14 +4,13 @@ import type { MentionInternals } from './mention-internals';
|
|
|
4
4
|
export interface RichTextMentionValidity extends ValidityObject {
|
|
5
5
|
}
|
|
6
6
|
declare type FlagNames<T> = T extends readonly (infer U)[] ? U : never;
|
|
7
|
-
export declare const baseValidityFlagNames: readonly ["
|
|
7
|
+
export declare const baseValidityFlagNames: readonly ["duplicateMappingMentionHref", "missingMentionHrefValue", "mentionHrefNotValidUrl", "mentionHrefDoesNotMatchPattern", "missingPatternAttribute", "unsupportedPatternValue"];
|
|
8
8
|
/**
|
|
9
9
|
* Validator for RichTextMention
|
|
10
10
|
*/
|
|
11
|
-
export declare class RichTextMentionValidator<ValidityFlagNames extends readonly string[]> extends Validator<typeof baseValidityFlagNames | ValidityFlagNames> {
|
|
11
|
+
export declare class RichTextMentionValidator<ValidityFlagNames extends readonly string[] = typeof baseValidityFlagNames> extends Validator<typeof baseValidityFlagNames | ValidityFlagNames> {
|
|
12
12
|
private readonly mentionInternals;
|
|
13
|
-
|
|
14
|
-
constructor(mentionInternals: MentionInternals<unknown>, configValidityKeys: ValidityFlagNames, supportedMappingElements: readonly (typeof Mapping<unknown>)[]);
|
|
13
|
+
constructor(mentionInternals: MentionInternals, configValidityKeys: ValidityFlagNames);
|
|
15
14
|
validate(mappings: Mapping<unknown>[], pattern: string | undefined): void;
|
|
16
15
|
/**
|
|
17
16
|
* @returns an object containing flags for various ways the configuation can be invalid
|
|
@@ -24,7 +23,6 @@ export declare class RichTextMentionValidator<ValidityFlagNames extends readonly
|
|
|
24
23
|
private updateMentionInternalsFlag;
|
|
25
24
|
private validateMissingPattern;
|
|
26
25
|
private validatePattern;
|
|
27
|
-
private validateMappingTypes;
|
|
28
26
|
private validateUniqueMentionHref;
|
|
29
27
|
private validateNoMissingMentionHref;
|
|
30
28
|
private validateHrefForUrl;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Validator } from '../../../utilities/models/validator';
|
|
2
2
|
export const baseValidityFlagNames = [
|
|
3
|
-
'unsupportedMappingType',
|
|
4
3
|
'duplicateMappingMentionHref',
|
|
5
4
|
'missingMentionHrefValue',
|
|
6
5
|
'mentionHrefNotValidUrl',
|
|
@@ -12,15 +11,13 @@ export const baseValidityFlagNames = [
|
|
|
12
11
|
* Validator for RichTextMention
|
|
13
12
|
*/
|
|
14
13
|
export class RichTextMentionValidator extends Validator {
|
|
15
|
-
constructor(mentionInternals, configValidityKeys
|
|
14
|
+
constructor(mentionInternals, configValidityKeys) {
|
|
16
15
|
super(configValidityKeys);
|
|
17
16
|
this.mentionInternals = mentionInternals;
|
|
18
|
-
this.supportedMappingElements = supportedMappingElements;
|
|
19
17
|
}
|
|
20
18
|
validate(mappings, pattern) {
|
|
21
19
|
this.untrackAll();
|
|
22
20
|
const mentionHrefs = mappings.map(mapping => mapping.key);
|
|
23
|
-
this.validateMappingTypes(mappings);
|
|
24
21
|
this.validateNoMissingMentionHref(mentionHrefs);
|
|
25
22
|
this.validateUniqueMentionHref(mentionHrefs);
|
|
26
23
|
this.validateMissingPattern(pattern);
|
|
@@ -55,10 +52,6 @@ export class RichTextMentionValidator extends Validator {
|
|
|
55
52
|
validatePattern(pattern) {
|
|
56
53
|
this.setConditionValue('unsupportedPatternValue', pattern === undefined || this.isInvalidRegex(pattern));
|
|
57
54
|
}
|
|
58
|
-
validateMappingTypes(mappings) {
|
|
59
|
-
const valid = mappings.every(mapping => this.supportedMappingElements.some(mappingClass => mapping instanceof mappingClass));
|
|
60
|
-
this.setConditionValue('unsupportedMappingType', !valid);
|
|
61
|
-
}
|
|
62
55
|
validateUniqueMentionHref(mentionHref) {
|
|
63
56
|
const invalid = new Set(mentionHref).size !== mentionHref.length;
|
|
64
57
|
this.setConditionValue('duplicateMappingMentionHref', invalid);
|
|
@@ -81,12 +74,13 @@ export class RichTextMentionValidator extends Validator {
|
|
|
81
74
|
: mentionHrefs.some(href => {
|
|
82
75
|
return (href === undefined
|
|
83
76
|
|| typeof href !== 'string'
|
|
84
|
-
|| !RegExp(pattern).test(href));
|
|
77
|
+
|| !new RegExp(pattern).test(href));
|
|
85
78
|
});
|
|
86
79
|
this.setConditionValue('mentionHrefDoesNotMatchPattern', invalid);
|
|
87
80
|
}
|
|
88
81
|
isInvalidUrl(url) {
|
|
89
82
|
try {
|
|
83
|
+
// Check whether the constructor throws an error for an Invalid URL.
|
|
90
84
|
// eslint-disable-next-line no-new
|
|
91
85
|
new URL(url);
|
|
92
86
|
return false;
|
|
@@ -97,7 +91,9 @@ export class RichTextMentionValidator extends Validator {
|
|
|
97
91
|
}
|
|
98
92
|
isInvalidRegex(pattern) {
|
|
99
93
|
try {
|
|
100
|
-
|
|
94
|
+
// Check whether the constructor throws an error when it cannot be parsed as a valid regular expression.
|
|
95
|
+
// eslint-disable-next-line no-new
|
|
96
|
+
new RegExp(pattern);
|
|
101
97
|
return false;
|
|
102
98
|
}
|
|
103
99
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mention-validator.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/base/models/mention-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,qCAAqC,CAAC;AAQhF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,
|
|
1
|
+
{"version":3,"file":"mention-validator.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/base/models/mention-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,qCAAqC,CAAC;AAQhF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,6BAA6B;I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QAAQ;uBACxB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3C,CAAC;YACN,CAAC,CAAC,CAAC;QACP,IAAI,CAAC,iBAAiB,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAEO,YAAY,CAAC,GAAW;QAC5B,IAAI;YACA,oEAAoE;YACpE,kCAAkC;YAClC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YACb,OAAO,KAAK,CAAC;SAChB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAI,CAAC;SACf;IACL,CAAC;IAEO,cAAc,CAAC,OAAe;QAClC,IAAI;YACA,wGAAwG;YACxG,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC;SAChB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RichTextMention } from '.';
|
|
2
|
-
export declare const template: import("@microsoft/fast-element").ViewTemplate<RichTextMention<import("
|
|
2
|
+
export declare const template: import("@microsoft/fast-element").ViewTemplate<RichTextMention<import("./models/mention-validator").RichTextMentionValidator<readonly ["duplicateMappingMentionHref", "missingMentionHrefValue", "mentionHrefNotValidUrl", "mentionHrefDoesNotMatchPattern", "missingPatternAttribute", "unsupportedPatternValue"]>>, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/base/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAiB;MACvC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/base/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGxD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAiB;MACvC,OAAO,CAAC,iBAAiB,CAAC;;SAEvB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MappingConfig } from './models/mapping-config';
|
|
2
|
+
/**
|
|
3
|
+
* The type of the detail associated with the `mention-update`
|
|
4
|
+
* event on the banner.
|
|
5
|
+
*/
|
|
6
|
+
export interface MentionUpdateEventDetail {
|
|
7
|
+
filter: string;
|
|
8
|
+
}
|
|
9
|
+
export declare type MappingConfigs = ReadonlyMap<string, MappingConfig>;
|
|
10
|
+
export declare type MentionUpdateEmitter = (filter: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/base/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MentionInternalsOptions } from '../base/models/mention-internals';
|
|
2
|
-
import {
|
|
2
|
+
import { RichTextMention } from '../base';
|
|
3
3
|
import type { MappingConfig } from '../base/models/mapping-config';
|
|
4
4
|
import type { Mapping } from '../../mapping/base';
|
|
5
5
|
import type { MappingUserKey } from '../../mapping/base/types';
|
|
@@ -12,10 +12,9 @@ declare global {
|
|
|
12
12
|
/**
|
|
13
13
|
* Rich Text user mention configuration element which will have MappingMentionUser elements as children
|
|
14
14
|
*/
|
|
15
|
-
export declare class RichTextMentionUsers extends RichTextMention<
|
|
15
|
+
export declare class RichTextMentionUsers extends RichTextMention<RichTextMentionUsersValidator> {
|
|
16
16
|
protected createValidator(): RichTextMentionUsersValidator;
|
|
17
17
|
protected getMentionInternalsOptions(): MentionInternalsOptions;
|
|
18
|
-
protected createMentionConfig(mappingConfigs: MappingConfigs): RichTextMentionConfig;
|
|
19
18
|
protected createMappingConfig(mapping: Mapping<MappingUserKey>): MappingConfig;
|
|
20
19
|
}
|
|
21
20
|
export declare const richTextMentionUsersTag: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DesignSystem } from '@microsoft/fast-foundation';
|
|
2
2
|
import { RichTextMention } from '../base';
|
|
3
|
-
import { MappingUserConfig } from '
|
|
3
|
+
import { MappingUserConfig } from './models/mapping-user-config';
|
|
4
4
|
import { template } from '../base/template';
|
|
5
5
|
import { iconAtTag } from '../../icons/at';
|
|
6
6
|
import { MappingUser } from '../../mapping/user';
|
|
@@ -20,11 +20,6 @@ export class RichTextMentionUsers extends RichTextMention {
|
|
|
20
20
|
viewElement: richTextMentionUsersViewTag
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
createMentionConfig(mappingConfigs) {
|
|
24
|
-
return {
|
|
25
|
-
mappingConfigs
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
23
|
createMappingConfig(mapping) {
|
|
29
24
|
if (mapping instanceof MappingUser) {
|
|
30
25
|
return new MappingUserConfig(mapping.key, mapping.displayName);
|