@rosoftlab/rdict 1.0.1-alpha-7 → 1.0.1-alpha-9

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.
@@ -1,4 +1,4 @@
1
- import * as i5$2 from '@angular/common';
1
+ import * as i4$1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
4
  import { Injectable, Inject, Component, NgModule, forwardRef, ViewChild, Input, EventEmitter, ElementRef, ViewEncapsulation, Output, InjectionToken } from '@angular/core';
@@ -6,55 +6,149 @@ import * as i1$1 from '@angular/router';
6
6
  import { RouterModule, UrlSegment, NavigationStart } from '@angular/router';
7
7
  import * as i2 from '@ngx-translate/core';
8
8
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
9
- import * as i4 from '@progress/kendo-angular-buttons';
10
- import { ButtonsModule } from '@progress/kendo-angular-buttons';
9
+ import * as i5 from '@progress/kendo-angular-buttons';
10
+ import { ButtonsModule, KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
11
11
  import { KENDO_SVGICON } from '@progress/kendo-angular-icons';
12
- import * as i5 from '@progress/kendo-angular-layout';
12
+ import * as i6 from '@progress/kendo-angular-layout';
13
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';
14
+ import * as i6$1 from '@progress/kendo-angular-toolbar';
15
+ import { ToolBarModule, KENDO_TOOLBAR, ToolBarToolComponent } from '@progress/kendo-angular-toolbar';
16
16
  import * as allIcons from '@progress/kendo-svg-icons';
17
- import { menuIcon } from '@progress/kendo-svg-icons';
18
- import { BehaviorSubject, map } from 'rxjs';
17
+ import { menuIcon, saveIcon, pencilIcon, trashIcon, plusIcon } from '@progress/kendo-svg-icons';
18
+ import { BehaviorSubject, from, map } from 'rxjs';
19
+ import { v4 } from 'uuid';
19
20
  import { io } from 'socket.io-client';
20
21
  import * as msgpackParser from 'socket.io-msgpack-parser';
21
22
  import * as i1 from '@rosoftlab/core';
22
23
  import { BaseModel, Attribute, BaseModelConfig, BaseService } from '@rosoftlab/core';
23
24
  import { __decorate, __metadata } from 'tslib';
24
25
  import * as i5$1 from '@angular/forms';
25
- import { FormGroup, ReactiveFormsModule } from '@angular/forms';
26
- import * as i4$1 from '@ngx-formly/core';
26
+ import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
27
+ import * as i4 from '@ngx-formly/core';
27
28
  import { FORMLY_CONFIG, FormlyModule } from '@ngx-formly/core';
28
29
  import { FormlyKendoModule } from '@ngx-formly/kendo';
29
- import * as i6 from '@progress/kendo-angular-grid';
30
+ import * as i5$2 from '@progress/kendo-angular-grid';
30
31
  import { KENDO_GRID } from '@progress/kendo-angular-grid';
31
32
  import { KENDO_LABEL } from '@progress/kendo-angular-label';
32
33
 
34
+ class SocketService {
35
+ constructor(socketUrl) {
36
+ this.socketUrl = socketUrl;
37
+ // Replace with your actual server URL
38
+ // this.socket.on("connect", () => {
39
+ // const engine = this.socket.io.engine;
40
+ // (engine.transport.name); // in most cases, prints "polling"
41
+ // engine.once("upgrade", () => {
42
+ // // called when the transport is upgraded (i.e. from HTTP long-polling to WebSocket)
43
+ // (engine.transport.name); // in most cases, prints "websocket"
44
+ // });
45
+ // });
46
+ }
47
+ initSocket(authToken) {
48
+ if (this.socket == null && authToken !== null) {
49
+ this.socket = io(this.socketUrl, {
50
+ withCredentials: true,
51
+ parser: msgpackParser,
52
+ auth: {
53
+ token: authToken, // Include the authentication token
54
+ },
55
+ query: {
56
+ "access_token": authToken
57
+ }
58
+ });
59
+ }
60
+ }
61
+ getInitialData() {
62
+ return new Promise((resolve, reject) => {
63
+ this.socket.on('init', (data) => {
64
+ if (data) {
65
+ resolve(data["dict_data"]);
66
+ }
67
+ else {
68
+ reject('No data received from init event');
69
+ }
70
+ });
71
+ });
72
+ }
73
+ getSetEvent(rdict) {
74
+ this.socket.on('set', (data) => {
75
+ // (rdict.get('__guid'), data, this.socket.id)
76
+ if (rdict.get('__guid') === data.did) {
77
+ // ('Set the data')
78
+ rdict.asyncSet(data.key, data.value, false);
79
+ }
80
+ });
81
+ }
82
+ // Emit the 'lazy_load' event with callback to get the response
83
+ requestLazyLoad(did, key) {
84
+ return new Promise((resolve, reject) => {
85
+ this.socket.emit('lazy_load', { did, key }, (response) => {
86
+ if (response && response.error) {
87
+ reject(response.error); // Handle error if present
88
+ }
89
+ else {
90
+ resolve(response); // Resolve with the response data
91
+ }
92
+ });
93
+ });
94
+ }
95
+ // Emit the 'set' event to update the data on the server
96
+ emitSet(did, key, value) {
97
+ return new Promise((resolve, reject) => {
98
+ this.socket.emit('set', { did, key, value }, (response) => {
99
+ if (response && response.error) {
100
+ reject(response.error);
101
+ }
102
+ else {
103
+ resolve();
104
+ }
105
+ });
106
+ });
107
+ }
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, deps: [{ token: SOCKET_URL }], target: i0.ɵɵFactoryTarget.Injectable }); }
109
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, providedIn: 'root' }); }
110
+ }
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, decorators: [{
112
+ type: Injectable,
113
+ args: [{
114
+ providedIn: 'root'
115
+ }]
116
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
117
+ type: Inject,
118
+ args: [SOCKET_URL]
119
+ }] }] });
120
+
33
121
  class ReactiveDictionary extends Map {
34
122
  static { this.instance = new Map; }
35
- constructor(socketService, authToken) {
123
+ constructor(socketService) {
36
124
  super();
37
125
  this.changes$ = new BehaviorSubject(null);
38
126
  this.isInitialized = false;
39
127
  this._authToken = null;
40
- this._authToken = authToken;
41
128
  this._socketService = socketService;
129
+ // this._socketService.initSocket(authToken)
130
+ // this._socketService.getSetEvent(this)
131
+ }
132
+ async initialize(authToken) {
133
+ this._authToken = authToken;
134
+ this._authToken = authToken;
42
135
  this._socketService.initSocket(authToken);
43
136
  this._socketService.getSetEvent(this);
44
- }
45
- // Method to get the singleton instance
46
- static getInstance(socketService, authToken, instance_key) {
47
- if (!instance_key)
48
- instance_key = 'root';
49
- if (!ReactiveDictionary.instance.has(instance_key)) {
50
- ReactiveDictionary.instance.set(instance_key, new ReactiveDictionary(socketService, authToken));
51
- }
52
- const instance = ReactiveDictionary.instance.get(instance_key);
53
- if (!instance) {
54
- throw new Error(`No instance found for key: ${instance_key}`); // Handle undefined case
55
- }
56
- return instance; // Now TypeScript knows 'instance' is not undefined
57
- }
137
+ await this.asyncInit();
138
+ }
139
+ // // Method to get the singleton instance
140
+ // public static getInstance(socketService: SocketService, authToken: string, instance_key?: string): ReactiveDictionary {
141
+ // if (!instance_key)
142
+ // instance_key = 'root'
143
+ // if (!ReactiveDictionary.instance.has(instance_key)) {
144
+ // ReactiveDictionary.instance.set(instance_key, new ReactiveDictionary(socketService, authToken));
145
+ // }
146
+ // const instance = ReactiveDictionary.instance.get(instance_key);
147
+ // if (!instance) {
148
+ // throw new Error(`No instance found for key: ${instance_key}`); // Handle undefined case
149
+ // }
150
+ // return instance; // Now TypeScript knows 'instance' is not undefined
151
+ // }
58
152
  // str_keys(): string[] {
59
153
  keys() {
60
154
  const excludedKeys = ['__guid', '__type']; // Key to exclude
@@ -98,7 +192,8 @@ class ReactiveDictionary extends Map {
98
192
  const lazyLoadData = await this.lazyLoadSync(this.get('__guid'), key);
99
193
  // console.log(lazyLoadData)
100
194
  if (lazyLoadData) {
101
- const dict = new ReactiveDictionary(this._socketService, this._authToken);
195
+ const dict = new ReactiveDictionary(this._socketService);
196
+ dict.initialize(this._authToken);
102
197
  await dict.asyncInit(lazyLoadData.data);
103
198
  this.set(key, dict);
104
199
  return dict;
@@ -107,6 +202,15 @@ class ReactiveDictionary extends Map {
107
202
  }
108
203
  return value;
109
204
  }
205
+ else {
206
+ const dict = new ReactiveDictionary(this._socketService);
207
+ dict.initialize(this._authToken);
208
+ dict.set('__guid', v4());
209
+ dict.set('__type', 'dict');
210
+ this.set(key, dict);
211
+ await this._socketService.emitSet(this.get('__guid'), key, this.transform_for_serialization(dict));
212
+ return dict;
213
+ }
110
214
  }
111
215
  else {
112
216
  const obj = await this.asyncGet(keys[0]);
@@ -116,6 +220,16 @@ class ReactiveDictionary extends Map {
116
220
  return null;
117
221
  }
118
222
  }
223
+ transform_for_serialization(value) {
224
+ // Transform a value to a format that can be serialized.
225
+ const dict_type = value['__type'];
226
+ if (dict_type === 'lazy')
227
+ return { "__type": "lazy" };
228
+ else if (value instanceof ReactiveDictionary)
229
+ return { "__type": "dict", "__guid": value.get('__guid') };
230
+ else
231
+ return value;
232
+ }
119
233
  // Asynchronous method to set a value by key
120
234
  async asyncSet(key, value, emmit_event = true) {
121
235
  if (emmit_event) {
@@ -167,6 +281,41 @@ class ReactiveDictionary extends Map {
167
281
  });
168
282
  return plainObject; // Return the plain object
169
283
  }
284
+ getAsObservable(key) {
285
+ return from(this.asyncGet(key));
286
+ }
287
+ // getAsObservable(key: string): Observable<any> {
288
+ // return from(this.asyncGet(key)).pipe(
289
+ // map(value => ({ data: value, success: true })), // Transform the response
290
+ // catchError(error => {
291
+ // console.error('Error fetching value:', error);
292
+ // throw error; // Rethrow the error so subscribers can handle it
293
+ // })
294
+ // );
295
+ // }
296
+ getTableAsObservable(key) {
297
+ return from(this.getTable(key)).pipe(map(dictionary => {
298
+ // Check if dictionary is an array
299
+ if (!Array.isArray(dictionary)) {
300
+ throw new Error('Expected an array but received something else');
301
+ }
302
+ // Check if all elements in the array are instances of ReactiveDictionary
303
+ const isArrayOfReactiveDictionaries = dictionary.every(item => item instanceof ReactiveDictionary);
304
+ if (!isArrayOfReactiveDictionaries) {
305
+ throw new Error('Expected an array of ReactiveDictionary instances but received something else');
306
+ }
307
+ // Convert each ReactiveDictionary to a plain object, filtering out '__guid'
308
+ return dictionary.map(dict => {
309
+ const filteredObject = {};
310
+ for (const [key, value] of dict.entries()) {
311
+ if (key !== '__guid') {
312
+ filteredObject[key] = value;
313
+ }
314
+ }
315
+ return filteredObject;
316
+ });
317
+ }));
318
+ }
170
319
  async getTable(key) {
171
320
  const data = await this.asyncGet(key); // Get rooms from the ReactiveDictionary
172
321
  if (!data) {
@@ -200,94 +349,25 @@ class ReactiveDictionary extends Map {
200
349
  onChanges() {
201
350
  return this.changes$.asObservable();
202
351
  }
203
- }
204
-
205
- class SocketService {
206
- constructor(socketUrl) {
207
- this.socketUrl = socketUrl;
208
- // Replace with your actual server URL
209
- // this.socket.on("connect", () => {
210
- // const engine = this.socket.io.engine;
211
- // (engine.transport.name); // in most cases, prints "polling"
212
- // engine.once("upgrade", () => {
213
- // // called when the transport is upgraded (i.e. from HTTP long-polling to WebSocket)
214
- // (engine.transport.name); // in most cases, prints "websocket"
215
- // });
216
- // });
217
- }
218
- initSocket(authToken) {
219
- if (this.socket == null && authToken !== null) {
220
- this.socket = io(this.socketUrl, {
221
- withCredentials: true,
222
- parser: msgpackParser,
223
- auth: {
224
- token: authToken, // Include the authentication token
225
- },
226
- query: {
227
- "access_token": authToken
228
- }
229
- });
230
- }
231
- }
232
- getInitialData() {
233
- return new Promise((resolve, reject) => {
234
- this.socket.on('init', (data) => {
235
- if (data) {
236
- resolve(data["dict_data"]);
237
- }
238
- else {
239
- reject('No data received from init event');
240
- }
241
- });
242
- });
243
- }
244
- getSetEvent(rdict) {
245
- this.socket.on('set', (data) => {
246
- // (rdict.get('__guid'), data, this.socket.id)
247
- if (rdict.get('__guid') === data.did) {
248
- // ('Set the data')
249
- rdict.asyncSet(data.key, data.value, false);
352
+ async addNew(record) {
353
+ const nextKey = this.size.toString();
354
+ const dict = await this.asyncGet(nextKey);
355
+ for (const key in record) {
356
+ if (record.hasOwnProperty(key)) {
357
+ await dict.asyncSet(key, record[key]);
250
358
  }
251
- });
252
- }
253
- // Emit the 'lazy_load' event with callback to get the response
254
- requestLazyLoad(did, key) {
255
- return new Promise((resolve, reject) => {
256
- this.socket.emit('lazy_load', { did, key }, (response) => {
257
- if (response && response.error) {
258
- reject(response.error); // Handle error if present
259
- }
260
- else {
261
- resolve(response); // Resolve with the response data
262
- }
263
- });
264
- });
265
- }
266
- // Emit the 'set' event to update the data on the server
267
- emitSet(did, key, value) {
268
- return new Promise((resolve, reject) => {
269
- this.socket.emit('set', { did, key, value }, (response) => {
270
- if (response && response.error) {
271
- reject(response.error);
272
- }
273
- else {
274
- resolve();
275
- }
276
- });
277
- });
359
+ }
278
360
  }
279
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, deps: [{ token: SOCKET_URL }], target: i0.ɵɵFactoryTarget.Injectable }); }
280
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, providedIn: 'root' }); }
361
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ReactiveDictionary, deps: [{ token: SocketService }], target: i0.ɵɵFactoryTarget.Injectable }); }
362
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ReactiveDictionary, providedIn: 'root' // This makes the service a singleton and available throughout the app
363
+ }); }
281
364
  }
