cmat 0.0.99 → 0.0.100

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.
@@ -2200,12 +2200,16 @@ class CmatDatetimepickerInputDirective {
2200
2200
  this.max = input(null, /* @ts-ignore */
2201
2201
  ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
2202
2202
  this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
2203
+ this._effectiveDisabled = computed(() => this.disabled() || this._fcDisabled(), /* @ts-ignore */
2204
+ ...(ngDevMode ? [{ debugName: "_effectiveDisabled" }] : /* istanbul ignore next */ []));
2203
2205
  this.value = input(null, /* @ts-ignore */
2204
2206
  ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
2205
2207
  this.dateFilter = computed(() => this.cmatDatepickerFilter(), /* @ts-ignore */
2206
2208
  ...(ngDevMode ? [{ debugName: "dateFilter" }] : /* istanbul ignore next */ []));
2207
2209
  this.datetimepicker = computed(() => this.cmatDatetimepicker(), /* @ts-ignore */
2208
2210
  ...(ngDevMode ? [{ debugName: "datetimepicker" }] : /* istanbul ignore next */ []));
2211
+ this._fcDisabled = signal(false, /* @ts-ignore */
2212
+ ...(ngDevMode ? [{ debugName: "_fcDisabled" }] : /* istanbul ignore next */ []));
2209
2213
  this._elementRef = inject(ElementRef);
2210
2214
  this._dateAdapter = inject(DatetimeAdapter, { optional: true });
2211
2215
  this._dateFormats = inject(CMAT_DATETIME_FORMATS, { optional: true });
@@ -2259,10 +2263,11 @@ class CmatDatetimepickerInputDirective {
2259
2263
  this._formatValue(this._internalValue());
2260
2264
  }
2261
2265
  });
2262
- effect(() => {
2263
- const inputValue = this.value();
2264
- untracked(() => this._setValue(inputValue));
2265
- });
2266
+ // 注意:不要在此处创建对 value() 输入的同步 effect。
2267
+ // 组件构造期创建的 effect 会在同一轮渲染末尾(writeValue 之后)统一 flush,
2268
+ // 首次运行时 value() 为默认值 null,会把 formControl 经 writeValue 写入的回显值清空,
2269
+ // 导致 formly 详情弹窗等"控件先带值后渲染"场景下日期输入框显示为空。
2270
+ // 外部值同步由 writeValue(formControl/ngModel)负责;[value] 输入保留仅为兼容。
2266
2271
  effect(() => {
2267
2272
  this.min();
2268
2273
  this._validatorOnChange();
@@ -2276,7 +2281,7 @@ class CmatDatetimepickerInputDirective {
2276
2281
  this._validatorOnChange();
2277
2282
  });
2278
2283
  effect(() => {
2279
- const disabledValue = this.disabled();
2284
+ const disabledValue = this._effectiveDisabled();
2280
2285
  this.disabledChange.emit(disabledValue);
2281
2286
  });
2282
2287
  }
@@ -2327,9 +2332,8 @@ class CmatDatetimepickerInputDirective {
2327
2332
  registerOnTouched(fn) {
2328
2333
  this._onTouched = fn;
2329
2334
  }
2330
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2331
2335
  setDisabledState(disabled) {
2332
- // Disabled state is managed through the disabled input signal
2336
+ this._fcDisabled.set(disabled);
2333
2337
  }
2334
2338
  onKeydown(event) {
2335
2339
  if (event.altKey && event.code === 'ArrowDown') {
@@ -2425,7 +2429,7 @@ class CmatDatetimepickerInputDirective {
2425
2429
  value ? this._dateAdapter.format(value, this._getDisplayFormat()) : '';
2426
2430
  }
2427
2431
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: CmatDatetimepickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2428
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: CmatDatetimepickerInputDirective, isStandalone: true, selector: "input[cmatDatetimepicker]", inputs: { cmatDatetimepicker: { classPropertyName: "cmatDatetimepicker", publicName: "cmatDatetimepicker", isSignal: true, isRequired: false, transformFunction: null }, cmatDatepickerFilter: { classPropertyName: "cmatDatepickerFilter", publicName: "cmatDatepickerFilter", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "input": "onInput($event.target.value)", "change": "onChange()", "blur": "onBlur()", "keydown": "onKeydown($event)" }, properties: { "attr.aria-haspopup": "true", "attr.aria-owns": "(datetimepicker()?.opened() && datetimepicker()?.id) || null", "attr.min": "min() ? datetimepicker()?.toIso8601(min()) : null", "attr.max": "max() ? datetimepicker()?.toIso8601(max()) : null", "disabled": "disabled()" } }, providers: [
2432
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: CmatDatetimepickerInputDirective, isStandalone: true, selector: "input[cmatDatetimepicker]", inputs: { cmatDatetimepicker: { classPropertyName: "cmatDatetimepicker", publicName: "cmatDatetimepicker", isSignal: true, isRequired: false, transformFunction: null }, cmatDatepickerFilter: { classPropertyName: "cmatDatepickerFilter", publicName: "cmatDatepickerFilter", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "input": "onInput($event.target.value)", "change": "onChange()", "blur": "onBlur()", "keydown": "onKeydown($event)" }, properties: { "attr.aria-haspopup": "true", "attr.aria-owns": "(datetimepicker()?.opened() && datetimepicker()?.id) || null", "attr.min": "min() ? datetimepicker()?.toIso8601(min()) : null", "attr.max": "max() ? datetimepicker()?.toIso8601(max()) : null", "disabled": "_effectiveDisabled()" } }, providers: [
2429
2433
  CMAT_DATETIMEPICKER_VALUE_ACCESSOR,
2430
2434
  CMAT_DATETIMEPICKER_VALIDATORS,
2431
2435
  { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: CmatDatetimepickerInputDirective },
@@ -2445,7 +2449,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
2445
2449
  '[attr.aria-owns]': '(datetimepicker()?.opened() && datetimepicker()?.id) || null',
2446
2450
  '[attr.min]': 'min() ? datetimepicker()?.toIso8601(min()) : null',
2447
2451
  '[attr.max]': 'max() ? datetimepicker()?.toIso8601(max()) : null',
2448
- '[disabled]': 'disabled()',
2452
+ '[disabled]': '_effectiveDisabled()',
2449
2453
  '(input)': 'onInput($event.target.value)',
2450
2454
  '(change)': 'onChange()',
2451
2455
  '(blur)': 'onBlur()',