@rosoftlab/rdict 1.0.4-alpha-12 → 1.0.5-alpha-2

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,40 +1,31 @@
1
- import * as i6 from '@angular/common';
1
+ import * as i1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Inject, Injectable, forwardRef, ViewChild, Input, Component, NgModule, HostBinding, EventEmitter, ElementRef, Output, ViewEncapsulation, InjectionToken } 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, TranslateService } from '@ngx-translate/core';
9
- import { ButtonsModule, KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
4
+ import { InjectionToken, Inject, Injectable, forwardRef, ViewChild, Input, Component } from '@angular/core';
5
+ import * as i2 from '@angular/router';
6
+ import { RouterModule } from '@angular/router';
7
+ import * as i3 from '@ngx-translate/core';
8
+ import { TranslateModule } from '@ngx-translate/core';
9
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
10
10
  import { KENDO_SVGICON } from '@progress/kendo-angular-icons';
11
- import * as i6$1 from '@progress/kendo-angular-layout';
11
+ import * as i6 from '@progress/kendo-angular-layout';
12
12
  import { LayoutModule } from '@progress/kendo-angular-layout';
13
13
  import * as i5 from '@progress/kendo-angular-toolbar';
14
14
  import { ToolBarToolComponent, ToolBarModule, KENDO_TOOLBAR } from '@progress/kendo-angular-toolbar';
15
15
  import * as allIcons from '@progress/kendo-svg-icons';
16
- import { menuIcon, userIcon, logoutIcon, saveIcon, arrowLeftIcon, pencilIcon, trashIcon, plusIcon } from '@progress/kendo-svg-icons';
17
- import * as i1 from '@rosoftlab/core';
18
- import { Subject, fromEvent, Observable, defer, mergeMap, filter, race, first, map, timeout, from, tap, catchError, throwError, BehaviorSubject } from 'rxjs';
16
+ import { menuIcon, userIcon, logoutIcon } from '@progress/kendo-svg-icons';
17
+ import * as i1$1 from '@rosoftlab/core';
18
+ import { Subject, fromEvent, Observable, defer, mergeMap, filter, race, first, map, timeout, from, tap, catchError, throwError } from 'rxjs';
19
19
  import { v4 } from 'uuid';
20
20
  import { io } from 'socket.io-client';
21
- import * as i8 from '@angular/forms';
22
- import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
23
- import * as i7 from '@ngx-formly/core';
24
- import { FORMLY_CONFIG, FormlyModule } from '@ngx-formly/core';
25
- import { FormlyKendoModule } from '@ngx-formly/kendo';
26
- import * as i2$1 from '@progress/kendo-angular-dialog';
27
- import { DialogCloseResult, KENDO_DIALOG } from '@progress/kendo-angular-dialog';
28
- import * as i9 from '@progress/kendo-angular-grid';
29
- import { KENDO_GRID } from '@progress/kendo-angular-grid';
30
- import * as i1$3 from '@progress/kendo-angular-label';
31
- import { KENDO_LABEL } from '@progress/kendo-angular-label';
32
- import * as i3 from '@progress/kendo-angular-notification';
33
- import * as i6$2 from '@progress/kendo-angular-intl';
21
+ import * as msgpack from '@msgpack/msgpack';
34
22
  import * as i1$2 from '@angular/common/http';
35
23
  import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
36
24
  import { filter as filter$1, map as map$1 } from 'rxjs/operators';
37
25
 
26
+ // projects/my-library/src/lib/socket-config.token.ts
27
+ const SOCKET_URL = new InjectionToken('SocketUrl');
28
+
38
29
  class SocketService {
39
30
  constructor(socketUrl) {
40
31
  this.disconnect$ = new Subject();
@@ -639,7 +630,7 @@ class KendoToolbarSpanComponent extends ToolBarToolComponent {
639
630
  <ng-template #toolbarTemplate>
640
631
  <span [ngClass]="cssClass" [textContent]="text"></span>
641
632
  </ng-template>
642
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
633
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
643
634
  }
644
635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: KendoToolbarSpanComponent, decorators: [{
645
636
  type: Component,
@@ -747,8 +738,8 @@ class FullComponent {
747
738
  });
748
739
  return drawerItems;
749
740
  }
750
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: FullComponent, deps: [{ token: i1.UserService }, { token: i1$1.Router }, { token: i2.TranslateService }, { token: ReactiveDictionary }, { token: i1.AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
751
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", 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 <span class=\"app-title\">{{apptitle}}</span>\r\n</div> -->\r\n<kendo-toolbar>\r\n <kendo-toolbar-span text=\"{{apptitle}}\" cssClass=\"app-title\"></kendo-toolbar-span>\r\n <kendo-toolbar-button [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></kendo-toolbar-button>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-dropdownbutton text=\"{{auth_service?.name}}\" [svgIcon]=\"userSvg\" [data]=\"user_menu\"></kendo-toolbar-dropdownbutton>\r\n</kendo-toolbar>\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 </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\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: "ngmodule", type: ToolBarModule }, { kind: "component", type: i5.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex", "showIcon", "showText"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i5.ToolBarButtonComponent, selector: "kendo-toolbar-button", inputs: ["showText", "showIcon", "text", "style", "className", "title", "disabled", "toggleable", "look", "togglable", "selected", "fillMode", "rounded", "themeColor", "icon", "iconClass", "svgIcon", "imageUrl"], outputs: ["click", "pointerdown", "selectedChange"], exportAs: ["kendoToolBarButton"] }, { kind: "component", type: i5.ToolBarDropDownButtonComponent, selector: "kendo-toolbar-dropdownbutton", inputs: ["arrowIcon", "title", "showText", "showIcon", "text", "icon", "svgIcon", "iconClass", "imageUrl", "popupSettings", "look", "primary", "fillMode", "themeColor", "buttonClass", "textField", "disabled", "data"], outputs: ["itemClick", "open", "close"], exportAs: ["kendoToolBarDropDownButton"] }, { kind: "component", type: i5.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { kind: "ngmodule", type: LayoutModule }, { kind: "component", type: i6$1.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$1.DrawerContainerComponent, selector: "kendo-drawer-container" }, { kind: "component", type: i6$1.DrawerContentComponent, selector: "kendo-drawer-content" }, { kind: "component", type: KendoToolbarSpanComponent, selector: "kendo-toolbar-span", inputs: ["text", "cssClass"] }] }); }
741
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: FullComponent, deps: [{ token: i1$1.UserService }, { token: i2.Router }, { token: i3.TranslateService }, { token: ReactiveDictionary }, { token: i1$1.AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
742
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", 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 <span class=\"app-title\">{{apptitle}}</span>\r\n</div> -->\r\n<kendo-toolbar>\r\n <kendo-toolbar-span text=\"{{apptitle}}\" cssClass=\"app-title\"></kendo-toolbar-span>\r\n <kendo-toolbar-button [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></kendo-toolbar-button>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-dropdownbutton text=\"{{auth_service?.name}}\" [svgIcon]=\"userSvg\" [data]=\"user_menu\"></kendo-toolbar-dropdownbutton>\r\n</kendo-toolbar>\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 </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\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: i2.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: ButtonsModule }, { kind: "ngmodule", type: ToolBarModule }, { kind: "component", type: i5.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i5.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: i5.ToolBarDropDownButtonComponent, selector: "kendo-toolbar-dropdownbutton", inputs: ["arrowIcon", "title", "showText", "showIcon", "text", "icon", "svgIcon", "iconClass", "imageUrl", "popupSettings", "look", "primary", "fillMode", "themeColor", "buttonClass", "textField", "disabled", "data"], outputs: ["itemClick", "open", "close"], exportAs: ["kendoToolBarDropDownButton"] }, { kind: "component", type: i5.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { 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" }, { kind: "component", type: KendoToolbarSpanComponent, selector: "kendo-toolbar-span", inputs: ["text", "cssClass"] }] }); }
752
743
  }
753
744
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: FullComponent, decorators: [{
754
745
  type: Component,
@@ -764,386 +755,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
764
755
  KENDO_TOOLBAR,
765
756
  KendoToolbarSpanComponent
766
757
  ], template: "<!-- <div class=\"custom-toolbar\">\r\n <button kendoButton [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></button>\r\n <span class=\"app-title\">{{apptitle}}</span>\r\n</div> -->\r\n<kendo-toolbar>\r\n <kendo-toolbar-span text=\"{{apptitle}}\" cssClass=\"app-title\"></kendo-toolbar-span>\r\n <kendo-toolbar-button [svgIcon]=\"menuSvg\" fillMode=\"flat\" (click)=\"drawer.toggle()\"></kendo-toolbar-button>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-dropdownbutton text=\"{{auth_service?.name}}\" [svgIcon]=\"userSvg\" [data]=\"user_menu\"></kendo-toolbar-dropdownbutton>\r\n</kendo-toolbar>\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 </kendo-drawer>\r\n\r\n <kendo-drawer-content>\r\n <router-outlet></router-outlet>\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"] }]
