Core Docs

Number

Input số nguyên / thập phân — bind decimal/int. Cấu hình `Precision` cho số chữ số thập phân.

Source: Core/Components/Number.cs · ComType: Number

Cấu hình

ComType:    Number
FieldName:  Quantity
Label:      Số lượng
ShowLabel:  true
Precision:  2          # 2 chữ số thập phân

Field DB dùng

FieldVai trò
FieldNameProperty của entity bind vào (int, decimal, double).
PrecisionSố chữ số thập phân hiển thị (vd 2 cho money). Giá trị raw vẫn full precision.
EventsJSON map event → method C# (Change, Input).
QueryOData/SQL query nội bộ (rare — cho calculated fields).
FormatDataTemplate {<FieldName>:format} áp lên value. Vd "{Amount:N2}", "{Total:N0} VND".
FormatEntityTemplate {FieldName} áp lên toàn entity (ghép nhiều field).
CanCacheTrue → cache giá trị (dùng cho computed columns).
AutoFitTrue → input co giãn theo nội dung.
PlainTextTrue → render plain (không format).
ChildStyleInline CSS style apply lên <input> bên trong.

Events kích hoạt

EventMethod signatureKhi nào
change(entity, newValue, oldValue, parent)Blur hoặc Enter, value đã đổi.
input(entity)Mỗi keystroke.
{ "change": "Recalculate" }
public void Recalculate(object entity, object newVal, object oldVal, object parent)
{
    var line = (InvoiceLine)entity;
    line.Total = line.Qty * line.Price;
    this.FindComponentByName<Number>("Total")?.UpdateView();
}

Tip

  • Precision chỉ chi phối hiển thị (format khi blur). Giá trị raw lưu vào entity vẫn là decimal đầy đủ.
  • Để giới hạn min/max — set vào Component.Validation (rule JSON: {"min": 0, "max": 999999}). Trước submit await this.IsFormValid() sẽ tự check.
  • AutoFit = true → input co giãn theo nội dung.

Core Docs · Astro · Core.API/wwwRoot/docs