@nettyapps/ntybase 0.0.3 → 0.0.5

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.
@@ -433,6 +433,10 @@ class AlertService {
433
433
  const actionText = action ? action : '@btnOK';
434
434
  this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
435
435
  }
436
+ showWarning(message, action, duration = 3000) {
437
+ const actionText = action ? action : '@btnOK';
438
+ this.snackBar.open(this.translate.instant(message), this.translate.instant(actionText), { duration });
439
+ }
436
440
  // For confirmation dialogs
437
441
  showConfirm(message) {
438
442
  return new Promise((resolve) => {
@@ -1152,6 +1156,7 @@ class AgGridBase {
1152
1156
  popupValid = input(false, ...(ngDevMode ? [{ debugName: "popupValid" }] : []));
1153
1157
  params = input('', ...(ngDevMode ? [{ debugName: "params" }] : []));
1154
1158
  parameters = input('', ...(ngDevMode ? [{ debugName: "parameters" }] : []));
1159
+ isEmbedded = input(false, ...(ngDevMode ? [{ debugName: "isEmbedded" }] : []));
1155
1160
  // Authentication
1156
1161
  authenticationList = [];
1157
1162
  // User access writes
@@ -1168,11 +1173,6 @@ class AgGridBase {
1168
1173
  refreshButtonValid = signal(false, ...(ngDevMode ? [{ debugName: "refreshButtonValid" }] : []));
1169
1174
  // Parameters for embeded components
1170
1175
  selectedElement = output();
1171
- // Filter Parameters
1172
- filterField = input(null, ...(ngDevMode ? [{ debugName: "filterField" }] : []));
1173
- filterFieldValue = input(null, ...(ngDevMode ? [{ debugName: "filterFieldValue" }] : []));
1174
- filterFieldNumeric = input(false, ...(ngDevMode ? [{ debugName: "filterFieldNumeric" }] : []));
1175
- filterFieldEquality = input('=', ...(ngDevMode ? [{ debugName: "filterFieldEquality" }] : []));
1176
1176
  // AG-Grid theme setting (dark mode)
1177
1177
  theme = myTheme;
1178
1178
  // Grid references
@@ -1468,10 +1468,10 @@ class AgGridBase {
1468
1468
  onGridReady(params) {
1469
1469
  this.gridApi = params.api;
1470
1470
  this.gridApi.addEventListener('selectionChanged', () => {
1471
- const selectedNodes = this.gridApi.getSelectedNodes();
1471
+ // Null-safe approach
1472
+ const selectedNodes = this.gridApi?.getSelectedNodes?.() || [];
1472
1473
  this.selectedRows.set(selectedNodes.map((node) => node.data));
1473
1474
  });
1474
- // Apply the saved filter when the grid is ready
1475
1475
  if (this.searchValue()) {
1476
1476
  this.gridApi.setGridOption('quickFilterText', this.searchValue());
1477
1477
  }
@@ -1510,7 +1510,7 @@ class AgGridBase {
1510
1510
  backClicked() {
1511
1511
  this.commonService.goBack();
1512
1512
  }
1513
- gotoURL(routePrefix, rightSidenav = [], parameters, type, isNewTab = false, embedded = false, dialogComponent) {
1513
+ gotoURL(routePrefix, rightSidenav = [], parameters, type, dialogComponent = null, isNewTab = false, isPopup = this.isEmbedded()) {
1514
1514
  const navigationExtras = {
1515
1515
  queryParams: {
1516
1516
  parameters: JSON.stringify(parameters),
@@ -1526,7 +1526,7 @@ class AgGridBase {
1526
1526
  window.open(fullUrl, '_blank');
1527
1527
  return;
1528
1528
  }
1529
- if (embedded && dialogComponent) {
1529
+ if (isPopup && dialogComponent) {
1530
1530
  this.dialog
1531
1531
  .open(dialogComponent, {
1532
1532
  data: {
@@ -1682,7 +1682,7 @@ class AgGridBase {
1682
1682
  return true;
1683
1683
  }
1684
1684
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
1685
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, usesOnChanges: true, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1685
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AgGridBase, isStandalone: true, selector: "ntybase-ag-grid-base", inputs: { readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, popupFilterValid: { classPropertyName: "popupFilterValid", publicName: "popupFilterValid", isSignal: true, isRequired: false, transformFunction: null }, popupValid: { classPropertyName: "popupValid", publicName: "popupValid", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, isEmbedded: { classPropertyName: "isEmbedded", publicName: "isEmbedded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, usesOnChanges: true, ngImport: i0, template: "<p>ag-grid-base works!</p>\n", styles: [""] });
1686
1686
  }
1687
1687
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AgGridBase, decorators: [{
1688
1688
  type: Component,
@@ -3043,22 +3043,53 @@ class AutoCompleteLookup {
3043
3043
  // Output
3044
3044
  selectedElement = output();
3045
3045
  ngOnInit() {
3046
- // Initialize with dialog data first
3047
- if (this.data) {
3048
- this.loadComponent(this.data);
3046
+ this.initializeComponent();
3047
+ }
3048
+ ngOnChanges(changes) {
3049
+ if (this.isComponentConfigChanged(changes)) {
3050
+ this.initializeComponent();
3049
3051
  }
3050
3052
  }
3053
+ isComponentConfigChanged(changes) {
3054
+ return (!!changes['component'] ||
3055
+ !!changes['filterField'] ||
3056
+ !!changes['filterFieldValue'] ||
3057
+ !!changes['filterFieldNumeric'] ||
3058
+ !!changes['filterFieldEquality']);
3059
+ }
3060
+ initializeComponent() {
3061
+ // Dialog data'sı varsa onu kullan, yoksa input'ları kullan
3062
+ const config = this.data || this.getInputConfig();
3063
+ this.loadComponent(config);
3064
+ }
3065
+ getInputConfig() {
3066
+ return {
3067
+ component: this.component(),
3068
+ filterField: this.filterField(),
3069
+ filterFieldValue: this.filterFieldValue(),
3070
+ filterFieldNumeric: this.filterFieldNumeric(),
3071
+ filterFieldEquality: this.filterFieldEquality(),
3072
+ };
3073
+ }
3051
3074
  loadComponent(config) {
3052
3075
  if (!config?.component)
3053
3076
  return;
3054
3077
  this.container.clear();
3055
3078
  const componentRef = this.container.createComponent(config.component);
3056
- // Set all inputs using setInput
3079
+ // Input'ları doğru şekilde set et - fonksiyon çağrısı YOK
3057
3080
  componentRef.setInput('popupValid', true);
3058
- componentRef.setInput('filterField', config.filterField);
3059
- componentRef.setInput('filterFieldValue', config.filterFieldValue);
3060
- componentRef.setInput('filterFieldEquality', config.filterFieldEquality);
3061
- componentRef.setInput('filterFieldNumeric', config.filterFieldNumeric);
3081
+ if (config.filterField !== undefined) {
3082
+ componentRef.setInput('filterField', config.filterField);
3083
+ }
3084
+ if (config.filterFieldValue !== undefined) {
3085
+ componentRef.setInput('filterFieldValue', config.filterFieldValue);
3086
+ }
3087
+ if (config.filterFieldEquality !== undefined) {
3088
+ componentRef.setInput('filterFieldEquality', config.filterFieldEquality);
3089
+ }
3090
+ if (config.filterFieldNumeric !== undefined) {
3091
+ componentRef.setInput('filterFieldNumeric', config.filterFieldNumeric);
3092
+ }
3062
3093
  // Handle output
3063
3094
  const sub = componentRef.instance.selectedElement.subscribe((data) => {
3064
3095
  this.selectedElement.emit(data);
@@ -3067,7 +3098,7 @@ class AutoCompleteLookup {
3067
3098
  componentRef.onDestroy(() => sub.unsubscribe());
3068
3099
  }
3069
3100
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AutoCompleteLookup, deps: [], target: i0.ɵɵFactoryTarget.Component });
3070
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AutoCompleteLookup, isStandalone: true, selector: "ntybase-auto-complete-lookup", inputs: { component: { classPropertyName: "component", publicName: "component", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: ` <ng-template #container></ng-template> `, isInline: true });
3101
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: AutoCompleteLookup, isStandalone: true, selector: "ntybase-auto-complete-lookup", inputs: { component: { classPropertyName: "component", publicName: "component", isSignal: true, isRequired: false, transformFunction: null }, filterField: { classPropertyName: "filterField", publicName: "filterField", isSignal: true, isRequired: false, transformFunction: null }, filterFieldValue: { classPropertyName: "filterFieldValue", publicName: "filterFieldValue", isSignal: true, isRequired: false, transformFunction: null }, filterFieldNumeric: { classPropertyName: "filterFieldNumeric", publicName: "filterFieldNumeric", isSignal: true, isRequired: false, transformFunction: null }, filterFieldEquality: { classPropertyName: "filterFieldEquality", publicName: "filterFieldEquality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedElement: "selectedElement" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: ` <ng-template #container></ng-template> `, isInline: true });
3071
3102
  }
3072
3103
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: AutoCompleteLookup, decorators: [{
3073
3104
  type: Component,