Trang tài liệu Trí Nam

Tài liệu hướng dẫn sử dụng core TNX 5

EditorControlSchema

Estimated reading: 3 minutes 338 views

Hình ảnh / Demo

Mục đích

Dùng để tạo 1 ô input soạn thảo văn bản(word) trong form.

Cách dùng

Import

Import vào đầu file .ts cần sử dụng

import { EditorControlSchema } from 'tnx-shared';

Cách dùng cơ bản

EditorControlSchema được thêm vào trong this.setting.schema khi khởi tạo form.

...
ngOnInit() {
...
this.setting.schema = [
    new EditorControlSchema({
        label: '12.1 Mục tiêu tổng thể',
        fullLabel: '12.1 Mục tiêu tổng thể',
        field: 'mucTieuChung',
        mdWidth: 12,
    }),
  ...
]
...
}
...

Thuộc tính

Sự kiện

new EditorControlSchema({
    field: 'myField',
    label: 'Trường muốn dùng',
    onChanged: (eventData: EventData) => {
      console.log(eventData);
      if (this.model.data.property || <>) {
          evt.formControls['other control name'].hidden = true;
      } else {
      evt.formControls['other control name'].hidden = false;
      }
    },
    // nếu là thành viên ngoài trường thì hiện, không phải thì ẩn đi
    hiddenCheck: (rootModel, currentNode) => {
       return !currentNode.parentNode.parentModel.isThanhVienNgoaiTruong;
    },
})