282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SocketService, decorators: [{
365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: ReactiveDictionary, decorators: [{
283
366
  type: Injectable,
284
367
  args: [{
285
- providedIn: 'root'
368
+ providedIn: 'root' // This makes the service a singleton and available throughout the app
286
369
  }]
287
- }], ctorParameters: () => [{ type: undefined, decorators: [{
288
- type: Inject,
289
- args: [SOCKET_URL]
290
- }] }] });
370
+ }], ctorParameters: () => [{ type: SocketService }] });
291
371
 
292
372
  let Menu = class Menu extends BaseModel {
293
373
  };
@@ -459,39 +539,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
459
539
  }]
460
540
  }], ctorParameters: () => [{ type: i1.DatastoreCore }] });
461
541
 
462
- class WsAuthService {
463
- constructor() {
464
- this.token = null;
465
- }
466
- get Token() {
467
- return this.token;
468
- }
469
- set Token(token) {
470
- this.token = token;
471
- }
472
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WsAuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
473
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WsAuthService, providedIn: 'root' }); }
474
- }
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WsAuthService, decorators: [{
476
- type: Injectable,
477
- args: [{
478
- providedIn: 'root'
479
- }]
480
- }], ctorParameters: () => [] });
481
-
482
542
  class FullComponent {
483
- constructor(userService, router, socketService, translate, wsAuthService) {
543
+ constructor(userService, router, translate, rdict) {
484
544
  this.userService = userService;
485
545
  this.router = router;
486
- this.socketService = socketService;
487
546
  this.translate = translate;
488
- this.wsAuthService = wsAuthService;
547
+ this.rdict = rdict;
489
548
  this.selected = "Inbox";
490
549
  this.menuSvg = menuIcon;
491
550
  this.expandedIndices = [2];
492
551
  this.hasItems = false;
493
552
  this.items = [];
494
553
  this.icons = allIcons;
554
+ //private rdict: ReactiveDictionary | undefined;
495
555
  this.apptitle = "Test";
496
556
  this.isItemExpanded = (item) => {
497
557
  return this.expandedIndices.indexOf(item.id) >= 0;
@@ -499,9 +559,6 @@ class FullComponent {
499
559
  this.getMenu();
500
560
  }
501
561
  async ngOnInit() {
502
- this.rdict = ReactiveDictionary.getInstance(this.socketService, this.wsAuthService.Token);
503
- if (this.rdict.size == 0)
504
- await this.rdict.asyncInit();
505
562
  this.apptitle = await this.rdict.asyncGet("appname");
506
563
  }
507
564
  getMenu() {
@@ -555,8 +612,8 @@ class FullComponent {
555
612
  });
556
613
  return drawerItems;
557
614
  }
558
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: FullComponent, deps: [{ token: UserService }, { token: i1$1.Router }, { token: SocketService }, { token: i2.TranslateService }, { token: WsAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
559
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: FullComponent, isStandalone: true, selector: "rdict-full", ngImport: i0, template: "<div class=\"custom-toolbar\">\r\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\r\n <!-- <kendo-toolbar-button icon=\"menu\" themeColor=\"tertiary\" (click)=\"drawer.toggle()\"> </kendo-toolbar-button> -->\r\n <span class=\"app-title\">{{apptitle}}</span>\r\n</div>\r\n<kendo-drawer-container>\r\n <kendo-drawer #drawer [items]=\"items\" mode=\"push\" [mini]=\"true\" [expanded]=\"true\" (select)=\"onSelect($event)\"\r\n [autoCollapse]=\"false\" [isItemExpanded]=\"isItemExpanded\">\r\n <!-- <ng-template kendoDrawerItemTemplate let-item>\r\n <div *ngIf=\"item.path !== ''\" class=\"k-drawer-link\" [routerLink]=\"item.path\">\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n <div *ngIf=\"item.path == ''\" class=\"k-drawer-link\" >\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n </ng-template> -->\r\n </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\r\n <!-- <div>{{selected}}</div> -->\r\n <!-- <my-content [selectedItem]=\"selected\"></my-content> -->\r\n </kendo-drawer-content>\r\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;color:#656565}.custom-toolbar button{margin:3px 0 3px 8px}.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", "routerOutletData"], 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" }] }); }
615
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: FullComponent, deps: [{ token: UserService }, { token: i1$1.Router }, { token: i2.TranslateService }, { token: ReactiveDictionary }], target: i0.ɵɵFactoryTarget.Component }); }
616
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: FullComponent, isStandalone: true, selector: "rdict-full", ngImport: i0, template: "<div class=\"custom-toolbar\">\r\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\r\n <!-- <kendo-toolbar-button icon=\"menu\" themeColor=\"tertiary\" (click)=\"drawer.toggle()\"> </kendo-toolbar-button> -->\r\n <span class=\"app-title\">{{apptitle}}</span>\r\n</div>\r\n<kendo-drawer-container>\r\n <kendo-drawer #drawer [items]=\"items\" mode=\"push\" [mini]=\"true\" [expanded]=\"true\" (select)=\"onSelect($event)\"\r\n [autoCollapse]=\"false\" [isItemExpanded]=\"isItemExpanded\">\r\n <!-- <ng-template kendoDrawerItemTemplate let-item>\r\n <div *ngIf=\"item.path !== ''\" class=\"k-drawer-link\" [routerLink]=\"item.path\">\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n <div *ngIf=\"item.path == ''\" class=\"k-drawer-link\" >\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n </ng-template> -->\r\n </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\r\n <!-- <div>{{selected}}</div> -->\r\n <!-- <my-content [selectedItem]=\"selected\"></my-content> -->\r\n </kendo-drawer-content>\r\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;color:#656565}.custom-toolbar button{margin:3px 0 3px 8px}.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", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonsModule }, { kind: "component", type: i5.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: i6.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: i6.DrawerContainerComponent, selector: "kendo-drawer-container" }, { kind: "component", type: i6.DrawerContentComponent, selector: "kendo-drawer-content" }] }); }
560
617
  }
