@limetech/lime-crm-building-blocks 1.95.0 → 1.96.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-document-item.cjs.entry.js +174 -0
- package/dist/cjs/limebb-document-picker.cjs.entry.js +82 -0
- package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
- package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +1 -1
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-text-editor.cjs.entry.js +3 -23
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/random-string-aac0a74b.js +24 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/document-picker/document-item/document-item.css +64 -0
- package/dist/collection/components/document-picker/document-item/document-item.js +265 -0
- package/dist/collection/components/document-picker/document-item/document-item.types.js +1 -0
- package/dist/collection/components/document-picker/document-picker.css +139 -0
- package/dist/collection/components/document-picker/document-picker.js +304 -0
- package/dist/collection/components/document-picker/document.types.js +1 -0
- package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
- package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
- package/dist/collection/components/feed/feed.js +1 -1
- package/dist/collection/components/icon-picker/icon-picker.js +1 -1
- package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
- package/dist/collection/components/info-tile/info-tile.js +1 -1
- package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
- package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/summary-popover/summary-popover.js +3 -3
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/collection/util/format-bytes.js +36 -0
- package/dist/components/document-item.js +190 -0
- package/dist/components/feed-item-thumbnail-file-info.js +1 -1
- package/dist/components/feed-timeline-item.js +1 -1
- package/dist/components/kanban-group.js +1 -1
- package/dist/components/kanban-item.js +1 -1
- package/dist/components/limebb-document-item.d.ts +11 -0
- package/dist/components/limebb-document-item.js +6 -0
- package/dist/components/limebb-document-picker.d.ts +11 -0
- package/dist/components/limebb-document-picker.js +111 -0
- package/dist/components/limebb-feed.js +1 -1
- package/dist/components/limebb-icon-picker.js +1 -1
- package/dist/components/limebb-info-tile-format.js +1 -1
- package/dist/components/limebb-info-tile.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +1 -1
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +2 -22
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/random-string.js +22 -0
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-document-item.entry.js +170 -0
- package/dist/esm/limebb-document-picker.entry.js +78 -0
- package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
- package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
- package/dist/esm/limebb-feed.entry.js +1 -1
- package/dist/esm/limebb-icon-picker.entry.js +1 -1
- package/dist/esm/limebb-info-tile-format.entry.js +1 -1
- package/dist/esm/limebb-info-tile.entry.js +1 -1
- package/dist/esm/limebb-kanban-group.entry.js +1 -1
- package/dist/esm/limebb-kanban-item.entry.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +1 -1
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-text-editor.entry.js +2 -22
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/random-string-f6ef6fbf.js +22 -0
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-7ef3bace.entry.js → p-00e7e0d4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-11ac105b.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-4a82410e.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-a694aae5.entry.js → p-50d3d61a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4ccce5cc.entry.js → p-5abe3fff.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-a44f543c.entry.js → p-61282e1a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-16199127.entry.js → p-79d4668a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-047c89de.entry.js → p-7c4bdc1b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8ef39ab8.entry.js → p-8064cbfb.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-88cc5b66.entry.js → p-82d33d43.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-d6a07ea4.entry.js → p-85b7291c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-7db8652e.entry.js → p-8664381a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-85e11ff7.entry.js → p-88c64360.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-9d25ed5a.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8dce83ad.entry.js → p-9d9f25da.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-516210d4.entry.js → p-beb0d164.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-abf1c197.entry.js → p-c9126885.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-46d2f604.entry.js → p-e35299e0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-fbda77a7.js +1 -0
- package/dist/lime-crm-building-blocks/{p-d6af09a8.entry.js → p-ff0b244b.entry.js} +1 -1
- package/dist/types/components/document-picker/document-item/document-item.d.ts +46 -0
- package/dist/types/components/document-picker/document-item/document-item.types.d.ts +37 -0
- package/dist/types/components/document-picker/document-picker.d.ts +80 -0
- package/dist/types/components/document-picker/document.types.d.ts +2 -0
- package/dist/types/components.d.ts +240 -0
- package/dist/types/util/format-bytes.d.ts +20 -0
- package/package.json +2 -2
- package/dist/lime-crm-building-blocks/p-29346b1a.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=()=>{var t;return"crypto"in window&&"function"==typeof(null===(t=window.crypto)||void 0===t?void 0:t.randomUUID)?"a_"+crypto.randomUUID():String.fromCodePoint(97+Math.floor(26*Math.random()))+Math.random().toString(36).slice(Math.max(0,2))+Math.random().toString(36).slice(Math.max(0,2))};export{t as c}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as i}from"./p-1556b545.js";const l=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.handleChangeType=t=>{t.stopPropagation();const e=t.detail.id;"none"===e?this.change.emit():this.change.emit("date"===e||"relative-date"===e?{type:e}:"percent"===e?{type:"number",options:{style:"percent"},suffix:["percentSign"]}:{type:"number",options:{style:e}})},this.isValidButton=t=>!this.type||"none"===t.id||"none"!==this.type&&("date"===this.type?t.id.includes("date"):!t.id.includes("date"))}render(){var t,e,l,n,o,s,d,r,a,u,c;const m=[{id:"none",title:"No formatting",selected:!(null===(t=this.value)||void 0===t?void 0:t.type)},{id:"currency",title:"Currency",selected:"number"===(null===(e=this.value)||void 0===e?void 0:e.type)&&"currency"===(null===(l=this.value.options)||void 0===l?void 0:l.style)},{id:"decimal",title:"Decimal",selected:"number"===(null===(n=this.value)||void 0===n?void 0:n.type)&&"decimal"===(null===(o=this.value.options)||void 0===o?void 0:o.style)},{id:"percent",title:"Percent",selected:"number"===(null===(s=this.value)||void 0===s?void 0:s.type)&&"percent"===(null===(d=this.value.options)||void 0===d?void 0:d.style)},{id:"unit",title:"Unit",selected:"number"===(null===(r=this.value)||void 0===r?void 0:r.type)&&"unit"===(null===(a=this.value.options)||void 0===a?void 0:a.style)},{id:"date",title:"Date",selected:"date"===(null===(u=this.value)||void 0===u?void 0:u.type)},{id:"relative-date",title:"Relative date",selected:"relative-date"===(null===(c=this.value)||void 0===c?void 0:c.type)}];return[i("limel-button-group",{key:"
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-1556b545.js";const l=class{constructor(i){t(this,i),this.change=e(this,"change",7),this.handleChangeType=t=>{t.stopPropagation();const e=t.detail.id;"none"===e?this.change.emit():this.change.emit("date"===e||"relative-date"===e?{type:e}:"percent"===e?{type:"number",options:{style:"percent"},suffix:["percentSign"]}:{type:"number",options:{style:e}})},this.isValidButton=t=>!this.type||"none"===t.id||"none"!==this.type&&("date"===this.type?t.id.includes("date"):!t.id.includes("date"))}render(){var t,e,l,n,o,s,d,r,a,u,c;const m=[{id:"none",title:"No formatting",selected:!(null===(t=this.value)||void 0===t?void 0:t.type)},{id:"currency",title:"Currency",selected:"number"===(null===(e=this.value)||void 0===e?void 0:e.type)&&"currency"===(null===(l=this.value.options)||void 0===l?void 0:l.style)},{id:"decimal",title:"Decimal",selected:"number"===(null===(n=this.value)||void 0===n?void 0:n.type)&&"decimal"===(null===(o=this.value.options)||void 0===o?void 0:o.style)},{id:"percent",title:"Percent",selected:"number"===(null===(s=this.value)||void 0===s?void 0:s.type)&&"percent"===(null===(d=this.value.options)||void 0===d?void 0:d.style)},{id:"unit",title:"Unit",selected:"number"===(null===(r=this.value)||void 0===r?void 0:r.type)&&"unit"===(null===(a=this.value.options)||void 0===a?void 0:a.style)},{id:"date",title:"Date",selected:"date"===(null===(u=this.value)||void 0===u?void 0:u.type)},{id:"relative-date",title:"Relative date",selected:"relative-date"===(null===(c=this.value)||void 0===c?void 0:c.type)}];return[i("limel-button-group",{key:"8c7bba2402e84e73df2bc5e906780aeb66b1af58",value:m.filter(this.isValidButton),onChange:this.handleChangeType}),this.renderFormatConfig()]}renderFormatConfig(){var t,e;if(!(null===(t=this.value)||void 0===t?void 0:t.type))return;let l=this.value.type;this.isNumberFormat(this.value)&&(l=null===(e=this.value.options)||void 0===e?void 0:e.style);const n=`limebb-info-tile-${l}-format`;return customElements.get(n)?i(n,{platform:this.platform,context:this.context,class:"format",value:this.value}):void 0}isNumberFormat(t){return"number"===(null==t?void 0:t.type)}};l.style=":host(limebb-info-tile-format){display:grid;gap:1rem}limel-button-group{grid-column:1/-1}.format{display:grid;gap:0.5rem;grid-template-columns:repeat(auto-fit, minmax(8rem, 1fr))}";export{l as limebb_info_tile_format}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
3
|
+
import { DocumentItem } from './document-item.types';
|
|
4
|
+
/**
|
|
5
|
+
* Document item
|
|
6
|
+
* Renders individual items of the document picker component.
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare class DocumentItemComponent implements LimeWebComponent {
|
|
10
|
+
/**
|
|
11
|
+
* @inheritdoc
|
|
12
|
+
*/
|
|
13
|
+
platform: LimeWebComponentPlatform;
|
|
14
|
+
/**
|
|
15
|
+
* @inheritdoc
|
|
16
|
+
*/
|
|
17
|
+
context: LimeWebComponentContext;
|
|
18
|
+
/**
|
|
19
|
+
* The item to display in the document picker.
|
|
20
|
+
*/
|
|
21
|
+
item: DocumentItem;
|
|
22
|
+
/**
|
|
23
|
+
* The semantic role of the list item.
|
|
24
|
+
* - 'radio': renders a radio button for single selection.
|
|
25
|
+
* - 'checkbox': renders a checkbox for multiple selection.
|
|
26
|
+
*/
|
|
27
|
+
type: 'radio' | 'checkbox';
|
|
28
|
+
/**
|
|
29
|
+
* Fired when clicking on the document item.
|
|
30
|
+
*/
|
|
31
|
+
interact: EventEmitter<DocumentItem>;
|
|
32
|
+
render(): any;
|
|
33
|
+
private renderBooleanInput;
|
|
34
|
+
private renderFileSize;
|
|
35
|
+
private renderHelp;
|
|
36
|
+
private handleDocumentItemClick;
|
|
37
|
+
private handleSelectionControlClick;
|
|
38
|
+
private handleSelectionControlChange;
|
|
39
|
+
private handleKeyDown;
|
|
40
|
+
private toggleSelection;
|
|
41
|
+
private emitSelectionChange;
|
|
42
|
+
private getControlId;
|
|
43
|
+
private isUnavailable;
|
|
44
|
+
private forceInputUnchecked;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=document-item.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Image } from '@limetech/lime-elements';
|
|
2
|
+
export interface DocumentItem {
|
|
3
|
+
/**
|
|
4
|
+
* The unique identifier for the document.
|
|
5
|
+
*/
|
|
6
|
+
id: number | string;
|
|
7
|
+
/**
|
|
8
|
+
* The file name of the document, which ends with the file extension.
|
|
9
|
+
*/
|
|
10
|
+
fileName: string;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the document in bytes.
|
|
13
|
+
*/
|
|
14
|
+
fileSize?: number;
|
|
15
|
+
/**
|
|
16
|
+
* A thumbnail visualizing the document.
|
|
17
|
+
*/
|
|
18
|
+
thumbnail?: Image;
|
|
19
|
+
/**
|
|
20
|
+
* Indicates the selected state of the document.
|
|
21
|
+
*/
|
|
22
|
+
selected?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether the document is disabled (unselectable).
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A string providing help or additional information about the document.
|
|
29
|
+
* Supports markdown format.
|
|
30
|
+
*/
|
|
31
|
+
help?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether the document has an error.
|
|
34
|
+
*/
|
|
35
|
+
hasError?: boolean;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=document-item.types.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
2
|
+
import { DocumentItem } from './document-item/document-item.types';
|
|
3
|
+
import { DocumentType } from './document.types';
|
|
4
|
+
export interface DocumentPickerChangeEventDetail {
|
|
5
|
+
/**
|
|
6
|
+
* The item the user interacted with, including its new `selected` state.
|
|
7
|
+
*/
|
|
8
|
+
item: DocumentItem;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates if the interacted item is selected after the interaction.
|
|
11
|
+
*/
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* A snapshot of all items that should now be selected.
|
|
15
|
+
*/
|
|
16
|
+
selectedItems: DocumentItem[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The document picker component allows users to select one or more
|
|
20
|
+
* files from a list of available documents.
|
|
21
|
+
*
|
|
22
|
+
* It is primarily designed to facilitate the selection of files
|
|
23
|
+
* that a user might want to import into the CRM, for example via
|
|
24
|
+
* our Microsoft Outlook Add-in.
|
|
25
|
+
*
|
|
26
|
+
* @exampleComponent limebb-example-document-picker-basic
|
|
27
|
+
* @exampleComponent limebb-example-document-picker-selection-mode
|
|
28
|
+
* @exampleComponent limebb-example-document-picker-limited-selection
|
|
29
|
+
* @exampleComponent limebb-example-document-picker-contextual-info
|
|
30
|
+
*
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export declare class DocumentPicker implements LimeWebComponent {
|
|
34
|
+
/**
|
|
35
|
+
* @inheritdoc
|
|
36
|
+
*/
|
|
37
|
+
platform: LimeWebComponentPlatform;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritdoc
|
|
40
|
+
*/
|
|
41
|
+
context: LimeWebComponentContext;
|
|
42
|
+
/**
|
|
43
|
+
* The list of document items to display in the picker.
|
|
44
|
+
*/
|
|
45
|
+
items: DocumentItem[];
|
|
46
|
+
/**
|
|
47
|
+
* Label to display for the group of items.
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional helper text to display below the items.
|
|
52
|
+
*/
|
|
53
|
+
helperText?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Set to `true` to indicate that the current selection is invalid.
|
|
56
|
+
*/
|
|
57
|
+
invalid: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Set to `true` to indicate that selecting an item is required.
|
|
60
|
+
*/
|
|
61
|
+
required: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Defines whether the picker allows single or multiple selection.
|
|
64
|
+
* - 'radio': Allows single selection within a group.
|
|
65
|
+
* - 'checkbox': Allows multiple selection.
|
|
66
|
+
*/
|
|
67
|
+
type: DocumentType;
|
|
68
|
+
/**
|
|
69
|
+
* Fired when a user changes the selection state of an item.
|
|
70
|
+
*/
|
|
71
|
+
private change;
|
|
72
|
+
private helperTextId;
|
|
73
|
+
private labelId;
|
|
74
|
+
constructor();
|
|
75
|
+
render(): any;
|
|
76
|
+
private renderItems;
|
|
77
|
+
private handleItemInteract;
|
|
78
|
+
private renderHelperLine;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=document-picker.d.ts.map
|
|
@@ -10,6 +10,8 @@ import { BrowserItem } from "./components/browser/browser-item.types";
|
|
|
10
10
|
import { ActionBarItem, CustomElementDefinition, DateType, EditorUiType, FormInfo, Icon, Image, Languages, ListItem, ListSeparator, OpenDirection } from "@limetech/lime-elements";
|
|
11
11
|
import { ChatItem } from "./components/chat-list/chat-item/chat-item.types";
|
|
12
12
|
import { ComponentPickerType } from "./components/component-command-picker/types";
|
|
13
|
+
import { DocumentItem } from "./components/document-picker/document-item/document-item.types";
|
|
14
|
+
import { DocumentType } from "./components/document-picker/document.types";
|
|
13
15
|
import { FeedItem } from "./components/feed/feed-item/feed-item.types";
|
|
14
16
|
import { DateTimeFormat, NumberFormat, RelativeDateTimeFormat } from "./components/info-tile/format";
|
|
15
17
|
import { InfoTile } from "./components/info-tile/info-tile";
|
|
@@ -26,6 +28,8 @@ export { BrowserItem } from "./components/browser/browser-item.types";
|
|
|
26
28
|
export { ActionBarItem, CustomElementDefinition, DateType, EditorUiType, FormInfo, Icon, Image, Languages, ListItem, ListSeparator, OpenDirection } from "@limetech/lime-elements";
|
|
27
29
|
export { ChatItem } from "./components/chat-list/chat-item/chat-item.types";
|
|
28
30
|
export { ComponentPickerType } from "./components/component-command-picker/types";
|
|
31
|
+
export { DocumentItem } from "./components/document-picker/document-item/document-item.types";
|
|
32
|
+
export { DocumentType } from "./components/document-picker/document.types";
|
|
29
33
|
export { FeedItem } from "./components/feed/feed-item/feed-item.types";
|
|
30
34
|
export { DateTimeFormat, NumberFormat, RelativeDateTimeFormat } from "./components/info-tile/format";
|
|
31
35
|
export { InfoTile } from "./components/info-tile/info-tile";
|
|
@@ -457,6 +461,79 @@ export namespace Components {
|
|
|
457
461
|
*/
|
|
458
462
|
"type": DateType;
|
|
459
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Document item
|
|
466
|
+
* Renders individual items of the document picker component.
|
|
467
|
+
* @private
|
|
468
|
+
*/
|
|
469
|
+
interface LimebbDocumentItem {
|
|
470
|
+
/**
|
|
471
|
+
* The context this component belongs to
|
|
472
|
+
* @inheritdoc
|
|
473
|
+
*/
|
|
474
|
+
"context": LimeWebComponentContext;
|
|
475
|
+
/**
|
|
476
|
+
* The item to display in the document picker.
|
|
477
|
+
*/
|
|
478
|
+
"item": DocumentItem;
|
|
479
|
+
/**
|
|
480
|
+
* Reference to the platform
|
|
481
|
+
* @inheritdoc
|
|
482
|
+
*/
|
|
483
|
+
"platform": LimeWebComponentPlatform;
|
|
484
|
+
/**
|
|
485
|
+
* The semantic role of the list item. - 'radio': renders a radio button for single selection. - 'checkbox': renders a checkbox for multiple selection.
|
|
486
|
+
*/
|
|
487
|
+
"type": 'radio' | 'checkbox';
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* The document picker component allows users to select one or more
|
|
491
|
+
* files from a list of available documents.
|
|
492
|
+
* It is primarily designed to facilitate the selection of files
|
|
493
|
+
* that a user might want to import into the CRM, for example via
|
|
494
|
+
* our Microsoft Outlook Add-in.
|
|
495
|
+
* @exampleComponent limebb-example-document-picker-basic
|
|
496
|
+
* @exampleComponent limebb-example-document-picker-selection-mode
|
|
497
|
+
* @exampleComponent limebb-example-document-picker-limited-selection
|
|
498
|
+
* @exampleComponent limebb-example-document-picker-contextual-info
|
|
499
|
+
* @beta
|
|
500
|
+
*/
|
|
501
|
+
interface LimebbDocumentPicker {
|
|
502
|
+
/**
|
|
503
|
+
* The context this component belongs to
|
|
504
|
+
* @inheritdoc
|
|
505
|
+
*/
|
|
506
|
+
"context": LimeWebComponentContext;
|
|
507
|
+
/**
|
|
508
|
+
* Optional helper text to display below the items.
|
|
509
|
+
*/
|
|
510
|
+
"helperText"?: string;
|
|
511
|
+
/**
|
|
512
|
+
* Set to `true` to indicate that the current selection is invalid.
|
|
513
|
+
*/
|
|
514
|
+
"invalid": boolean;
|
|
515
|
+
/**
|
|
516
|
+
* The list of document items to display in the picker.
|
|
517
|
+
*/
|
|
518
|
+
"items": DocumentItem[];
|
|
519
|
+
/**
|
|
520
|
+
* Label to display for the group of items.
|
|
521
|
+
*/
|
|
522
|
+
"label"?: string;
|
|
523
|
+
/**
|
|
524
|
+
* Reference to the platform
|
|
525
|
+
* @inheritdoc
|
|
526
|
+
*/
|
|
527
|
+
"platform": LimeWebComponentPlatform;
|
|
528
|
+
/**
|
|
529
|
+
* Set to `true` to indicate that selecting an item is required.
|
|
530
|
+
*/
|
|
531
|
+
"required": boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Defines whether the picker allows single or multiple selection. - 'radio': Allows single selection within a group. - 'checkbox': Allows multiple selection.
|
|
534
|
+
*/
|
|
535
|
+
"type": DocumentType;
|
|
536
|
+
}
|
|
460
537
|
/**
|
|
461
538
|
* An "empty state" in user interface design refers to the screen or space displayed, when there is no data
|
|
462
539
|
* or content available to show to the user. This state typically occurs in new accounts, after clearing data,
|
|
@@ -1504,6 +1581,14 @@ export interface LimebbDateRangeCustomEvent<T> extends CustomEvent<T> {
|
|
|
1504
1581
|
detail: T;
|
|
1505
1582
|
target: HTMLLimebbDateRangeElement;
|
|
1506
1583
|
}
|
|
1584
|
+
export interface LimebbDocumentItemCustomEvent<T> extends CustomEvent<T> {
|
|
1585
|
+
detail: T;
|
|
1586
|
+
target: HTMLLimebbDocumentItemElement;
|
|
1587
|
+
}
|
|
1588
|
+
export interface LimebbDocumentPickerCustomEvent<T> extends CustomEvent<T> {
|
|
1589
|
+
detail: T;
|
|
1590
|
+
target: HTMLLimebbDocumentPickerElement;
|
|
1591
|
+
}
|
|
1507
1592
|
export interface LimebbFeedCustomEvent<T> extends CustomEvent<T> {
|
|
1508
1593
|
detail: T;
|
|
1509
1594
|
target: HTMLLimebbFeedElement;
|
|
@@ -1810,6 +1895,57 @@ declare global {
|
|
|
1810
1895
|
prototype: HTMLLimebbDateRangeElement;
|
|
1811
1896
|
new (): HTMLLimebbDateRangeElement;
|
|
1812
1897
|
};
|
|
1898
|
+
interface HTMLLimebbDocumentItemElementEventMap {
|
|
1899
|
+
"interact": DocumentItem;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Document item
|
|
1903
|
+
* Renders individual items of the document picker component.
|
|
1904
|
+
* @private
|
|
1905
|
+
*/
|
|
1906
|
+
interface HTMLLimebbDocumentItemElement extends Components.LimebbDocumentItem, HTMLStencilElement {
|
|
1907
|
+
addEventListener<K extends keyof HTMLLimebbDocumentItemElementEventMap>(type: K, listener: (this: HTMLLimebbDocumentItemElement, ev: LimebbDocumentItemCustomEvent<HTMLLimebbDocumentItemElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1908
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1909
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1910
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1911
|
+
removeEventListener<K extends keyof HTMLLimebbDocumentItemElementEventMap>(type: K, listener: (this: HTMLLimebbDocumentItemElement, ev: LimebbDocumentItemCustomEvent<HTMLLimebbDocumentItemElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
1912
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1913
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1914
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1915
|
+
}
|
|
1916
|
+
var HTMLLimebbDocumentItemElement: {
|
|
1917
|
+
prototype: HTMLLimebbDocumentItemElement;
|
|
1918
|
+
new (): HTMLLimebbDocumentItemElement;
|
|
1919
|
+
};
|
|
1920
|
+
interface HTMLLimebbDocumentPickerElementEventMap {
|
|
1921
|
+
"change": DocumentItem | DocumentItem[];
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* The document picker component allows users to select one or more
|
|
1925
|
+
* files from a list of available documents.
|
|
1926
|
+
* It is primarily designed to facilitate the selection of files
|
|
1927
|
+
* that a user might want to import into the CRM, for example via
|
|
1928
|
+
* our Microsoft Outlook Add-in.
|
|
1929
|
+
* @exampleComponent limebb-example-document-picker-basic
|
|
1930
|
+
* @exampleComponent limebb-example-document-picker-selection-mode
|
|
1931
|
+
* @exampleComponent limebb-example-document-picker-limited-selection
|
|
1932
|
+
* @exampleComponent limebb-example-document-picker-contextual-info
|
|
1933
|
+
* @beta
|
|
1934
|
+
*/
|
|
1935
|
+
interface HTMLLimebbDocumentPickerElement extends Components.LimebbDocumentPicker, HTMLStencilElement {
|
|
1936
|
+
addEventListener<K extends keyof HTMLLimebbDocumentPickerElementEventMap>(type: K, listener: (this: HTMLLimebbDocumentPickerElement, ev: LimebbDocumentPickerCustomEvent<HTMLLimebbDocumentPickerElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1937
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1938
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1939
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1940
|
+
removeEventListener<K extends keyof HTMLLimebbDocumentPickerElementEventMap>(type: K, listener: (this: HTMLLimebbDocumentPickerElement, ev: LimebbDocumentPickerCustomEvent<HTMLLimebbDocumentPickerElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
1941
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1942
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1943
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1944
|
+
}
|
|
1945
|
+
var HTMLLimebbDocumentPickerElement: {
|
|
1946
|
+
prototype: HTMLLimebbDocumentPickerElement;
|
|
1947
|
+
new (): HTMLLimebbDocumentPickerElement;
|
|
1948
|
+
};
|
|
1813
1949
|
/**
|
|
1814
1950
|
* An "empty state" in user interface design refers to the screen or space displayed, when there is no data
|
|
1815
1951
|
* or content available to show to the user. This state typically occurs in new accounts, after clearing data,
|
|
@@ -2539,6 +2675,8 @@ declare global {
|
|
|
2539
2675
|
"limebb-dashboard-widget": HTMLLimebbDashboardWidgetElement;
|
|
2540
2676
|
"limebb-date-picker": HTMLLimebbDatePickerElement;
|
|
2541
2677
|
"limebb-date-range": HTMLLimebbDateRangeElement;
|
|
2678
|
+
"limebb-document-item": HTMLLimebbDocumentItemElement;
|
|
2679
|
+
"limebb-document-picker": HTMLLimebbDocumentPickerElement;
|
|
2542
2680
|
"limebb-empty-state": HTMLLimebbEmptyStateElement;
|
|
2543
2681
|
"limebb-feed": HTMLLimebbFeedElement;
|
|
2544
2682
|
"limebb-feed-item-thumbnail-file-info": HTMLLimebbFeedItemThumbnailFileInfoElement;
|
|
@@ -3024,6 +3162,87 @@ declare namespace LocalJSX {
|
|
|
3024
3162
|
*/
|
|
3025
3163
|
"type"?: DateType;
|
|
3026
3164
|
}
|
|
3165
|
+
/**
|
|
3166
|
+
* Document item
|
|
3167
|
+
* Renders individual items of the document picker component.
|
|
3168
|
+
* @private
|
|
3169
|
+
*/
|
|
3170
|
+
interface LimebbDocumentItem {
|
|
3171
|
+
/**
|
|
3172
|
+
* The context this component belongs to
|
|
3173
|
+
* @inheritdoc
|
|
3174
|
+
*/
|
|
3175
|
+
"context"?: LimeWebComponentContext;
|
|
3176
|
+
/**
|
|
3177
|
+
* The item to display in the document picker.
|
|
3178
|
+
*/
|
|
3179
|
+
"item"?: DocumentItem;
|
|
3180
|
+
/**
|
|
3181
|
+
* Fired when clicking on the document item.
|
|
3182
|
+
*/
|
|
3183
|
+
"onInteract"?: (event: LimebbDocumentItemCustomEvent<DocumentItem>) => void;
|
|
3184
|
+
/**
|
|
3185
|
+
* Reference to the platform
|
|
3186
|
+
* @inheritdoc
|
|
3187
|
+
*/
|
|
3188
|
+
"platform": LimeWebComponentPlatform;
|
|
3189
|
+
/**
|
|
3190
|
+
* The semantic role of the list item. - 'radio': renders a radio button for single selection. - 'checkbox': renders a checkbox for multiple selection.
|
|
3191
|
+
*/
|
|
3192
|
+
"type"?: 'radio' | 'checkbox';
|
|
3193
|
+
}
|
|
3194
|
+
/**
|
|
3195
|
+
* The document picker component allows users to select one or more
|
|
3196
|
+
* files from a list of available documents.
|
|
3197
|
+
* It is primarily designed to facilitate the selection of files
|
|
3198
|
+
* that a user might want to import into the CRM, for example via
|
|
3199
|
+
* our Microsoft Outlook Add-in.
|
|
3200
|
+
* @exampleComponent limebb-example-document-picker-basic
|
|
3201
|
+
* @exampleComponent limebb-example-document-picker-selection-mode
|
|
3202
|
+
* @exampleComponent limebb-example-document-picker-limited-selection
|
|
3203
|
+
* @exampleComponent limebb-example-document-picker-contextual-info
|
|
3204
|
+
* @beta
|
|
3205
|
+
*/
|
|
3206
|
+
interface LimebbDocumentPicker {
|
|
3207
|
+
/**
|
|
3208
|
+
* The context this component belongs to
|
|
3209
|
+
* @inheritdoc
|
|
3210
|
+
*/
|
|
3211
|
+
"context"?: LimeWebComponentContext;
|
|
3212
|
+
/**
|
|
3213
|
+
* Optional helper text to display below the items.
|
|
3214
|
+
*/
|
|
3215
|
+
"helperText"?: string;
|
|
3216
|
+
/**
|
|
3217
|
+
* Set to `true` to indicate that the current selection is invalid.
|
|
3218
|
+
*/
|
|
3219
|
+
"invalid"?: boolean;
|
|
3220
|
+
/**
|
|
3221
|
+
* The list of document items to display in the picker.
|
|
3222
|
+
*/
|
|
3223
|
+
"items"?: DocumentItem[];
|
|
3224
|
+
/**
|
|
3225
|
+
* Label to display for the group of items.
|
|
3226
|
+
*/
|
|
3227
|
+
"label"?: string;
|
|
3228
|
+
/**
|
|
3229
|
+
* Fired when a user changes the selection state of an item.
|
|
3230
|
+
*/
|
|
3231
|
+
"onChange"?: (event: LimebbDocumentPickerCustomEvent<DocumentItem | DocumentItem[]>) => void;
|
|
3232
|
+
/**
|
|
3233
|
+
* Reference to the platform
|
|
3234
|
+
* @inheritdoc
|
|
3235
|
+
*/
|
|
3236
|
+
"platform": LimeWebComponentPlatform;
|
|
3237
|
+
/**
|
|
3238
|
+
* Set to `true` to indicate that selecting an item is required.
|
|
3239
|
+
*/
|
|
3240
|
+
"required"?: boolean;
|
|
3241
|
+
/**
|
|
3242
|
+
* Defines whether the picker allows single or multiple selection. - 'radio': Allows single selection within a group. - 'checkbox': Allows multiple selection.
|
|
3243
|
+
*/
|
|
3244
|
+
"type"?: DocumentType;
|
|
3245
|
+
}
|
|
3027
3246
|
/**
|
|
3028
3247
|
* An "empty state" in user interface design refers to the screen or space displayed, when there is no data
|
|
3029
3248
|
* or content available to show to the user. This state typically occurs in new accounts, after clearing data,
|
|
@@ -4146,6 +4365,8 @@ declare namespace LocalJSX {
|
|
|
4146
4365
|
"limebb-dashboard-widget": LimebbDashboardWidget;
|
|
4147
4366
|
"limebb-date-picker": LimebbDatePicker;
|
|
4148
4367
|
"limebb-date-range": LimebbDateRange;
|
|
4368
|
+
"limebb-document-item": LimebbDocumentItem;
|
|
4369
|
+
"limebb-document-picker": LimebbDocumentPicker;
|
|
4149
4370
|
"limebb-empty-state": LimebbEmptyState;
|
|
4150
4371
|
"limebb-feed": LimebbFeed;
|
|
4151
4372
|
"limebb-feed-item-thumbnail-file-info": LimebbFeedItemThumbnailFileInfo;
|
|
@@ -4299,6 +4520,25 @@ declare module "@stencil/core" {
|
|
|
4299
4520
|
* @exampleComponent limebb-example-date-range
|
|
4300
4521
|
*/
|
|
4301
4522
|
"limebb-date-range": LocalJSX.LimebbDateRange & JSXBase.HTMLAttributes<HTMLLimebbDateRangeElement>;
|
|
4523
|
+
/**
|
|
4524
|
+
* Document item
|
|
4525
|
+
* Renders individual items of the document picker component.
|
|
4526
|
+
* @private
|
|
4527
|
+
*/
|
|
4528
|
+
"limebb-document-item": LocalJSX.LimebbDocumentItem & JSXBase.HTMLAttributes<HTMLLimebbDocumentItemElement>;
|
|
4529
|
+
/**
|
|
4530
|
+
* The document picker component allows users to select one or more
|
|
4531
|
+
* files from a list of available documents.
|
|
4532
|
+
* It is primarily designed to facilitate the selection of files
|
|
4533
|
+
* that a user might want to import into the CRM, for example via
|
|
4534
|
+
* our Microsoft Outlook Add-in.
|
|
4535
|
+
* @exampleComponent limebb-example-document-picker-basic
|
|
4536
|
+
* @exampleComponent limebb-example-document-picker-selection-mode
|
|
4537
|
+
* @exampleComponent limebb-example-document-picker-limited-selection
|
|
4538
|
+
* @exampleComponent limebb-example-document-picker-contextual-info
|
|
4539
|
+
* @beta
|
|
4540
|
+
*/
|
|
4541
|
+
"limebb-document-picker": LocalJSX.LimebbDocumentPicker & JSXBase.HTMLAttributes<HTMLLimebbDocumentPickerElement>;
|
|
4302
4542
|
/**
|
|
4303
4543
|
* An "empty state" in user interface design refers to the screen or space displayed, when there is no data
|
|
4304
4544
|
* or content available to show to the user. This state typically occurs in new accounts, after clearing data,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a file size in bytes into a human readable string.
|
|
3
|
+
*
|
|
4
|
+
* Uses base 1024 units (binary prefixes without the "i" designation)
|
|
5
|
+
* and applies adaptive precision: one decimal for values < 10 of the
|
|
6
|
+
* chosen unit, otherwise no decimals.
|
|
7
|
+
*
|
|
8
|
+
* Examples:
|
|
9
|
+
* - 0 => "0 B"
|
|
10
|
+
* - 512 => "512 B"
|
|
11
|
+
* - 1536 => "1.5 KB"
|
|
12
|
+
* - 1048576 => "1 MB"
|
|
13
|
+
* - 5347737600 => "4.98 GB" (value < 10 so one decimal)
|
|
14
|
+
*
|
|
15
|
+
* @param bytes - the size in bytes
|
|
16
|
+
* @param decimals - max number of decimals for small unit values (default: 1)
|
|
17
|
+
* @returns formatted size string
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatBytes(bytes: number | undefined | null, decimals?: number): string;
|
|
20
|
+
//# sourceMappingURL=format-bytes.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-crm-building-blocks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.96.0",
|
|
4
4
|
"description": "A home for shared components meant for use with Lime CRM",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@limetech/eslint-config": "^3.0.1",
|
|
38
|
-
"@limetech/lime-elements": "^38.
|
|
38
|
+
"@limetech/lime-elements": "^38.29.0",
|
|
39
39
|
"@limetech/lime-web-components": "^6.4.1",
|
|
40
40
|
"@limetech/lime-web-components-testing": "^1.0.0",
|
|
41
41
|
"@lundalogik/lime-icons8": "^2.36.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,g as r}from"./p-1556b545.js";import{D as s,M as n,c as o,W as a,H as h,T as c}from"./p-1fba0ade.js";import{A as u,a as f,b as l,E as d,T as v}from"./p-463d3174.js";import{d as b,b as p,k as m,c as g,s as y,a as j,e as w,U as O,S,g as k}from"./p-bcc23575.js";import{i as M,e as x}from"./p-c40a3f4b.js";import{d as I,r as T,S as A,a as C,i as E}from"./p-b31772c8.js";import{d as F,i as P,o as $,g as _,h as D,n as N,a as L}from"./p-5322fd19.js";import{i as R}from"./p-1484e300.js";var U=/\s/,z=/^\s+/;var G=NaN,W=/^[-+]0x[0-9a-f]+$/i,H=/^0b[01]+$/i,Q=/^0o[0-7]+$/i,q=parseInt;function B(t){if("number"==typeof t)return t;if(M(t))return G;if(I(t)){var i="function"==typeof t.valueOf?t.valueOf():t;t=I(i)?i+"":i}if("string"!=typeof t)return 0===t?t:+t;var e;t=(e=t)?e.slice(0,function(t){for(var i=t.length;i--&&U.test(t.charAt(i)););return i}(e)+1).replace(z,""):e;var r=H.test(t);return r||Q.test(t)?q(t.slice(2),r?2:8):W.test(t)?G:+t}var K=Object.create;const V=function(){function t(){}return function(i){if(!I(i))return{};if(K)return K(i);t.prototype=i;var e=new t;return t.prototype=void 0,e}}();function J(t,i,e){"__proto__"==i&&b?b(t,i,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[i]=e}var X=Object.prototype.hasOwnProperty;function Y(t,i,e){var r=t[i];X.call(t,i)&&x(r,e)&&(void 0!==e||i in t)||J(t,i,e)}function Z(t,i,e,r){var s=!e;e||(e={});for(var n=-1,o=i.length;++n<o;){var a=i[n],h=r?r(e[a],t[a],a,e,t):void 0;void 0===h&&(h=t[a]),s?J(e,a,h):Y(e,a,h)}return e}var tt=Object.prototype.hasOwnProperty;function it(t){return P(t)?p(t,!0):function(t){if(!I(t))return function(t){var i=[];if(null!=t)for(var e in Object(t))i.push(e);return i}(t);var i=F(t),e=[];for(var r in t)("constructor"!=r||!i&&tt.call(t,r))&&e.push(r);return e}(t)}const et=$(Object.getPrototypeOf,Object);var rt="object"==typeof exports&&exports&&!exports.nodeType&&exports,st=rt&&"object"==typeof module&&module&&!module.nodeType&&module,nt=st&&st.exports===rt?T.Buffer:void 0,ot=nt?nt.allocUnsafe:void 0;const at=Object.getOwnPropertySymbols?function(t){for(var i=[];t;)j(i,g(t)),t=et(t);return i}:y;function ht(t){return w(t,it,at)}var ct=Object.prototype.hasOwnProperty;function ut(t){var i=new t.constructor(t.byteLength);return new O(i).set(new O(t)),i}var ft=/\w*$/,lt=A?A.prototype:void 0,dt=lt?lt.valueOf:void 0,vt="[object Boolean]",bt="[object Date]",pt="[object Map]",mt="[object Number]",gt="[object RegExp]",yt="[object Set]",jt="[object String]",wt="[object Symbol]",Ot="[object ArrayBuffer]",St="[object DataView]",kt="[object Float32Array]",Mt="[object Float64Array]",xt="[object Int8Array]",It="[object Int16Array]",Tt="[object Int32Array]",At="[object Uint8Array]",Ct="[object Uint8ClampedArray]",Et="[object Uint16Array]",Ft="[object Uint32Array]";var Pt=N&&N.isMap;const $t=Pt?D(Pt):function(t){return C(t)&&"[object Map]"==_(t)};var _t=N&&N.isSet;const Dt=_t?D(_t):function(t){return C(t)&&"[object Set]"==_(t)};var Nt=1,Lt=2,Rt=4,Ut="[object Arguments]",zt="[object Function]",Gt="[object GeneratorFunction]",Wt="[object Object]",Ht={};function Qt(t,i,e,r,s,n){var o,a=i&Nt,h=i&Lt,c=i&Rt;if(e&&(o=s?e(t,r,s,n):e(t)),void 0!==o)return o;if(!I(t))return t;var u=E(t);if(u){if(o=function(t){var i=t.length,e=new t.constructor(i);return i&&"string"==typeof t[0]&&ct.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(t),!a)return function(t,i){var e=-1,r=t.length;for(i||(i=Array(r));++e<r;)i[e]=t[e];return i}(t,o)}else{var f=_(t),l=f==zt||f==Gt;if(L(t))return function(t,i){if(i)return t.slice();var e=t.length,r=ot?ot(e):new t.constructor(e);return t.copy(r),r}(t,a);if(f==Wt||f==Ut||l&&!s){if(o=h||l?{}:function(t){return"function"!=typeof t.constructor||F(t)?{}:V(et(t))}(t),!a)return h?function(t,i){return Z(t,at(t),i)}(t,function(t,i){return t&&Z(i,it(i),t)}(o,t)):function(t,i){return Z(t,g(t),i)}(t,function(t,i){return t&&Z(i,m(i),t)}(o,t))}else{if(!Ht[f])return s?t:{};o=function(t,i,e){var r,s,n=t.constructor;switch(i){case Ot:return ut(t);case vt:case bt:return new n(+t);case St:return function(t,i){var e=i?ut(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case kt:case Mt:case xt:case It:case Tt:case At:case Ct:case Et:case Ft:return function(t,i){var e=i?ut(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}(t,e);case pt:return new n;case mt:case jt:return new n(t);case gt:return(s=new(r=t).constructor(r.source,ft.exec(r))).lastIndex=r.lastIndex,s;case yt:return new n;case wt:return dt?Object(dt.call(t)):{}}}(t,f,a)}}n||(n=new S);var d=n.get(t);if(d)return d;n.set(t,o),Dt(t)?t.forEach((function(r){o.add(Qt(r,i,e,r,t,n))})):$t(t)&&t.forEach((function(r,s){o.set(s,Qt(r,i,e,s,t,n))}));var v=u?void 0:(c?h?ht:k:h?it:m)(t);return function(t,i){for(var e=-1,r=null==t?0:t.length;++e<r&&!1!==i(t[e],e););}(v||t,(function(r,s){v&&(r=t[s=r]),Y(o,s,Qt(r,i,e,s,t,n))})),o}Ht[Ut]=Ht["[object Array]"]=Ht["[object ArrayBuffer]"]=Ht["[object DataView]"]=Ht["[object Boolean]"]=Ht["[object Date]"]=Ht["[object Float32Array]"]=Ht["[object Float64Array]"]=Ht["[object Int8Array]"]=Ht["[object Int16Array]"]=Ht["[object Int32Array]"]=Ht["[object Map]"]=Ht["[object Number]"]=Ht[Wt]=Ht["[object RegExp]"]=Ht["[object Set]"]=Ht["[object String]"]=Ht["[object Symbol]"]=Ht["[object Uint8Array]"]=Ht["[object Uint8ClampedArray]"]=Ht["[object Uint16Array]"]=Ht["[object Uint32Array]"]=!0,Ht["[object Error]"]=Ht[zt]=Ht["[object WeakMap]"]=!1;const qt=function(){return T.Date.now()};var Bt=Math.max,Kt=Math.min;function Vt(t,i){return t.label===i}function Jt(t,i){return Object.values(t.properties).find((t=>t&&t.relation&&Vt(t.relation.getLimetype(),i)))}function Xt(t,i){const e=Jt(t,i);return!!e&&function(t){return s(t)&&!n(t)}(e)}class Yt{get limeObjectService(){return this.platform.get(o.LimeObjectRepository)}get queryService(){return this.platform.get(o.Query)}get viewFactoryRegistry(){return this.platform.get(o.ViewFactoryRegistry)}get translator(){var t;return null===(t=this.platform)||void 0===t?void 0:t.get(o.Translate)}get triggerCharacter(){return this._triggerCharacter}get triggerHandler(){return this._triggerHandler}constructor(t,i,e){this.platform=t,this.context=i,this.searchableLimetypes=e,this.groupCounts={},this._triggerCharacter="@",this._triggerHandler={searcher:t=>this.searcher(t),inserter:(t,i)=>this.inserter(t,i),emptySearchMessage:"Start typing a name...",noItemsFoundMessage:"No results for your search...",nodeDefinition:{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.searcher=async t=>{if(!t)return[];const{objects:i}=await this.limeObjectService.search(t,this.searchableLimetypes,10);return this.createSearchListItems(i)},this.inserter=async(t,i)=>{var e;const r=this.triggerHandler.nodeDefinition;r&&t.insert({node:{tagName:r.customElement.tagName,attributes:r.mapAttributes(i)},children:[null===(e=i.value)||void 0===e?void 0:e.descriptive]})}}async initialize(){await this.loadGroupCounts()}async loadGroupCounts(){const t=this.searchableLimetypes.filter((t=>!Vt(t,"user")&&Xt(t,"user"))).map((t=>this.getGroupCounts(t)));for(const i of await Promise.all(t))Object.assign(this.groupCounts,i)}async getGroupCounts(t){var i;const e=Jt(t,"user"),r=t.name;try{const t=await this.queryService.execute({limetype:r,responseFormat:{object:{_id:null,[e.name]:{count:{aggregate:{op:a.Count}}}}}});if(!(null===(i=t.objects)||void 0===i?void 0:i.length))return{[r]:{}};const s=this.createGroupCount(t.objects,e.name);return{[r]:s}}catch(i){return console.error(`Error fetching group count for limetype: ${t.name}`,i),{[r]:{}}}}createGroupCount(t,i){const e={};for(const r of t){const{_id:t,[i]:s}=r;e[t]=s.count}return e}createSearchListItems(t=[]){return t.map((t=>this.createSearchListItem(t))).filter(R)}createSearchListItem(t){const i=this.viewFactoryRegistry.getFactory("search"),e=this.limeObjectService.getObject(t._limetype,t._id);if(!e)return null;const r=i(e,this.context),s=this.getGroupCountComponent(e);return Object.assign(Object.assign({},r),s?{primaryComponent:s}:{})}getGroupCountComponent(t){var i;const e=t.getLimetype(),r=null===(i=this.groupCounts[e.name])||void 0===i?void 0:i[t.id],s=Jt(e,"user");if(void 0!==r&&s)return{name:"limebb-mention-group-counter",props:{count:r,limetype:s.relation.getLimetype(),helperLabel:this.translator.get("webclient.notification-center.members-will-be-notified")}}}}class Zt{constructor(t,i){this.file=t,this.http=i,this.uploadCancelled=!1,this.getUrl=t=>`api/v1/file/${null!=t?t:""}`}async initialize(){this.uploadService=await this.http.createFileUpload(h.Post,this.getUrl(),this.file),this.progressCallback&&(this.uploadService.onProgress=this.progressCallback)}async upload(){return this.uploadService.upload()}getFileName(){return this.file.name}cancel(){this.uploadService.cancel(),this.uploadCancelled=!0}set onProgress(t){this.progressCallback=t,this.uploadService&&(this.uploadService.onProgress=t)}}class ti{constructor(t){this.platform=t}async handleImagePasted(t){const i=null==t?void 0:t.fileInfo;if(!i)return;if(!this.validateImageSize(i))return;t.insertThumbnail();const e=await this.createFileUpload(i),r=null==e?void 0:e.href;return r&&void 0!==(null==e?void 0:e.fileId)?t.insertImage(r):t.insertFailedThumbnail(),e}parseFileIdFromSrc(t){if(t){const i=/\/(\d+)\/contents\/?$/.exec(t);if(i&&i[1])return Number(i[1])}}validateImageSize(t){return!!t.fileContent&&t.fileContent.size<=52428800}async createFileUpload(t){var i;if(!t.fileContent)return;const e=new Zt(t.fileContent,this.http);await e.initialize();const r=Object.assign(Object.assign({},t),{progress:0,file:e,state:"added",fileId:void 0,href:void 0,id:t.id});e.onProgress=t=>{0===r.progress&&(r.state="uploading"),r.progress=t,100===t&&(r.state="finalizing")};const s=await e.upload();return r.fileId=s.id,r.filename=s.filename,r.extension=s.extension,r.contentType=s.contentType,r.size=s.size,r.state="done",r.href=null===(i=s._links)||void 0===i?void 0:i.contents.href,r}get http(){return this.platform.get(o.Http)}}const ii=class{watchOpen(){this.setupHandlers(),this.setPickerMessage()}watchQuery(){this.setPickerMessage()}constructor(e){var r;t(this,e),this.change=i(this,"change",7),this.metadataChange=i(this,"metadataChange",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.triggerMap={},this.customElements=[],this.allowInlineImages=!1,this.items=[],this.highlightedItemIndex=0,this.isPickerOpen=!1,this.isSearching=!1,this.registeredTriggers=[],this.registeredTriggerMap=this.triggerMap,this.registeredCustomElements=this.customElements,this.activeTrigger=void 0,this.handleMouseClick=t=>{this.textEditorPickerElement&&(t.target===this.textEditorPickerElement||this.resetTriggerAndPicker())},this.handleKeyPress=t=>{if(!this.isPickerOpen||!this.activeTrigger)return;if(![f,l,u,d,v].includes(t.key))return;if(t.stopPropagation(),t.preventDefault(),"keyup"===t.type)return;const i={[f]:this.handleEscapeKey,[d]:this.handleEnterOrTabKey,[v]:this.handleEnterOrTabKey,[u]:this.handleArrowKeyPress,[l]:this.handleArrowKeyPress}[t.key];i&&i(t)},this.handleArrowKeyPress=t=>{this.highlightedItemIndex=this.findNonSeparatorIndex(t.key,this.highlightedItemIndex)},this.findNonSeparatorIndex=(t,i,e=0)=>{if(0===this.items.length||e>this.items.length)return i;const r=((t,i,e)=>(i+(t===u?1:-1)+e)%e)(t,i,this.items.length);return this.isListSeparator(this.items[r])?this.findNonSeparatorIndex(t,r,e+1):r},this.handleEscapeKey=()=>{var t;null===(t=this.triggerFunction)||void 0===t||t.stopTrigger(),this.resetTriggerAndPicker()},this.handleEnterOrTabKey=t=>{this.handleItemSelection(t)},this.handleMetadataChange=t=>{t.stopPropagation();const i=t.detail,e=this.getEnhancedImages(i.images||[]),r=Object.assign(Object.assign({},i),{images:e});this.metadataChange.emit(r)},this.handleImagePasted=t=>{t.stopPropagation(),this.allowInlineImages&&this.uploadHandler.handleImagePasted(t.detail)},this.handleTriggerStart=t=>{t.stopPropagation(),this.activeTrigger=t.detail.trigger,this.triggerFunction=t.detail.textEditor,this.isPickerOpen=!0},this.handleTriggerStop=t=>{t.stopPropagation(),this.resetTriggerAndPicker()},this.handleTriggerChange=t=>{var i;t.stopImmediatePropagation(),this.editorPickerQuery=t.detail.value;const e=null===(i=this.registeredTriggerMap[t.detail.trigger])||void 0===i?void 0:i.searcher;e&&(this.isSearching=!0,this.debouncedSearchFn(e,this.editorPickerQuery))},this.resetTriggerAndPicker=()=>{this.isPickerOpen=!1,this.activeTrigger=void 0,this.triggerFunction=void 0,this.isSearching=!1,this.highlightedItemIndex=0,this.items=[]},this.handleItemSelection=t=>{var i;let e;if(t instanceof CustomEvent)e=t.detail;else{if(!(t instanceof KeyboardEvent))return;{const t=this.items[this.highlightedItemIndex];if(this.isListSeparator(t))return;e=t}}if(!this.activeTrigger)return;const r=this.registeredTriggerMap[this.activeTrigger];try{r.inserter(this.triggerFunction,e)}catch(t){console.error("Error inserting",t)}this.resetTriggerAndPicker(),null===(i=this.textEditor)||void 0===i||i.focus()},this.handleVisibilityChange=()=>{"hidden"===document.visibilityState&&this.saveDraft()},this.handleBeforeUnload=()=>{this.saveDraft()},this.portalId="crypto"in window&&"function"==typeof(null===(r=window.crypto)||void 0===r?void 0:r.randomUUID)?"a_"+crypto.randomUUID():String.fromCodePoint(97+Math.floor(26*Math.random()))+Math.random().toString(36).slice(Math.max(0,2))+Math.random().toString(36).slice(Math.max(0,2)),this.debouncedSearchFn=function(t,i,e){var r,s,n,o,a,h,c=0,u=!1,f=!1,l=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function d(i){var e=r,n=s;return r=s=void 0,c=i,o=t.apply(n,e)}function v(t){var e=t-h;return void 0===h||e>=i||e<0||f&&t-c>=n}function b(){var t=qt();if(v(t))return p(t);a=setTimeout(b,function(t){var e=i-(t-h);return f?Kt(e,n-(t-c)):e}(t))}function p(t){return a=void 0,l&&r?d(t):(r=s=void 0,o)}function m(){var t=qt(),e=v(t);if(r=arguments,s=this,h=t,e){if(void 0===a)return function(t){return c=t,a=setTimeout(b,i),u?d(t):o}(h);if(f)return clearTimeout(a),a=setTimeout(b,i),d(h)}return void 0===a&&(a=setTimeout(b,i)),o}return i=B(i)||0,I(e)&&(u=!!e.leading,n=(f="maxWait"in e)?Bt(B(e.maxWait)||0,i):n,l="trailing"in e?!!e.trailing:l),m.cancel=function(){void 0!==a&&clearTimeout(a),c=0,r=h=s=a=void 0},m.flush=function(){return void 0===a?o:p(qt())},m}((async(t,i)=>{try{const e=await t(i);if(i!==this.editorPickerQuery||!this.activeTrigger)return;this.items=e}catch(t){console.error("Error searching",t)}finally{this.isSearching=!1}}),300)}connectedCallback(){var t,i,e,r;if(this.draftIdentifier){const s=null!==(i=null===(t=this.context)||void 0===t?void 0:t.id)&&void 0!==i?i:"no-limeobject",n=null!==(r=null===(e=this.context)||void 0===e?void 0:e.limetype)&&void 0!==r?r:"no-limetype";this.textEditorInnerId=["text-editor-draft",n,s,this.draftIdentifier].join("-")}this.textEditorInnerId&&(document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleBeforeUnload)),this.uploadHandler=new ti(this.platform)}componentWillLoad(){this.allowMentioning&&this.registerMentions(),this.registerTriggers(),this.loadDraft()}disconnectedCallback(){document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("mousedown",this.handleMouseClick),this.saveDraft(),this.host&&(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0})),this.debouncedSearchFn&&this.debouncedSearchFn.cancel&&this.debouncedSearchFn.cancel()}registerMentions(){const t=new Yt(this.platform,this.context,this.searchableLimetypes),i=t.triggerHandler.nodeDefinition;i&&(this.registeredCustomElements.push(i.customElement),this.registeredTriggerMap[t.triggerCharacter]=t.triggerHandler,t.initialize())}registerTriggers(){this.registeredTriggers=Object.keys(this.registeredTriggerMap)}setPickerMessage(){var t;if(!this.activeTrigger)return;const i=this.registeredTriggerMap[this.activeTrigger];this.pickerMessage=(null===(t=this.editorPickerQuery)||void 0===t?void 0:t.length)>0?i.noItemsFoundMessage:i.emptySearchMessage}setupHandlers(){this.isPickerOpen?(this.host.addEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.addEventListener("keydown",this.handleKeyPress,{capture:!0}),document.addEventListener("mousedown",this.handleMouseClick)):(this.host.removeEventListener("keyup",this.handleKeyPress,{capture:!0}),this.host.removeEventListener("keydown",this.handleKeyPress,{capture:!0}),document.removeEventListener("mousedown",this.handleMouseClick))}isListSeparator(t){return"separator"in t&&!0===t.separator}render(){return[e("limel-text-editor",{key:"f2f48910b31ecf37bc6e41245f3e6e6a70b87695",ref:t=>this.textEditor=t,tabindex:this.disabled?-1:0,value:this.value,contentType:this.contentType,customElements:this.registeredCustomElements,"aria-disabled":this.disabled,language:this.language,triggers:this.registeredTriggers,onTriggerStart:this.handleTriggerStart,onTriggerStop:this.handleTriggerStop,onTriggerChange:this.handleTriggerChange,onImagePasted:this.handleImagePasted,onMetadataChange:this.handleMetadataChange,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 e("limel-portal",{containerId:this.portalId,visible:this.isPickerOpen,openDirection:"top",inheritParentWidth:!0,anchor:this.textEditor},e("limebb-text-editor-picker",{ref:t=>this.textEditorPickerElement=t,items:(t=this.items,i=this.highlightedItemIndex,t.map(((t,e)=>{const r=Qt(t,5);return Object.assign(Object.assign({},r),{selected:e===i})}))),onItemSelected:this.handleItemSelection,emptyMessage:this.pickerMessage,isSearching:this.isSearching}));var t,i}getEnhancedImages(t){return t.map((t=>{let i;return"success"===t.state&&(i=this.uploadHandler.parseFileIdFromSrc(t.src)),i?Object.assign(Object.assign({},t),{fileId:i}):t}))}loadDraft(){if(!this.userDataService||!this.textEditorInnerId)return;if(this.value)return;const t=this.userDataService.get(this.textEditorInnerId);t&&this.change.emit(t)}saveDraft(){var t,i,e,r;if(!this.textEditorInnerId)return;const s=null===(t=this.value)||void 0===t?void 0:t.trim(),n=null===(i=this.userDataService)||void 0===i?void 0:i.get(this.textEditorInnerId);s&&s!==n?null===(e=this.userDataService)||void 0===e||e.set(this.textEditorInnerId,s):!s&&n&&(null===(r=this.userDataService)||void 0===r||r.set(this.textEditorInnerId,void 0))}get userDataService(){return this.platform.get(o.UserDataRepository)}get host(){return r(this)}static get watchers(){return{isPickerOpen:["watchOpen"],editorPickerQuery:["watchQuery"]}}};!function(t,i,e,r){var s,n=arguments.length,o=n<3?i:null===r?r=Object.getOwnPropertyDescriptor(i,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(i,e,o):s(i,e))||o);n>3&&o&&Object.defineProperty(i,e,o)}([c({map:[function(t){return Object.values(t).filter((t=>Vt(t,"user")||Xt(t,"user")))}]})],ii.prototype,"searchableLimetypes",void 0);export{ii as limebb_text_editor}
|