@rosoftlab/rdict 1.0.0-alpha-15

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.
Files changed (42) hide show
  1. package/README.md +27 -0
  2. package/esm2022/lib/components/index.mjs +4 -0
  3. package/esm2022/lib/components/layouts/full/full.component.mjs +112 -0
  4. package/esm2022/lib/components/rdict-crud/rdict-crud.component.mjs +43 -0
  5. package/esm2022/lib/components/rdict-generic-table/rdict-generic-table.component.mjs +285 -0
  6. package/esm2022/lib/components/rdict-generic-table/rdict-table-title.mjs +34 -0
  7. package/esm2022/lib/core.mjs +5 -0
  8. package/esm2022/lib/models/index.mjs +4 -0
  9. package/esm2022/lib/models/menu.mjs +60 -0
  10. package/esm2022/lib/models/right.mjs +57 -0
  11. package/esm2022/lib/models/user.mjs +30 -0
  12. package/esm2022/lib/reactive-dictionary.mjs +173 -0
  13. package/esm2022/lib/rsl-material-module.mjs +95 -0
  14. package/esm2022/lib/services/index.mjs +4 -0
  15. package/esm2022/lib/services/socket.service.mjs +92 -0
  16. package/esm2022/lib/services/user.service.mjs +37 -0
  17. package/esm2022/lib/services/ws-auth.service.mjs +22 -0
  18. package/esm2022/lib/socket-config.token.mjs +4 -0
  19. package/esm2022/public-api.mjs +6 -0
  20. package/esm2022/rosoftlab-rdict.mjs +5 -0
  21. package/fesm2022/rosoftlab-rdict.mjs +1004 -0
  22. package/fesm2022/rosoftlab-rdict.mjs.map +1 -0
  23. package/index.d.ts +5 -0
  24. package/lib/components/index.d.ts +3 -0
  25. package/lib/components/layouts/full/full.component.d.ts +36 -0
  26. package/lib/components/rdict-crud/rdict-crud.component.d.ts +15 -0
  27. package/lib/components/rdict-generic-table/rdict-generic-table.component.d.ts +73 -0
  28. package/lib/components/rdict-generic-table/rdict-table-title.d.ts +11 -0
  29. package/lib/core.d.ts +4 -0
  30. package/lib/models/index.d.ts +3 -0
  31. package/lib/models/menu.d.ts +15 -0
  32. package/lib/models/right.d.ts +14 -0
  33. package/lib/models/user.d.ts +8 -0
  34. package/lib/reactive-dictionary.d.ts +20 -0
  35. package/lib/rsl-material-module.d.ts +45 -0
  36. package/lib/services/index.d.ts +3 -0
  37. package/lib/services/socket.service.d.ts +13 -0
  38. package/lib/services/user.service.d.ts +15 -0
  39. package/lib/services/ws-auth.service.d.ts +9 -0
  40. package/lib/socket-config.token.d.ts +2 -0
  41. package/package.json +56 -0
  42. package/public-api.d.ts +2 -0
