@ardium-ui/ui 5.0.0-alpha.13 → 5.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -688,6 +688,8 @@ class NumberInputModel {
688
688
  v = this._applyNumberConstraint(v);
689
689
  v = this._applyMinMaxConstraints(v);
690
690
  }
691
+ if (v === '')
692
+ v = null;
691
693
  //update view
692
694
  const oldVal = this._value();
693
695
  this.setValue(v);
@@ -8308,6 +8310,7 @@ const _numberInputDefaults = {
8308
8310
  allowFloat: false,
8309
8311
  noButtons: false,
8310
8312
  stepSize: 1,
8313
+ keepFocusOnQuickChangeButton: true,
8311
8314
  };
8312
8315
  const ARD_NUMBER_INPUT_DEFAULTS = new InjectionToken('ard-number-input-defaults', {
8313
8316
  factory: () => ({
@@ -8339,14 +8342,14 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
8339
8342
  this._wasViewInit = false;
8340
8343
  this.inputId = input();
8341
8344
  //! placeholder
8342
- this.placeholder = input();
8345
+ this.placeholder = input(this._DEFAULTS.placeholder);
8343
8346
  this.placeholderTemplate = contentChild(ArdNumberInputPlaceholderTemplateDirective);
8344
8347
  this.shouldDisplayPlaceholder = computed(() => !!this.placeholder() && !this.inputModel.stringValue());
8345
8348
  //! appearance
8346
- this.appearance = input(FormElementAppearance.Outlined);
8347
- this.variant = input(FormElementVariant.Rounded);
8348
- this.alignText = input(OneAxisAlignment.Middle);
8349
- this.compact = input(false, { transform: v => coerceBooleanProperty(v) });
8349
+ this.appearance = input(this._DEFAULTS.appearance);
8350
+ this.variant = input(this._DEFAULTS.variant);
8351
+ this.alignText = input(this._DEFAULTS.alignText);
8352
+ this.compact = input(this._DEFAULTS.compact, { transform: v => coerceBooleanProperty(v) });
8350
8353
  this.ngClasses = computed(() => {
8351
8354
  return [
8352
8355
  `ard-appearance-${this.appearance()}`,
@@ -8374,7 +8377,7 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
8374
8377
  //! other inputs
8375
8378
  this.inputAttrs = input({});
8376
8379
  //! value two-way binding
8377
- this._valueBeforeInit = '0';
8380
+ this._valueBeforeInit = null;
8378
8381
  this.valueChange = output();
8379
8382
  //! event emitters
8380
8383
  this.inputEvent = output({ alias: 'input' });
@@ -8382,13 +8385,15 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
8382
8385
  this.clearEvent = output({ alias: 'clear' });
8383
8386
  this.quickChangeEvent = output({ alias: 'quickChange' });
8384
8387
  //! min/max and number type
8385
- this.min = input(0, { transform: v => coerceNumberProperty(v, 0) });
8386
- this.max = input(999999, { transform: v => coerceNumberProperty(v, 999999) });
8387
- this.allowFloat = input(false, { transform: v => coerceBooleanProperty(v) });
8388
+ this.min = input(this._DEFAULTS.min, { transform: v => coerceNumberProperty(v, this._DEFAULTS.min) });
8389
+ this.max = input(this._DEFAULTS.max, { transform: v => coerceNumberProperty(v, this._DEFAULTS.max) });
8390
+ this.allowFloat = input(this._DEFAULTS.allowFloat, { transform: v => coerceBooleanProperty(v) });
8388
8391
  //! incerement/decrement buttons
8389
- this.noButtons = input(false, { transform: v => coerceBooleanProperty(v) });
8390
- this.keepFocusOnQuickChangeButton = input(true, { transform: v => coerceBooleanProperty(v) });
8391
- this.stepSize = input(1, {
8392
+ this.noButtons = input(this._DEFAULTS.noButtons, { transform: v => coerceBooleanProperty(v) });
8393
+ this.keepFocusOnQuickChangeButton = input(this._DEFAULTS.keepFocusOnQuickChangeButton, {
8394
+ transform: v => coerceBooleanProperty(v),
8395
+ });
8396
+ this.stepSize = input(this._DEFAULTS.stepSize, {
8392
8397
  transform: v => {
8393
8398
  const newValue = coerceNumberProperty(v, 1);
8394
8399
  if (newValue === 0)
@@ -8398,11 +8403,11 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
8398
8403
  return newValue;
8399
8404
  },
8400
8405
  });
8401
- effect(() => {
8402
- const v = this.inputModel.numberValue();
8403
- this.valueChange.emit(v);
8404
- this._onChangeRegistered?.(v);
8405
- });
8406
+ // effect(() => {
8407
+ // const v = this.inputModel.numberValue();
8408
+ // this.valueChange.emit(v);
8409
+ // this._onChangeRegistered?.(v);
8410
+ // });
8406
8411
  }
8407
8412
  ngAfterViewInit() {
8408
8413
  this._setInputAttributes();
@@ -8496,6 +8501,7 @@ class ArdiumNumberInputComponent extends _FormFieldComponentBase {
8496
8501
  _emitChange() {
8497
8502
  const v = this.inputModel.numberValue();
8498
8503
  this.changeEvent.emit(v);
8504
+ this._onChangeRegistered?.(v);
8499
8505
  }
8500
8506
  //smart focus
8501
8507
  onMouseup() {