767
- }], ctorParameters: () => [{ type: i1.UserService }, { type: i1$1.Router }, { type: i2.TranslateService }, { type: ReactiveDictionary }, { type: i1.AuthService }] });
768
-
769
- class MaterialDialogService {
770
- constructor(translate, dialogService, notificationService) {
771
- this.translate = translate;
772
- this.dialogService = dialogService;
773
- this.notificationService = notificationService;
774
- this.state = {
775
- content: "Your data has been saved.",
776
- type: { style: "success", icon: true },
777
- animation: { type: "slide", duration: 400 },
778
- hideAfter: 3000,
779
- };
780
- }
781
- confirmDelete() {
782
- return this.confirm(this.translate.instant("Are you sure you want to delete this record ?"), this.translate.instant("Delete Record"), this.translate.instant("General.Yes"), this.translate.instant("General.No"));
783
- }
784
- confirm(content, title, confirmButtonText, cancelButtonText) {
785
- const dialog = this.dialogService.open({
786
- title: title || "Confirm",
787
- content: content || "Are you sure?",
788
- actions: [
789
- { text: cancelButtonText || "No", result: false },
790
- { text: confirmButtonText || "Yes", themeColor: "primary", result: true }
791
- ],
792
- width: 450,
793
- height: 200,
794
- minWidth: 250,
795
- });
796
- // Return an Observable<boolean>
797
- return new Observable((observer) => {
798
- dialog.result.subscribe((result) => {
799
- if (result instanceof DialogCloseResult) {
800
- // Dialog was closed without an action
801
- observer.next(false);
802
- }
803
- else {
804
- const actionResult = result;
805
- observer.next(actionResult.result);
806
- }
807
- observer.complete(); // Complete the observable
808
- });
809
- });
810
- }
811
- showError(content, title, confirmButtonText, cancelButtonText) {
812
- const dialog = this.dialogService.open({
813
- title: title || "Error",
814
- content: content || "Error message?",
815
- width: 450,
816
- height: 200,
817
- minWidth: 250,
818
- });
819
- // Return an Observable<boolean>
820
- return new Observable((observer) => {
821
- dialog.result.subscribe((result) => {
822
- if (result instanceof DialogCloseResult) {
823
- // Dialog was closed without an action
824
- observer.next(false);
825
- }
826
- else {
827
- const actionResult = result;
828
- observer.next(actionResult.result);
829
- }
830
- observer.complete(); // Complete the observable
831
- });
832
- });
833
- }
834
- showSaveMessage(message) {
835
- this.state.content = message || "Your data has been saved.";
836
- this.state.type = { style: "success", icon: true };
837
- this.notificationService.show(this.state);
838
- }
839
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MaterialDialogService, deps: [{ token: i2.TranslateService }, { token: i2$1.DialogService }, { token: i3.NotificationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
840
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MaterialDialogService, providedIn: 'root' }); }
841
- }
842
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MaterialDialogService, decorators: [{
843
- type: Injectable,
844
- args: [{
845
- providedIn: 'root'
846
- }]
847
- }], ctorParameters: () => [{ type: i2.TranslateService }, { type: i2$1.DialogService }, { type: i3.NotificationService }] });
758
+ }], ctorParameters: () => [{ type: i1$1.UserService }, { type: i2.Router }, { type: i3.TranslateService }, { type: ReactiveDictionary }, { type: i1$1.AuthService }] });
848
759
 
