@nettyapps/ntyux 21.0.0 → 21.0.1

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, NgModule, inject, Injectable, input, output, ViewContainerRef, ViewChild, Input, ViewEncapsulation, signal, effect, computed, forwardRef, ChangeDetectionStrategy, ElementRef, model } from '@angular/core';
2
+ import { Component, NgModule, inject, Injectable, input, output, ViewContainerRef, ViewChild, Input, ViewEncapsulation, signal, effect, computed, forwardRef, ChangeDetectionStrategy, model, viewChild, ElementRef } from '@angular/core';
3
3
  import * as i1$1 from '@angular/material/form-field';
4
4
  import { MatFormFieldModule } from '@angular/material/form-field';
5
5
  import * as i2$1 from '@angular/material/autocomplete';
@@ -11,7 +11,7 @@ import * as i4 from '@angular/material/input';
11
11
  import { MatInputModule } from '@angular/material/input';
12
12
  import * as i2 from '@angular/material/icon';
13
13
  import { MatIconModule } from '@angular/material/icon';
14
- import { UiBase, NettyUISearchInput } from '@nettyapps/ntyui';
14
+ import { UiBase, NettyUINumberInput, NettyUISearchInput } from '@nettyapps/ntyui';
15
15
  import { HttpClient } from '@angular/common/http';
16
16
  import { EnvironmentProxy } from '@nettyapps/ntycontract';
17
17
  import { MAT_DIALOG_DATA, MatDialog, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';
@@ -601,6 +601,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
601
601
  args: ['autoCompleteInput']
602
602
  }] } });
603
603
 
