Trang tài liệu Trí Nam

Tài liệu hướng dẫn vận hành DevOps

ColorPickerControlSchema

Estimated reading: 2 minutes 191 views

Hình ảnh / Demo

Mục đích

Dùng để tạo 1 ô input chọn màu sắc trong form. Giá trị trả về là 1 string HexColor của màu đã chọn.

Cách dùng

Import

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

				
					import { ColorPickerControlSchema } from 'tnx-shared';
				
			

Cách dùng cơ bản

ColorPickerControlSchema được thêm vào trong this.setting.schema khi khởi tạo form.
				
					...
ngOnInit() {
...
this.setting.schema = [
    new ColorPickerControlSchema({
        label: 'Màu sắc',
        field: 'demo1',
        mdWidth: 3
    }),
  ...
]
...
}
...
				
			

Thuộc tính

Sự kiện

				
					
  new ColorPickerControlSchema({
      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;
        }
      }
  })
				
			
CONTENTS