Override Spec TableLowcode
kasus seperti apa yang mengharuskan programmer menggunakan static spec?
- pengen lebih leluasa untuk mengcustom spec
- API belum standar alurkerja contohnya belum ada endpoint spec
How to nya
- buat spec static nya
const spec = {
show_as_menu: true,
name: 'payslip',
is_bpmn: true,
is_usertask: false,
can_bulk: false,
can_create: true,
can_delete: false,
can_edit: true,
can_detail: true,
label: 'Takwim',
base_url: import.meta.env.VITE_API_BASEURL,
path: '/workflow/v1/bpmn/pengajuanizin',
description: 'Field Dari Takwim',
header_action: [
{
label: 'Tambah',
action_label: 'Tambah Pengajuan',
method: 'post',
form_type: 'new_page',
path: '/workflow/v1/bpmn/pengajuanizin',
icon: 'plus',
type: 'primary',
},
],
field_action: [
{
label: 'Detail',
action_label: 'Detail Payslip',
method: 'get',
form_type: 'modal',
path: '/workflow/v1/bpmn/pengajuanizin/{id}',
icon: 'eye',
type: 'primary',
},
{
label: 'Edit',
action_label: 'Kemaskini Takwim',
method: 'put',
form_type: 'modal',
path: '/workflow/v1/bpmn/pengajuanizin/{id}',
icon: 'edit',
type: 'primary',
},
{
label: 'Hapus',
action_label: 'Hapus Takwim',
method: 'delete',
form_type: 'confirm_modal',
confirm: {
title: 'Hapus Data',
message: 'Adakah anda pasti ingin memadam data ini?',
confirm_text: 'Ya, Teruskan',
cancel_text: 'Batal',
},
path: '/workflow/v1/bpmn/pengajuanizin/{id}',
icon: 'trash',
type: 'danger',
},
],
fields: {
id: {
name: 'id',
label: 'Id',
required: true,
searchable: false,
filterable: false,
sortable: true,
type: 'number',
form_field_type: 'INPUT_NUMBER',
primary: false,
is_hidden_in_create: true,
is_hidden_in_edit: true,
is_hidden_in_list: false,
is_hidden_in_detail: true,
rules: ['required', 'integer'],
format: '',
prefix: '',
suffix: '',
list_order: 6,
create_order: 6,
edit_order: 6,
},
jenis_pengajuan: {
name: 'id',
label: 'Id',
required: true,
searchable: false,
filterable: false,
sortable: true,
type: 'number',
form_field_type: 'INPUT_NUMBER',
primary: false,
is_hidden_in_create: true,
is_hidden_in_edit: true,
is_hidden_in_list: false,
is_hidden_in_detail: true,
rules: ['required', 'integer'],
format: '',
prefix: '',
suffix: '',
list_order: 6,
create_order: 6,
edit_order: 6,
},
action: {
name: 'action',
label: 'Id',
required: true,
searchable: false,
filterable: false,
sortable: true,
type: 'number',
form_field_type: 'INPUT_NUMBER',
primary: false,
is_hidden_in_create: true,
is_hidden_in_edit: true,
is_hidden_in_list: false,
is_hidden_in_detail: true,
rules: ['required', 'integer'],
format: '',
prefix: '',
suffix: '',
list_order: 6,
create_order: 6,
edit_order: 6,
},
jam_mulai: {
name: 'jenis_pengajuan',
label: 'jenis',
required: true,
searchable: false,
filterable: false,
sortable: true,
type: 'number',
form_field_type: 'INPUT_STRING',
primary: false,
is_hidden_in_create: true,
is_hidden_in_edit: true,
is_hidden_in_list: false,
is_hidden_in_detail: true,
rules: ['required', 'integer'],
format: '',
prefix: '',
suffix: '',
list_order: 6,
create_order: 6,
edit_order: 6,
},
},
}
- kirim via props
<TableLowcode
baseUrl={import.meta.env.VITE_API_BASEURL}
spec={spec}
/>
- TableLowcode tidak akan ngehit API spec lagi namun langsung menggunakan spec static yagn dikirimkan via props