849
- class TranslateExtension {
850
- constructor(translate) {
851
- this.translate = translate;
852
- }
853
- prePopulate(field) {
854
- const props = field.props || {};
855
- if (!props['translate'] || props['_translated']) {
856
- return;
857
- }
858
- props['_translated'] = true;
859
- field.expressions = {
860
- ...(field.expressions || {}),
861
- 'props.label': this.translate.stream(props.label),
862
- };
863
- if (props.placeholder) {
864
- field.expressions = {
865
- ...(field.expressions || {}),
866
- 'props.placeholder': this.translate.stream(props.placeholder)
867
- };
868
- }
869
- if (props.description) {
870
- field.expressions = {
871
- ...(field.expressions || {}),
872
- 'props.description': this.translate.stream(props.description)
873
- };
874
- }
875
- }
876
- }
877
- function registerTranslateExtension(translate) {
878
- return {
879
- validationMessages: [
880
- {
881
- name: 'required',
882
- message(error, field) {
883
- // console.log(field);
884
- return translate.stream('General.Field.Required', { field: field.props.label });
885
- },
886
- },
887
- ],
888
- extensions: [
889
- {
890
- name: 'translate',
891
- extension: new TranslateExtension(translate),
892
- }
893
- ],
894
- };
895
- }
896
-
897
- class CrudFormlyTransaltionModule {
898
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CrudFormlyTransaltionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
899
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.8", ngImport: i0, type: CrudFormlyTransaltionModule, imports: [CommonModule] }); }
900
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CrudFormlyTransaltionModule, providers: [
901
- { provide: FORMLY_CONFIG, multi: true, useFactory: registerTranslateExtension, deps: [TranslateService] },
902
- ], imports: [CommonModule] }); }
903
- }
904
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CrudFormlyTransaltionModule, decorators: [{
905
- type: NgModule,
906
- args: [{
907
- imports: [
908
- CommonModule,
909
- ],
910
- providers: [
911
- { provide: FORMLY_CONFIG, multi: true, useFactory: registerTranslateExtension, deps: [TranslateService] },
912
- ],
913
- }]
914
- }] });
915
-
916
- class RdictCrudComponent {
917
- constructor(router, route, translate, rdict, localFileService, dialogService, routeHistory, location) {
918
- this.router = router;
919
- this.route = route;
920
- this.translate = translate;
921
- this.rdict = rdict;
922
- this.localFileService = localFileService;
923
- this.dialogService = dialogService;
924
- this.routeHistory = routeHistory;
925
- this.location = location;
926
- this.baseForm = new FormGroup({});
927
- this.model = {};
928
- this.options = {};
929
- this.fields = [];
930
- this.hostClass = '';
931
- this.saveIcon = saveIcon;
932
- this.backIcon = arrowLeftIcon;
933
- }
934
- async ngOnInit() {
935
- this.setValueFromSnapshot(this, this.route.snapshot, 'fileLayout', '');
936
- const currentUrlSegments = this.router.url.split('/').filter((segment) => segment !== '' && isNaN(Number(segment)));
937
- if (['add', 'edit'].includes(currentUrlSegments[currentUrlSegments.length - 1])) {
938
- currentUrlSegments.pop();
939
- }
940
- this.dictPath = currentUrlSegments.join('.');
941
- this.hostClass = currentUrlSegments.join(' ') + ' crud';
942
- this.rdictModel = currentUrlSegments.length > 0 ? currentUrlSegments[currentUrlSegments.length - 1] : '';
943
- const id = this.route.snapshot.paramMap.get('id');
944
- this.modelKey = id ?? null;
945
- this.getModelFields();
946
- this.getModel();
947
- const addUrl = this.router.createUrlTree([]).toString();
948
- this.editRoute = this.router.createUrlTree([addUrl.replace('add', 'edit')]).toString();
949
- }
950
- get hostClasses() {
951
- return this.hostClass;
952
- }
953
- setValueFromSnapshot(component, snapshot, key, defaultValue) {
954
- if (component[key] === undefined) {
955
- let dataFromSnapshot = snapshot.data[key];
956
- if (dataFromSnapshot === null || dataFromSnapshot === undefined) {
957
- dataFromSnapshot = snapshot.params[key];
958
- }
959
- component[key] = dataFromSnapshot !== undefined ? dataFromSnapshot : defaultValue;
960
- }
961
- }
962
- onSubmit(model) {
963
- // this.saveModel(this.baseForm)
964
- }
965
- getModel() {
966
- if (this.modelKey) {
967
- this.rdict.get$(this.dictPath).subscribe({
968
- next: (value) => {
969
- value.get$(this.modelKey).subscribe({
970
- next: (modelValue) => {
971
- this.modelRdict = modelValue;
972
- this.model = this.modelRdict.getPlainObject();
973
- this.modelRdict.onChange$().subscribe((changes) => {
974
- if (changes) {
975
- console.log('Changes detected:', changes);
976
- this.baseForm.get(changes.key).patchValue(changes.value);
977
- // this.model[changes.key] = changes.value;
978
- }
979
- });
980
- }
981
- });
982
- },
983
- error: (err) => console.error('Error:', err.message)
984
- });
985
- }
986
- }
987
- getModelFields() {
988
- if (this.rdictModel) {
989
- if (this.fileLayout) {
990
- //load from file
991
- this.localFileService.getJsonData(this.fileLayout).subscribe({
992
- next: (value) => {
993
- if (value) {
994
- const layout = value.find((item) => item.model === this.rdictModel);
995
- this.setLayout(layout?.formLayout);
996
- }
997
- },
998
- error: (err) => console.error('Error:', err.message)
999
- });
1000
- }
1001
- else
1002
- this.rdict.get$('config.models.' + this.rdictModel + '.formLayout').subscribe({
1003
- next: (formLayout) => {
1004
- if (formLayout) {
1005
- this.setLayout(formLayout);
1006
- }
1007
- },
1008
- error: (err) => console.error('Error:', err.message)
1009
- });
1010
- }
1011
- }
1012
- setLayout(formLayout) {
1013
- this.title = this.translate.instant(formLayout['title']);
1014
- // console.log(formLayout["fields"]);
1015
- let fieldsTmp = formLayout['fields'];
1016
- this.fields = this.transformFields(fieldsTmp);
1017
- // this.transformJsonToFormlyFields()
760
+ class CustomParser {
761
+ encode(packet) {
762
+ const transformedPacket = this.transformDatesForEncoding(packet);
763
+ return msgpack.encode(transformedPacket);
1018
764
  }
1019
- // transformJsonToFormlyFields(json: any[]): FormlyFieldConfig[] {
1020
- // // return json.map(field => {
1021
- // // if (field.type === 'select' && field.props.options) {
1022
- // // field.props.options = this.getSelectData(field.props.options);
1023
- // // }
1024
- // // return {
1025
- // // key: field.key,
1026
- // // type: field.type,
1027
- // // props: field.props,
1028
- // // fieldGroup: field?.fieldGroup
1029
- // // };
1030
- // // });
1031
- // }
1032
- transformFields(fields) {
1033
- return fields.map((field) => this.transformField(field));
765
+ decode(packet) {
766
+ const decodedPacket = msgpack.decode(packet);
767
+ return this.transformDatesForDecoding(decodedPacket);
1034
768
  }
1035
- transformField(field) {
1036
- // Handle the current field
1037
- if (field.type === 'select' && field.props?.options && typeof field.props.options === 'string') {
1038
- field.props.options = this.getSelectData(field.props.options);
769
+ transformDatesForEncoding(packet) {
770
+ if (packet instanceof Date) {
771
+ return { __type: 'Date', value: packet.toISOString() };
1039
772
  }
1040
- // Recursively handle fieldGroup
1041
- if (field.fieldGroup) {
1042
- field.fieldGroup = this.transformFields(field.fieldGroup);
773
+ if (Array.isArray(packet)) {
774
+ return packet.map((item) => this.transformDatesForEncoding(item));
1043
775
  }
1044
- // Recursively handle fieldArray
1045
- if (field.fieldArray) {
1046
- if (typeof field.fieldArray === 'function') {
1047
- const originalFieldArrayFn = field.fieldArray;
1048
- field.fieldArray = (fieldConfig) => {
1049
- const transformedField = this.transformField(originalFieldArrayFn(fieldConfig));
1050
- return transformedField;
1051
- };
1052
- }
1053
- else {
1054
- field.fieldArray = this.transformField(field.fieldArray);
776
+ if (typeof packet === 'object' && packet !== null) {
777
+ const result = {};
778
+ for (const key in packet) {
779
+ result[key] = this.transformDatesForEncoding(packet[key]);
1055
780
  }
781
+ return result;
1056
782
  }
1057
- return field;
783
+ return packet;
1058
784
  }
1059
- async onSave() {
1060
- await this.saveModel(this.baseForm);
1061
- }
1062
- async saveModel(fg) {
1063
- if (fg.valid) {
1064
- var dict = await this.rdict.asyncGet(this.dictPath);
1065
- var new_value = fg.value;
1066
- if ('db_id' in this.model) {
1067
- // property exists
1068
- new_value['db_id'] = this.model['db_id'];
1069
- }
1070
- var result = await dict.update(fg.value, this.modelKey);
1071
- if (result) {
1072
- this.modelKey = Object.keys(result)[0];
1073
- const data = result[this.modelKey];
1074
- // Update the form values
1075
- this.baseForm.patchValue(data);
1076
- // Mark the form as pristine and untouched
1077
- this.baseForm.markAsPristine();
1078
- this.baseForm.markAsUntouched();
1079
- this.baseForm.updateValueAndValidity();
1080
- if (this.editRoute) {
1081
- const url = this.router.createUrlTree([this.editRoute, this.modelKey]).toString();
1082
- this.location.replaceState(url);
1083
- }
1084
- this.dialogService.showSaveMessage();
1085
- }
1086
- // console.log(fg.value);
785
+ transformDatesForDecoding(packet) {
786
+ if (packet && packet.__type === 'Date') {
787
+ return new Date(packet.value);
1087
788
  }
1088
- else {
1089
- this.validateAllFormFields(fg);
789
+ if (Array.isArray(packet)) {
790
+ return packet.map((item) => this.transformDatesForDecoding(item));
1090
791
  }
1091
- }
1092
- validateAllFormFields(fg) {
1093
- Object.keys(fg.controls).forEach((field) => {
1094
- // console.log(field);
1095
- const control = fg.get(field);
1096
- if (control instanceof FormControl) {
1097
- control.markAsTouched({ onlySelf: true });
792
+ if (typeof packet === 'object' && packet !== null) {
793
+ const result = {};
794
+ for (const key in packet) {
795
+ result[key] = this.transformDatesForDecoding(packet[key]);
1098
796
  }
1099
- else if (control instanceof FormGroup) {
1100
- this.validateAllFormFields(control);
1101
- }
1102
- });
1103
- }
1104
- getSelectData(key) {
1105
- return this.rdict.getArray$(key);
1106
- }
1107
- onBack() {
1108
- if (this.baseForm.dirty) {
1109
- this.dialogService.confirm('Do you want to cancel the changes ?').subscribe({
1110
- next: (result) => {
1111
- if (result) {
1112
- this.router.navigate([this.routeHistory.getPreviousUrl() || '/']);
1113
- }
1114
- }
1115
- });
1116
- // .subscribe((result) => {
1117
- // if (result) {
1118
- // this.router.navigate([this.routeHistory.getPreviousUrl() || '/']);
1119
- // }
1120
- // });
1121
- }
1122
- else {
1123
- this.router.navigate([this.routeHistory.getPreviousUrl() || '/']);
797
+ return result;
1124
798
  }
799
+ return packet;
1125
800
  }
1126
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RdictCrudComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: ReactiveDictionary }, { token: i1.LocalFileService }, { token: MaterialDialogService }, { token: i1.RouteHistoryService }, { token: i6.Location }], target: i0.ɵɵFactoryTarget.Component }); }
1127
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: RdictCrudComponent, isStandalone: true, selector: "app-rdict-crud", host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<kendo-toolbar>\r\n <kendo-toolbar-button text=\"Back\" showText=\"both\" [svgIcon]=\"backIcon\" showIcon=\"both\" themeColor=\"primary\"\r\n [disabled]=\"false\" (click)=\"onBack()\">\r\n </kendo-toolbar-button>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Save\" showText=\"both\" [svgIcon]=\"saveIcon\" showIcon=\"both\" themeColor=\"success\"\r\n [disabled]=\"false\" (click)=\"onSave()\">\r\n </kendo-toolbar-button>\r\n</kendo-toolbar>\r\n\r\n <form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n </form>\r\n<div kendoDialogContainer></div>", styles: ["::ng-deep formly-field{padding:.3rem;display:block}\n"], dependencies: [{ kind: "ngmodule", type: FormlyModule }, { kind: "component", type: i7.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormlyKendoModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "ngmodule", type: CrudFormlyTransaltionModule }, { kind: "component", type: i5.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex", "showIcon", "showText"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i5.ToolBarButtonComponent, selector: "kendo-toolbar-button", inputs: ["showText", "showIcon", "text", "style", "className", "title", "disabled", "toggleable", "look", "togglable", "selected", "fillMode", "rounded", "themeColor", "icon", "iconClass", "svgIcon", "imageUrl"], outputs: ["click", "pointerdown", "selectedChange"], exportAs: ["kendoToolBarButton"] }, { kind: "component", type: i5.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { kind: "directive", type: i2$1.DialogContainerDirective, selector: "[kendoDialogContainer]" }] }); }
1128
801
  }
1129
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RdictCrudComponent, decorators: [{
1130
- type: Component,
1131
- args: [{ selector: 'app-rdict-crud', imports: [
1132
- FormlyModule,
1133
- ReactiveFormsModule,
1134
- FormlyKendoModule,
1135
- TranslateModule,
1136
- CrudFormlyTransaltionModule,
1137
- KENDO_GRID,
1138
- KENDO_TOOLBAR,
1139
- KENDO_LABEL,
1140
- KENDO_BUTTONS,
1141
- KENDO_DIALOG
1142
- ], template: "<kendo-toolbar>\r\n <kendo-toolbar-button text=\"Back\" showText=\"both\" [svgIcon]=\"backIcon\" showIcon=\"both\" themeColor=\"primary\"\r\n [disabled]=\"false\" (click)=\"onBack()\">\r\n </kendo-toolbar-button>\r\n <kendo-toolbar-spacer></kendo-toolbar-spacer>\r\n <kendo-toolbar-button text=\"Save\" showText=\"both\" [svgIcon]=\"saveIcon\" showIcon=\"both\" themeColor=\"success\"\r\n [disabled]=\"false\" (click)=\"onSave()\">\r\n </kendo-toolbar-button>\r\n</kendo-toolbar>\r\n\r\n <form [formGroup]=\"baseForm\" (ngSubmit)=\"onSubmit(model)\">\r\n <formly-form [form]=\"baseForm\" [fields]=\"fields\" [model]=\"model\" [options]=\"options\"></formly-form>\r\n </form>\r\n<div kendoDialogContainer></div>", styles: ["::ng-deep formly-field{padding:.3rem;display:block}\n"] }]
1143
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: ReactiveDictionary }, { type: i1.LocalFileService }, { type: MaterialDialogService }, { type: i1.RouteHistoryService }, { type: i6.Location }], propDecorators: { hostClasses: [{
1144
- type: HostBinding,
1145
- args: ['class']
1146
- }] } });
1147
802
 
1148
803
  class FileService {
1149
804
  // private baseUrl ='http://localhost:5200';
@@ -1287,691 +942,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
1287
942
  args: [SOCKET_URL]
1288
943
  }] }] });
1289
944
 
1290
- /** Main mapper */
1291
- function kendoToFilterRequest(e) {
1292
- const { skip = 0, take = 0, sort, filter, group } = e ?? e;
1293
- const page_size = take || undefined;
1294
- const page = take ? Math.floor(skip / take) + 1 : undefined;
1295
- return {
1296
- page,
1297
- page_size,
1298
- sorts: kendoSortsToDict(sort),
1299
- filters: kendoFilterToSieve(filter),
1300
- group_by: kendoGroupToArray(group)
1301
- // distinctColumns: fill if you use a “distinct” mode in your API
1302
- };
1303
- }
1304
- /* ------------------------------- Sorts ---------------------------------- */
1305
- function kendoSortsToDict(sorts) {
1306
- if (!sorts?.length)
1307
- return undefined;
1308
- const result = {};
1309
- for (const s of sorts) {
1310
- if (!s.field)
1311
- continue;
1312
- result[s.field] = (s.dir ?? 'asc');
1313
- }
1314
- return result;
1315
- }
1316
- /* ---------------- GroupBy as array ---------------- */
1317
- function kendoGroupToArray(group) {
1318
- if (!group?.length)
1319
- return undefined;
1320
- return group.map((g) => g.field);
1321
- }
1322
- /* ------------------------------ Filters --------------------------------- */
1323
- /**
1324
- * Converts Kendo filter tree to a Sieve filter string.
1325
- * Notes (Sieve):
1326
- * - Clause is {Name}{Operator}{Value}, AND with commas, simple OR via:
1327
- * - multiple names: (Field1|Field2)opValue
1328
- * - multiple values: Field@=a|b
1329
- * - Operators: ==, !=, >, <, >=, <=, @= (contains), _= (starts), _-= (ends),
1330
- * and case-insensitive variants like @=* etc. :contentReference[oaicite:1]{index=1}
1331
- */
1332
- function kendoFilterToSieve(node) {
1333
- if (!node)
1334
- return undefined;
1335
- if (isLeaf(node)) {
1336
- const op = mapOperator(node.operator, !!node.ignoreCase, node.value);
1337
- if (!op)
1338
- return undefined; // unsupported operator (e.g., isnull/isnotnull)
1339
- const name = node.field;
1340
- const value = formatSieveValue(node.value);
1341
- return `${name}${op}${value}`;
1342
- }
1343
- // Composite: best-effort mapping.
1344
- // AND → comma-join
1345
- // OR → try to compress same-field same-op OR into value pipes; otherwise fall back to (Field1|Field2)opValue when viable.
1346
- const parts = node.filters.map((f) => kendoFilterToSieve(f)).filter(Boolean);
1347
- if (!parts.length)
1348
- return undefined;
1349
- if (node.logic === 'and') {
1350
- return parts.join(',');
1351
- }
1352
- // OR logic – try simple compressions; if not possible, return a comma-joined set of grouped OR chunks when possible.
1353
- // Heuristic: if all parts share the same {field,op} with different values → merge via value pipes.
1354
- const parsed = parts.map(parseClause).filter(Boolean);
1355
- if (parsed.length && allSame(parsed, (c) => `${c.name}|${c.op}`)) {
1356
- const { name, op } = parsed[0];
1357
- const pipedValues = parsed.map((c) => c.value).join('|');
1358
- return `${name}${op}${pipedValues}`;
1359
- }
1360
- // If all parts share same {op,value} but different fields → (A|B)opV
1361
- if (parsed.length && allSame(parsed, (c) => `${c.op}|${c.value}`)) {
1362
- const fields = parsed.map((c) => c.name).join('|');
1363
- const { op, value } = parsed[0];
1364
- return `(${fields})${op}${value}`;
1365
- }
1366
- // Fallback: join with Sieve’s AND (comma). (General mixed OR trees can’t always be represented in Sieve DSL.
1367
- // If you need exact semantics, consider adding a custom Sieve filter.) :contentReference[oaicite:2]{index=2}
1368
- return parts.join(',');
1369
- }
1370
- /* ----------------------------- Helpers ---------------------------------- */
1371
- function isLeaf(f) {
1372
- return f.filters === undefined;
1373
- }
1374
- // Map Kendo operators to Sieve operators (case-insensitive variants when ignoreCase=true)
1375
- function mapOperator(kendoOp, ignoreCase, value) {
1376
- // Kendo operators list: eq, neq, lt, lte, gt, gte, contains, doesnotcontain, startswith, endswith,
1377
- // isnull, isnotnull, isempty, isnotempty
1378
- // Sieve operators: ==, !=, <, <=, >, >=, @=, !@=, _=, _-=, and their * variants for case-insensitive. :contentReference[oaicite:3]{index=3}
1379
- const strOps = {
1380
- contains: '@=',
1381
- doesnotcontain: '!@=',
1382
- startswith: '_=',
1383
- endswith: '_-='
1384
- };
1385
- const base = (() => {
1386
- switch (kendoOp) {
1387
- case 'eq':
1388
- return '==';
1389
- case 'neq':
1390
- return '!=';
1391
- case 'lt':
1392
- return '<';
1393
- case 'lte':
1394
- return '<=';
1395
- case 'gt':
1396
- return '>';
1397
- case 'gte':
1398
- return '>=';
1399
- case 'contains':
1400
- return strOps.contains;
1401
- case 'doesnotcontain':
1402
- return strOps.doesnotcontain;
1403
- case 'startswith':
1404
- return strOps.startswith;
1405
- case 'endswith':
1406
- return strOps.endswith;
1407
- case 'isempty':
1408
- return '=='; // value should be ''
1409
- case 'isnotempty':
1410
- return '!='; // value should be ''
1411
- // isnull / isnotnull don’t have a native Sieve op. Recommend a custom filter on the API.
1412
- case 'isnull':
1413
- case 'isnotnull':
1414
- return undefined;
1415
- default:
1416
- return undefined;
1417
- }
1418
- })();
1419
- if (!base)
1420
- return undefined;
1421
- // Promote to case-insensitive *only* for string-y ops when requested
1422
- const isStringy = ['@=', '!@=', '_=', '_-='].includes(base) || typeof value === 'string';
1423
- if (ignoreCase && isStringy) {
1424
- // Sieve: case-insensitive variants add a trailing * (e.g., @=*). :contentReference[oaicite:4]{index=4}
1425
- return base.endsWith('*') ? base : `${base}*`;
1426
- }
1427
- return base;
1428
- }
1429
- function formatSieveValue(v) {
1430
- if (v === '' || v === null || v === undefined)
1431
- return '';
1432
- if (v instanceof Date)
1433
- return toISO(v);
1434
- // Kendo may send dates as strings – try to detect ISO-like and pass through
1435
- if (typeof v === 'string' && isDateLike(v))
1436
- return v;
1437
- if (typeof v === 'string')
1438
- return escapeSieve(v);
1439
- if (typeof v === 'number' || typeof v === 'bigint' || typeof v === 'boolean')
1440
- return String(v);
1441
- // Arrays can appear with “in” like semantics via OR; join with pipes
1442
- if (Array.isArray(v))
1443
- return v.map(formatSieveValue).join('|');
1444
- // Fallback to JSON (rare)
1445
- return escapeSieve(JSON.stringify(v));
1446
- }
1447
- function toISO(d) {
1448
- // Prefer full ISO so the API can parse reliably
1449
- // return new Date(d).toISOString();
1450
- const y = d.getFullYear();
1451
- const m = String(d.getMonth() + 1).padStart(2, '0');
1452
- const day = String(d.getDate()).padStart(2, '0');
1453
- const hh = String(d.getHours()).padStart(2, '0');
1454
- const mm = String(d.getMinutes()).padStart(2, '0');
1455
- const ss = String(d.getSeconds()).padStart(2, '0');
1456
- return `${y}-${m}-${day}T${hh}:${mm}:${ss}`;
1457
- }
1458
- function isDateLike(s) {
1459
- // very lenient check
1460
- return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(s);
1461
- }
1462
- function escapeSieve(s) {
1463
- // Sieve escaping: backslash to escape commas and pipes (and the backslash itself). :contentReference[oaicite:5]{index=5}
1464
- return s.replace(/([\\,|])/g, '\\$1');
1465
- }
1466
- /** Parses "NameOPValue" (no commas) into {name,op,value} */
1467
- function parseClause(clause) {
1468
- // Operators (longer first)
1469
- const ops = ['==*', '!=*', '@=*', '!@=*', '_=*', '!_=*', '_-=*', '==', '!=', '>=', '<=', '>', '<', '@=', '!@=', '_=', '_-='];
1470
- for (const op of ops) {
1471
- const idx = clause.indexOf(op);
1472
- if (idx > 0) {
1473
- return {
1474
- name: clause.slice(0, idx),
1475
- op,
1476
- value: clause.slice(idx + op.length)
1477
- };
1478
- }
1479
- }
1480
- return null;
1481
- }
1482
- function allSame(arr, key) {
1483
- if (!arr.length)
1484
- return true;
1485
- const k0 = key(arr[0]);
1486
- return arr.every((a) => key(a) === k0);
1487
- }
1488
-
1489
- class RdictTableTitle extends ToolBarToolComponent {
1490
- constructor() {
1491
- super();
1492
- this.tabindex = -1;
1493
- }
1494
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RdictTableTitle, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1495
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", 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: `
1496
- <ng-template #toolbarTemplate>
1497
- <kendo-label>{{text}}</kendo-label>
1498
- </ng-template>
1499
- `, isInline: true, dependencies: [{ kind: "component", type: i1$3.LabelComponent, selector: "kendo-label", inputs: ["text", "for", "optional", "labelCssStyle", "labelCssClass"], exportAs: ["kendoLabel"] }] }); }
1500
- }
1501
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RdictTableTitle, decorators: [{
1502
- type: Component,
1503
- args: [{
1504
- providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => RdictTableTitle) }],
1505
- selector: 'table-title',
1506
- standalone: true,
1507
- imports: [
1508
- KENDO_LABEL,
1509
- ],
1510
- template: `
1511
- <ng-template #toolbarTemplate>
1512
- <kendo-label>{{text}}</kendo-label>
1513
- </ng-template>
1514
- `
1515
- }]
1516
- }], ctorParameters: () => [], propDecorators: { toolbarTemplate: [{
1517
- type: ViewChild,
1518
- args: ['toolbarTemplate', { static: true }]
1519
- }], text: [{
1520
- type: Input
1521
- }] } });
1522
-
1523
- class GenericRdictTableComponent {
1524
- constructor(router, route, translate, injector, localFileService, rdict, dialogService, intl, fileService) {
1525
- this.router = router;
1526
- this.route = route;
1527
- this.translate = translate;
1528
- this.injector = injector;
1529
- this.localFileService = localFileService;
1530
- this.rdict = rdict;
1531
- this.dialogService = dialogService;
1532
- this.intl = intl;
1533
- this.fileService = fileService;
1534
- this.editOnClick = false;
1535
- this.editOnDblClick = false;
1536
- this.data = [];
1537
- this.pageIndex = 1;
1538
- this.pageSize = 30;
1539
- this.isLoadingResults = true;
1540
- this.isRateLimitReached = false;
1541
- // @ViewChild('table') table: MatTable<any>;
1542
- // @ViewChild('table', { read: ElementRef }) public matTableRef: ElementRef;
1543
- this.selectedObject = new EventEmitter();
1544
- this.click = new EventEmitter();
1545
- this.editModel = new EventEmitter();
1546
- this.columns = [];
1547
- this.tableLayout = {};
1548
- this.allColumns = [];
1549
- this.referenceColumns = [];
1550
- this.referenceData = new Map();
1551
- // ColumnMode = ColumnMode;
1552
- // SelectionType = SelectionType;
1553
- this.headerHeight = 50;
1554
- this.rowHeight = 50;
1555
- this.svgEdit = pencilIcon;
1556
- this.svgDelete = trashIcon;
1557
- this.svgAdd = plusIcon;
1558
- this.state = {
1559
- skip: 0,
1560
- take: 30
1561
- };
1562
- this.stateChange = new BehaviorSubject(this.state);
1563
- }
1564
- async ngOnInit() {
1565
- this.setValueFromSnapshot(this, this.route.snapshot, 'model', null);
1566
- this.setValueFromSnapshot(this, this.route.snapshot, 'dictPath', null);
1567
- this.setValueFromSnapshot(this, this.route.snapshot, 'showSerach', false);
1568
- this.setValueFromSnapshot(this, this.route.snapshot, 'searchFields', null);
1569
- this.setValueFromSnapshot(this, this.route.snapshot, 'customInclude', null);
1570
- this.setValueFromSnapshot(this, this.route.snapshot, 'defaultSort', null);
1571
- this.setValueFromSnapshot(this, this.route.snapshot, 'defaultSortDirection', null);
1572
- this.setValueFromSnapshot(this, this.route.snapshot, 'deletePropertyName', 'name');
1573
- this.setValueFromSnapshot(this, this.route.snapshot, 'defaultFilter', null);
1574
- this.setValueFromSnapshot(this, this.route.snapshot, 'showHeader', true);
1575
- this.setValueFromSnapshot(this, this.route.snapshot, 'deleteDisableRule', null);
1576
- this.setValueFromSnapshot(this, this.route.snapshot, 'hasAdd', true);
1577
- this.setValueFromSnapshot(this, this.route.snapshot, 'canDelete', true);
1578
- this.setValueFromSnapshot(this, this.route.snapshot, 'canEdit', true);
1579
- this.setValueFromSnapshot(this, this.route.snapshot, 'editOnClick', false);
1580
- this.setValueFromSnapshot(this, this.route.snapshot, 'editOnDblClick', false);
1581
- this.setValueFromSnapshot(this, this.route.snapshot, 'editColumn', null);
1582
- this.setValueFromSnapshot(this, this.route.snapshot, 'fileLayout', '');
1583
- this.setValueFromSnapshot(this, this.route.snapshot, 'useView', false);
1584
- this.setValueFromSnapshot(this, this.route.snapshot, 'pageable', false);
1585
- this.setValueFromSnapshot(this, this.route.snapshot, 'pageSizes ', [10, 20, 30, 50, 100]);
1586
- const currentUrlSegments = this.router.url.split('/').map((segment) => new UrlSegment(segment, {}));
1587
- this.basePath = currentUrlSegments.map((segment) => segment.path).join('/');
1588
- const filteredSegments = currentUrlSegments.filter((segment) => segment.path !== '');
1589
- this.dictPath = filteredSegments.map((segment) => segment.path).join('.');
1590
- this.model = filteredSegments.length > 0 ? filteredSegments[filteredSegments.length - 1].path : ''; // Default to empty string if no valid segments
1591
- this.router.events.subscribe((event) => {
1592
- if (event instanceof NavigationStart) {
1593
- // Navigation to another page is about to occur
1594
- this.data = [];
1595
- this.pageIndex = 1;
1596
- // Perform actions or update component as needed
1597
- }
1598
- });
1599
- if (this.useView) {
1600
- if (this.defaultSort) {
1601
- this.state.sort = this.defaultSort;
1602
- }
1603
- await this.getParentDict();
1604
- }
1605
- this.getListLayout();
1606
- this.loadData();
1607
- }
1608
- async getParentDict() {
1609
- const lastDotIndex = this.dictPath.lastIndexOf('.');
1610
- const parentPath = lastDotIndex !== -1 ? this.dictPath.substring(0, lastDotIndex) : this.dictPath;
1611
- this.parentDict = await this.rdict.asyncGet(parentPath);
1612
- }
1613
- setValueFromSnapshot(component, snapshot, key, defaultValue) {
1614
- if (component[key] === undefined) {
1615
- let dataFromSnapshot = snapshot.data[key];
1616
- if (dataFromSnapshot === null || dataFromSnapshot === undefined) {
1617
- dataFromSnapshot = snapshot.params[key];
1618
- }
1619
- component[key] = dataFromSnapshot !== undefined ? dataFromSnapshot : defaultValue;
1620
- }
1621
- }
1622
- loadData() {
1623
- if (this.useView) {
1624
- this.loadDataView();
1625
- return;
1626
- }
1627
- this.rdict.get$(this.dictPath).subscribe({
1628
- next: (rdictData) => {
1629
- this.tableRdict = rdictData;
1630
- this.tableRdict.onChange$().subscribe({
1631
- next: (changes) => {
1632
- console.log('Changes detected grid:', changes);
1633
- this.onChangeEvent(changes);
1634
- }
1635
- });
1636
- this.tableRdict.onDelete$().subscribe({
1637
- next: (changes) => {
1638
- console.log('Delete detected grid:', changes);
1639
- this.ondDeleteEvent(changes);
1640
- }
1641
- });
1642
- this.rdict.getArray$(this.dictPath, this.tableRdict).subscribe({
1643
- next: (value) => {
1644
- this.dataSource = value;
1645
- },
1646
- error: (err) => console.error('Error:', err.message)
1647
- });
1648
- },
1649
- error: (err) => console.error('Error:', err.message)
1650
- });
1651
- }
1652
- loadDataView() {
1653
- //Get the parent path
1654
- // const request = {
1655
- // filters: '',
1656
- // sorts: { import_date: 'desc' },
1657
- // page: Math.floor(this.state.skip / this.state.take) + 1,
1658
- // page_size: this.state.take
1659
- // };
1660
- const request = kendoToFilterRequest(this.state);
1661
- this.parentDict.getFilteredView(this.model, request).subscribe({
1662
- next: (view) => {
1663
- // console.log('View:', view);
1664
- this.dataSource = view;
1665
- }
1666
- });
1667
- }
1668
- onChangeEvent(changes) {
1669
- if (changes) {
1670
- const key = changes?.key;
1671
- const value = changes?.value;
1672
- if (key == 'transactions') {
1673
- //I have receibed transactions update
1674
- //Update all transactions in the table
1675
- const transactions = value;
1676
- for (const [key, value] of Object.entries(transactions)) {
1677
- const index = this.dataSource.findIndex((item) => item.__idx === key);
1678
- if (index > -1) {
1679
- this.dataSource[index] = value;
1680
- }
1681
- else {
1682
- //get the object from rdict
1683
- // this.tableRdict.get$(key).subscribe({
1684
- // next: (value) => {
1685
- // var dd = value.getPlainObject();
1686
- this.dataSource.push(value);
1687
- // }
1688
- // });
1689
- }
1690
- }
1691
- }
1692
- else {
1693
- if (key && value) {
1694
- const index = this.dataSource.findIndex((item) => item.__idx === key);
1695
- if (index > -1) {
1696
- this.dataSource[index] = value;
1697
- }
1698
- else {
1699
- //get the object from rdict
1700
- this.tableRdict.get$(key).subscribe({
1701
- next: (value) => {
1702
- var dd = value.getPlainObject();
1703
- this.dataSource.push(dd);
1704
- }
1705
- });
1706
- }
1707
- }
1708
- }
1709
- }
1710
- }
1711
- ondDeleteEvent(changes) {
1712
- if (changes) {
1713
- const key = changes?.key;
1714
- if (key) {
1715
- const index = this.dataSource.findIndex((item) => item.__idx === key);
1716
- if (index > -1) {
1717
- this.dataSource.splice(index, 1);
1718
- }
1719
- // this.tableRdict.delete(key)
1720
- }
1721
- }
1722
- }
1723
- getListLayout() {
1724
- if (this.model) {
1725
- if (this.fileLayout) {
1726
- //load from file
1727
- this.localFileService.getJsonData(this.fileLayout).subscribe({
1728
- next: (value) => {
1729
- if (value) {
1730
- const layout = value.find((item) => item.model === this.model);
1731
- this.setLayout(layout?.tableLayout);
1732
- }
1733
- },
1734
- error: (err) => console.error('Error:', err.message)
1735
- });
1736
- }
1737
- //Use rdict layout
1738
- else
1739
- this.rdict.get$('config.models.' + this.model + '.tableLayout').subscribe({
1740
- next: (value) => {
1741
- this.setLayout(value);
1742
- },
1743
- error: (err) => console.error('Error:', err.message)
1744
- });
1745
- }
1746
- }
1747
- setLayout(layout) {
1748
- if (layout) {
1749
- this.tableLayout = layout;
1750
- this.title = this.translate.instant(this.tableLayout['title']);
1751
- this.allColumns = this.tableLayout['columns'].map((item) => {
1752
- if (!item.isTranslated) {
1753
- item.name = this.translate.instant(item.translateKey);
1754
- item.isTranslated = true;
1755
- item.isEditLink = false;
1756
- if (this.editColumn && this.editColumn === item.propertyName) {
1757
- item.isEditLink = true;
1758
- }
1759
- if (!item.type) {
1760
- item.type = 'property';
1761
- }
1762
- }
1763
- return item;
1764
- });
1765
- // console.log('All columns:', this.allColumns);
1766
- //Get reference columns
1767
- const referenceColumns = this.allColumns.filter((item) => item.reference !== undefined && item.reference !== null);
1768
- if (referenceColumns.length > 0) {
1769
- referenceColumns.forEach((item) => {
1770
- this.rdict.getArray$(item.reference).subscribe({
1771
- next: (value) => {
1772
- if (value) {
1773
- // console.log('Reference data:', value);
1774
- // value=value.map((o: any) => ({ ...o, oid: Number(o.oid) }))
1775
- this.referenceData.set(item.reference, this.arrayToMap(value, item.referenceKey));
1776
- }
1777
- },
1778
- error: (err) => console.error('Error:', err.message)
1779
- });
1780
- });
1781
- }
1782
- this.columns = [];
1783
- this.allColumns.sort((a, b) => a.order - b.order);
1784
- this.displayedColumns = [];
1785
- this.displayedColumns.push.apply(this.displayedColumns, this.allColumns.map((x) => x.propertyName));
1786
- }
1787
- }
1788
- arrayToMap(array, keyProperty) {
1789
- const map = new Map();
1790
- for (const item of array) {
1791
- const key = String(item[keyProperty]); // ensure it's a string
1792
- map.set(key, item);
1793
- }
1794
- return map;
1795
- }
1796
- addHandler() {
1797
- this.router.navigate([`${this.basePath}/add`]);
1798
- }
1799
- editHandler(args) {
1800
- this.edit(args.dataItem);
1801
- // this.editDataItem = args.dataItem;
1802
- // this.isNew = false;
1803
- }
1804
- edit(dataItem, column) {
1805
- if (column.type == 'file') {
1806
- const fileId = dataItem[column.file_id_property];
1807
- const file_name = dataItem[column.propertyName];
1808
- this.fileService.downloadFile(fileId).subscribe({
1809
- next: (evt) => {
1810
- if (evt.type === 'progress') {
1811
- // optional: show progress
1812
- // this.progress = evt.total ? Math.round(100 * evt.loaded / evt.total) : null;
1813
- return;
1814
- }
1815
- // evt.type === 'response'
1816
- const file = evt.file;
1817
- const url = URL.createObjectURL(file);
1818
- const a = document.createElement('a');
1819
- a.href = url;
1820
- a.download = file_name; // suggested filename
1821
- a.style.display = 'none';
1822
- document.body.appendChild(a);
1823
- a.click();
1824
- a.remove();
1825
- URL.revokeObjectURL(url);
1826
- },
1827
- error: (err) => {
1828
- console.error('Download failed', err);
1829
- }
1830
- });
1831
- }
1832
- else {
1833
- this.router.navigate([`${this.basePath}/edit/${dataItem.__idx}`]);
1834
- }
1835
- }
1836
- removeHandler(args) {
1837
- this.dialogService.confirmDelete().subscribe({
1838
- next: (result) => {
1839
- if (result) {
1840
- this.tableRdict.delete$(args.dataItem.__idx).subscribe({
1841
- next: (result) => {
1842
- this.dataSource.splice(args.rowIndex, 1);
1843
- }
1844
- });
1845
- }
1846
- }
1847
- });
1848
- // this.editService.remove(args.dataItem);
1849
- }
1850
- getCellValue(item, column) {
1851
- if (typeof item !== 'object' || item === null) {
1852
- return null; // or `undefined` or some fallback
1853
- }
1854
- if (column.type == 'reference') {
1855
- const getNestedValue = (obj, path) => path.split('.').reduce((acc, key) => acc?.[key], obj);
1856
- const propertyValue = getNestedValue(item, column.propertyName);
1857
- const value = this.referenceData.get(column.reference)?.get(String(propertyValue))?.[column.referenceProperty] ?? propertyValue;
1858
- return this.formatValue(value, column.format);
1859
- return value;
1860
- }
1861
- else {
1862
- return this.formatValue(item[column.propertyName], column.format);
1863
- }
1864
- }
1865
- filterChange(filter) {
1866
- // console.log(filter);
1867
- // this.loadData();
1868
- }
1869
- dataStateChange(state) {
1870
- this.state = state;
1871
- this.loadData();
1872
- }
1873
- pageChange(state) {
1874
- console.log('State:', state);
1875
- this.stateChange.next(state);
1876
- }
1877
- formatValue(value, format) {
1878
- if (value === null || value === undefined || !format) {
1879
- return value ?? '';
1880
- }
1881
- // Accept both "{0:...}" and plain "..." patterns
1882
- const inner = this.extractFormat(format);
1883
- // Heuristics: date vs number
1884
- if (this.looksLikeDateFormat(inner)) {
1885
- const d = value instanceof Date ? value : new Date(value);
1886
- return isNaN(d.getTime()) ? value : this.intl.formatDate(d, inner);
1887
- }
1888
- const num = typeof value === 'number' ? value : Number(value);
1889
- if (!Number.isNaN(num)) {
1890
- // supports "n", "n2", "c", "p", etc. and custom patterns
1891
- return this.intl.formatNumber(num, inner);
1892
- }
1893
- // Fallback: return as-is if not a date/number
1894
- return value;
1895
- }
1896
- extractFormat(fmt) {
1897
- const m = fmt.match(/^\{0:([^}]+)\}$/);
1898
- return m ? m[1] : fmt;
1899
- }
1900
- looksLikeDateFormat(f) {
1901
- // crude but effective: typical date tokens
1902
- return /d|M|y|H|h|m|s|E|a/.test(f) && !/^[cnp]/i.test(f);
1903
- }
1904
- inferFilterType(col) {
1905
- if (!col)
1906
- return 'text';
1907
- const f = this.extractFormat(col.format || '');
1908
- if (this.looksLikeDateFormat(f))
1909
- return 'date';
1910
- if (/^(n\d*|c|p\d*|n)$/i.test(f))
1911
- return 'numeric'; // Kendo number patterns
1912
- if (col.type === 'boolean')
1913
- return 'boolean';
1914
- return 'text';
1915
- }
1916
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: GenericRdictTableComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }, { token: i2.TranslateService }, { token: i0.Injector }, { token: i1.LocalFileService }, { token: ReactiveDictionary }, { token: MaterialDialogService }, { token: i6$2.IntlService }, { token: FileService }], target: i0.ɵɵFactoryTarget.Component }); }
1917
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", 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\" [sortable]=\"true\" [filterable]=\"showSerach\" [resizable]=\"true\" (add)=\"addHandler()\"\r\n (edit)=\"editHandler($event)\" (remove)=\"removeHandler($event)\"\r\n (filterChange)=\"filterChange($event)\"\r\n (dataStateChange)=\"dataStateChange($event)\"\r\n \r\n [pageable]=\"{pageSizes:pageSizes}\" [pageSize]=\"state.take\"\r\n [skip]=\"state.skip\" [sort]=\"state.sort\" >\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 *ngIf=\"hasAdd\" 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\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" [field]=\"column.propertyName\"\r\n [title]=\"column.translateKey | translate\" [format]=\"column.format\" [filter]=\"inferFilterType(column)\">\r\n <!-- Use ng-template to customize the column content -->\r\n <ng-template *ngIf=\"column.isEditLink; else defaultTemplate\" kendoGridCellTemplate let-dataItem>\r\n <!-- Create a link that calls editHandler(dataItem) -->\r\n <a href=\"javascript:void(0)\" (click)=\"edit(dataItem,column)\" class=\"edit-link\">\r\n {{ getCellValue(dataItem,column) }}\r\n </a>\r\n </ng-template>\r\n \r\n <!-- <ng-template *ngIf=\"column.type=='reference'; else defaultTemplate\" kendoGridCellTemplate let-dataItem>\r\n <a href=\"javascript:void(0)\" (click)=\"edit(dataItem)\" class=\"edit-link\">\r\n {{ getCellValue$(dataItem,column) | async }}\r\n </a>\r\n </ng-template> -->\r\n <!-- Default template for non-link columns -->\r\n <ng-template #defaultTemplate kendoGridCellTemplate let-dataItem>\r\n {{ getCellValue(dataItem,column) }}\r\n </ng-template>\r\n </kendo-grid-column>\r\n\r\n\r\n <kendo-grid-command-column *ngIf=\"canEdit && canDelete\" title=\"\" [width]=\"100\">\r\n <ng-template kendoGridCellTemplate>\r\n <!-- <button kendoButton kendoGridEditCommand [svgIcon]=\"svgEdit\" themeColor=\"light\" ></button>\r\n <button kendoButton kendoGridRemoveCommand [svgIcon]=\"svgDelete\" themeColor=\"error\"></button> -->\r\n <button *ngIf=\"canEdit\" kendoGridEditCommand [svgIcon]=\"svgEdit\" themeColor=\"light\"></button>\r\n <button *ngIf=\"canDelete\" kendoGridRemoveCommand [svgIcon]=\"svgDelete\" themeColor=\"error\"></button>\r\n </ng-template>\r\n </kendo-grid-command-column>\r\n</kendo-grid>\r\n<div kendoDialogContainer></div>", styles: [".edit-link{color:#00f!important;text-decoration:underline!important;cursor:pointer!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type:
1918
- // MatPaginatorModule,
1919
- // MatTableModule,
1920
- TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: i9.GridComponent, selector: "kendo-grid", inputs: ["data", "pageSize", "height", "rowHeight", "adaptiveMode", "detailRowHeight", "skip", "scrollable", "selectable", "sort", "size", "trackBy", "filter", "group", "virtualColumns", "filterable", "sortable", "pageable", "groupable", "gridResizable", "rowReorderable", "navigable", "autoSize", "rowClass", "rowSticky", "rowSelected", "isRowSelectable", "cellSelected", "resizable", "reorderable", "loading", "columnMenu", "hideHeader", "showInactiveTools", "isDetailExpanded", "isGroupExpanded", "dataLayoutMode"], outputs: ["filterChange", "pageChange", "groupChange", "sortChange", "selectionChange", "rowReorder", "dataStateChange", "gridStateChange", "groupExpand", "groupCollapse", "detailExpand", "detailCollapse", "edit", "cancel", "save", "remove", "add", "cellClose", "cellClick", "pdfExport", "excelExport", "columnResize", "columnReorder", "columnVisibilityChange", "columnLockedChange", "columnStickyChange", "scrollBottom", "contentScroll"], exportAs: ["kendoGrid"] }, { kind: "directive", type: i9.GridToolbarFocusableDirective, selector: " [kendoGridToolbarFocusable], [kendoGridAddCommand], [kendoGridCancelCommand], [kendoGridEditCommand], [kendoGridRemoveCommand], [kendoGridSaveCommand], [kendoGridExcelCommand], [kendoGridPDFCommand] " }, { kind: "component", type: i9.ColumnComponent, selector: "kendo-grid-column", inputs: ["field", "format", "sortable", "groupable", "editor", "filter", "filterVariant", "filterable", "editable"] }, { kind: "directive", type: i9.FocusableDirective, selector: "[kendoGridFocusable], [kendoGridEditCommand], [kendoGridRemoveCommand], [kendoGridSaveCommand], [kendoGridCancelCommand], [kendoGridSelectionCheckbox] ", inputs: ["kendoGridFocusable"] }, { kind: "component", type: i9.CommandColumnComponent, selector: "kendo-grid-command-column" }, { kind: "directive", type: i9.CellTemplateDirective, selector: "[kendoGridCellTemplate]" }, { kind: "component", type: i9.EditCommandDirective, selector: "[kendoGridEditCommand]" }, { kind: "component", type: i9.RemoveCommandDirective, selector: "[kendoGridRemoveCommand]" }, { kind: "directive", type: i9.AddCommandToolbarDirective, selector: "[kendoGridAddTool]" }, { kind: "component", type: i5.ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex", "showIcon", "showText"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: i5.ToolbarCustomMessagesComponent, selector: "kendo-toolbar-messages" }, { kind: "component", type: i5.ToolBarButtonComponent, selector: "kendo-toolbar-button", inputs: ["showText", "showIcon", "text", "style", "className", "title", "disabled", "toggleable", "look", "togglable", "selected", "fillMode", "rounded", "themeColor", "icon", "iconClass", "svgIcon", "imageUrl"], outputs: ["click", "pointerdown", "selectedChange"], exportAs: ["kendoToolBarButton"] }, { kind: "component", type: i5.ToolBarSpacerComponent, selector: "kendo-toolbar-spacer", exportAs: ["kendoToolBarSpacer"] }, { kind: "directive", type: i2$1.DialogContainerDirective, selector: "[kendoDialogContainer]" }, { kind: "component", type: RdictTableTitle, selector: "table-title", inputs: ["text"] }], encapsulation: i0.ViewEncapsulation.None }); }
1921
- }
1922
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: GenericRdictTableComponent, decorators: [{
1923
- type: Component,
1924
- args: [{ selector: 'rsl-rdict-generic-table', encapsulation: ViewEncapsulation.None, imports: [
1925
- CommonModule,
1926
- RouterModule,
1927
- // MatPaginatorModule,
1928
- // MatTableModule,
1929
- TranslateModule,
1930
- KENDO_GRID,
1931
- KENDO_TOOLBAR,
1932
- KENDO_LABEL,
1933
- KENDO_BUTTONS,
1934
- KENDO_DIALOG,
1935
- RdictTableTitle
1936
- ], providers: [], template: "<kendo-grid [data]=\"dataSource\" [sortable]=\"true\" [filterable]=\"showSerach\" [resizable]=\"true\" (add)=\"addHandler()\"\r\n (edit)=\"editHandler($event)\" (remove)=\"removeHandler($event)\"\r\n (filterChange)=\"filterChange($event)\"\r\n (dataStateChange)=\"dataStateChange($event)\"\r\n \r\n [pageable]=\"{pageSizes:pageSizes}\" [pageSize]=\"state.take\"\r\n [skip]=\"state.skip\" [sort]=\"state.sort\" >\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 *ngIf=\"hasAdd\" 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\r\n <kendo-grid-column *ngFor=\"let column of allColumns\" [field]=\"column.propertyName\"\r\n [title]=\"column.translateKey | translate\" [format]=\"column.format\" [filter]=\"inferFilterType(column)\">\r\n <!-- Use ng-template to customize the column content -->\r\n <ng-template *ngIf=\"column.isEditLink; else defaultTemplate\" kendoGridCellTemplate let-dataItem>\r\n <!-- Create a link that calls editHandler(dataItem) -->\r\n <a href=\"javascript:void(0)\" (click)=\"edit(dataItem,column)\" class=\"edit-link\">\r\n {{ getCellValue(dataItem,column) }}\r\n </a>\r\n </ng-template>\r\n \r\n <!-- <ng-template *ngIf=\"column.type=='reference'; else defaultTemplate\" kendoGridCellTemplate let-dataItem>\r\n <a href=\"javascript:void(0)\" (click)=\"edit(dataItem)\" class=\"edit-link\">\r\n {{ getCellValue$(dataItem,column) | async }}\r\n </a>\r\n </ng-template> -->\r\n <!-- Default template for non-link columns -->\r\n <ng-template #defaultTemplate kendoGridCellTemplate let-dataItem>\r\n {{ getCellValue(dataItem,column) }}\r\n </ng-template>\r\n </kendo-grid-column>\r\n\r\n\r\n <kendo-grid-command-column *ngIf=\"canEdit && canDelete\" title=\"\" [width]=\"100\">\r\n <ng-template kendoGridCellTemplate>\r\n <!-- <button kendoButton kendoGridEditCommand [svgIcon]=\"svgEdit\" themeColor=\"light\" ></button>\r\n <button kendoButton kendoGridRemoveCommand [svgIcon]=\"svgDelete\" themeColor=\"error\"></button> -->\r\n <button *ngIf=\"canEdit\" kendoGridEditCommand [svgIcon]=\"svgEdit\" themeColor=\"light\"></button>\r\n <button *ngIf=\"canDelete\" kendoGridRemoveCommand [svgIcon]=\"svgDelete\" themeColor=\"error\"></button>\r\n </ng-template>\r\n </kendo-grid-command-column>\r\n</kendo-grid>\r\n<div kendoDialogContainer></div>", styles: [".edit-link{color:#00f!important;text-decoration:underline!important;cursor:pointer!important}\n"] }]
1937
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }, { type: i2.TranslateService }, { type: i0.Injector }, { type: i1.LocalFileService }, { type: ReactiveDictionary }, { type: MaterialDialogService }, { type: i6$2.IntlService }, { type: FileService }], propDecorators: { showSerach: [{
1938
- type: Input
1939
- }], searchFields: [{
1940
- type: Input
1941
- }], customInclude: [{
1942
- type: Input
1943
- }], defaultSort: [{
1944
- type: Input
1945
- }], deletePropertyName: [{
1946
- type: Input
1947
- }], defaultFilter: [{
1948
- type: Input
1949
- }], showHeader: [{
1950
- type: Input
1951
- }], hasAdd: [{
1952
- type: Input
1953
- }], canDelete: [{
1954
- type: Input
1955
- }], canEdit: [{
1956
- type: Input
1957
- }], editOnClick: [{
1958
- type: Input
1959
- }], editOnDblClick: [{
1960
- type: Input
1961
- }], filter: [{
1962
- type: ViewChild,
1963
- args: [ElementRef, { static: false }]
1964
- }], selectedObject: [{
1965
- type: Output
1966
- }], click: [{
1967
- type: Output
1968
- }], editModel: [{
1969
- type: Output
1970
- }] } });
1971
-
1972
- // projects/my-library/src/lib/socket-config.token.ts
1973
- const SOCKET_URL = new InjectionToken('SocketUrl');
1974
-
1975
945
  /*
1976
946
  * Public API Surface of rdict
1977
947
  */
@@ -1980,5 +950,5 @@ const SOCKET_URL = new InjectionToken('SocketUrl');
1980
950
  * Generated bundle index. Do not edit.
1981
951
  */
1982
952
 
1983
- export { FullComponent, GenericRdictTableComponent, MaterialDialogService, RdictCrudComponent, ReactiveDictionary, SOCKET_URL, SocketService };
953
+ export { CustomParser, FileService, FullComponent, ReactiveDictionary, SOCKET_URL, SocketService };
1984
954
  //# sourceMappingURL=rosoftlab-rdict.mjs.map