Skip to content

refactor(protected method): update method to protected #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] [![npm-downloads]][npm-downloads] ![][typescript-image] [![license-image]][license-url]

## Introduction

Adonis datatable is an inspiration from laravel datatable. This code is taken from some of those source codes.
Adonis datatable is an inspiration from laravel datatable. It is heavily inspired by the PHP library [Laravel Datatables](https://yajrabox.com/docs/laravel-datatables) and even share some code.

## Official Documentation

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@adityadarma/adonis-datatables",
"description": "Package server side datatables on AdonisJS",
"version": "1.1.7",
"version": "1.1.8",
"engines": {
"node": ">=20.6.0"
},
Expand Down Expand Up @@ -46,7 +46,7 @@
"adonis",
"adonisjs"
],
"author": "Aditya Darma",
"author": "Aditya Darma <adhit.boys1@gmail.com>",
"license": "MIT",
"devDependencies": {
"@adonisjs/assembler": "^7.7.0",
Expand Down
22 changes: 11 additions & 11 deletions src/datatable_abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export abstract class DataTableAbstract implements DataTable {

protected $dataObject: boolean = true

constructor() {
this.config = new Config(app.config.get('datatables'))
}

static canCreate(_source: any) {
return false
}
Expand All @@ -63,14 +67,15 @@ export abstract class DataTableAbstract implements DataTable {
return new this(source)
}

constructor() {
this.config = new Config(app.config.get('datatables'))
}
/**
* Implement function
*/
protected abstract defaultOrdering(): any

/**
* Implement function
*/
abstract defaultOrdering(): any
protected abstract resolveCallback(): any

/**
* Implement function
Expand Down Expand Up @@ -102,11 +107,6 @@ export abstract class DataTableAbstract implements DataTable {
*/
abstract globalSearch(keyword: string): void

/**
* Implement function
*/
protected abstract resolveCallback(): any

protected prepareContext(): void {
if (this.ctx) {
return
Expand Down Expand Up @@ -170,7 +170,7 @@ export abstract class DataTableAbstract implements DataTable {
}
}

protected async processResults(results: Record<string, any>[]): Promise<Record<string, any>[]> {
protected processResults(results: Record<string, any>[]): Record<string, any>[] {
const processor = new DataProcessor(
results,
this.getColumnsDefinition(),
Expand All @@ -179,7 +179,7 @@ export abstract class DataTableAbstract implements DataTable {
this.config
)

return await processor.process(this.$dataObject)
return processor.process(this.$dataObject)
}

protected render(data: any[]): void {
Expand Down
Loading