@@ -0,0 +1,1004 @@
1
+ import * as i5$1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken, Injectable, Inject, Component, forwardRef, ViewChild, Input, EventEmitter, ElementRef, ViewEncapsulation, Output, NgModule } from '@angular/core';
5
+ import * as i1$1 from '@angular/router';
6
+ import { RouterModule, UrlSegment, NavigationStart } from '@angular/router';
7
+ import * as i2 from '@ngx-translate/core';
8
+ import { TranslateModule } from '@ngx-translate/core';
9
+ import * as i4 from '@progress/kendo-angular-buttons';
10
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
11
+ import { KENDO_SVGICON } from '@progress/kendo-angular-icons';
12
+ import * as i5 from '@progress/kendo-angular-layout';
13
+ import { LayoutModule } from '@progress/kendo-angular-layout';
14
+ import * as i7 from '@progress/kendo-angular-toolbar';
15
+ import { ToolBarModule, ToolBarToolComponent, KENDO_TOOLBAR } from '@progress/kendo-angular-toolbar';
16
+ import * as allIcons from '@progress/kendo-svg-icons';
17
+ import { menuIcon } from '@progress/kendo-svg-icons';
18
+ import { BehaviorSubject, map } from 'rxjs';
19
+ import { io } from 'socket.io-client';
20
+ import * as msgpackParser from 'socket.io-msgpack-parser';
21
+ import * as i1 from 'dist/@rosoftlab/core';
22
+ import { BaseModel, Attribute, BaseModelConfig, BaseService } from 'dist/@rosoftlab/core';
23
+ import { __decorate, __metadata } from 'tslib';
24
+ import * as i2$1 from '@angular/forms';
25
+ import { FormGroup, ReactiveFormsModule } from '@angular/forms';
26
+ import * as i1$2 from '@ngx-formly/core';
27
+ import { FormlyModule } from '@ngx-formly/core';
28
+ import { FormlyKendoModule } from '@ngx-formly/kendo';
29
+ import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
30
+ import { MatSort, MatSortModule } from '@angular/material/sort';
31
+ import * as i6 from '@progress/kendo-angular-grid';
32
+ import { KENDO_GRID } from '@progress/kendo-angular-grid';
33
+ import { KENDO_LABEL } from '@progress/kendo-angular-label';
34
+ import { ColumnMode, SelectionType } from '@swimlane/ngx-datatable';
35
+ import { DragDropModule } from '@angular/cdk/drag-drop';
36
+ import { PortalModule } from '@angular/cdk/portal';
37
+ import { CdkStepperModule } from '@angular/cdk/stepper';
38
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
39
+ import { MatBadgeModule } from '@angular/material/badge';
40
+ import { MatButtonModule } from '@angular/material/button';
41
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
42
+ import { MatCardModule } from '@angular/material/card';
43
+ import { MatCheckboxModule } from '@angular/material/checkbox';
44
+ import { MatChipsModule } from '@angular/material/chips';
45
+ import { MatNativeDateModule, MatRippleModule, MatOptionModule } from '@angular/material/core';
46
+ import { MatDatepickerModule } from '@angular/material/datepicker';
47
+ import { MatDialogModule } from '@angular/material/dialog';
48
+ import { MatDividerModule } from '@angular/material/divider';
49
+ import { MatExpansionModule } from '@angular/material/expansion';
50
+ import { MatGridListModule } from '@angular/material/grid-list';
51
+ import { MatIconModule } from '@angular/material/icon';
52
+ import { MatInputModule } from '@angular/material/input';
53
+ import { MatListModule } from '@angular/material/list';
54
+ import { MatMenuModule } from '@angular/material/menu';
55
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
56
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
57
+ import { MatRadioModule } from '@angular/material/radio';
58
+ import { MatSelectModule } from '@angular/material/select';
59
+ import { MatSidenavModule } from '@angular/material/sidenav';
60
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
61
+ import { MatSliderModule } from '@angular/material/slider';
62
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
63
+ import { MatStepperModule } from '@angular/material/stepper';
64
+ import { MatTableModule } from '@angular/material/table';
65
+ import { MatTabsModule } from '@angular/material/tabs';
66
+ import { MatToolbarModule } from '@angular/material/toolbar';
67
+ import { MatTooltipModule } from '@angular/material/tooltip';
68
+ import { MatTreeModule } from '@angular/material/tree';
69
+
70
+ class ReactiveDictionary extends Map {
71
+ static { this.instance = new Map; }
72
+ constructor(socketService, authToken) {
73
+ super();
74
+ this.changes$ = new BehaviorSubject(null);
75
+ this.isInitialized = false;
76
+ this._authToken = null;
77
+ this._authToken = authToken;
78
+ this._socketService = socketService;
79
+ this._socketService.initSocket(authToken);
80
+ this._socketService.getSetEvent(this);
81
+ }
82
+ // Method to get the singleton instance
83
+ static getInstance(socketService, authToken, instance_key) {
84
+ if (!instance_key)
85
+ instance_key = 'root';
86
+ if (!ReactiveDictionary.instance.has(instance_key)) {
87
+ ReactiveDictionary.instance.set(instance_key, new ReactiveDictionary(socketService, authToken));
88
+ }
89
+ const instance = ReactiveDictionary.instance.get(instance_key);
90
+ if (!instance) {
91
+ throw new Error(`No instance found for key: ${instance_key}`); // Handle undefined case
92
+ }
93
+ return instance; // Now TypeScript knows 'instance' is not undefined
94
+ }
95
+ // str_keys(): string[] {
96
+ keys() {
97
+ const excludedKeys = ['__guid', '__type']; // Key to exclude
98
+ const iterator = super.keys();
99
+ const filteredIterator = {
100
+ [Symbol.iterator]: () => ({
101
+ next: () => {
102
+ let result;
103
+ // Loop until we find a valid key or run out of keys
104
+ do {
105
+ result = iterator.next(); // Get the next entry ([key, value])
106
+ if (result.done)
107
+ return { done: true }; // Stop if done
108
+ const key = result.value; // Destructure the entry
109
+ const value = super.get(key);
110
+ // Check if the key is in excludedKeys or if the value is an object
111
+ if (!excludedKeys.includes(key) &&
112
+ !(typeof value === 'object' && value !== null)) {
113
+ return { value: key, done: false }; // Return the valid key
114
+ }
115
+ } while (true); // Continue until a valid key is found
116
+ }
117
+ })
118
+ };
119
+ return filteredIterator;
120
+ }
121
+ // Asynchronous method to get a value by key
122
+ async asyncGet(key) {
123
+ // console.log('Get key: ', key);
124
+ const keys = key.split('.');
125
+ if (keys.length === 1) {
126
+ if (this.has(key)) {
127
+ const value = this.get(key);
128
+ if (value instanceof ReactiveDictionary) {
129
+ return value;
130
+ }
131
+ if (typeof value === 'object' && value !== null) {
132
+ const dict_type = value['__type'];
133
+ // console.log('value type : ', dict_type);
134
+ if (dict_type === 'dict' || dict_type === 'lazy') {
135
+ const lazyLoadData = await this.lazyLoadSync(this.get('__guid'), key);
136
+ // console.log(lazyLoadData)
137
+ if (lazyLoadData) {
138
+ const dict = new ReactiveDictionary(this._socketService, this._authToken);
139
+ await dict.asyncInit(lazyLoadData.data);
140
+ this.set(key, dict);
141
+ return dict;
142
+ }
143
+ }
144
+ }
145
+ return value;
146
+ }
147
+ }
148
+ else {
149
+ const obj = await this.asyncGet(keys[0]);
150
+ if (obj)
151
+ return await obj.asyncGet(keys.slice(1).join('.'));
152
+ else
153
+ return null;
154
+ }
155
+ }
156
+ // Asynchronous method to set a value by key
157
+ async asyncSet(key, value, emmit_event = true) {
158
+ if (emmit_event) {
159
+ try {
160
+ await this._socketService.emitSet(this.get('__guid'), key, value);
161
+ }
162
+ catch (error) {
163
+ console.error('Error emitting set event:', error);
164
+ }
165
+ }
166
+ this.set(key, value);
167
+ this.changes$.next({ key, value });
168
+ }
169
+ // Asynchronous method to initialize with a set of key-value pairs
170
+ async asyncInit(initialData) {
171
+ if (!this.isInitialized) {
172
+ try {
173
+ // If initial data is not provided, fetch it
174
+ const data = initialData || await this._socketService.getInitialData();
175
+ // this.known_dicts.set(data.__guid,data);
176
+ // Set the initial properties on the proxy
177
+ for (const [key, value] of Object.entries(data)) {
178
+ this.set(key, value);
179
+ }
180
+ this.isInitialized = true;
181
+ }
182
+ catch (error) {
183
+ console.error('Error during initialization:', error);
184
+ }
185
+ }
186
+ }
187
+ async lazyLoadSync(guid, prop) {
188
+ try {
189
+ const data = await this._socketService.requestLazyLoad(guid, String(prop));
190
+ return data;
191
+ }
192
+ catch (error) {
193
+ console.error('Error fetching data:', error);
194
+ throw error;
195
+ }
196
+ }
197
+ getPlainObject() {
198
+ const plainObject = {};
199
+ this.forEach((value, key) => {
200
+ if (value instanceof ReactiveDictionary)
201
+ plainObject[key] = value.getPlainObject();
202
+ else
203
+ plainObject[key] = value; // Add key-value pairs to the plain object
204
+ });
205
+ return plainObject; // Return the plain object
206
+ }
207
+ async getTable(key) {
208
+ const data = await this.asyncGet(key); // Get rooms from the ReactiveDictionary
209
+ if (!data) {
210
+ return []; // Return an empty array if data is undefined
211
+ }
212
+ // Filter and get only entries that are instances of ReactiveDictionary
213
+ const result = await Promise.all(Array.from(data.entries()).map(async (key) => await data.asyncGet(key[0])) // Get data from asyncGet
214
+ ) || []; // Return an empty array if the above yields undefined
215
+ return result.filter((entry) => entry instanceof ReactiveDictionary);
216
+ }
217
+ async getTableWithoutGuid(key) {
218
+ const data = await this.asyncGet(key); // Get rooms from the ReactiveDictionary
219
+ if (!data) {
220
+ return []; // Return an empty array if data is undefined
221
+ }
222
+ // Filter and get only entries that are instances of ReactiveDictionary
223
+ const result = await Promise.all(Array.from(data.entries()).map(async (key) => await data.asyncGet(key[0])) // Get data from asyncGet
224
+ ) || []; // Return an empty array if the above yields undefined
225
+ var filteredResults = result.filter((entry) => entry instanceof ReactiveDictionary);
226
+ return filteredResults.map(dictionary => {
227
+ // Convert Map to object and filter out __guid
228
+ const filteredObject = {};
229
+ for (const [key, value] of dictionary.entries()) {
230
+ if (key !== '__guid') {
231
+ filteredObject[key] = value;
232
+ }
233
+ }
234
+ return filteredObject;
235
+ });
236
+ }
237
+ onChanges() {
238
+ return this.changes$.asObservable();
239
+ }
240
+ }
241
+
242
+ // projects/my-library/src/lib/socket-config.token.ts
243
+ const SOCKET_URL = new InjectionToken('SocketUrl');
244
+
245
+ class SocketService {
246
+ constructor(socketUrl) {
247
+ this.socketUrl = socketUrl;
248
+ // Replace with your actual server URL
249
+ // this.socket.on("connect", () => {
250
+ // const engine = this.socket.io.engine;
251
+ // (engine.transport.name); // in most cases, prints "polling"
252
+ // engine.once("upgrade", () => {
253
+ // // called when the transport is upgraded (i.e. from HTTP long-polling to WebSocket)
254
+ // (engine.transport.name); // in most cases, prints "websocket"
255
+ // });
256
+ // });
257
+ }
258
+ initSocket(authToken) {
259
+ if (this.socket == null && authToken !== null) {
260
+ this.socket = io(this.socketUrl, {
261
+ withCredentials: true,
262
+ parser: msgpackParser,
263
+ auth: {
264
+ token: authToken, // Include the authentication token
265
+ },
266
+ query: {
267
+ "access_token": authToken
268
+ }
269
+ });
270
+ }
271
+ }
272
+ getInitialData() {
273
+ return new Promise((resolve, reject) => {
274
+ this.socket.on('init', (data) => {
275
+ if (data) {
276
+ resolve(data["dict_data"]);
277
+ }
278
+ else {
279
+ reject('No data received from init event');
280
+ }
281
+ });
282
+ });
283
+ }
284
+ getSetEvent(rdict) {
285
+ this.socket.on('set', (data) => {
286
+ // (rdict.get('__guid'), data, this.socket.id)
287
+ if (rdict.get('__guid') === data.did) {
288
+ // ('Set the data')
289
+ rdict.asyncSet(data.key, data.value, false);
290
+ }
291
+ });
292
+ }
293
+ // Emit the 'lazy_load' event with callback to get the response
294
+ requestLazyLoad(did, key) {
295
+ return new Promise((resolve, reject) => {
296
+ this.socket.emit('lazy_load', { did, key }, (response) => {
297
+ if (response && response.error) {
298
+ reject(response.error); // Handle error if present
299
+ }
300
+ else {
301
+ resolve(response); // Resolve with the response data
302
+ }
303
+ });
304
+ });
305
+ }
306
+ // Emit the 'set' event to update the data on the server
307
+ emitSet(did, key, value) {
308
+ return new Promise((resolve, reject) => {
309
+ this.socket.emit('set', { did, key, value }, (response) => {
310
+ if (response && response.error) {
311
+ reject(response.error);
312
+ }
313
+ else {
314
+ resolve();
315
+ }
316
+ });
317
+ });
318
+ }
319
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SocketService, deps: [{ token: SOCKET_URL }], target: i0.ɵɵFactoryTarget.Injectable }); }
320
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SocketService, providedIn: 'root' }); }
321
+ }
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SocketService, decorators: [{
323
+ type: Injectable,
324
+ args: [{
325
+ providedIn: 'root'
326
+ }]
327
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
328
+ type: Inject,
329
+ args: [SOCKET_URL]
330
+ }] }] });
331
+
332
+ let Menu = class Menu extends BaseModel {
333
+ };
334
+ __decorate([
335
+ Attribute({ serializedName: 'id' }),
336
+ __metadata("design:type", String)
337
+ ], Menu.prototype, "id", void 0);
338
+ __decorate([
339
+ Attribute({ serializedName: 'header' }),
340
+ __metadata("design:type", String)
341
+ ], Menu.prototype, "header", void 0);
342
+ __decorate([
343
+ Attribute({ serializedName: 'icon' }),
344
+ __metadata("design:type", String)
345
+ ], Menu.prototype, "icon", void 0);
346
+ __decorate([
347
+ Attribute({ serializedName: 'link' }),
348
+ __metadata("design:type", String)
349
+ ], Menu.prototype, "link", void 0);
350
+ __decorate([
351
+ Attribute({ serializedName: 'title' }),
352
+ __metadata("design:type", String)
353
+ ], Menu.prototype, "title", void 0);
354
+ __decorate([
355
+ Attribute({ serializedName: 'sublinks' }),
356
+ __metadata("design:type", Array)
357
+ ], Menu.prototype, "sublinks", void 0);
358
+ __decorate([
359
+ Attribute({ serializedName: 'target' }),
360
+ __metadata("design:type", String)
361
+ ], Menu.prototype, "target", void 0);
362
+ __decorate([
363
+ Attribute({ serializedName: 'external' }),
364
+ __metadata("design:type", Boolean)
365
+ ], Menu.prototype, "external", void 0);
366
+ __decorate([
367
+ Attribute({ serializedName: 'description' }),
368
+ __metadata("design:type", String)
369
+ ], Menu.prototype, "description", void 0);
370
+ __decorate([
371
+ Attribute({ serializedName: 'order' }),
372
+ __metadata("design:type", Number)
373
+ ], Menu.prototype, "order", void 0);
374
+ __decorate([
375
+ Attribute({ serializedName: 'translationKey' }),
376
+ __metadata("design:type", String)
377
+ ], Menu.prototype, "translationKey", void 0);
378
+ __decorate([
379
+ Attribute({ serializedName: 'color' }),
380
+ __metadata("design:type", String)
381
+ ], Menu.prototype, "color", void 0);
382
+ Menu = __decorate([
383
+ BaseModelConfig({
384
+ type: 'user',
385
+ modelEndpointUrl: 'user/menus'
386
+ })
387
+ ], Menu);
388
+
389
+ // import { Attribute, BaseModel, BaseModelConfig } from '@rosoftlab/core';
390
+ let Right = class Right extends BaseModel {
391
+ };
392
+ __decorate([
393
+ Attribute({ serializedName: 'id' }),
394
+ __metadata("design:type", String)
395
+ ], Right.prototype, "id", void 0);
396
+ __decorate([
397
+ Attribute({ serializedName: 'name' }),
398
+ __metadata("design:type", String)
399
+ ], Right.prototype, "name", void 0);
400
+ __decorate([
401
+ Attribute({ serializedName: 'rightKey' }),
402
+ __metadata("design:type", String)
403
+ ], Right.prototype, "rightKey", void 0);
404
+ __decorate([
405
+ Attribute({ serializedName: 'pagePath' }),
406
+ __metadata("design:type", String)
407
+ ], Right.prototype, "pagePath", void 0);
408
+ __decorate([
409
+ Attribute({ serializedName: 'order' }),
410
+ __metadata("design:type", Number)
411
+ ], Right.prototype, "order", void 0);
412
+ __decorate([
413
+ Attribute({ serializedName: 'isMenu' }),
414
+ __metadata("design:type", Boolean)
415
+ ], Right.prototype, "isMenu", void 0);
416
+ __decorate([
417
+ Attribute({ serializedName: 'resourceName' }),
418
+ __metadata("design:type", String)
419
+ ], Right.prototype, "resourceName", void 0);
420
+ __decorate([
421
+ Attribute({ serializedName: 'parentId' }),
422
+ __metadata("design:type", String)
423
+ ], Right.prototype, "parentId", void 0);
424
+ __decorate([
425
+ Attribute({ serializedName: 'color' }),
426
+ __metadata("design:type", String)
427
+ ], Right.prototype, "color", void 0);
428
+ __decorate([
429
+ Attribute({ serializedName: 'defaultRoles' }),
430
+ __metadata("design:type", String)
431
+ ], Right.prototype, "defaultRoles", void 0);
432
+ __decorate([
433
+ Attribute({ serializedName: 'icon' }),
434
+ __metadata("design:type", String)
435
+ ], Right.prototype, "icon", void 0);
436
+ Right = __decorate([
437
+ BaseModelConfig({
438
+ type: 'right',
439
+ modelEndpointUrl: 'user/rights'
440
+ })
441
+ ], Right);
442
+
443
+ let User = class User extends BaseModel {
444
+ get fullName() {
445
+ return this.firstName + ' ' + this.lastName;
446
+ }
447
+ };
448
+ __decorate([
449
+ Attribute({ serializedName: 'id' }),
450
+ __metadata("design:type", String)
451
+ ], User.prototype, "id", void 0);
452
+ __decorate([
453
+ Attribute({ serializedName: 'firstName' }),
454
+ __metadata("design:type", String)
455
+ ], User.prototype, "firstName", void 0);
456
+ __decorate([
457
+ Attribute({ serializedName: 'lastName' }),
458
+ __metadata("design:type", String)
459
+ ], User.prototype, "lastName", void 0);
460
+ __decorate([
461
+ Attribute({ serializedName: 'email' }),
462
+ __metadata("design:type", String)
463
+ ], User.prototype, "email", void 0);
464
+ User = __decorate([
465
+ BaseModelConfig({
466
+ type: 'user'
467
+ })
468
+ ], User);
469
+
470
+ class UserService extends BaseService {
471
+ constructor(datastore) {
472
+ super(datastore);
473
+ this.setModelType(User);
474
+ }
475
+ getRights() {
476
+ const response = this.datastore.findAll(Right);
477
+ return response;
478
+ }
479
+ hasRightForLink(link) {
480
+ if (this.userRights && link) {
481
+ const right = this.userRights.find(f => link.indexOf(f.pagePath) >= 0);
482
+ return true;
483
+ }
484
+ return false;
485
+ }
486
+ getMenus() {
487
+ const response = this.datastore.findAll(Menu);
488
+ return response;
489
+ }
490
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: UserService, deps: [{ token: i1.DatastoreCore }], target: i0.ɵɵFactoryTarget.Injectable }); }
491
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: UserService, providedIn: 'root' }); }
492
+ }
493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: UserService, decorators: [{
494
+ type: Injectable,
495
+ args: [{
496
+ providedIn: 'root'
497
+ }]
498
+ }], ctorParameters: () => [{ type: i1.DatastoreCore }] });
499
+
500
+ class WsAuthService {
501
+ constructor() {
502
+ this.token = null;
503
+ }
504
+ get Token() {
505
+ return this.token;
506
+ }
507
+ set Token(token) {
508
+ this.token = token;
509
+ }
510
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: WsAuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
511
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: WsAuthService, providedIn: 'root' }); }
512
+ }
513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: WsAuthService, decorators: [{
514
+ type: Injectable,
515
+ args: [{
516
+ providedIn: 'root'
517
+ }]
518
+ }], ctorParameters: () => [] });
519
+
520
+ class FullComponent {
521
+ constructor(userService, router, socketService, translate, wsAuthService) {
522
+ this.userService = userService;
523
+ this.router = router;
524
+ this.socketService = socketService;
525
+ this.translate = translate;
526
+ this.wsAuthService = wsAuthService;
527
+ this.selected = "Inbox";
528
+ this.menuSvg = menuIcon;
529
+ this.expandedIndices = [2];
530
+ this.hasItems = false;
531
+ this.items = [];
532
+ this.icons = allIcons;
533
+ this.apptitle = "Test";
534
+ this.isItemExpanded = (item) => {
535
+ return this.expandedIndices.indexOf(item.id) >= 0;
536
+ };
537
+ this.getMenu();
538
+ }
539
+ async ngOnInit() {
540
+ this.rdict = ReactiveDictionary.getInstance(this.socketService, this.wsAuthService.Token);
541
+ if (this.rdict.size == 0)
542
+ await this.rdict.asyncInit();
543
+ this.apptitle = await this.rdict.asyncGet("appname");
544
+ }
545
+ getMenu() {
546
+ this.userService.getMenus().subscribe({
547
+ next: value => {
548
+ this.items = this.transformToDrawerItems(value.getModels());
549
+ },
550
+ error: err => console.error('Observable emitted an error: ' + err),
551
+ complete: () => console.log('Observable emitted the complete notification')
552
+ });
553
+ this.menu$ = this.userService.getMenus().pipe(map(f => {
554
+ const data = f.getModels();
555
+ this.hasItems = data.length > 0;
556
+ return data;
557
+ }));
558
+ }
559
+ // public items: Array<DrawerItem> //= items;
560
+ onSelect(ev) {
561
+ this.selected = ev.item.text;
562
+ const current = ev.item.id;
563
+ if (this.expandedIndices.indexOf(current) >= 0) {
564
+ this.expandedIndices = this.expandedIndices.filter((id) => id !== current);
565
+ }
566
+ else {
567
+ this.expandedIndices.push(current);
568
+ }
569
+ if (ev.item.path && ev.item.path !== '') {
570
+ this.router.navigate([ev.item.path]);
571
+ // this.router.navigateByUrl(ev.item.path);
572
+ // this.router.navigate(['/import_layout']);
573
+ }
574
+ }
575
+ transformToDrawerItems(data, parentId) {
576
+ let drawerItems = [];
577
+ data.forEach(item => {
578
+ const drawerItem = {
579
+ id: item.id,
580
+ text: this.translate.instant(item.translationKey),
581
+ // icon: item.icon,
582
+ svgIcon: this.icons[item.icon],
583
+ selected: false, // Set this based on your application's state or logic
584
+ parentId: parentId,
585
+ path: (item.sublinks && item.sublinks.length > 0) ? '' : item.link
586
+ };
587
+ drawerItems.push(drawerItem);
588
+ // Recursively process children and flatten them
589
+ if (item.sublinks && item.sublinks.length > 0) {
590
+ const childItems = this.transformToDrawerItems(item.sublinks, item.id);
591
+ drawerItems = drawerItems.concat(childItems); // Add children to the drawerItems array
592
+ }
593
+ });
594
+ return drawerItems;
595
+ }
596
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: FullComponent, deps: [{ token: UserService }, { token: i1$1.Router }, { token: SocketService }, { token: i2.TranslateService }, { token: WsAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
597
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: FullComponent, isStandalone: true, selector: "rdict-full", ngImport: i0, template: "<div class=\"custom-toolbar\">\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\n <!-- <kendo-toolbar-button icon=\"menu\" themeColor=\"tertiary\" (click)=\"drawer.toggle()\"> </kendo-toolbar-button> -->\n <span class=\"app-title\">{{apptitle}}</span>\n</div>\n<kendo-drawer-container>\n <kendo-drawer #drawer [items]=\"items\" mode=\"push\" [mini]=\"true\" [expanded]=\"true\" (select)=\"onSelect($event)\"\n [autoCollapse]=\"false\" [isItemExpanded]=\"isItemExpanded\">\n <!-- <ng-template kendoDrawerItemTemplate let-item>\n <div *ngIf=\"item.path !== ''\" class=\"k-drawer-link\" [routerLink]=\"item.path\">\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\n <span>{{ item.text }}</span>\n </div>\n <div *ngIf=\"item.path == ''\" class=\"k-drawer-link\" >\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\n <span>{{ item.text }}</span>\n </div>\n </ng-template> -->\n </kendo-drawer>\n\n <kendo-drawer-content>\n <router-outlet></router-outlet>\n <!-- <div>{{selected}}</div> -->\n <!-- <my-content [selectedItem]=\"selected\"></my-content> -->\n </kendo-drawer-content>\n</kendo-drawer-container>", styles: ["html,body,rdict-full{padding:0;height:100%}rdict-full{display:flex;flex-direction:column}kendo-drawer-container{flex:1 1 auto;overflow-y:auto}.k-icon{font-size:20px}.custom-toolbar{width:100%;background-color:#f6f6f6;line-height:10px;border-bottom:inset;border-bottom-width:1px;padding:3px 8px;color:#656565}.app-title{margin-left:20px;font-weight:700;font-size:17px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonsModule }, { kind: "component", type: i4.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "ngmodule", type: ToolBarModule }, { kind: "ngmodule", type: LayoutModule }, { kind: "component", type: i5.DrawerComponent, selector: "kendo-drawer", inputs: ["mode", "position", "mini", "expanded", "width", "miniWidth", "autoCollapse", "items", "isItemExpanded", "animation"], outputs: ["expand", "collapse", "select", "expandedChange"], exportAs: ["kendoDrawer"] }, { kind: "component", type: i5.DrawerContainerComponent, selector: "kendo-drawer-container" }, { kind: "component", type: i5.DrawerContentComponent, selector: "kendo-drawer-content" }] }); }
598
+ }
599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: FullComponent, decorators: [{
600
+ type: Component,
601
+ args: [{ selector: 'rdict-full', standalone: true, imports: [
602
+ CommonModule,
603
+ RouterModule,
604
+ TranslateModule,
605
+ CommonModule,
606
+ ButtonsModule,
607
+ ToolBarModule,
608
+ LayoutModule,
609
+ KENDO_SVGICON
610
+ ], template: "<div class=\"custom-toolbar\">\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\n <!-- <kendo-toolbar-button icon=\"menu\" themeColor=\"tertiary\" (click)=\"drawer.toggle()\"> </kendo-toolbar-button> -->\n <span class=\"app-title\">{{apptitle}}</span>\n</div>\n<kendo-drawer-container>\n <kendo-drawer #drawer [items]=\"items\" mode=\"push\" [mini]=\"true\" [expanded]=\"true\" (select)=\"onSelect($event)\"\n [autoCollapse]=\"false\" [isItemExpanded]=\"isItemExpanded\">\n <!-- <ng-template kendoDrawerItemTemplate let-item>\n <div *ngIf=\"item.path !== ''\" class=\"k-drawer-link\" [routerLink]=\"item.path\">\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\n <span>{{ item.text }}</span>\n </div>\n <div *ngIf=\"item.path == ''\" class=\"k-drawer-link\" >\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\n <span>{{ item.text }}</span>\n </div>\n </ng-template> -->\n </kendo-drawer>\n\n <kendo-drawer-content>\n <router-outlet></router-outlet>\n <!-- <div>{{selected}}</div> -->\n <!-- <my-content [selectedItem]=\"selected\"></my-content> -->\n </kendo-drawer-content>\n</kendo-drawer-container>", styles: ["html,body,rdict-full{padding:0;height:100%}rdict-full{display:flex;flex-direction:column}kendo-drawer-container{flex:1 1 auto;overflow-y:auto}.k-icon{font-size:20px}.custom-toolbar{width:100%;background-color:#f6f6f6;line-height:10px;border-bottom:inset;border-bottom-width:1px;padding:3px 8px;color:#656565}.app-title{margin-left:20px;font-weight:700;font-size:17px}\n"] }]
611
+ }], ctorParameters: () => [{ type: UserService }, { type: i1$1.Router }, { type: SocketService }, { type: i2.TranslateService }, { type: WsAuthService }] });
612
+
613
+ ;
614
+ class RdictCrudComponent {
615
+ constructor() {
616
+ this.baseForm = new FormGroup({});
617
+ this.model = {};
618
+ this.options = {};
619
+ this.fields = [
620
+ {
621
+ key: 'name',
622
+ type: 'input',
623
+ props: {
624
+ label: 'General.Name',
625
+ translate: true,
626
+ required: true,
627
+ },
628
+ },
629
+ ];
630
+ }
631
+ ngOnInit() {
632
+ }
633
+ onSubmit(model) {
634
+ }
635
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RdictCrudComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
636
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: RdictCrudComponent, isStandalone: true, selector: "app-rdict-crud", ngImport: i0, template: "<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\n</form>", styles: [""], dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i1$2.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyKendoModule }, { kind: "ngmodule", type: TranslateModule }] }); }
637
+ }
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RdictCrudComponent, decorators: [{
639
+ type: Component,
640
+ args: [{ standalone: true, selector: 'app-rdict-crud', imports: [
641
+ FormlyModule,
642
+ ReactiveFormsModule,
643
+ FormlyKendoModule,
644
+ TranslateModule
645
+ ], template: "<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\n</form>" }]
646
+ }], ctorParameters: () => [] });
647
+
648
+ class RdictTableTitle extends ToolBarToolComponent {
649
+ constructor() {
650
+ super();
651
+ this.tabindex = -1;
652
+ }
653
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RdictTableTitle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
654
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: RdictTableTitle, isStandalone: true, selector: "table-title", inputs: { text: "text" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => RdictTableTitle) }], viewQueries: [{ propertyName: "toolbarTemplate", first: true, predicate: ["toolbarTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
655
+ <ng-template #toolbarTemplate>
656
+ <kendo-label>{{text}}</kendo-label>
657
+ </ng-template>
658
+ `, isInline: true }); }
659
+ }
660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RdictTableTitle, decorators: [{
661
+ type: Component,
662
+ args: [{
663
+ providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => RdictTableTitle) }],
664
+ selector: 'table-title',
665
+ standalone: true,
666
+ template: `
667
+ <ng-template #toolbarTemplate>
668
+ <kendo-label>{{text}}</kendo-label>
669
+ </ng-template>
670
+ `
671
+ }]
672
+ }], ctorParameters: () => [], propDecorators: { toolbarTemplate: [{
673
+ type: ViewChild,
674
+ args: ['toolbarTemplate', { static: true }]
675
+ }], text: [{
676
+ type: Input
677
+ }] } });
678
+
679
+ class GenericRdictTableComponent {
680
+ constructor(router, route, translate, injector, socketService, wsAuthService, el) {
681
+ this.router = router;
682
+ this.route = route;
683
+ this.translate = translate;
684
+ this.injector = injector;
685
+ this.socketService = socketService;
686
+ this.wsAuthService = wsAuthService;
687
+ this.el = el;
688
+ this.editOnClick = false;
689
+ this.editOnDblClick = false;
690
+ this.data = [];
691
+ this.pageIndex = 1;
692
+ this.pageSize = 30;
693
+ this.isLoadingResults = true;
694
+ this.isRateLimitReached = false;
695
+ // @ViewChild('table') table: MatTable<any>;
696
+ // @ViewChild('table', { read: ElementRef }) public matTableRef: ElementRef;
697
+ this.selectedObject = new EventEmitter();
698
+ this.click = new EventEmitter();
699
+ this.editModel = new EventEmitter();
700
+ this.columns = [];
701
+ this.tableLayout = {};
702
+ this.allColumns = [];
703
+ this.ColumnMode = ColumnMode;
704
+ this.SelectionType = SelectionType;
705
+ this.headerHeight = 50;
706
+ this.rowHeight = 50;
707
+ }
708
+ async ngOnInit() {
709
+ this.setValueFromSnapshot(this, this.route.snapshot, 'model', "");
710
+ this.setValueFromSnapshot(this, this.route.snapshot, 'showSerach', false);
711
+ this.setValueFromSnapshot(this, this.route.snapshot, 'searchFields', null);
712
+ this.setValueFromSnapshot(this, this.route.snapshot, 'customInclude', null);
713
+ this.setValueFromSnapshot(this, this.route.snapshot, 'defaultSort', null);
714
+ this.setValueFromSnapshot(this, this.route.snapshot, 'defaultSortDirection', '');
715
+ this.setValueFromSnapshot(this, this.route.snapshot, 'deletePropertyName', 'name');
716
+ this.setValueFromSnapshot(this, this.route.snapshot, 'defaultFilter', null);
717
+ this.setValueFromSnapshot(this, this.route.snapshot, 'showHeader', true);
718
+ this.setValueFromSnapshot(this, this.route.snapshot, 'deleteDisableRule', null);
719
+ this.setValueFromSnapshot(this, this.route.snapshot, 'hasAdd', true);
720
+ this.setValueFromSnapshot(this, this.route.snapshot, 'canDelete', true);
721
+ this.setValueFromSnapshot(this, this.route.snapshot, 'canEdit', true);
722
+ this.setValueFromSnapshot(this, this.route.snapshot, 'editOnClick', false);
723
+ this.setValueFromSnapshot(this, this.route.snapshot, 'editOnDblClick', false);
724
+ const currentUrlSegments = this.router.url.split('/').map(segment => new UrlSegment(segment, {}));
725
+ this.basePath = currentUrlSegments.map(segment => segment.path).join('/');
726
+ const filteredSegments = currentUrlSegments.filter(segment => segment.path !== '');
727
+ this.dictPath = filteredSegments.map(segment => segment.path).join('.');
728
+ this.model = filteredSegments.length > 0 ? filteredSegments[filteredSegments.length - 1].path : ''; // Default to empty string if no valid segments
729
+ this.router.events.subscribe(event => {
730
+ if (event instanceof NavigationStart) {
731
+ // Navigation to another page is about to occur
732
+ this.data = [];
733
+ this.pageIndex = 1;
734
+ // Perform actions or update component as needed
735
+ }
736
+ });
737
+ this.rdict = ReactiveDictionary.getInstance(this.socketService, this.wsAuthService.Token);
738
+ if (this.rdict.size == 0)
739
+ await this.rdict.asyncInit();
740
+ await this.getListLayout();
741
+ await this.loadData();
742
+ // this.isLoading = true;
743
+ // this.onScroll(0);
744
+ }
745
+ setValueFromSnapshot(component, snapshot, key, defaultValue) {
746
+ if (component[key] === undefined) {
747
+ let dataFromSnapshot = snapshot.data[key];
748
+ if (dataFromSnapshot === null || dataFromSnapshot === undefined) {
749
+ dataFromSnapshot = snapshot.params[key];
750
+ }
751
+ component[key] = dataFromSnapshot !== undefined ? dataFromSnapshot : defaultValue;
752
+ }
753
+ }
754
+ async loadData() {
755
+ var x = await this.rdict.getTable(this.dictPath);
756
+ const result = x.map(dictionary => {
757
+ // Convert Map to object and filter out __guid
758
+ const filteredObject = {};
759
+ for (const [key, value] of dictionary.entries()) {
760
+ if (key !== '__guid') {
761
+ filteredObject[key] = value;
762
+ }
763
+ }
764
+ return filteredObject;
765
+ });
766
+ this.dataSource = result; //new MatTableDataSource(result);
767
+ }
768
+ // async handleChange(event) {
769
+ // this.filterValue = event.target.value.toLowerCase();
770
+ // this.data = [];
771
+ // this.pageIndex = 1
772
+ // this.loadData();
773
+ // }
774
+ // loadData(event = null) {
775
+ // const filters = [];
776
+ // let sorts = '';
777
+ // this.isLoading = true;
778
+ // if (this.defaultSort) {
779
+ // if (this.defaultSortDirection === 'desc') {
780
+ // sorts = '-' + this.defaultSort;
781
+ // } else {
782
+ // sorts = this.defaultSort;
783
+ // }
784
+ // }
785
+ // if (this.showSerach) {
786
+ // if (this.filterValue) {
787
+ // const y = '(' + this.searchFields.replace(',', '|') + ')';
788
+ // filters.push(y + '@=*' + this.filterValue);
789
+ // }
790
+ // }
791
+ // if (this.defaultFilter) {
792
+ // filters.push(this.defaultFilter)
793
+ // }
794
+ // setTimeout(() => {
795
+ // const filtersValue = filters.join(', ');
796
+ // this.modelService.getAll(this.pageIndex, this.pageSize, sorts, filtersValue, this.customInclude).subscribe(
797
+ // (response: BaseQueryData<T>) => {
798
+ // if (this.pageIndex !== response.getMeta().meta.count) {
799
+ // this.pageIndex++
800
+ // } else {
801
+ // if (event) event.target.disabled = true;
802
+ // }
803
+ // // if (this.filterValue)
804
+ // // this.data = response.getModels();
805
+ // // else
806
+ // const rows = [...this.data, ...response.getModels()];
807
+ // this.data = rows;
808
+ // // this.data = this.data.concat();
809
+ // if (event) event.target.complete();
810
+ // this.isLoading = false;
811
+ // })
812
+ // }, 700);
813
+ // }
814
+ // async handleRefresh(event) {
815
+ // this.pageIndex = 1
816
+ // this.data = [];
817
+ // this.loadData();
818
+ // event.target.complete();
819
+ // }
820
+ // onAdd() {
821
+ // console.log(this.basePath)
822
+ // this.router.navigate([this.basePath + '/add'])
823
+ // // this.navCtrl.navigateForward(this.basePath + '/add');
824
+ // }
825
+ // editModel(model: BaseModelFormly) {
826
+ // if (this.canEdit)
827
+ // this.router.navigate([this.basePath + '/edit/', model.id]);
828
+ // // this.navCtrl.navigateForward(this.basePath + '/edit/' + model.id);
829
+ // }
830
+ async getListLayout() {
831
+ if (this.model) {
832
+ this.tableLayout = await this.rdict.asyncGet("config.models." + this.model + ".tableLayout");
833
+ if (this.tableLayout) {
834
+ this.title = this.translate.instant(this.tableLayout["title"]);
835
+ this.allColumns = this.tableLayout["columns"].map(item => {
836
+ if (!item.isTranslated) {
837
+ item.name = this.translate.instant(item.translateKey);
838
+ item.isTranslated = true;
839
+ }
840
+ return item;
841
+ });
842
+ this.columns = [];
843
+ // this.allColumns = Reflect.getMetadata('IonicDataTableLayout', this.model).map((item: IonicDataTableLayoutConfig) => {
844
+ // if (!item.isTranslated) {
845
+ // item.name = this.translate.instant(item.name);
846
+ // item.isTranslated = true
847
+ // }
848
+ // return item;
849
+ // });
850
+ this.allColumns.sort((a, b) => a.order - b.order);
851
+ // if (this.canDelete || this.canEdit) {
852
+ // this.allColumns.push({
853
+ // // cellTemplate: null,
854
+ // name: '',
855
+ // // cellClass: 'actions-cell',
856
+ // draggable: false,
857
+ // sortable: false,
858
+ // visible: true
859
+ // // width: 100,
860
+ // // maxWidth: 100,
861
+ // // minWidth: 100
862
+ // })
863
+ // }
864
+ // this.columns = this.allColumns.filter((item: IonicDataTableLayoutConfig) => item.visible);
865
+ this.displayedColumns = [];
866
+ // if (this.allowReorderItems) {
867
+ // this.displayedColumns.push('position')
868
+ // }
869
+ this.displayedColumns.push.apply(this.displayedColumns, this.allColumns.map(x => x.propertyName));
870
+ }
871
+ }
872
+ }
873
+ addHandler() {
874
+ console.log("add");
875
+ this.router.navigate([this.basePath + '/add']);
876
+ // this.editDataItem = new Product();
877
+ // this.isNew = true;
878
+ }
879
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: GenericRdictTableComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: i0.Injector }, { token: SocketService }, { token: WsAuthService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
880
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: GenericRdictTableComponent, isStandalone: true, selector: "rsl-rdict-generic-table", inputs: { showSerach: "showSerach", searchFields: "searchFields", customInclude: "customInclude", defaultSort: "defaultSort", defaultSortDirection: "defaultSortDirection", deletePropertyName: "deletePropertyName", defaultFilter: "defaultFilter", showHeader: "showHeader", hasAdd: "hasAdd", canDelete: "canDelete", canEdit: "canEdit", editOnClick: "editOnClick", editOnDblClick: "editOnDblClick" }, outputs: { selectedObject: "selectedObject", click: "click", editModel: "editModel" }, providers: [], viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, static: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, static: true }, { propertyName: "filter", first: true, predicate: ElementRef, descendants: true }], ngImport: i0, template: "<kendo-grid [data]=\"dataSource\" \n [sortable]=\"true\" \n [filterable]=\"showSerach\"\n (add)=\"addHandler()\">\n <kendo-toolbar>\n <table-title text=\"{{title}}\"></table-title>\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\n <kendo-toolbar-button text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\n </kendo-toolbar>\n <!-- <kendo-toolbar>\n \n <kendo-toolbar-spacer></kendo-toolbar-spacer>\n <button kendoGridAddCommand type=\"button\">Add new</button>\n </kendo-toolbar> -->\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\n title=\" {{column.translateKey | translate}}\">\n </kendo-grid-column>\n</kendo-grid>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type:
881
+ // MatPaginatorModule,
882
+ // MatTableModule,
883
+ TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: i6.GridComponent, selector: "kendo-grid", inputs: ["data", "pageSize", "height", "rowHeight", "detailRowHeight", "skip", "scrollable", "selectable", "sort", "size", "trackBy", "filter", "group", "virtualColumns", "filterable", "sortable", "pageable", "groupable", "rowReorderable", "navigable", "navigatable", "autoSize", "rowClass", "rowSticky", "rowSelected", "isRowSelectable", "cellSelected", "resizable", "reorderable", "loading", "columnMenu", "hideHeader", "isDetailExpanded", "isGroupExpanded"], outputs: ["filterChange", "pageChange", "groupChange", "sortChange", "selectionChange", "rowReorder", "dataStateChange", "groupExpand", "groupCollapse", "detailExpand", "detailCollapse", "edit", "cancel", "save", "remove", "add", "cellClose", "cellClick", "pdfExport", "excelExport", "columnResize", "columnReorder", "columnVisibilityChange", "columnLockedChange", "columnStickyChange", "scrollBottom", "contentScroll"], exportAs: ["kendoGrid"] }, { kind: "component", type: i6.ColumnComponent, selector: "kendo-grid-column", inputs: ["field", "format", "sortable", "groupable", "editor", "filter", "filterable", "editable"] }, { kind: "directive", type: i6.AddCommandToolbarDirective, selector: "[kendoGridAddTool]" }, { kind: "component", type: i7.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i7.ToolbarCustomMessagesComponent, selector: "kendo-toolbar-messages" }, { kind: "component", type: i7.ToolBarButtonComponent, selector: "kendo-toolbar-button", inputs: ["showText", "showIcon", "text", "style", "className", "title", "disabled", "toggleable", "look", "togglable", "selected", "fillMode", "themeColor", "icon", "iconClass", "svgIcon", "imageUrl"], outputs: ["click", "pointerdown", "selectedChange"], exportAs: ["kendoToolBarButton"] }, { kind: "component", type: i7.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { kind: "component", type: RdictTableTitle, selector: "table-title", inputs: ["text"] }], encapsulation: i0.ViewEncapsulation.None }); }
884
+ }
885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: GenericRdictTableComponent, decorators: [{
886
+ type: Component,
887
+ args: [{ selector: 'rsl-rdict-generic-table', encapsulation: ViewEncapsulation.None, standalone: true, imports: [
888
+ CommonModule,
889
+ RouterModule,
890
+ // MatPaginatorModule,
891
+ // MatTableModule,
892
+ TranslateModule,
893
+ KENDO_GRID,
894
+ KENDO_TOOLBAR,
895
+ KENDO_LABEL,
896
+ RdictTableTitle
897
+ ], providers: [], template: "<kendo-grid [data]=\"dataSource\" \n [sortable]=\"true\" \n [filterable]=\"showSerach\"\n (add)=\"addHandler()\">\n <kendo-toolbar>\n <table-title text=\"{{title}}\"></table-title>\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\n <kendo-toolbar-button text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\n </kendo-toolbar>\n <!-- <kendo-toolbar>\n \n <kendo-toolbar-spacer></kendo-toolbar-spacer>\n <button kendoGridAddCommand type=\"button\">Add new</button>\n </kendo-toolbar> -->\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\n title=\" {{column.translateKey | translate}}\">\n </kendo-grid-column>\n</kendo-grid>" }]
898
+ }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: i0.Injector }, { type: SocketService }, { type: WsAuthService }, { type: i0.ElementRef }], propDecorators: { showSerach: [{
899
+ type: Input
900
+ }], searchFields: [{
901
+ type: Input
902
+ }], customInclude: [{
903
+ type: Input
904
+ }], defaultSort: [{
905
+ type: Input
906
+ }], defaultSortDirection: [{
907
+ type: Input
908
+ }], deletePropertyName: [{
909
+ type: Input
910
+ }], defaultFilter: [{
911
+ type: Input
912
+ }], showHeader: [{
913
+ type: Input
914
+ }], hasAdd: [{
915
+ type: Input
916
+ }], canDelete: [{
917
+ type: Input
918
+ }], canEdit: [{
919
+ type: Input
920
+ }], editOnClick: [{
921
+ type: Input
922
+ }], editOnDblClick: [{
923
+ type: Input
924
+ }], paginator: [{
925
+ type: ViewChild,
926
+ args: [MatPaginator, { static: true }]
927
+ }], sort: [{
928
+ type: ViewChild,
929
+ args: [MatSort, { static: true }]
930
+ }], filter: [{
931
+ type: ViewChild,
932
+ args: [ElementRef, { static: false }]
933
+ }], selectedObject: [{
934
+ type: Output
935
+ }], click: [{
936
+ type: Output
937
+ }], editModel: [{
938
+ type: Output
939
+ }] } });
940
+
941
+ const COMMON_MODULES = [
942
+ CommonModule,
943
+ ReactiveFormsModule,
944
+ MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
945
+ MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule,
946
+ MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule,
947
+ MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule,
948
+ MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule,
949
+ MatTooltipModule, MatOptionModule, DragDropModule, MatDividerModule, PortalModule, MatTreeModule, MatBadgeModule, MatStepperModule,
950
+ CdkStepperModule
951
+ ];
952
+ class RSLMaterialModule {
953
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RSLMaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
954
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: RSLMaterialModule, imports: [CommonModule,
955
+ ReactiveFormsModule,
956
+ MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
957
+ MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule,
958
+ MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule,
959
+ MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule,
960
+ MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule,
961
+ MatTooltipModule, MatOptionModule, DragDropModule, MatDividerModule, PortalModule, MatTreeModule, MatBadgeModule, MatStepperModule,
962
+ CdkStepperModule, TranslateModule], exports: [CommonModule,
963
+ ReactiveFormsModule,
964
+ MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
965
+ MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule,
966
+ MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule,
967
+ MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule,
968
+ MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule,
969
+ MatTooltipModule, MatOptionModule, DragDropModule, MatDividerModule, PortalModule, MatTreeModule, MatBadgeModule, MatStepperModule,
970
+ CdkStepperModule, TranslateModule] }); }
971
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RSLMaterialModule, imports: [COMMON_MODULES, TranslateModule, CommonModule,
972
+ ReactiveFormsModule,
973
+ MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule,
974
+ MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule,
975
+ MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule,
976
+ MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule,
977
+ MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule,
978
+ MatTooltipModule, MatOptionModule, DragDropModule, MatDividerModule, PortalModule, MatTreeModule, MatBadgeModule, MatStepperModule,
979
+ CdkStepperModule, TranslateModule] }); }
980
+ }
981
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: RSLMaterialModule, decorators: [{
982
+ type: NgModule,
983
+ args: [{
984
+ imports: [
985
+ ...COMMON_MODULES,
986
+ TranslateModule
987
+ ],
988
+ exports: [
989
+ ...COMMON_MODULES,
990
+ TranslateModule
991
+ ],
992
+ }]
993
+ }] });
994
+
995
+ /*
996
+ * Public API Surface of rdict
997
+ */
998
+
999
+ /**
1000
+ * Generated bundle index. Do not edit.
1001
+ */
1002
+
1003
+ export { FullComponent, GenericRdictTableComponent, Menu, RSLMaterialModule, RdictCrudComponent, ReactiveDictionary, Right, SocketService, User, UserService, WsAuthService };
1004
+ //# sourceMappingURL=rosoftlab-rdict.mjs.map