@limetech/lime-crm-building-blocks 1.55.7 → 1.56.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/CHANGELOG.md +7 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +29 -0
- package/dist/cjs/limebb-text-editor-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-text-editor.cjs.entry.js +133 -23
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/text-editor/mention-group-counter.css +18 -0
- package/dist/collection/components/text-editor/mention-group-counter.js +95 -0
- package/dist/collection/components/text-editor/mentions.js +2 -17
- package/dist/collection/components/text-editor/text-editor-picker.js +8 -8
- package/dist/collection/components/text-editor/text-editor.js +92 -10
- package/dist/collection/util/limetype.js +44 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/limebb-mention-group-counter.d.ts +11 -0
- package/dist/components/limebb-mention-group-counter.js +47 -0
- package/dist/components/limebb-text-editor.js +134 -24
- package/dist/components/text-editor-picker.js +1 -1
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +25 -0
- package/dist/esm/limebb-text-editor-picker.entry.js +1 -1
- package/dist/esm/limebb-text-editor.entry.js +134 -24
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-c8762131.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-7cd87ebd.entry.js → p-e9b322dc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-fb3b1279.entry.js +1 -0
- package/dist/types/components/text-editor/mention-group-counter.d.ts +26 -0
- package/dist/types/components/text-editor/mentions.d.ts +9 -0
- package/dist/types/components/text-editor/text-editor-picker.d.ts +3 -3
- package/dist/types/components/text-editor/text-editor.d.ts +8 -0
- package/dist/types/components/text-editor/utils/searcher-utils.d.ts +2 -2
- package/dist/types/components.d.ts +43 -6
- package/dist/types/util/limetype.d.ts +33 -0
- package/package.json +3 -3
- package/dist/lime-crm-building-blocks/p-a5f619e8.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.56.0](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.7...v1.56.0) (2024-12-19)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **text-editor:** show number of coworkers for groups in mention picker ([59b8725](https://github.com/Lundalogik/lime-crm-building-blocks/commit/59b8725cd9ad47339580549e5bf5e09a1aad4d2e))
|
|
7
|
+
|
|
1
8
|
## [1.55.7](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.6...v1.55.7) (2024-12-17)
|
|
2
9
|
|
|
3
10
|
### Bug Fixes
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"items":[16],"paginationSize":[2,"pagination-size"],"groupBy":[513,"group-by"],"groups":[16]}]]],["limebb-text-editor.cjs",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"items":[32],"highlightedItemIndex":[32],"customElements":[32],"registeredTriggers":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]}]]],["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]}]]],["limebb-component-picker.cjs",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-navigation-button.cjs",[[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-column.cjs",[[1,"limebb-kanban-column",{"platform":[16],"context":[16],"columnHeading":[1,"column-heading"],"items":[16],"loading":[4],"paginationSize":[2,"pagination-size"],"displayedItemCount":[32]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
18
|
+
return index.bootstrapLazy([["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"items":[16],"paginationSize":[2,"pagination-size"],"groupBy":[513,"group-by"],"groups":[16]}]]],["limebb-text-editor.cjs",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"items":[32],"highlightedItemIndex":[32],"customElements":[32],"registeredTriggers":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]}]]],["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]}]]],["limebb-component-picker.cjs",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-navigation-button.cjs",[[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-column.cjs",[[1,"limebb-kanban-column",{"platform":[16],"context":[16],"columnHeading":[1,"column-heading"],"items":[16],"loading":[4],"paginationSize":[2,"pagination-size"],"displayedItemCount":[32]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
19
19
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-dd1aef9e.js');
|
|
6
|
+
|
|
7
|
+
const mentionGroupCounterCss = ":host(limebb-mention-group-counter){order:2;margin-right:-0.5rem;box-sizing:border-box;transition:background-color 0.2s ease;min-width:fit-content;font-size:smaller;border-radius:9rem;cursor:help;padding:0.25rem 0.5rem;line-height:1;border:1px solid rgb(var(--contrast-500))}:host(limebb-mention-group-counter:hover){border-color:rgb(var(--contrast-100));background-color:rgb(var(--contrast-600))}";
|
|
8
|
+
|
|
9
|
+
const MentionGroupCounter = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.tooltipId = 'a' + crypto.randomUUID();
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const label = this.getLabel();
|
|
16
|
+
return [
|
|
17
|
+
index.h("span", { id: this.tooltipId }, label),
|
|
18
|
+
index.h("limel-tooltip", { elementId: this.tooltipId, label: label, helperLabel: this.helperLabel }),
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
getLabel() {
|
|
22
|
+
const localname = this.limetype.localname;
|
|
23
|
+
const limetypeLabel = this.count === 1 ? localname.singular : localname.plural;
|
|
24
|
+
return `${this.count} ${limetypeLabel}`;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
MentionGroupCounter.style = mentionGroupCounterCss;
|
|
28
|
+
|
|
29
|
+
exports.limebb_mention_group_counter = MentionGroupCounter;
|
|
@@ -74,7 +74,7 @@ const TextEditorPicker = class {
|
|
|
74
74
|
} })));
|
|
75
75
|
}
|
|
76
76
|
return (index.h(index.Host, { onMouseDown: this.handleMouseDown }, [
|
|
77
|
-
index.h("div", null, index.h("limel-
|
|
77
|
+
index.h("div", null, index.h("limel-list", { type: "selectable", items: this.getItems(), onInteract: this.selectOnInteract }), index.h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
78
78
|
]));
|
|
79
79
|
}
|
|
80
80
|
renderSpinner() {
|
|
@@ -1121,30 +1121,59 @@ function legacyCreateRandomString() {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
|
|
1123
1123
|
/**
|
|
1124
|
-
*
|
|
1124
|
+
* Whether the given object has the given label or not.
|
|
1125
1125
|
*
|
|
1126
|
-
* @param {
|
|
1127
|
-
* @
|
|
1126
|
+
* @param {LimeType|LimeProperty} object the object to check label for
|
|
1127
|
+
* @param {string} label the label to check for
|
|
1128
|
+
* @returns {boolean} true if the object has the label
|
|
1128
1129
|
*/
|
|
1129
|
-
function getMentionLimetypes(limetypes) {
|
|
1130
|
-
return Object.values(limetypes).filter((limetype) => {
|
|
1131
|
-
return limetype.label === 'user' || isGroupMention(limetype);
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
function isGroupMention(limetype) {
|
|
1135
|
-
const coworkerProperty = getRelationProperty(limetype, 'user');
|
|
1136
|
-
return (!!coworkerProperty &&
|
|
1137
|
-
isManyRelation(coworkerProperty) &&
|
|
1138
|
-
!hasLabel(limetype, 'user'));
|
|
1139
|
-
}
|
|
1140
1130
|
function hasLabel(object, label) {
|
|
1141
1131
|
return object.label === label;
|
|
1142
1132
|
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Whether the given property is a hasmany relation or not.
|
|
1135
|
+
*
|
|
1136
|
+
* @param {LimeProperty} property the property to check
|
|
1137
|
+
* @returns {boolean} true if the property is a hasmany relation
|
|
1138
|
+
*/
|
|
1143
1139
|
function isManyRelation(property) {
|
|
1144
1140
|
return isRelation(property) && !isSingleRelation(property);
|
|
1145
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Finds a relation property on the given limetype that is related to a
|
|
1144
|
+
* limetype with the given label.
|
|
1145
|
+
*
|
|
1146
|
+
* @param {LimeType} limetype the limetype to search for the relation property
|
|
1147
|
+
* @param {string} label the label of the target limetype to match
|
|
1148
|
+
* @returns {LimeProperty|undefined} the relation property or undefined
|
|
1149
|
+
*/
|
|
1146
1150
|
function getRelationProperty(limetype, label) {
|
|
1147
|
-
return Object.values(limetype.properties).find((property) =>
|
|
1151
|
+
return Object.values(limetype.properties).find((property) => property &&
|
|
1152
|
+
property.relation &&
|
|
1153
|
+
hasLabel(property.relation.getLimetype(), label));
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Whether the limetype has a hasmany relation of a limetype with the given label
|
|
1157
|
+
*
|
|
1158
|
+
* @param {LimeType} limetype the limetype
|
|
1159
|
+
* @param {string} relatedLabel the label of the related limetype
|
|
1160
|
+
* @returns {boolean} true if the limetype has the hasmany relation
|
|
1161
|
+
*/
|
|
1162
|
+
function hasHasManyRelation(limetype, relatedLabel) {
|
|
1163
|
+
const property = getRelationProperty(limetype, relatedLabel);
|
|
1164
|
+
return !!property && isManyRelation(property);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Get the limetypes that should be available for mentions
|
|
1169
|
+
*
|
|
1170
|
+
* @param {Record<string, LimeType>} limetypes all limetypes
|
|
1171
|
+
* @returns {LimeType[]} mention limetypes
|
|
1172
|
+
*/
|
|
1173
|
+
function getMentionLimetypes(limetypes) {
|
|
1174
|
+
return Object.values(limetypes).filter((limetype) => {
|
|
1175
|
+
return (hasLabel(limetype, 'user') || hasHasManyRelation(limetype, 'user'));
|
|
1176
|
+
});
|
|
1148
1177
|
}
|
|
1149
1178
|
|
|
1150
1179
|
/* eslint-disable no-underscore-dangle */
|
|
@@ -1242,6 +1271,7 @@ const LimeBBTextEditor = class {
|
|
|
1242
1271
|
*/
|
|
1243
1272
|
this.isSearching = false;
|
|
1244
1273
|
this.activeTrigger = undefined;
|
|
1274
|
+
this.groupCounts = {};
|
|
1245
1275
|
this.triggerMap = {
|
|
1246
1276
|
'@': {
|
|
1247
1277
|
customElement: {
|
|
@@ -1364,6 +1394,7 @@ const LimeBBTextEditor = class {
|
|
|
1364
1394
|
}
|
|
1365
1395
|
componentWillLoad() {
|
|
1366
1396
|
this.setCustomElementsAndTriggers();
|
|
1397
|
+
this.loadGroupCounts();
|
|
1367
1398
|
}
|
|
1368
1399
|
disconnectedCallback() {
|
|
1369
1400
|
if (this.host) {
|
|
@@ -1452,23 +1483,102 @@ const LimeBBTextEditor = class {
|
|
|
1452
1483
|
}
|
|
1453
1484
|
}
|
|
1454
1485
|
createSearchListItems(searchObjects = []) {
|
|
1486
|
+
const items = searchObjects.map((object) => this.createSearchListItem(object));
|
|
1487
|
+
return items.filter(nonNull.isNonNull);
|
|
1488
|
+
}
|
|
1489
|
+
createSearchListItem(object) {
|
|
1455
1490
|
const createSearchItem = this.viewFactoryRegistry.getFactory('search');
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1491
|
+
const limeobject = this.limeObjectService.getObject(object._limetype, object._id);
|
|
1492
|
+
if (!limeobject) {
|
|
1493
|
+
return null;
|
|
1494
|
+
}
|
|
1495
|
+
const searchListItem = createSearchItem(limeobject, this.context);
|
|
1496
|
+
const primaryComponent = this.getGroupCountComponent(limeobject);
|
|
1497
|
+
return Object.assign(Object.assign({}, searchListItem), (primaryComponent ? { primaryComponent: primaryComponent } : {}));
|
|
1498
|
+
}
|
|
1499
|
+
getGroupCountComponent(limeobject) {
|
|
1500
|
+
var _a;
|
|
1501
|
+
const limetype = limeobject.getLimetype();
|
|
1502
|
+
const groupCount = (_a = this.groupCounts[limetype.name]) === null || _a === void 0 ? void 0 : _a[limeobject.id];
|
|
1503
|
+
const coworkerProperty = getRelationProperty(limetype, 'user');
|
|
1504
|
+
if (groupCount === undefined || !coworkerProperty) {
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
const coworkerLimetype = coworkerProperty.relation.getLimetype();
|
|
1508
|
+
return {
|
|
1509
|
+
name: 'limebb-mention-group-counter',
|
|
1510
|
+
props: {
|
|
1511
|
+
count: groupCount,
|
|
1512
|
+
pluralLimetypeName: coworkerLimetype.localname.plural,
|
|
1513
|
+
helperLabel: this.translator.get('webclient.notification-center.members-will-be-notified'),
|
|
1514
|
+
},
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
async loadGroupCounts() {
|
|
1518
|
+
if (!this.allowMentioning) {
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const groupCountsLoads = this.searchableLimetypes
|
|
1522
|
+
.filter((limetype) => !hasLabel(limetype, 'user') &&
|
|
1523
|
+
hasHasManyRelation(limetype, 'user'))
|
|
1524
|
+
.map((limetype) => this.getGroupCounts(limetype));
|
|
1525
|
+
const groupCounts = await Promise.all(groupCountsLoads);
|
|
1526
|
+
groupCounts.forEach((groupCount) => {
|
|
1527
|
+
Object.assign(this.groupCounts, groupCount);
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
async getGroupCounts(limetype) {
|
|
1531
|
+
var _a;
|
|
1532
|
+
const coworkerProperty = getRelationProperty(limetype, 'user');
|
|
1533
|
+
const limetypeName = limetype.name;
|
|
1534
|
+
try {
|
|
1535
|
+
const result = await this.query.execute({
|
|
1536
|
+
limetype: limetypeName,
|
|
1537
|
+
responseFormat: {
|
|
1538
|
+
object: {
|
|
1539
|
+
_id: null,
|
|
1540
|
+
[coworkerProperty.name]: {
|
|
1541
|
+
count: {
|
|
1542
|
+
aggregate: {
|
|
1543
|
+
op: types.AggregateOperator.Count,
|
|
1544
|
+
},
|
|
1545
|
+
},
|
|
1546
|
+
},
|
|
1547
|
+
},
|
|
1548
|
+
},
|
|
1549
|
+
});
|
|
1550
|
+
if (!((_a = result.objects) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
1551
|
+
return { [limetypeName]: {} };
|
|
1461
1552
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1553
|
+
const groupCount = this.createGroupCount(result.objects, coworkerProperty.name);
|
|
1554
|
+
return { [limetypeName]: groupCount };
|
|
1555
|
+
}
|
|
1556
|
+
catch (error) {
|
|
1557
|
+
console.error(`Error fetching group count for limetype: ${limetype.name}`, error);
|
|
1558
|
+
return { [limetypeName]: {} };
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
createGroupCount(objects, coworkerPropertyName) {
|
|
1562
|
+
const groupCount = {};
|
|
1563
|
+
objects.forEach((object) => {
|
|
1564
|
+
const { _id: id, [coworkerPropertyName]: aggregateProperty } = object;
|
|
1565
|
+
groupCount[id] = aggregateProperty.count;
|
|
1566
|
+
});
|
|
1567
|
+
return groupCount;
|
|
1465
1568
|
}
|
|
1466
1569
|
get limeObjectService() {
|
|
1467
1570
|
return this.platform.get(types.PlatformServiceName.LimeObjectRepository);
|
|
1468
1571
|
}
|
|
1572
|
+
get query() {
|
|
1573
|
+
return this.platform.get(types.PlatformServiceName.Query);
|
|
1574
|
+
}
|
|
1469
1575
|
get viewFactoryRegistry() {
|
|
1470
1576
|
return this.platform.get(types.PlatformServiceName.ViewFactoryRegistry);
|
|
1471
1577
|
}
|
|
1578
|
+
get translator() {
|
|
1579
|
+
var _a;
|
|
1580
|
+
return (_a = this.platform) === null || _a === void 0 ? void 0 : _a.get(types.PlatformServiceName.Translate);
|
|
1581
|
+
}
|
|
1472
1582
|
get host() { return index.getElement(this); }
|
|
1473
1583
|
static get watchers() { return {
|
|
1474
1584
|
"isPickerOpen": ["watchOpen"],
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"items":[16],"paginationSize":[2,"pagination-size"],"groupBy":[513,"group-by"],"groups":[16]}]]],["limebb-text-editor.cjs",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"items":[32],"highlightedItemIndex":[32],"customElements":[32],"registeredTriggers":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]}]]],["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]}]]],["limebb-component-picker.cjs",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-navigation-button.cjs",[[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-column.cjs",[[1,"limebb-kanban-column",{"platform":[16],"context":[16],"columnHeading":[1,"column-heading"],"items":[16],"loading":[4],"paginationSize":[2,"pagination-size"],"displayedItemCount":[32]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
17
|
+
return index.bootstrapLazy([["limebb-feed.cjs",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-kanban.cjs",[[1,"limebb-kanban",{"platform":[16],"context":[16],"items":[16],"paginationSize":[2,"pagination-size"],"groupBy":[513,"group-by"],"groups":[16]}]]],["limebb-text-editor.cjs",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"items":[32],"highlightedItemIndex":[32],"customElements":[32],"registeredTriggers":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]}]]],["limebb-date-range.cjs",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["limebb-info-tile-currency-format.cjs",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["limebb-notification-list.cjs",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]}]]],["limebb-browser.cjs",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["limebb-component-config.cjs",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]}]]],["limebb-component-picker.cjs",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-dashboard-widget.cjs",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["limebb-icon-picker.cjs",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["limebb-info-tile.cjs",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]}]]],["limebb-info-tile-date-format.cjs",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["limebb-info-tile-decimal-format.cjs",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["limebb-info-tile-format.cjs",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["limebb-info-tile-relative-date-format.cjs",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["limebb-info-tile-unit-format.cjs",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["limebb-limeobject-file-viewer.cjs",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["limebb-locale-picker.cjs",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["limebb-mention.cjs",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["limebb-mention-group-counter.cjs",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["limebb-navigation-button.cjs",[[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["limebb-kanban-column.cjs",[[1,"limebb-kanban-column",{"platform":[16],"context":[16],"columnHeading":[1,"column-heading"],"items":[16],"loading":[4],"paginationSize":[2,"pagination-size"],"displayedItemCount":[32]}]]],["limebb-text-editor-picker.cjs",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]}]]],["limebb-currency-picker.cjs",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["limebb-date-picker.cjs",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["limebb-feed-timeline-item.cjs",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["limebb-notification-item.cjs",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-kanban-item.cjs",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["limebb-empty-state.cjs",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"./components/navigation-button/navigation-button.js",
|
|
28
28
|
"./components/notification-list/notification-list.js",
|
|
29
29
|
"./components/notification-list/notification-item/notification-item.js",
|
|
30
|
+
"./components/text-editor/mention-group-counter.js",
|
|
30
31
|
"./components/text-editor/text-editor-picker.js",
|
|
31
32
|
"./components/text-editor/text-editor.js"
|
|
32
33
|
],
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
:host(limebb-mention-group-counter) {
|
|
2
|
+
order: 2;
|
|
3
|
+
margin-right: -0.5rem;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
transition: background-color 0.2s ease;
|
|
6
|
+
min-width: fit-content;
|
|
7
|
+
font-size: smaller;
|
|
8
|
+
border-radius: 9rem;
|
|
9
|
+
cursor: help;
|
|
10
|
+
padding: 0.25rem 0.5rem;
|
|
11
|
+
line-height: 1;
|
|
12
|
+
border: 1px solid rgb(var(--contrast-500));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(limebb-mention-group-counter:hover) {
|
|
16
|
+
border-color: rgb(var(--contrast-100));
|
|
17
|
+
background-color: rgb(var(--contrast-600));
|
|
18
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
/**
|
|
3
|
+
* This component is used to display the number of items in a group
|
|
4
|
+
* that will be affected by a mention. This is displayed on the
|
|
5
|
+
* list items of the mention picker.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export class MentionGroupCounter {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.tooltipId = 'a' + crypto.randomUUID();
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const label = this.getLabel();
|
|
15
|
+
return [
|
|
16
|
+
h("span", { id: this.tooltipId }, label),
|
|
17
|
+
h("limel-tooltip", { elementId: this.tooltipId, label: label, helperLabel: this.helperLabel }),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
getLabel() {
|
|
21
|
+
const localname = this.limetype.localname;
|
|
22
|
+
const limetypeLabel = this.count === 1 ? localname.singular : localname.plural;
|
|
23
|
+
return `${this.count} ${limetypeLabel}`;
|
|
24
|
+
}
|
|
25
|
+
static get is() { return "limebb-mention-group-counter"; }
|
|
26
|
+
static get encapsulation() { return "shadow"; }
|
|
27
|
+
static get originalStyleUrls() {
|
|
28
|
+
return {
|
|
29
|
+
"$": ["mention-group-counter.scss"]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static get styleUrls() {
|
|
33
|
+
return {
|
|
34
|
+
"$": ["mention-group-counter.css"]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get properties() {
|
|
38
|
+
return {
|
|
39
|
+
"count": {
|
|
40
|
+
"type": "number",
|
|
41
|
+
"mutable": false,
|
|
42
|
+
"complexType": {
|
|
43
|
+
"original": "number",
|
|
44
|
+
"resolved": "number",
|
|
45
|
+
"references": {}
|
|
46
|
+
},
|
|
47
|
+
"required": false,
|
|
48
|
+
"optional": false,
|
|
49
|
+
"docs": {
|
|
50
|
+
"tags": [],
|
|
51
|
+
"text": "Number of items in the group"
|
|
52
|
+
},
|
|
53
|
+
"attribute": "count",
|
|
54
|
+
"reflect": false
|
|
55
|
+
},
|
|
56
|
+
"limetype": {
|
|
57
|
+
"type": "unknown",
|
|
58
|
+
"mutable": false,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "LimeType",
|
|
61
|
+
"resolved": "LimeType",
|
|
62
|
+
"references": {
|
|
63
|
+
"LimeType": {
|
|
64
|
+
"location": "import",
|
|
65
|
+
"path": "@limetech/lime-web-components"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": false,
|
|
70
|
+
"optional": false,
|
|
71
|
+
"docs": {
|
|
72
|
+
"tags": [],
|
|
73
|
+
"text": "The limetype to show group count for"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"helperLabel": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"mutable": false,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "string",
|
|
81
|
+
"resolved": "string",
|
|
82
|
+
"references": {}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "Will be used to construct a more descriptive tooltip\nIn English, this could be `will be notified!`"
|
|
89
|
+
},
|
|
90
|
+
"attribute": "helper-label",
|
|
91
|
+
"reflect": false
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasHasManyRelation, hasLabel } from '@building-blocks/util/limetype';
|
|
2
2
|
/**
|
|
3
3
|
* Get the limetypes that should be available for mentions
|
|
4
4
|
*
|
|
@@ -7,21 +7,6 @@ import { isRelation, isSingleRelation, } from '@limetech/lime-web-components';
|
|
|
7
7
|
*/
|
|
8
8
|
export function getMentionLimetypes(limetypes) {
|
|
9
9
|
return Object.values(limetypes).filter((limetype) => {
|
|
10
|
-
return limetype
|
|
10
|
+
return (hasLabel(limetype, 'user') || hasHasManyRelation(limetype, 'user'));
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function isGroupMention(limetype) {
|
|
14
|
-
const coworkerProperty = getRelationProperty(limetype, 'user');
|
|
15
|
-
return (!!coworkerProperty &&
|
|
16
|
-
isManyRelation(coworkerProperty) &&
|
|
17
|
-
!hasLabel(limetype, 'user'));
|
|
18
|
-
}
|
|
19
|
-
function hasLabel(object, label) {
|
|
20
|
-
return object.label === label;
|
|
21
|
-
}
|
|
22
|
-
function isManyRelation(property) {
|
|
23
|
-
return isRelation(property) && !isSingleRelation(property);
|
|
24
|
-
}
|
|
25
|
-
function getRelationProperty(limetype, label) {
|
|
26
|
-
return Object.values(limetype.properties).find((property) => { var _a, _b; return ((_b = (_a = property === null || property === void 0 ? void 0 : property.relation) === null || _a === void 0 ? void 0 : _a.getLimetype()) === null || _b === void 0 ? void 0 : _b.label) === label; });
|
|
27
|
-
}
|
|
@@ -78,7 +78,7 @@ export class TextEditorPicker {
|
|
|
78
78
|
} })));
|
|
79
79
|
}
|
|
80
80
|
return (h(Host, { onMouseDown: this.handleMouseDown }, [
|
|
81
|
-
h("div", null, h("limel-
|
|
81
|
+
h("div", null, h("limel-list", { type: "selectable", items: this.getItems(), onInteract: this.selectOnInteract }), h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
82
82
|
]));
|
|
83
83
|
}
|
|
84
84
|
renderSpinner() {
|
|
@@ -115,10 +115,10 @@ export class TextEditorPicker {
|
|
|
115
115
|
"type": "unknown",
|
|
116
116
|
"mutable": false,
|
|
117
117
|
"complexType": {
|
|
118
|
-
"original": "
|
|
119
|
-
"resolved": "
|
|
118
|
+
"original": "ListItem[]",
|
|
119
|
+
"resolved": "ListItem<any>[]",
|
|
120
120
|
"references": {
|
|
121
|
-
"
|
|
121
|
+
"ListItem": {
|
|
122
122
|
"location": "import",
|
|
123
123
|
"path": "@limetech/lime-elements"
|
|
124
124
|
}
|
|
@@ -197,7 +197,7 @@ export class TextEditorPicker {
|
|
|
197
197
|
"composed": true,
|
|
198
198
|
"docs": {
|
|
199
199
|
"tags": [],
|
|
200
|
-
"text": "Emitted when the
|
|
200
|
+
"text": "Emitted when the list is closed from inside the component.\n(*Not* emitted when the consumer sets the `open`-property to `false`.)"
|
|
201
201
|
},
|
|
202
202
|
"complexType": {
|
|
203
203
|
"original": "void",
|
|
@@ -215,10 +215,10 @@ export class TextEditorPicker {
|
|
|
215
215
|
"text": ""
|
|
216
216
|
},
|
|
217
217
|
"complexType": {
|
|
218
|
-
"original": "
|
|
219
|
-
"resolved": "
|
|
218
|
+
"original": "ListItem",
|
|
219
|
+
"resolved": "ListItem<any>",
|
|
220
220
|
"references": {
|
|
221
|
-
"
|
|
221
|
+
"ListItem": {
|
|
222
222
|
"location": "import",
|
|
223
223
|
"path": "@limetech/lime-elements"
|
|
224
224
|
}
|