561
618
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: FullComponent, decorators: [{
562
619
  type: Component,
@@ -570,7 +627,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
570
627
  LayoutModule,
571
628
  KENDO_SVGICON
572
629
  ], template: "<div class=\"custom-toolbar\">\r\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\r\n <!-- <kendo-toolbar-button icon=\"menu\" themeColor=\"tertiary\" (click)=\"drawer.toggle()\"> </kendo-toolbar-button> -->\r\n <span class=\"app-title\">{{apptitle}}</span>\r\n</div>\r\n<kendo-drawer-container>\r\n <kendo-drawer #drawer [items]=\"items\" mode=\"push\" [mini]=\"true\" [expanded]=\"true\" (select)=\"onSelect($event)\"\r\n [autoCollapse]=\"false\" [isItemExpanded]=\"isItemExpanded\">\r\n <!-- <ng-template kendoDrawerItemTemplate let-item>\r\n <div *ngIf=\"item.path !== ''\" class=\"k-drawer-link\" [routerLink]=\"item.path\">\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n <div *ngIf=\"item.path == ''\" class=\"k-drawer-link\" >\r\n <kendo-svgicon [icon]=\"item.svgIcon\"></kendo-svgicon>\r\n <span>{{ item.text }}</span>\r\n </div>\r\n </ng-template> -->\r\n </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\r\n <!-- <div>{{selected}}</div> -->\r\n <!-- <my-content [selectedItem]=\"selected\"></my-content> -->\r\n </kendo-drawer-content>\r\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;color:#656565}.custom-toolbar button{margin:3px 0 3px 8px}.app-title{margin-left:20px;font-weight:700;font-size:17px}\n"] }]
