function crudCommonOptions() {
    return {
        affixHeader: false,
        stopAutoRefreshWhenModalIsOpen: true,
        resizable: false,
        syncLocation: false,
        silentPolling: true,
    }
}

function readOnlyDialogOptions() {
    return {
        actions: [],
        showCloseButton: false,
        closeOnEsc: true,
        closeOnOutside: true,
        disabled: true,
    }
}

function paginationCommonOptions(perPage = true, maxButtons = 5) {
    let option = {
        type: 'pagination',
        layout: [
            'pager'
        ],
        maxButtons: maxButtons,
        showPageInput: false,
        perPageAvailable: [10, 15, 20, 50, 100, 200],
    }
    if (perPage) {
        option.layout.push('perPage')
    }
    return option
}

function paginationTemplate(perPage = 20, maxButtons = 5) {
    return {
        perPage: perPage,
        headerToolbar: [
            "reload",
            paginationCommonOptions(true, maxButtons),
        ],
        footerToolbar: [
            "statistics",
            paginationCommonOptions(true, maxButtons),
        ],
    }
}