604
+ class ValueUnitInput extends UiBase {
605
+ name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
606
+ // Number input
607
+ min = input(null, ...(ngDevMode ? [{ debugName: "min" }] : []));
608
+ max = input(null, ...(ngDevMode ? [{ debugName: "max" }] : []));
609
+ step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : []));
610
+ precision = input(2, ...(ngDevMode ? [{ debugName: "precision" }] : []));
611
+ // AutoComplete
612
+ tableName = input('', ...(ngDevMode ? [{ debugName: "tableName" }] : []));
613
+ searchAfter = input(3, ...(ngDevMode ? [{ debugName: "searchAfter" }] : []));
614
+ fieldCode = input(null, ...(ngDevMode ? [{ debugName: "fieldCode" }] : []));
615
+ fieldName = input(null, ...(ngDevMode ? [{ debugName: "fieldName" }] : []));
616
+ lookupComponent = input(null, ...(ngDevMode ? [{ debugName: "lookupComponent" }] : []));
617
+ lookupComponentPath = input(null, ...(ngDevMode ? [{ debugName: "lookupComponentPath" }] : []));
618
+ filterField = input(null, ...(ngDevMode ? [{ debugName: "filterField" }] : []));
619
+ filterFieldValue = input(null, ...(ngDevMode ? [{ debugName: "filterFieldValue" }] : []));
620
+ filterFieldNumeric = input(false, ...(ngDevMode ? [{ debugName: "filterFieldNumeric" }] : []));
621
+ filterFieldEquality = input('=', ...(ngDevMode ? [{ debugName: "filterFieldEquality" }] : []));
622
+ debounceTime = input(500, ...(ngDevMode ? [{ debugName: "debounceTime" }] : []));
623
+ value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
624
+ quantityModel = viewChild('quantityModel', ...(ngDevMode ? [{ debugName: "quantityModel" }] : []));
625
+ unitModel = viewChild('unitModel', ...(ngDevMode ? [{ debugName: "unitModel" }] : []));
626
+ internalValue = {
627
+ quantity: null,
628
+ unit: null,
629
+ };
630
+ constructor() {
631
+ super();
632
+ effect(() => {
633
+ const currentValue = this.value();
634
+ if (currentValue !== null && currentValue !== this.internalValue) {
635
+ this.updateInternalValue(currentValue);
636
+ }
637
+ });
638
+ }
639
+ updateInternalValue(value) {
640
+ if (value && typeof value === 'object') {
641
+ this.internalValue = {
642
+ quantity: value.quantity || null,
643
+ unit: value.unit || null,
644
+ };
645
+ }
646
+ else {
647
+ this.internalValue = { quantity: null, unit: null };
648
+ }
649
+ }
650
+ // Quantity changed
651
+ onQuantityChange(quantity) {
652
+ this.internalValue.quantity = quantity;
653
+ this.updateValue();
654
+ this.onTouched();
655
+ }
656
+ // Unit changed
657
+ onUnitChange(unit) {
658
+ this.internalValue.unit = unit;
659
+ this.updateValue();
660
+ this.onTouched();
661
+ }
662
+ updateValue() {
663
+ const newValue = {
664
+ quantity: this.internalValue.quantity,
665
+ unit: this.internalValue.unit,
666
+ };
667
+ this.value.set(newValue);
668
+ this.onChange(newValue);
669
+ }
670
+ writeValue(value) {
671
+ if (value) {
672
+ this.updateInternalValue(value);
673
+ this.value.set(value);
674
+ }
675
+ else {
676
+ this.internalValue = { quantity: null, unit: null };
677
+ this.value.set(null);
678
+ }
679
+ }
680
+ clearAll() {
681
+ this.internalValue = { quantity: null, unit: null };
682
+ this.value.set(null);
683
+ this.onChange(null);
684
+ this.onTouched();
685
+ }
686
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ValueUnitInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
687
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.0.3", type: ValueUnitInput, isStandalone: true, selector: "lib-value-unit-input", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, precision: { classPropertyName: "precision", publicName: "precision", isSignal: true, isRequired: false, transformFunction: null }, tableName: { classPropertyName: "tableName", publicName: "tableName", isSignal: true, isRequired: false, transformFunction: null }, searchAfter: { classPropertyName: "searchAfter", publicName: "searchAfter", isSignal: true, isRequired: false, transformFunction: null }, fieldCode: { classPropertyName: "fieldCode", publicName: "fieldCode", isSignal: true, isRequired: false, transformFunction: null }, fieldName: { classPropertyName: "fieldName", publicName: "fieldName", isSignal: true, isRequired: false, transformFunction: null }, lookupComponent: { classPropertyName: "lookupComponent", publicName: "lookupComponent", isSignal: true, isRequired: false, transformFunction: null }, lookupComponentPath: { classPropertyName: "lookupComponentPath", publicName: "lookupComponentPath", 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 }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
688
+ {
689
+ provide: NG_VALUE_ACCESSOR,
690
+ useExisting: forwardRef(() => ValueUnitInput),
691
+ multi: true,
692
+ },
693
+ ], viewQueries: [{ propertyName: "quantityModel", first: true, predicate: ["quantityModel"], descendants: true, isSignal: true }, { propertyName: "unitModel", first: true, predicate: ["unitModel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"value-unit-container\">\n <!-- Number Input -->\n <ntyui-number-input\n #quantityModel=\"ngModel\"\n [label]=\"label()\"\n [appearance]=\"appearance()\"\n [name]=\"name() + '_quantity'\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onQuantityChange($event)\"\n class=\"quantity-input\"\n >\n </ntyui-number-input>\n\n <!-- AutoComplete for Unit -->\n <ntybase-auto-complete\n #unitModel=\"ngModel\"\n [label]=\"'Birim'\"\n [appearance]=\"appearance()\"\n [name]=\"name() + '_unit'\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [tableName]=\"tableName()\"\n [searchAfter]=\"searchAfter()\"\n [fieldCode]=\"fieldCode()\"\n [fieldName]=\"fieldName()\"\n [lookupComponent]=\"lookupComponent()\"\n [lookupComponentPath]=\"lookupComponentPath()\"\n [filterField]=\"filterField()\"\n [filterFieldValue]=\"filterFieldValue()\"\n [filterFieldNumeric]=\"filterFieldNumeric()\"\n [filterFieldEquality]=\"filterFieldEquality()\"\n [debounceTime]=\"debounceTime()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onUnitChange($event)\"\n class=\"unit-input\"\n >\n </ntybase-auto-complete>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: NettyUINumberInput, selector: "ntyui-number-input" }, { kind: "component", type: AutoComplete, selector: "ntybase-auto-complete", inputs: ["tableName", "searchAfter", "fieldCode", "fieldName", "lookupComponent", "lookupComponentPath", "filterField", "filterFieldValue", "filterFieldNumeric", "filterFieldEquality", "debounceTime"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
694
+ }
695
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: ValueUnitInput, decorators: [{
696
+ type: Component,
697
+ args: [{ selector: 'lib-value-unit-input', imports: [NettyUINumberInput, AutoComplete, FormsModule], providers: [
698
+ {
699
+ provide: NG_VALUE_ACCESSOR,
700
+ useExisting: forwardRef(() => ValueUnitInput),
701
+ multi: true,
702
+ },
703
+ ], template: "<div class=\"value-unit-container\">\n <!-- Number Input -->\n <ntyui-number-input\n #quantityModel=\"ngModel\"\n [label]=\"label()\"\n [appearance]=\"appearance()\"\n [name]=\"name() + '_quantity'\"\n [placeholder]=\"placeholder()\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onQuantityChange($event)\"\n class=\"quantity-input\"\n >\n </ntyui-number-input>\n\n <!-- AutoComplete for Unit -->\n <ntybase-auto-complete\n #unitModel=\"ngModel\"\n [label]=\"'Birim'\"\n [appearance]=\"appearance()\"\n [name]=\"name() + '_unit'\"\n [required]=\"required()\"\n [disabled]=\"disabled()\"\n [tableName]=\"tableName()\"\n [searchAfter]=\"searchAfter()\"\n [fieldCode]=\"fieldCode()\"\n [fieldName]=\"fieldName()\"\n [lookupComponent]=\"lookupComponent()\"\n [lookupComponentPath]=\"lookupComponentPath()\"\n [filterField]=\"filterField()\"\n [filterFieldValue]=\"filterFieldValue()\"\n [filterFieldNumeric]=\"filterFieldNumeric()\"\n [filterFieldEquality]=\"filterFieldEquality()\"\n [debounceTime]=\"debounceTime()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onUnitChange($event)\"\n class=\"unit-input\"\n >\n </ntybase-auto-complete>\n</div>\n" }]
704
+ }], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], precision: [{ type: i0.Input, args: [{ isSignal: true, alias: "precision", required: false }] }], tableName: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableName", required: false }] }], searchAfter: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchAfter", required: false }] }], fieldCode: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldCode", required: false }] }], fieldName: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldName", required: false }] }], lookupComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponent", required: false }] }], lookupComponentPath: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupComponentPath", required: false }] }], filterField: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterField", required: false }] }], filterFieldValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldValue", required: false }] }], filterFieldNumeric: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldNumeric", required: false }] }], filterFieldEquality: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFieldEquality", required: false }] }], debounceTime: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounceTime", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], quantityModel: [{ type: i0.ViewChild, args: ['quantityModel', { isSignal: true }] }], unitModel: [{ type: i0.ViewChild, args: ['unitModel', { isSignal: true }] }] } });
705
+
604
706
  class HttpError403 {
605
707
  attemptedUrl = '';
606
708
  routeSubscription;
@@ -1079,5 +1181,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImpor
1079
1181
  * Generated bundle index. Do not edit.
1080
1182
  */
1081
1183
 
1082
- export { AutoComplete, ColorPalette, HttpError403, HttpError404, LeftSidenav, Ntyux, NtyuxModule, SelectionItem, Theme, Toolbar };
1184
+ export { AutoComplete, ColorPalette, HttpError403, HttpError404, LeftSidenav, Ntyux, NtyuxModule, SelectionItem, Theme, Toolbar, ValueUnitInput };
1083
1185
  //# sourceMappingURL=nettyapps-ntyux.mjs.map