573
- }], ctorParameters: () => [{ type: UserService }, { type: i1$1.Router }, { type: SocketService }, { type: i2.TranslateService }, { type: WsAuthService }] });
630
+ }], ctorParameters: () => [{ type: UserService }, { type: i1$1.Router }, { type: i2.TranslateService }, { type: ReactiveDictionary }] });
574
631
 
575
632
  class TranslateExtension {
576
633
  constructor(translate) {
@@ -639,57 +696,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
639
696
  }]
640
697
  }] });
641
698
 
642
- ;
643
699
  class RdictCrudComponent {
644
- // = [
645
- // {
646
- // key: 'name',
647
- // type: 'input',
648
- // props: {
649
- // label: 'General.Name',
650
- // translate: true,
651
- // required: true,
652
- // }
653
- // },
654
- // ];
655
- constructor(router, route, translate, socketService, wsAuthService) {
700
+ constructor(router, route, translate, rdict) {
656
701
  this.router = router;
657
702
  this.route = route;
658
703
  this.translate = translate;
659
- this.socketService = socketService;
660
- this.wsAuthService = wsAuthService;
704
+ this.rdict = rdict;
661
705
  this.baseForm = new FormGroup({});
662
706
  this.model = {};
663
707
  this.options = {};
664
708
  this.fields = [];
709
+ this.saveIcon = saveIcon;
665
710
  }
666
711
  async ngOnInit() {
667
- const currentUrlSegments = this.router.url.split('/').map(segment => new UrlSegment(segment, {}));
668
- this.basePath = currentUrlSegments.map(segment => segment.path).join('/');
669
- const filteredSegments = currentUrlSegments.filter(segment => segment.path !== '');
670
- this.dictPath = filteredSegments.map(segment => segment.path).join('.');
671
- this.rdictModel = filteredSegments.length > 0 ? filteredSegments[filteredSegments.length - 2].path : ''; // Default to empty string if no valid segments
672
- this.rdict = ReactiveDictionary.getInstance(this.socketService, this.wsAuthService.Token);
673
- if (this.rdict.size == 0)
674
- await this.rdict.asyncInit();
675
- await this.getModelFields();
712
+ const currentUrlSegments = this.router.url.split('/').filter(segment => segment !== '' && isNaN(Number(segment)));
713
+ if (['add', 'edit'].includes(currentUrlSegments[currentUrlSegments.length - 1])) {
714
+ currentUrlSegments.pop();
715
+ }
716
+ this.dictPath = currentUrlSegments.join('.');
717
+ this.rdictModel = currentUrlSegments.length > 0 ? currentUrlSegments[currentUrlSegments.length - 1] : '';
718
+ this.getModelFields();
676
719
  }
677
720
  onSubmit(model) {
721
+ this.saveModel(this.baseForm);
678
722
  }
679
- async getModelFields() {
723
+ getModelFields() {
680
724
  if (this.rdictModel) {
681
- const formLayout = await this.rdict.asyncGet("config.models." + this.rdictModel + ".formLayout");
682
- // const tableLayout = await this.rdict.asyncGet("config.models." + this.rdictModel + ".tableLayout");
683
- console.log(formLayout);
684
- // console.log(tableLayout);
685
- if (formLayout) {
686
- this.title = this.translate.instant(formLayout["title"]);
687
- this.fields = formLayout["fields"];
688
- }
725
+ this.rdict.getAsObservable("config.models." + this.rdictModel + ".formLayout").subscribe({
726
+ next: formLayout => {
727
+ if (formLayout) {
728
+ this.title = this.translate.instant(formLayout["title"]);
729
+ this.fields = formLayout["fields"];
730
+ }
731
+ },
732
+ error: err => console.error('Error:', err.message),
733
+ });
689
734
  }
690
735
  }
691
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: RdictCrudComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: SocketService }, { token: WsAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
692
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: RdictCrudComponent, isStandalone: true, selector: "app-rdict-crud", ngImport: i0, template: "<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n</form>", styles: [""], dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i4$1.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyKendoModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CrudFormlyTransaltionModule }] }); }
736
+ async onSave() {
737
+ await this.saveModel(this.baseForm);
738
+ }
739
+ async saveModel(fg) {
740
+ if (fg.valid) {
741
+ var dict = await this.rdict.asyncGet(this.dictPath);
742
+ await dict.addNew(fg.value);
743
+ console.log(fg.value);
744
+ }
745
+ else {
746
+ this.validateAllFormFields(fg);
747
+ }
748
+ }
749
+ validateAllFormFields(fg) {
750
+ Object.keys(fg.controls).forEach(field => {
751
+ // console.log(field);
752
+ const control = fg.get(field);
753
+ if (control instanceof FormControl) {
754
+ control.markAsTouched({ onlySelf: true });
755
+ }
756
+ else if (control instanceof FormGroup) {
757
+ this.validateAllFormFields(control);
758
+ }
759
+ });
760
+ }
761
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: RdictCrudComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: ReactiveDictionary }], target: i0.ɵɵFactoryTarget.Component }); }
762
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: RdictCrudComponent, isStandalone: true, selector: "app-rdict-crud", ngImport: i0, template: "<kendo-toolbar>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Save\" showText=\"both\" [svgIcon]=\"saveIcon\" showIcon=\"both\" themeColor=\"primary\"\r\n [disabled]=\"false\" (click)=\"onSave()\">\r\n </kendo-toolbar-button>\r\n</kendo-toolbar>\r\n<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n</form>", styles: [""], dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyKendoModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CrudFormlyTransaltionModule }, { kind: "component", type: i6$1.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i6$1.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: i6$1.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }] }); }
693
763
  }
