@sinequa/atomic-angular 1.10.0 → 1.11.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.
@@ -0,0 +1,250 @@
1
+ import { UpdateContainerInput } from '@sinequa/atomic';
2
+ import { EnvironmentProviders } from '@angular/core';
3
+
4
+ type TooltipPlacement = 'top' | 'right' | 'left' | 'bottom';
5
+ interface TooltipController {
6
+ attach(el: HTMLElement, text: string, placement?: TooltipPlacement, condition?: () => boolean): void;
7
+ position(trigger: HTMLElement, placement?: TooltipPlacement): void;
8
+ el: HTMLSpanElement;
9
+ }
10
+ interface MobileSheetController {
11
+ open(panelEl: HTMLElement, titleText: string, originEl?: HTMLElement | null): void;
12
+ close(): void;
13
+ }
14
+
15
+ type ContainerRole = 'creator' | 'owner' | 'reader';
16
+ interface Collection {
17
+ id: string;
18
+ name: string;
19
+ icon: string;
20
+ desc: string;
21
+ tags: string[];
22
+ docs: number;
23
+ creatorId: string;
24
+ ownerIds: string[];
25
+ readerIds: string[];
26
+ currentUserRole: ContainerRole;
27
+ favorited: boolean;
28
+ }
29
+ interface CollectionDocument {
30
+ _id: string;
31
+ name: string;
32
+ containerId?: string;
33
+ type: string;
34
+ date: string;
35
+ size?: string;
36
+ source?: string;
37
+ status?: 'uploading' | 'indexing' | 'error' | null;
38
+ uploadedBy?: string;
39
+ }
40
+ declare class CollectionsStore extends EventTarget {
41
+ collections: Collection[];
42
+ documents: Record<string, CollectionDocument[]>;
43
+ selectedIds: Set<string>;
44
+ private _loaded;
45
+ private _loadingPromise;
46
+ private _page;
47
+ private _total;
48
+ private _documentsState;
49
+ private _emit;
50
+ getAll(): Collection[];
51
+ get(id: string): Collection | null;
52
+ fetchContainer(id: string): Promise<Collection>;
53
+ get hasMoreCollections(): boolean;
54
+ ensureLoaded(): Promise<Collection[]>;
55
+ load(): Promise<Collection[]>;
56
+ loadMore(): Promise<Collection[]>;
57
+ create({ name, desc, tags }: {
58
+ name: string;
59
+ desc?: string;
60
+ tags?: string[];
61
+ }): Promise<Collection>;
62
+ update(id: string, patch: UpdateContainerInput): Promise<Collection | null>;
63
+ remove(ids: string[]): Promise<{
64
+ succeeded: string[];
65
+ failed: {
66
+ id: string;
67
+ error: string;
68
+ }[];
69
+ }>;
70
+ toggleFavorite(id: string): boolean | undefined;
71
+ getDocuments(collectionId: string): CollectionDocument[];
72
+ hasMoreDocuments(collectionId: string): boolean;
73
+ loadDocuments(collectionId: string): Promise<CollectionDocument[]>;
74
+ loadMoreDocuments(collectionId: string): Promise<CollectionDocument[]>;
75
+ addDocuments(collectionId: string, docs: CollectionDocument[]): void;
76
+ saveDocuments(collectionId: string, docs: CollectionDocument[]): Promise<CollectionDocument[]>;
77
+ removeDocuments(collectionId: string, docIds: string[]): Promise<void>;
78
+ moveDocuments(fromCollectionId: string, toCollectionId: string, docIds: string[]): Promise<void>;
79
+ toggleSelected(id: string, checked: boolean): void;
80
+ get selectedCount(): number;
81
+ }
82
+ declare const store: CollectionsStore;
83
+
84
+ interface TrackerFileInput {
85
+ id: string;
86
+ name: string;
87
+ type: string;
88
+ }
89
+ interface UploadTrackerController {
90
+ addFiles(trackerDocs: TrackerFileInput[], colId: string, colName: string): void;
91
+ onProgress(docId: string, pct: number): void;
92
+ onIndexing(docId: string): void;
93
+ onComplete(docId: string): void;
94
+ onError(docId: string): void;
95
+ }
96
+
97
+ interface CollectionsHost extends HTMLElement {
98
+ readonly shadowRoot: ShadowRoot;
99
+ _pickerContainer: HTMLDivElement;
100
+ _tooltip: TooltipController;
101
+ _colCurrentView: 'grid' | 'list';
102
+ _colGridBuilt: boolean;
103
+ _colListBuilt: boolean;
104
+ _showList(): Promise<void>;
105
+ _hideList(): void;
106
+ _buildCollectionCard(col: Collection): HTMLElement;
107
+ _updateColTabCounts(): void;
108
+ _applyColFilters?(): void;
109
+ _exitColSelection(): void;
110
+ _updateColSelCount(): void;
111
+ _closeColDeleteModal(): void;
112
+ _currentCol: Collection | null;
113
+ _currentDocs: CollectionDocument[];
114
+ _cdvCurrentView: 'grid' | 'list';
115
+ _cdvListBuilt: boolean;
116
+ _openColDetail(col: Collection): void;
117
+ _closeColDetail(): void;
118
+ _refreshCdvEmpty(): void;
119
+ _buildDocCard(doc: CollectionDocument): HTMLElement;
120
+ _buildDocListView(docs: CollectionDocument[]): void;
121
+ _resetDetailSearch?(): void;
122
+ _exitDocSelection(): void;
123
+ openAddCollectionModal?(): void;
124
+ _openRefDocPreview(docRef: RefDocument): void;
125
+ _closeColDocPreview(): void;
126
+ _syncColDocPreviewView(): void;
127
+ _uploadTracker: UploadTrackerController;
128
+ }
129
+
130
+ interface Passage {
131
+ page: number;
132
+ text: string;
133
+ }
134
+ interface RefDocument {
135
+ title: string;
136
+ date: string;
137
+ path: string;
138
+ passages?: Passage[];
139
+ }
140
+
141
+ declare class LexiqCollectionsElement extends HTMLElement implements CollectionsHost {
142
+ readonly shadowRoot: ShadowRoot;
143
+ _initialized: boolean;
144
+ _pickerContainer: HTMLDivElement;
145
+ _tooltip: TooltipController;
146
+ _colCurrentView: 'grid' | 'list';
147
+ _colGridBuilt: boolean;
148
+ _colListBuilt: boolean;
149
+ _showList: () => Promise<void>;
150
+ _hideList: () => void;
151
+ _buildCollectionCard: (col: Collection) => HTMLElement;
152
+ _updateColTabCounts: () => void;
153
+ _exitColSelection: () => void;
154
+ _updateColSelCount: () => void;
155
+ _closeColDeleteModal: () => void;
156
+ _currentCol: Collection | null;
157
+ _currentDocs: CollectionDocument[];
158
+ _cdvCurrentView: 'grid' | 'list';
159
+ _cdvListBuilt: boolean;
160
+ _openColDetail: (col: Collection) => void;
161
+ _closeColDetail: () => void;
162
+ _refreshCdvEmpty: () => void;
163
+ _buildDocCard: (doc: CollectionDocument) => HTMLElement;
164
+ _buildDocListView: (docs: CollectionDocument[]) => void;
165
+ _exitDocSelection: () => void;
166
+ _openRefDocPreview: (docRef: RefDocument) => void;
167
+ _closeColDocPreview: () => void;
168
+ _syncColDocPreviewView: () => void;
169
+ _uploadTracker: UploadTrackerController;
170
+ constructor();
171
+ connectedCallback(): void;
172
+ showList(): Promise<void>;
173
+ hideList(): void;
174
+ showDetail(collectionId: string): Promise<void>;
175
+ hideDetail(): void;
176
+ openDocumentPreview(docRef: RefDocument): void;
177
+ closeDocumentPreview(): void;
178
+ get collections(): Collection[];
179
+ }
180
+
181
+ type IncomingDocument = Partial<Pick<CollectionDocument, '_id'>> & Omit<CollectionDocument, '_id'>;
182
+ interface PickerOptions {
183
+ mobileSheet?: MobileSheetController | null;
184
+ root?: ShadowRoot | null;
185
+ container?: HTMLElement | null;
186
+ documents?: IncomingDocument[];
187
+ onSave?: ((name: string) => void) | null;
188
+ onUnsave?: (() => void) | null;
189
+ scrollContainer?: EventTarget | null;
190
+ fromCollectionId?: string | null;
191
+ onMoved?: (() => void) | null;
192
+ }
193
+
194
+ declare class LexiqCollectionPickerElement extends HTMLElement {
195
+ private _initialized;
196
+ private _container;
197
+ constructor();
198
+ connectedCallback(): void;
199
+ private _withEvents;
200
+ openSaveCard(anchorEl: HTMLElement, opts?: Partial<PickerOptions>): void;
201
+ closeSaveCard(anchorEl?: HTMLElement | null): void;
202
+ triggerSaveFeedback(anchorEl: HTMLElement, opts?: Partial<PickerOptions>): void;
203
+ openMoveMenu(anchorEl: HTMLElement, targetItems: HTMLElement[], opts?: Partial<PickerOptions>): void;
204
+ closeMoveMenu(): void;
205
+ }
206
+
207
+ declare class LexiqCollectionMentionListElement extends HTMLElement {
208
+ private _initialized;
209
+ private _list;
210
+ private _onSelectionChanged;
211
+ private _onCreated;
212
+ private _onCollectionsLoaded;
213
+ constructor();
214
+ connectedCallback(): void;
215
+ disconnectedCallback(): void;
216
+ private _renderMessage;
217
+ private _build;
218
+ private _buildRow;
219
+ private _syncChecks;
220
+ private _dispatchSelectionChanged;
221
+ get items(): {
222
+ id: string;
223
+ icon: string;
224
+ name: string;
225
+ desc: string;
226
+ }[];
227
+ selectById(id: string): void;
228
+ }
229
+
230
+ declare function defineLexiqCollections(tagName?: string): void;
231
+ declare function defineLexiqCollectionPicker(tagName?: string): void;
232
+ declare function defineLexiqCollectionMentionList(tagName?: string): void;
233
+ declare function registerLexiqCollectionsElements(): void;
234
+
235
+ /**
236
+ * Registers the LexiQ Collections native Custom Elements when the Angular
237
+ * application environment initializes. Add to an app/route `providers` array:
238
+ *
239
+ * ```ts
240
+ * export const appConfig: ApplicationConfig = {
241
+ * providers: [provideLexiqCollectionsElements()],
242
+ * };
243
+ * ```
244
+ *
245
+ * Components using the tags still need `schemas: [CUSTOM_ELEMENTS_SCHEMA]`.
246
+ */
247
+ declare function provideLexiqCollectionsElements(): EnvironmentProviders;
248
+
249
+ export { LexiqCollectionMentionListElement, LexiqCollectionPickerElement, LexiqCollectionsElement, store as collectionsStore, defineLexiqCollectionMentionList, defineLexiqCollectionPicker, defineLexiqCollections, provideLexiqCollectionsElements, registerLexiqCollectionsElements };
250
+ export type { Collection, CollectionDocument, ContainerRole, PickerOptions, RefDocument };