@limetech/lime-crm-building-blocks 1.55.4 → 1.55.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/CHANGELOG.md +16 -0
- package/dist/cjs/limebb-text-editor-picker.cjs.entry.js +22 -6
- package/dist/cjs/limebb-text-editor.cjs.entry.js +13 -2
- package/dist/collection/components/text-editor/text-editor-picker.css +12 -1
- package/dist/collection/components/text-editor/text-editor-picker.js +22 -6
- package/dist/collection/components/text-editor/text-editor.js +13 -2
- package/dist/components/limebb-text-editor.js +13 -2
- package/dist/components/text-editor-picker.js +23 -7
- package/dist/esm/limebb-text-editor-picker.entry.js +23 -7
- package/dist/esm/limebb-text-editor.entry.js +13 -2
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-7cd87ebd.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-edbe4b21.entry.js +1 -0
- package/dist/types/components/text-editor/text-editor-picker.d.ts +3 -0
- package/dist/types/components/text-editor/text-editor.d.ts +2 -2
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-99f8e335.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-a3aeec8e.entry.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.55.6](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.5...v1.55.6) (2024-12-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
* **text-editor-picker:** prevent default on mousedown ([0bbe534](https://github.com/Lundalogik/lime-crm-building-blocks/commit/0bbe5341532019dc0439e34acb83a0c9a8be07e2)), closes [Lundalogik/crm-feature#4528](https://github.com/Lundalogik/crm-feature/issues/4528)
|
|
7
|
+
|
|
8
|
+
## [1.55.5](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.4...v1.55.5) (2024-12-12)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
* **text-editor-picker:** render spinner with items ([649c5b2](https://github.com/Lundalogik/lime-crm-building-blocks/commit/649c5b282c2ab4a0677a3804a6c445b4f4c5765f))
|
|
14
|
+
* **text-editor:** improve visibility of search spinner ([717c86f](https://github.com/Lundalogik/lime-crm-building-blocks/commit/717c86fbab1296eed4df8413c3a1070ad2cc47d7))
|
|
15
|
+
* **text-editor:** make state variables private ([b4cdfe7](https://github.com/Lundalogik/lime-crm-building-blocks/commit/b4cdfe7d91c8758d0b54db6c4158b2949421b065))
|
|
16
|
+
|
|
1
17
|
## [1.55.4](https://github.com/Lundalogik/lime-crm-building-blocks/compare/v1.55.3...v1.55.4) (2024-12-12)
|
|
2
18
|
|
|
3
19
|
### Bug Fixes
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-dd1aef9e.js');
|
|
6
6
|
const keycodes = require('./keycodes-4c91c567.js');
|
|
7
7
|
|
|
8
|
-
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-spinner{margin:0
|
|
8
|
+
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-menu-list{position:relative}limel-spinner{margin:0 auto}.spinner-in-list{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}";
|
|
9
9
|
|
|
10
10
|
const TextEditorPicker = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -65,17 +65,33 @@ const TextEditorPicker = class {
|
|
|
65
65
|
}
|
|
66
66
|
render() {
|
|
67
67
|
if (this.items.length === 0) {
|
|
68
|
-
|
|
68
|
+
if (this.isSearching) {
|
|
69
|
+
return this.renderSpinner();
|
|
70
|
+
}
|
|
71
|
+
return (index.h(index.Host, { onMouseDown: this.handleMouseDown }, index.h("limebb-empty-state", { value: this.emptyMessage, icon: {
|
|
69
72
|
name: 'search_more',
|
|
70
73
|
color: 'rgb(var(--contrast-800))',
|
|
71
|
-
} }));
|
|
74
|
+
} })));
|
|
72
75
|
}
|
|
76
|
+
return (index.h(index.Host, { onMouseDown: this.handleMouseDown }, [
|
|
77
|
+
index.h("div", null, index.h("limel-menu-list", { items: this.getItems(), onInteract: this.selectOnInteract }), index.h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
78
|
+
]));
|
|
79
|
+
}
|
|
80
|
+
renderSpinner() {
|
|
73
81
|
if (this.isSearching) {
|
|
74
82
|
return index.h("limel-spinner", { size: "small", class: "search-spinner" });
|
|
75
83
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
}
|
|
85
|
+
handleMouseDown(event) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
}
|
|
88
|
+
getItems() {
|
|
89
|
+
return this.items.map((item) => {
|
|
90
|
+
if ('separator' in item) {
|
|
91
|
+
return item;
|
|
92
|
+
}
|
|
93
|
+
return Object.assign(Object.assign({}, item), { disabled: this.isSearching });
|
|
94
|
+
});
|
|
79
95
|
}
|
|
80
96
|
get host() { return index.getElement(this); }
|
|
81
97
|
static get watchers() { return {
|
|
@@ -1303,13 +1303,16 @@ const LimeBBTextEditor = class {
|
|
|
1303
1303
|
this.handleTriggerChange = (event) => {
|
|
1304
1304
|
event.stopImmediatePropagation();
|
|
1305
1305
|
this.editorPickerQuery = event.detail.value;
|
|
1306
|
+
this.isSearching = true;
|
|
1306
1307
|
this.search();
|
|
1307
1308
|
};
|
|
1308
1309
|
this.stopTrigger = () => {
|
|
1309
1310
|
this.isPickerOpen = false;
|
|
1310
1311
|
this.activeTrigger = undefined;
|
|
1311
1312
|
this.triggerFunction = undefined;
|
|
1313
|
+
this.isSearching = false;
|
|
1312
1314
|
this.highlightedItemIndex = 0;
|
|
1315
|
+
this.items = [];
|
|
1313
1316
|
};
|
|
1314
1317
|
this.handleItemSelection = (event) => {
|
|
1315
1318
|
var _a;
|
|
@@ -1417,9 +1420,14 @@ const LimeBBTextEditor = class {
|
|
|
1417
1420
|
}
|
|
1418
1421
|
async search() {
|
|
1419
1422
|
if (!this.limeObjectService) {
|
|
1423
|
+
this.isSearching = false;
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
if (!this.editorPickerQuery) {
|
|
1427
|
+
this.items = [];
|
|
1428
|
+
this.isSearching = false;
|
|
1420
1429
|
return;
|
|
1421
1430
|
}
|
|
1422
|
-
this.isSearching = true;
|
|
1423
1431
|
const query = this.editorPickerQuery;
|
|
1424
1432
|
const limit = SEARCH_LIMIT;
|
|
1425
1433
|
try {
|
|
@@ -1427,12 +1435,15 @@ const LimeBBTextEditor = class {
|
|
|
1427
1435
|
if (query !== this.editorPickerQuery) {
|
|
1428
1436
|
return;
|
|
1429
1437
|
}
|
|
1438
|
+
this.isSearching = false;
|
|
1430
1439
|
if (!objects.length) {
|
|
1431
1440
|
this.items = [];
|
|
1432
1441
|
return;
|
|
1433
1442
|
}
|
|
1443
|
+
if (!this.activeTrigger) {
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1434
1446
|
this.items = this.createSearchListItems(objects);
|
|
1435
|
-
this.isSearching = false;
|
|
1436
1447
|
}
|
|
1437
1448
|
catch (e) {
|
|
1438
1449
|
console.error('Failed search for user', e);
|
|
@@ -9,8 +9,19 @@
|
|
|
9
9
|
box-shadow: var(--shadow-depth-16);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
limel-menu-list {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
limel-spinner {
|
|
13
|
-
margin: 0
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.spinner-in-list {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 50%;
|
|
23
|
+
left: 50%;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
@keyframes fade-in {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ESCAPE } from '@building-blocks/util/keycodes';
|
|
2
|
-
import { h, } from '@stencil/core';
|
|
2
|
+
import { h, Host, } from '@stencil/core';
|
|
3
3
|
/**
|
|
4
4
|
* Text editor picker
|
|
5
5
|
* This component displays a list of items that will be displayed in a popover,
|
|
@@ -69,17 +69,33 @@ export class TextEditorPicker {
|
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
71
|
if (this.items.length === 0) {
|
|
72
|
-
|
|
72
|
+
if (this.isSearching) {
|
|
73
|
+
return this.renderSpinner();
|
|
74
|
+
}
|
|
75
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, h("limebb-empty-state", { value: this.emptyMessage, icon: {
|
|
73
76
|
name: 'search_more',
|
|
74
77
|
color: 'rgb(var(--contrast-800))',
|
|
75
|
-
} }));
|
|
78
|
+
} })));
|
|
76
79
|
}
|
|
80
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, [
|
|
81
|
+
h("div", null, h("limel-menu-list", { items: this.getItems(), onInteract: this.selectOnInteract }), h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
82
|
+
]));
|
|
83
|
+
}
|
|
84
|
+
renderSpinner() {
|
|
77
85
|
if (this.isSearching) {
|
|
78
86
|
return h("limel-spinner", { size: "small", class: "search-spinner" });
|
|
79
87
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
}
|
|
89
|
+
handleMouseDown(event) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
}
|
|
92
|
+
getItems() {
|
|
93
|
+
return this.items.map((item) => {
|
|
94
|
+
if ('separator' in item) {
|
|
95
|
+
return item;
|
|
96
|
+
}
|
|
97
|
+
return Object.assign(Object.assign({}, item), { disabled: this.isSearching });
|
|
98
|
+
});
|
|
83
99
|
}
|
|
84
100
|
static get is() { return "limebb-text-editor-picker"; }
|
|
85
101
|
static get encapsulation() { return "shadow"; }
|
|
@@ -184,13 +184,16 @@ export class LimeBBTextEditor {
|
|
|
184
184
|
this.handleTriggerChange = (event) => {
|
|
185
185
|
event.stopImmediatePropagation();
|
|
186
186
|
this.editorPickerQuery = event.detail.value;
|
|
187
|
+
this.isSearching = true;
|
|
187
188
|
this.search();
|
|
188
189
|
};
|
|
189
190
|
this.stopTrigger = () => {
|
|
190
191
|
this.isPickerOpen = false;
|
|
191
192
|
this.activeTrigger = undefined;
|
|
192
193
|
this.triggerFunction = undefined;
|
|
194
|
+
this.isSearching = false;
|
|
193
195
|
this.highlightedItemIndex = 0;
|
|
196
|
+
this.items = [];
|
|
194
197
|
};
|
|
195
198
|
this.handleItemSelection = (event) => {
|
|
196
199
|
var _a;
|
|
@@ -298,9 +301,14 @@ export class LimeBBTextEditor {
|
|
|
298
301
|
}
|
|
299
302
|
async search() {
|
|
300
303
|
if (!this.limeObjectService) {
|
|
304
|
+
this.isSearching = false;
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (!this.editorPickerQuery) {
|
|
308
|
+
this.items = [];
|
|
309
|
+
this.isSearching = false;
|
|
301
310
|
return;
|
|
302
311
|
}
|
|
303
|
-
this.isSearching = true;
|
|
304
312
|
const query = this.editorPickerQuery;
|
|
305
313
|
const limit = SEARCH_LIMIT;
|
|
306
314
|
try {
|
|
@@ -308,12 +316,15 @@ export class LimeBBTextEditor {
|
|
|
308
316
|
if (query !== this.editorPickerQuery) {
|
|
309
317
|
return;
|
|
310
318
|
}
|
|
319
|
+
this.isSearching = false;
|
|
311
320
|
if (!objects.length) {
|
|
312
321
|
this.items = [];
|
|
313
322
|
return;
|
|
314
323
|
}
|
|
324
|
+
if (!this.activeTrigger) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
315
327
|
this.items = this.createSearchListItems(objects);
|
|
316
|
-
this.isSearching = false;
|
|
317
328
|
}
|
|
318
329
|
catch (e) {
|
|
319
330
|
console.error('Failed search for user', e);
|
|
@@ -1302,13 +1302,16 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1302
1302
|
this.handleTriggerChange = (event) => {
|
|
1303
1303
|
event.stopImmediatePropagation();
|
|
1304
1304
|
this.editorPickerQuery = event.detail.value;
|
|
1305
|
+
this.isSearching = true;
|
|
1305
1306
|
this.search();
|
|
1306
1307
|
};
|
|
1307
1308
|
this.stopTrigger = () => {
|
|
1308
1309
|
this.isPickerOpen = false;
|
|
1309
1310
|
this.activeTrigger = undefined;
|
|
1310
1311
|
this.triggerFunction = undefined;
|
|
1312
|
+
this.isSearching = false;
|
|
1311
1313
|
this.highlightedItemIndex = 0;
|
|
1314
|
+
this.items = [];
|
|
1312
1315
|
};
|
|
1313
1316
|
this.handleItemSelection = (event) => {
|
|
1314
1317
|
var _a;
|
|
@@ -1416,9 +1419,14 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1416
1419
|
}
|
|
1417
1420
|
async search() {
|
|
1418
1421
|
if (!this.limeObjectService) {
|
|
1422
|
+
this.isSearching = false;
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (!this.editorPickerQuery) {
|
|
1426
|
+
this.items = [];
|
|
1427
|
+
this.isSearching = false;
|
|
1419
1428
|
return;
|
|
1420
1429
|
}
|
|
1421
|
-
this.isSearching = true;
|
|
1422
1430
|
const query = this.editorPickerQuery;
|
|
1423
1431
|
const limit = SEARCH_LIMIT;
|
|
1424
1432
|
try {
|
|
@@ -1426,12 +1434,15 @@ const LimeBBTextEditor = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
1426
1434
|
if (query !== this.editorPickerQuery) {
|
|
1427
1435
|
return;
|
|
1428
1436
|
}
|
|
1437
|
+
this.isSearching = false;
|
|
1429
1438
|
if (!objects.length) {
|
|
1430
1439
|
this.items = [];
|
|
1431
1440
|
return;
|
|
1432
1441
|
}
|
|
1442
|
+
if (!this.activeTrigger) {
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1433
1445
|
this.items = this.createSearchListItems(objects);
|
|
1434
|
-
this.isSearching = false;
|
|
1435
1446
|
}
|
|
1436
1447
|
catch (e) {
|
|
1437
1448
|
console.error('Failed search for user', e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { a as ESCAPE } from './keycodes.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './empty-state.js';
|
|
4
4
|
|
|
5
|
-
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-spinner{margin:0
|
|
5
|
+
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-menu-list{position:relative}limel-spinner{margin:0 auto}.spinner-in-list{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}";
|
|
6
6
|
|
|
7
7
|
const TextEditorPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
@@ -64,17 +64,33 @@ const TextEditorPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
64
64
|
}
|
|
65
65
|
render() {
|
|
66
66
|
if (this.items.length === 0) {
|
|
67
|
-
|
|
67
|
+
if (this.isSearching) {
|
|
68
|
+
return this.renderSpinner();
|
|
69
|
+
}
|
|
70
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, h("limebb-empty-state", { value: this.emptyMessage, icon: {
|
|
68
71
|
name: 'search_more',
|
|
69
72
|
color: 'rgb(var(--contrast-800))',
|
|
70
|
-
} }));
|
|
73
|
+
} })));
|
|
71
74
|
}
|
|
75
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, [
|
|
76
|
+
h("div", null, h("limel-menu-list", { items: this.getItems(), onInteract: this.selectOnInteract }), h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
77
|
+
]));
|
|
78
|
+
}
|
|
79
|
+
renderSpinner() {
|
|
72
80
|
if (this.isSearching) {
|
|
73
81
|
return h("limel-spinner", { size: "small", class: "search-spinner" });
|
|
74
82
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
}
|
|
84
|
+
handleMouseDown(event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
}
|
|
87
|
+
getItems() {
|
|
88
|
+
return this.items.map((item) => {
|
|
89
|
+
if ('separator' in item) {
|
|
90
|
+
return item;
|
|
91
|
+
}
|
|
92
|
+
return Object.assign(Object.assign({}, item), { disabled: this.isSearching });
|
|
93
|
+
});
|
|
78
94
|
}
|
|
79
95
|
get host() { return this; }
|
|
80
96
|
static get watchers() { return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a0338355.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a0338355.js';
|
|
2
2
|
import { a as ESCAPE } from './keycodes-5ad45042.js';
|
|
3
3
|
|
|
4
|
-
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-spinner{margin:0
|
|
4
|
+
const textEditorPickerCss = ":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-menu-list{position:relative}limel-spinner{margin:0 auto}.spinner-in-list{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}";
|
|
5
5
|
|
|
6
6
|
const TextEditorPicker = class {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -61,17 +61,33 @@ const TextEditorPicker = class {
|
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
63
|
if (this.items.length === 0) {
|
|
64
|
-
|
|
64
|
+
if (this.isSearching) {
|
|
65
|
+
return this.renderSpinner();
|
|
66
|
+
}
|
|
67
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, h("limebb-empty-state", { value: this.emptyMessage, icon: {
|
|
65
68
|
name: 'search_more',
|
|
66
69
|
color: 'rgb(var(--contrast-800))',
|
|
67
|
-
} }));
|
|
70
|
+
} })));
|
|
68
71
|
}
|
|
72
|
+
return (h(Host, { onMouseDown: this.handleMouseDown }, [
|
|
73
|
+
h("div", null, h("limel-menu-list", { items: this.getItems(), onInteract: this.selectOnInteract }), h("div", { class: "spinner-in-list" }, this.renderSpinner())),
|
|
74
|
+
]));
|
|
75
|
+
}
|
|
76
|
+
renderSpinner() {
|
|
69
77
|
if (this.isSearching) {
|
|
70
78
|
return h("limel-spinner", { size: "small", class: "search-spinner" });
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
}
|
|
81
|
+
handleMouseDown(event) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
}
|
|
84
|
+
getItems() {
|
|
85
|
+
return this.items.map((item) => {
|
|
86
|
+
if ('separator' in item) {
|
|
87
|
+
return item;
|
|
88
|
+
}
|
|
89
|
+
return Object.assign(Object.assign({}, item), { disabled: this.isSearching });
|
|
90
|
+
});
|
|
75
91
|
}
|
|
76
92
|
get host() { return getElement(this); }
|
|
77
93
|
static get watchers() { return {
|
|
@@ -1299,13 +1299,16 @@ const LimeBBTextEditor = class {
|
|
|
1299
1299
|
this.handleTriggerChange = (event) => {
|
|
1300
1300
|
event.stopImmediatePropagation();
|
|
1301
1301
|
this.editorPickerQuery = event.detail.value;
|
|
1302
|
+
this.isSearching = true;
|
|
1302
1303
|
this.search();
|
|
1303
1304
|
};
|
|
1304
1305
|
this.stopTrigger = () => {
|
|
1305
1306
|
this.isPickerOpen = false;
|
|
1306
1307
|
this.activeTrigger = undefined;
|
|
1307
1308
|
this.triggerFunction = undefined;
|
|
1309
|
+
this.isSearching = false;
|
|
1308
1310
|
this.highlightedItemIndex = 0;
|
|
1311
|
+
this.items = [];
|
|
1309
1312
|
};
|
|
1310
1313
|
this.handleItemSelection = (event) => {
|
|
1311
1314
|
var _a;
|
|
@@ -1413,9 +1416,14 @@ const LimeBBTextEditor = class {
|
|
|
1413
1416
|
}
|
|
1414
1417
|
async search() {
|
|
1415
1418
|
if (!this.limeObjectService) {
|
|
1419
|
+
this.isSearching = false;
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
if (!this.editorPickerQuery) {
|
|
1423
|
+
this.items = [];
|
|
1424
|
+
this.isSearching = false;
|
|
1416
1425
|
return;
|
|
1417
1426
|
}
|
|
1418
|
-
this.isSearching = true;
|
|
1419
1427
|
const query = this.editorPickerQuery;
|
|
1420
1428
|
const limit = SEARCH_LIMIT;
|
|
1421
1429
|
try {
|
|
@@ -1423,12 +1431,15 @@ const LimeBBTextEditor = class {
|
|
|
1423
1431
|
if (query !== this.editorPickerQuery) {
|
|
1424
1432
|
return;
|
|
1425
1433
|
}
|
|
1434
|
+
this.isSearching = false;
|
|
1426
1435
|
if (!objects.length) {
|
|
1427
1436
|
this.items = [];
|
|
1428
1437
|
return;
|
|
1429
1438
|
}
|
|
1439
|
+
if (!this.activeTrigger) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1430
1442
|
this.items = this.createSearchListItems(objects);
|
|
1431
|
-
this.isSearching = false;
|
|
1432
1443
|
}
|
|
1433
1444
|
catch (e) {
|
|
1434
1445
|
console.error('Failed search for user', e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[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"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-8e85017b.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-4b389d50",[[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"]}]]],["p-32ab34e5",[[1,"limebb-kanban",{platform:[16],context:[16],items:[16],paginationSize:[2,"pagination-size"],groupBy:[513,"group-by"],groups:[16]}]]],["p-edbe4b21",[[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]}]]],["p-2e549d89",[[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]}]]],["p-beb4e864",[[1,"limebb-info-tile-currency-format",{platform:[16],context:[16],value:[16]}]]],["p-56654f3d",[[1,"limebb-notification-list",{platform:[16],context:[16],items:[16],loading:[4],lastVisitedTimestamp:[1,"last-visited-timestamp"]}]]],["p-c4e176ca",[[17,"limebb-browser",{platform:[16],context:[16],items:[16],layout:[1],filter:[32]}]]],["p-dc97e968",[[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]}]]],["p-3f66a22e",[[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"]}]]],["p-74dfea73",[[1,"limebb-dashboard-widget",{heading:[513],subheading:[513],supportingText:[513,"supporting-text"],icon:[513]}]]],["p-8aafd8fb",[[1,"limebb-icon-picker",{value:[1],required:[4],readonly:[4],invalid:[4],disabled:[4],label:[1],helperText:[1,"helper-text"]}]]],["p-949f5146",[[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]}]]],["p-3602eb38",[[1,"limebb-info-tile-date-format",{value:[16]}]]],["p-87d08f0d",[[1,"limebb-info-tile-decimal-format",{value:[16]}]]],["p-2867f980",[[1,"limebb-info-tile-format",{platform:[16],context:[16],type:[1],value:[16]}]]],["p-c163374e",[[1,"limebb-info-tile-relative-date-format",{value:[16]}]]],["p-d0a17301",[[1,"limebb-info-tile-unit-format",{value:[16]}]]],["p-58416605",[[1,"limebb-limeobject-file-viewer",{platform:[16],context:[16],property:[1],fileTypes:[16],limeobject:[32],limetype:[32]}]]],["p-1acd64f5",[[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]}]]],["p-6abd79e1",[[1,"limebb-mention",{limetype:[1],objectid:[2],limeobject:[32]}]]],["p-25011706",[[17,"limebb-navigation-button",{href:[513],tooltipLabel:[513,"tooltip-label"],tooltipHelperLabel:[513,"tooltip-helper-label"],type:[513]}]]],["p-fd6bc5af",[[1,"limebb-kanban-column",{platform:[16],context:[16],columnHeading:[1,"column-heading"],items:[16],loading:[4],paginationSize:[2,"pagination-size"],displayedItemCount:[32]}]]],["p-7cd87ebd",[[1,"limebb-text-editor-picker",{items:[16],open:[516],isSearching:[4,"is-searching"],emptyMessage:[1,"empty-message"]}]]],["p-99a45f29",[[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]}]]],["p-bf3dfc8b",[[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]}]]],["p-abdc6601",[[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]}]]],["p-39b80f7a",[[1,"limebb-notification-item",{platform:[16],context:[16],item:[16]}]]],["p-9e9e54f3",[[1,"limebb-kanban-item",{platform:[16],context:[16],item:[16]}]]],["p-b4e15af7",[[1,"limebb-empty-state",{heading:[513],value:[513],icon:[16]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as e,H as i,g as a}from"./p-8e85017b.js";import{a as r}from"./p-0086e532.js";const n=class{constructor(e){t(this,e),this.cancel=s(this,"cancel",7),this.itemSelected=s(this,"itemSelected",7),this.items=[],this.open=!1,this.isSearching=!1,this.emptyMessage="",this.handleCancel=t=>{t instanceof KeyboardEvent&&t.key!==r||(t.stopPropagation(),t.preventDefault(),this.cancel.emit())},this.selectOnInteract=t=>{t.stopPropagation(),t.preventDefault(),this.itemSelected.emit(t.detail)}}watchOpen(t){!0===t?this.setupHandlers():!1===t&&this.teardownHandlers()}connectedCallback(){this.open&&this.setupHandlers()}disconnectedCallback(){this.teardownHandlers()}setupHandlers(){this.host.addEventListener("keyup",this.handleCancel)}teardownHandlers(){this.host&&this.host.removeEventListener("keyup",this.handleCancel)}render(){return 0===this.items.length?this.isSearching?this.renderSpinner():e(i,{onMouseDown:this.handleMouseDown},e("limebb-empty-state",{value:this.emptyMessage,icon:{name:"search_more",color:"rgb(var(--contrast-800))"}})):e(i,{onMouseDown:this.handleMouseDown},[e("div",null,e("limel-menu-list",{items:this.getItems(),onInteract:this.selectOnInteract}),e("div",{class:"spinner-in-list"},this.renderSpinner()))])}renderSpinner(){if(this.isSearching)return e("limel-spinner",{size:"small",class:"search-spinner"})}handleMouseDown(t){t.preventDefault()}getItems(){return this.items.map((t=>"separator"in t?t:Object.assign(Object.assign({},t),{disabled:this.isSearching})))}get host(){return a(this)}static get watchers(){return{open:["watchOpen"]}}};n.style=":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-menu-list{position:relative}limel-spinner{margin:0 auto}.spinner-in-list{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}";export{n as limebb_text_editor_picker}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,h as i,g as r}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as d,c as l,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var i;t=(i=t)?i.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(i)+1).replace($,""):i;var r=D.test(t);return r||L.test(t)?Q(t.slice(2),r?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}();function z(t,e,i){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}var G=Object.prototype.hasOwnProperty;function H(t,e,i){var r=t[e];G.call(t,e)&&O(r,i)&&(void 0!==i||e in t)||z(t,e,i)}function K(t,e,i,r){var n=!i;i||(i={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=r?r(i[a],t[a],a,i,t):void 0;void 0===c&&(c=t[a]),n?z(i,a,c):H(i,a,c)}return i}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e}(t);var e=M(t),i=[];for(var r in t)("constructor"!=r||!e&&V.call(t,r))&&i.push(r);return i}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,it=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,l(t)),t=X(t);return e}:b;function rt(t){return m(t,J,it)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},dt={};function lt(t,e,i,r,n,s){var o,a=1&e,c=2&e,u=4&e;if(i&&(o=n?i(t,r,n,s):i(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!a)return function(t,e){var i=-1,r=t.length;for(e||(e=Array(r));++i<r;)e[i]=t[i];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var i=t.length,r=et?et(i):new t.constructor(i);return t.copy(r),r}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,it(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,l(t),e)}(t,function(t,e){return t&&K(e,d(e),t)}(o,t))}else{if(!dt[f])return n?t:{};o=function(t,e,i){var r,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var i=e?st(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(r=t).constructor(r.source,ot.exec(r))).lastIndex=r.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(r){o.add(lt(r,e,i,r,t,s))})):ht(t)&&t.forEach((function(r,n){o.set(n,lt(r,e,i,n,t,s))}));var p=h?void 0:(u?c?rt:g:c?J:d)(t);return function(t,e){for(var i=-1,r=null==t?0:t.length;++i<r&&!1!==e(t[i],i););}(p||t,(function(r,n){p&&(r=t[n=r]),H(o,n,lt(r,e,i,n,t,s))})),o}dt["[object Arguments]"]=dt["[object Array]"]=dt["[object ArrayBuffer]"]=dt["[object DataView]"]=dt["[object Boolean]"]=dt["[object Date]"]=dt["[object Float32Array]"]=dt["[object Float64Array]"]=dt["[object Int8Array]"]=dt["[object Int16Array]"]=dt["[object Int32Array]"]=dt["[object Map]"]=dt["[object Number]"]=dt["[object Object]"]=dt["[object RegExp]"]=dt["[object Set]"]=dt["[object String]"]=dt["[object Symbol]"]=dt["[object Uint8Array]"]=dt["[object Uint8ClampedArray]"]=dt["[object Uint16Array]"]=dt["[object Uint32Array]"]=!0,dt["[object Error]"]=dt["[object Function]"]=dt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(i){var r;t(this,i),this.change=e(this,"change",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{this.isPickerOpen=!1,this.stopTrigger()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.stopTrigger()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.isSearching=!0,this.search()},this.stopTrigger=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var e;let i;if(t instanceof CustomEvent)i=t.detail;else{if(!(t instanceof KeyboardEvent))return;i=this.items[this.highlightedItemIndex]}this.insertEditorNode(i),this.stopTrigger(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e,i;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const r=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(t)},children:[null===(i=t.value)||void 0===i?void 0:i.descriptive]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(r=window.crypto)||void 0===r?void 0:r.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,i){var r,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(e){var i=r,s=n;return r=n=void 0,u=e,o=t.apply(s,i)}function l(t){return u=t,a=setTimeout(p,e),h?d(t):o}function b(t){var i=t-c;return void 0===c||i>=e||i<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var i=e-(t-c);return f?mt(i,s-(t-u)):i}(t))}function m(t){return a=void 0,v&&r?d(t):(r=n=void 0,o)}function j(){var t=bt(),i=b(t);if(r=arguments,n=this,c=t,i){if(void 0===a)return l(c);if(f)return clearTimeout(a),a=setTimeout(p,e),d(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(i)&&(h=!!i.leading,s=(f="maxWait"in i)?pt(W(i.maxWait)||0,e):s,v="trailing"in i?!!i.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,r=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[i("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return i("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},i("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,i)=>{const r=lt(t,5);return Object.assign(Object.assign({},r),{selected:i===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return void(this.isSearching=!1);if(!this.editorPickerQuery)return this.items=[],void(this.isSearching=!1);const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(this.isSearching=!1,!e.length)return void(this.items=[]);if(!this.activeTrigger)return;this.items=this.createSearchListItems(e)}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const i=this.limeObjectService.getObject(t._limetype,t._id);return i?e(i,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,i,r){var n,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);s>3&&o&&Object.defineProperty(e,i,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,i;return"user"===(null===(i=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===i?void 0:i.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(i=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(i))&&("user",!("user"===t.label));var i}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
|
|
@@ -40,6 +40,9 @@ export declare class TextEditorPicker {
|
|
|
40
40
|
private setupHandlers;
|
|
41
41
|
private teardownHandlers;
|
|
42
42
|
render(): any;
|
|
43
|
+
private renderSpinner;
|
|
43
44
|
private handleCancel;
|
|
45
|
+
protected handleMouseDown(event: MouseEvent): void;
|
|
44
46
|
private selectOnInteract;
|
|
47
|
+
private getItems;
|
|
45
48
|
}
|
|
@@ -125,11 +125,11 @@ export declare class LimeBBTextEditor implements FormComponent<string> {
|
|
|
125
125
|
/**
|
|
126
126
|
* Open state of the picker
|
|
127
127
|
*/
|
|
128
|
-
isPickerOpen
|
|
128
|
+
private isPickerOpen;
|
|
129
129
|
/**
|
|
130
130
|
* Loading state of the picker
|
|
131
131
|
*/
|
|
132
|
-
isSearching
|
|
132
|
+
private isSearching;
|
|
133
133
|
private host;
|
|
134
134
|
/**
|
|
135
135
|
* Dispatched when a change is made to the editor
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as r,g as i}from"./p-8e85017b.js";import{P as n}from"./p-4506e883.js";import{a as s}from"./p-db4425f5.js";import{A as o,a,b as c,E as u,T as h}from"./p-0086e532.js";import{d as f,b as v,k as l,c as d,s as b,a as p,e as m,U as j,S as y,g}from"./p-ef494ab2.js";import{i as w,e as O}from"./p-28e4e638.js";import{d as x,r as k,S as A,a as S,i as T}from"./p-e7281662.js";import{d as M,i as E,o as N,g as I,h as _,n as C,a as F}from"./p-f340c7e6.js";import{i as P}from"./p-86b9d9e8.js";import"./p-8b377b1f.js";var R=/\s/,$=/^\s+/;var U=/^[-+]0x[0-9a-f]+$/i,D=/^0b[01]+$/i,L=/^0o[0-7]+$/i,Q=parseInt;function W(t){if("number"==typeof t)return t;if(w(t))return NaN;if(x(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=x(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;var r;t=(r=t)?r.slice(0,function(t){for(var e=t.length;e--&&R.test(t.charAt(e)););return e}(r)+1).replace($,""):r;var i=D.test(t);return i||L.test(t)?Q(t.slice(2),i?2:8):U.test(t)?NaN:+t}var B=Object.create,q=function(){function t(){}return function(e){if(!x(e))return{};if(B)return B(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function z(t,e,r){"__proto__"==e&&f?f(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var G=Object.prototype.hasOwnProperty;function H(t,e,r){var i=t[e];G.call(t,e)&&O(i,r)&&(void 0!==r||e in t)||z(t,e,r)}function K(t,e,r,i){var n=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],c=i?i(r[a],t[a],a,r,t):void 0;void 0===c&&(c=t[a]),n?z(r,a,c):H(r,a,c)}return r}var V=Object.prototype.hasOwnProperty;function J(t){return E(t)?v(t,!0):function(t){if(!x(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&V.call(t,i))&&r.push(i);return r}(t)}var X=N(Object.getPrototypeOf,Object),Y="object"==typeof exports&&exports&&!exports.nodeType&&exports,Z=Y&&"object"==typeof module&&module&&!module.nodeType&&module,tt=Z&&Z.exports===Y?k.Buffer:void 0,et=tt?tt.allocUnsafe:void 0,rt=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)p(e,d(t)),t=X(t);return e}:b;function it(t){return m(t,J,rt)}var nt=Object.prototype.hasOwnProperty;function st(t){var e=new t.constructor(t.byteLength);return new j(e).set(new j(t)),e}var ot=/\w*$/,at=A?A.prototype:void 0,ct=at?at.valueOf:void 0;var ut=C&&C.isMap,ht=ut?_(ut):function(t){return S(t)&&"[object Map]"==I(t)},ft=C&&C.isSet,vt=ft?_(ft):function(t){return S(t)&&"[object Set]"==I(t)},lt={};function dt(t,e,r,i,n,s){var o,a=1&e,c=2&e,u=4&e;if(r&&(o=n?r(t,i,n,s):r(t)),void 0!==o)return o;if(!x(t))return t;var h=T(t);if(h){if(o=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&nt.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!a)return function(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}(t,o)}else{var f=I(t),v="[object Function]"==f||"[object GeneratorFunction]"==f;if(F(t))return function(t,e){if(e)return t.slice();var r=t.length,i=et?et(r):new t.constructor(r);return t.copy(i),i}(t,a);if("[object Object]"==f||"[object Arguments]"==f||v&&!n){if(o=c||v?{}:function(t){return"function"!=typeof t.constructor||M(t)?{}:q(X(t))}(t),!a)return c?function(t,e){return K(t,rt(t),e)}(t,function(t,e){return t&&K(e,J(e),t)}(o,t)):function(t,e){return K(t,d(t),e)}(t,function(t,e){return t&&K(e,l(e),t)}(o,t))}else{if(!lt[f])return n?t:{};o=function(t,e,r){var i,n,s=t.constructor;switch(e){case"[object ArrayBuffer]":return st(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,r);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(n=new(i=t).constructor(i.source,ot.exec(i))).lastIndex=i.lastIndex,n;case"[object Set]":return new s;case"[object Symbol]":return ct?Object(ct.call(t)):{}}}(t,f,a)}}s||(s=new y);var b=s.get(t);if(b)return b;s.set(t,o),vt(t)?t.forEach((function(i){o.add(dt(i,e,r,i,t,s))})):ht(t)&&t.forEach((function(i,n){o.set(n,dt(i,e,r,n,t,s))}));var p=h?void 0:(u?c?it:g:c?J:l)(t);return function(t,e){for(var r=-1,i=null==t?0:t.length;++r<i&&!1!==e(t[r],r););}(p||t,(function(i,n){p&&(i=t[n=i]),H(o,n,dt(i,e,r,n,t,s))})),o}lt["[object Arguments]"]=lt["[object Array]"]=lt["[object ArrayBuffer]"]=lt["[object DataView]"]=lt["[object Boolean]"]=lt["[object Date]"]=lt["[object Float32Array]"]=lt["[object Float64Array]"]=lt["[object Int8Array]"]=lt["[object Int16Array]"]=lt["[object Int32Array]"]=lt["[object Map]"]=lt["[object Number]"]=lt["[object Object]"]=lt["[object RegExp]"]=lt["[object Set]"]=lt["[object String]"]=lt["[object Symbol]"]=lt["[object Uint8Array]"]=lt["[object Uint8ClampedArray]"]=lt["[object Uint16Array]"]=lt["[object Uint32Array]"]=!0,lt["[object Error]"]=lt["[object Function]"]=lt["[object WeakMap]"]=!1;var bt=function(){return k.Date.now()},pt=Math.max,mt=Math.min;const jt=class{constructor(r){var i;t(this,r),this.change=e(this,"change",7),this.allowMentioning=!1,this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.required=!1,this.ui="standard",this.allowResize=!0,this.value="",this.items=[],this.highlightedItemIndex=0,this.customElements=[],this.registeredTriggers=[],this.isPickerOpen=!1,this.isSearching=!1,this.activeTrigger=void 0,this.triggerMap={"@":{customElement:{tagName:"limebb-mention",attributes:["limetype","objectid","href"]},mapAttributes:t=>({limetype:t.value.getLimetype().name,objectid:t.value.id,href:`object/${this.context.limetype}/${this.context.id}`})}},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![a,c,o,u,h].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const e={[a]:this.handleEscapeKey,[u]:this.handleEnterOrTabKey,[h]:this.handleEnterOrTabKey,[o]:this.handleArrowKeyPress,[c]:this.handleArrowKeyPress}[t.key];e&&e(t)},this.handleArrowKeyPress=t=>{var e;this.highlightedItemIndex=(this.highlightedItemIndex+(t.key===o?1:-1)+(e=this.items.length))%e},this.handleEscapeKey=()=>{this.isPickerOpen=!1,this.stopTrigger()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleTriggerStart=t=>{t.stopPropagation(),this.isPickerOpen=!0,this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor},this.handleTriggerStop=t=>{t.stopPropagation(),this.stopTrigger()},this.handleTriggerChange=t=>{t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value,this.search()},this.stopTrigger=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.highlightedItemIndex=0},this.handleItemSelection=t=>{var e;let r;if(t instanceof CustomEvent)r=t.detail;else{if(!(t instanceof KeyboardEvent))return;r=this.items[this.highlightedItemIndex]}this.insertEditorNode(r),this.stopTrigger(),null===(e=this.textEditor)||void 0===e||e.focus()},this.insertEditorNode=t=>{var e,r;if(void 0===this.activeTrigger)return void console.warn("No triggerMap found");const i=this.triggerMap[this.activeTrigger];try{null===(e=this.triggerFunction)||void 0===e||e.insert({node:{tagName:i.customElement.tagName,attributes:i.mapAttributes(t)},children:[null===(r=t.value)||void 0===r?void 0:r.descriptive]})}catch(t){console.error("Can't insert node to the text editor",t)}},this.portalId="crypto"in window&&"function"==typeof(null===(i=window.crypto)||void 0===i?void 0:i.randomUUID)?"a_"+crypto.randomUUID():String.fromCharCode(97+Math.floor(26*Math.random()))+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2),this.search=function(t,e,r){var i,n,s,o,a,c,u=0,h=!1,f=!1,v=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function l(e){var r=i,s=n;return i=n=void 0,u=e,o=t.apply(s,r)}function d(t){return u=t,a=setTimeout(p,e),h?l(t):o}function b(t){var r=t-c;return void 0===c||r>=e||r<0||f&&t-u>=s}function p(){var t=bt();if(b(t))return m(t);a=setTimeout(p,function(t){var r=e-(t-c);return f?mt(r,s-(t-u)):r}(t))}function m(t){return a=void 0,v&&i?l(t):(i=n=void 0,o)}function j(){var t=bt(),r=b(t);if(i=arguments,n=this,c=t,r){if(void 0===a)return d(c);if(f)return clearTimeout(a),a=setTimeout(p,e),l(c)}return void 0===a&&(a=setTimeout(p,e)),o}return e=W(e)||0,x(r)&&(h=!!r.leading,s=(f="maxWait"in r)?pt(W(r.maxWait)||0,e):s,v="trailing"in r?!!r.trailing:v),j.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=c=n=a=void 0},j.flush=function(){return void 0===a?o:m(bt())},j}(this.search,300)}watchOpen(){this.setupHandlers()}watchQuery(){this.setPickerMessage()}componentWillLoad(){this.setCustomElementsAndTriggers()}disconnectedCallback(){this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}setCustomElementsAndTriggers(){this.customElements=Object.values(this.triggerMap).map((t=>t.customElement)),this.allowMentioning&&(this.registeredTriggers=Object.keys(this.triggerMap))}setPickerMessage(){this.pickerMessage=!0===this.isPickerOpen&&this.editorPickerQuery.length>0?"No results for your search...":"Start typing a name..."}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0})):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}))}render(){return[r("limel-text-editor",{ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.customElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,ui:this.ui,allowResize:this.allowResize,required:this.required,disabled:this.disabled,readonly:this.readonly,helperText:this.helperText,placeholder:this.placeholder,label:this.label,invalid:this.invalid}),this.renderPicker()]}renderPicker(){if(this.isPickerOpen)return r("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},r("limebb-text-editor-picker",{items:(t=this.items,e=this.highlightedItemIndex,t.map(((t,r)=>{const i=dt(t,5);return Object.assign(Object.assign({},i),{selected:r===e})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,e}async search(){if(!this.limeObjectService)return;this.isSearching=!0;const t=this.editorPickerQuery;try{const{objects:e}=await this.limeObjectService.search(t,this.searchableLimetypes,10);if(t!==this.editorPickerQuery)return;if(!e.length)return void(this.items=[]);this.items=this.createSearchListItems(e),this.isSearching=!1}catch(t){console.error("Failed search for user",t)}}createSearchListItems(t=[]){const e=this.viewFactoryRegistry.getFactory("search");return t.map((t=>{const r=this.limeObjectService.getObject(t._limetype,t._id);return r?e(r,this.context):null})).filter(P)}get limeObjectService(){return this.platform.get(n.LimeObjectRepository)}get viewFactoryRegistry(){return this.platform.get(n.ViewFactoryRegistry)}get host(){return i(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);s>3&&o&&Object.defineProperty(e,r,o)}([s({map:[function(t){return Object.values(t).filter((t=>"user"===t.label||function(t){const e=function(t){return Object.values(t.properties).find((t=>{var e,r;return"user"===(null===(r=null===(e=null==t?void 0:t.relation)||void 0===e?void 0:e.getLimetype())||void 0===r?void 0:r.label)}))}(t);return!!e&&(function(t){return t&&["belongsto","hasone","hasmany","hasandbelongstomany"].includes(t.type)}(r=e)&&!function(t){return t&&["belongsto","hasone"].includes(t.type)}(r))&&("user",!("user"===t.label));var r}(t)))}]})],jt.prototype,"searchableLimetypes",void 0);export{jt as limebb_text_editor}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as e,g as i}from"./p-8e85017b.js";import{a}from"./p-0086e532.js";const r=class{constructor(e){t(this,e),this.cancel=s(this,"cancel",7),this.itemSelected=s(this,"itemSelected",7),this.items=[],this.open=!1,this.isSearching=!1,this.emptyMessage="",this.handleCancel=t=>{t instanceof KeyboardEvent&&t.key!==a||(t.stopPropagation(),t.preventDefault(),this.cancel.emit())},this.selectOnInteract=t=>{t.stopPropagation(),t.preventDefault(),this.itemSelected.emit(t.detail)}}watchOpen(t){!0===t?this.setupHandlers():!1===t&&this.teardownHandlers()}connectedCallback(){this.open&&this.setupHandlers()}disconnectedCallback(){this.teardownHandlers()}setupHandlers(){this.host.addEventListener("keyup",this.handleCancel)}teardownHandlers(){this.host&&this.host.removeEventListener("keyup",this.handleCancel)}render(){return 0===this.items.length?e("limebb-empty-state",{value:this.emptyMessage,icon:{name:"search_more",color:"rgb(var(--contrast-800))"}}):this.isSearching?e("limel-spinner",{size:"small",class:"search-spinner"}):[e("limel-menu-list",{items:this.items,onInteract:this.selectOnInteract})]}get host(){return i(this)}static get watchers(){return{open:["watchOpen"]}}};r.style=":host(limebb-text-editor-picker){animation:fade-in 0.3s ease forwards;animation-delay:0.1s;display:block;max-width:calc(100vw - 2rem);padding:0.125rem;border-radius:0.5rem;background-color:rgba(var(--contrast-100));box-shadow:var(--shadow-depth-16)}limel-spinner{margin:0.5rem auto}@keyframes fade-in{0%{opacity:0}100%{opacity:1}}";export{r as limebb_text_editor_picker}
|