694
764
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: RdictCrudComponent, decorators: [{
695
765
  type: Component,
@@ -698,9 +768,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
698
768
  ReactiveFormsModule,
699
769
  FormlyKendoModule,
700
770
  TranslateModule,
701
- CrudFormlyTransaltionModule
702
- ], template: "<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n</form>" }]
703
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: SocketService }, { type: WsAuthService }] });
771
+ CrudFormlyTransaltionModule,
772
+ KENDO_TOOLBAR
773
+ ], template: "<kendo-toolbar>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Save\" showText=\"both\" [svgIcon]=\"saveIcon\" showIcon=\"both\" themeColor=\"primary\"\r\n [disabled]=\"false\" (click)=\"onSave()\">\r\n </kendo-toolbar-button>\r\n</kendo-toolbar>\r\n<form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n</form>" }]
774
+ }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: ReactiveDictionary }] });
704
775
 
705
776
  class RdictTableTitle extends ToolBarToolComponent {
706
777
  constructor() {
@@ -734,14 +805,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
734
805
  }] } });
735
806
 
736
807
  class GenericRdictTableComponent {
737
- constructor(router, route, translate, injector, socketService, wsAuthService, el) {
808
+ constructor(router, route, translate, injector, el, rdict) {
738
809
  this.router = router;
739
810
  this.route = route;
740
811
  this.translate = translate;
741
812
  this.injector = injector;
742
- this.socketService = socketService;
743
- this.wsAuthService = wsAuthService;
744
813
  this.el = el;
814
+ this.rdict = rdict;
815
+ this.themeColors = [
816
+ "base",
817
+ "primary",
818
+ "secondary",
819
+ "tertiary",
820
+ "info",
821
+ "success",
822
+ "warning",
823
+ "error",
824
+ "dark",
825
+ "light",
826
+ "inverse",
827
+ ];
745
828
  this.editOnClick = false;
746
829
  this.editOnDblClick = false;
747
830
  this.data = [];
@@ -761,6 +844,9 @@ class GenericRdictTableComponent {
761
844
  // SelectionType = SelectionType;
762
845
  this.headerHeight = 50;
763
846
  this.rowHeight = 50;
847
+ this.svgEdit = pencilIcon;
848
+ this.svgDelete = trashIcon;
849
+ this.svgAdd = plusIcon;
764
850
  }
765
851
  async ngOnInit() {
766
852
  this.setValueFromSnapshot(this, this.route.snapshot, 'model', "");
@@ -791,13 +877,8 @@ class GenericRdictTableComponent {
791
877
  // Perform actions or update component as needed
792
878
  }
793
879
  });
794
- this.rdict = ReactiveDictionary.getInstance(this.socketService, this.wsAuthService.Token);
795
- if (this.rdict.size == 0)
796
- await this.rdict.asyncInit();
797
- await this.getListLayout();
798
- await this.loadData();
799
- // this.isLoading = true;
800
- // this.onScroll(0);
880
+ this.getListLayout();
881
+ this.loadData();
801
882
  }
802
883
  setValueFromSnapshot(component, snapshot, key, defaultValue) {
803
884
  if (component[key] === undefined) {
@@ -809,117 +890,35 @@ class GenericRdictTableComponent {
809
890
  }
810
891
  }
811
892
  async loadData() {
812
- var x = await this.rdict.getTable(this.dictPath);
813
- const result = x.map(dictionary => {
814
- // Convert Map to object and filter out __guid
815
- const filteredObject = {};
816
- for (const [key, value] of dictionary.entries()) {
817
- if (key !== '__guid') {
818
- filteredObject[key] = value;
819
- }
820
- }
821
- return filteredObject;
893
+ this.rdict.getTableAsObservable(this.dictPath).subscribe({
894
+ next: value => {
895
+ this.dataSource = value;
896
+ },
897
+ error: err => console.error('Error:', err.message),
822
898
  });
823
- this.dataSource = result; //new MatTableDataSource(result);
824
899
  }
825
- // async handleChange(event) {
826
- // this.filterValue = event.target.value.toLowerCase();
827
- // this.data = [];
828
- // this.pageIndex = 1
829
- // this.loadData();
830
- // }
831
- // loadData(event = null) {
832
- // const filters = [];
833
- // let sorts = '';
834
- // this.isLoading = true;
835
- // if (this.defaultSort) {
836
- // if (this.defaultSortDirection === 'desc') {
837
- // sorts = '-' + this.defaultSort;
838
- // } else {
839
- // sorts = this.defaultSort;
840
- // }
841
- // }
842
- // if (this.showSerach) {
843
- // if (this.filterValue) {
844
- // const y = '(' + this.searchFields.replace(',', '|') + ')';
845
- // filters.push(y + '@=*' + this.filterValue);
846
- // }
847
- // }
848
- // if (this.defaultFilter) {
849
- // filters.push(this.defaultFilter)
850
- // }
851
- // setTimeout(() => {
852
- // const filtersValue = filters.join(', ');
853
- // this.modelService.getAll(this.pageIndex, this.pageSize, sorts, filtersValue, this.customInclude).subscribe(
854
- // (response: BaseQueryData<T>) => {
855
- // if (this.pageIndex !== response.getMeta().meta.count) {
856
- // this.pageIndex++
857
- // } else {
858
- // if (event) event.target.disabled = true;
859
- // }
860
- // // if (this.filterValue)
861
- // // this.data = response.getModels();
862
- // // else
863
- // const rows = [...this.data, ...response.getModels()];
864
- // this.data = rows;
865
- // // this.data = this.data.concat();
866
- // if (event) event.target.complete();
867
- // this.isLoading = false;
868
- // })
869
- // }, 700);
870
- // }
871
- // async handleRefresh(event) {
872
- // this.pageIndex = 1
873
- // this.data = [];
874
- // this.loadData();
875
- // event.target.complete();
876
- // }
877
- // onAdd() {
878
- // console.log(this.basePath)
879
- // this.router.navigate([this.basePath + '/add'])
880
- // // this.navCtrl.navigateForward(this.basePath + '/add');
881
- // }
882
- // editModel(model: BaseModelFormly) {
883
- // if (this.canEdit)
884
- // this.router.navigate([this.basePath + '/edit/', model.id]);
885
- // // this.navCtrl.navigateForward(this.basePath + '/edit/' + model.id);
886
- // }
887
- async getListLayout() {
900
+ getListLayout() {
888
901
  if (this.model) {
889
- this.tableLayout = await this.rdict.asyncGet("config.models." + this.model + ".tableLayout");
890
- const formLayout = await this.rdict.asyncGet("config.models." + this.model + ".formLayout");
891
- console.log(formLayout);
892
- if (this.tableLayout) {
893
- this.title = this.translate.instant(this.tableLayout["title"]);
894
- this.allColumns = this.tableLayout["columns"].map(item => {
895
- if (!item.isTranslated) {
896
- item.name = this.translate.instant(item.translateKey);
897
- item.isTranslated = true;
902
+ this.rdict.getAsObservable("config.models." + this.model + ".tableLayout").subscribe({
903
+ next: value => {
904
+ if (value) {
905
+ this.tableLayout = value;
906
+ this.title = this.translate.instant(this.tableLayout["title"]);
907
+ this.allColumns = this.tableLayout["columns"].map(item => {
908
+ if (!item.isTranslated) {
909
+ item.name = this.translate.instant(item.translateKey);
910
+ item.isTranslated = true;
911
+ }
912
+ return item;
913
+ });
914
+ this.columns = [];
915
+ this.allColumns.sort((a, b) => a.order - b.order);
916
+ this.displayedColumns = [];
917
+ this.displayedColumns.push.apply(this.displayedColumns, this.allColumns.map(x => x.propertyName));
898
918
  }
899
- return item;
900
- });
901
- this.columns = [];
902
- this.allColumns.sort((a, b) => a.order - b.order);
903
- // if (this.canDelete || this.canEdit) {
904
- // this.allColumns.push({
905
- // // cellTemplate: null,
906
- // name: '',
907
- // // cellClass: 'actions-cell',
908
- // draggable: false,
909
- // sortable: false,
910
- // visible: true
911
- // // width: 100,
912
- // // maxWidth: 100,
913
- // // minWidth: 100
914
- // })
915
- // }
916
- // this.columns = this.allColumns.filter((item: IonicDataTableLayoutConfig) => item.visible);
917
- this.displayedColumns = [];
918
- // if (this.allowReorderItems) {
919
- // this.displayedColumns.push('position')
920
- // }
921
- this.displayedColumns.push.apply(this.displayedColumns, this.allColumns.map(x => x.propertyName));
922
- }
919
+ },
920
+ error: err => console.error('Error:', err.message),
921
+ });
923
922
  }
924
923
  }
925
924
  addHandler() {
@@ -928,11 +927,11 @@ class GenericRdictTableComponent {
928
927
  // this.editDataItem = new Product();
929
928
  // this.isNew = true;
930
929
  }
931
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", 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 }); }
932
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: GenericRdictTableComponent, isStandalone: true, selector: "rsl-rdict-generic-table", inputs: { showSerach: "showSerach", searchFields: "searchFields", customInclude: "customInclude", defaultSort: "defaultSort", 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: "filter", first: true, predicate: ElementRef, descendants: true }], ngImport: i0, template: "<kendo-grid [data]=\"dataSource\" \r\n [sortable]=\"true\" \r\n [filterable]=\"showSerach\"\r\n (add)=\"addHandler()\">\r\n <kendo-toolbar>\r\n <table-title text=\"{{title}}\"></table-title>\r\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\r\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\r\n </kendo-toolbar>\r\n <!-- <kendo-toolbar>\r\n \r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <button kendoGridAddCommand type=\"button\">Add new</button>\r\n </kendo-toolbar> -->\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\r\n title=\" {{column.translateKey | translate}}\">\r\n </kendo-grid-column>\r\n</kendo-grid>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5$2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type:
930
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GenericRdictTableComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: i0.Injector }, { token: i0.ElementRef }, { token: ReactiveDictionary }], target: i0.ɵɵFactoryTarget.Component }); }
931
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: GenericRdictTableComponent, isStandalone: true, selector: "rsl-rdict-generic-table", inputs: { showSerach: "showSerach", searchFields: "searchFields", customInclude: "customInclude", defaultSort: "defaultSort", 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: "filter", first: true, predicate: ElementRef, descendants: true }], ngImport: i0, template: "<kendo-grid [data]=\"dataSource\" \r\n [sortable]=\"true\" \r\n [filterable]=\"showSerach\"\r\n [resizable]=\"true\"\r\n (add)=\"addHandler()\">\r\n <kendo-toolbar>\r\n <table-title text=\"{{title}}\"></table-title>\r\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\r\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button kendoButton [svgIcon]=\"svgAdd\" text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\r\n </kendo-toolbar>\r\n\r\n <!-- <kendo-toolbar>\r\n \r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <button kendoGridAddCommand type=\"button\">Add new</button>\r\n </kendo-toolbar> -->\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\r\n title=\" {{column.translateKey | translate}}\">\r\n </kendo-grid-column>\r\n <kendo-grid-command-column title=\"\" [width]=\"100\" >\r\n <ng-template kendoGridCellTemplate>\r\n <button kendoButton [svgIcon]=\"svgEdit\" themeColor=\"light\" ></button>\r\n <button kendoButton [svgIcon]=\"svgDelete\" themeColor=\"error\"></button>\r\n </ng-template>\r\n </kendo-grid-command-column>\r\n</kendo-grid>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type:
933
932
  // MatPaginatorModule,
934
933
  // MatTableModule,
935
- 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 }); }
934
+ TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: i5$2.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: i5$2.ColumnComponent, selector: "kendo-grid-column", inputs: ["field", "format", "sortable", "groupable", "editor", "filter", "filterable", "editable"] }, { kind: "component", type: i5$2.CommandColumnComponent, selector: "kendo-grid-command-column" }, { kind: "directive", type: i5$2.CellTemplateDirective, selector: "[kendoGridCellTemplate]" }, { kind: "directive", type: i5$2.AddCommandToolbarDirective, selector: "[kendoGridAddTool]" }, { kind: "component", type: i6$1.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i6$1.ToolbarCustomMessagesComponent, selector: "kendo-toolbar-messages" }, { kind: "component", type: i6$1.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: i6$1.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { kind: "component", type: i5.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: "component", type: RdictTableTitle, selector: "table-title", inputs: ["text"] }], encapsulation: i0.ViewEncapsulation.None }); }
936
935
  }
937
936
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: GenericRdictTableComponent, decorators: [{
938
937
  type: Component,
@@ -945,9 +944,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
945
944
  KENDO_GRID,
946
945
  KENDO_TOOLBAR,
947
946
  KENDO_LABEL,
947
+ KENDO_BUTTONS,
948
948
  RdictTableTitle
949
- ], providers: [], template: "<kendo-grid [data]=\"dataSource\" \r\n [sortable]=\"true\" \r\n [filterable]=\"showSerach\"\r\n (add)=\"addHandler()\">\r\n <kendo-toolbar>\r\n <table-title text=\"{{title}}\"></table-title>\r\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\r\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\r\n </kendo-toolbar>\r\n <!-- <kendo-toolbar>\r\n \r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <button kendoGridAddCommand type=\"button\">Add new</button>\r\n </kendo-toolbar> -->\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\r\n title=\" {{column.translateKey | translate}}\">\r\n </kendo-grid-column>\r\n</kendo-grid>" }]
950
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: i0.Injector }, { type: SocketService }, { type: WsAuthService }, { type: i0.ElementRef }], propDecorators: { showSerach: [{
949
+ ], providers: [], template: "<kendo-grid [data]=\"dataSource\" \r\n [sortable]=\"true\" \r\n [filterable]=\"showSerach\"\r\n [resizable]=\"true\"\r\n (add)=\"addHandler()\">\r\n <kendo-toolbar>\r\n <table-title text=\"{{title}}\"></table-title>\r\n <kendo-toolbar-messages>Test</kendo-toolbar-messages>\r\n <!-- <kendo-toolbar-separator></kendo-toolbar-separator> -->\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button kendoButton [svgIcon]=\"svgAdd\" text=\"Add new\" kendoGridAddTool></kendo-toolbar-button>\r\n </kendo-toolbar>\r\n\r\n <!-- <kendo-toolbar>\r\n \r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <button kendoGridAddCommand type=\"button\">Add new</button>\r\n </kendo-toolbar> -->\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" field=\"{{ column.propertyName }}\"\r\n title=\" {{column.translateKey | translate}}\">\r\n </kendo-grid-column>\r\n <kendo-grid-command-column title=\"\" [width]=\"100\" >\r\n <ng-template kendoGridCellTemplate>\r\n <button kendoButton [svgIcon]=\"svgEdit\" themeColor=\"light\" ></button>\r\n <button kendoButton [svgIcon]=\"svgDelete\" themeColor=\"error\"></button>\r\n </ng-template>\r\n </kendo-grid-command-column>\r\n</kendo-grid>\r\n" }]
950
+ }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: i0.Injector }, { type: i0.ElementRef }, { type: ReactiveDictionary }], propDecorators: { showSerach: [{
951
951
  type: Input
952
952
  }], searchFields: [{
953
953
  type: Input
@@ -993,5 +993,5 @@ const SOCKET_URL = new InjectionToken('SocketUrl');
993
993
  * Generated bundle index. Do not edit.
994
994
  */
995
995
 
996
- export { FullComponent, GenericRdictTableComponent, Menu, RdictCrudComponent, ReactiveDictionary, Right, SOCKET_URL, SocketService, User, UserService, WsAuthService };
996
+ export { FullComponent, GenericRdictTableComponent, Menu, RdictCrudComponent, ReactiveDictionary, Right, SOCKET_URL, SocketService, User, UserService };
997
997
  //# sourceMappingURL=rosoftlab-rdict.mjs.map