datatable-axios 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rollup.config.js +0 -27
- package/src/axios.js +0 -5
- package/src/datatable.js +0 -56
- package/src/index.js +0 -2
- package/vite.config.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datatable-axios",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A powerful npm package for effortless datatable interactions with seamless Axios calls. Effortlessly integrate search, paginate, and pagination functionalities into your projects with ease.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/datatable-axios.js",
|
package/rollup.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// rollup.config.js
|
|
2
|
-
import commonjs from '@rollup/plugin-commonjs'
|
|
3
|
-
import resolve from '@rollup/plugin-node-resolve'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
input: 'src/index.js', // Adjust your entry point
|
|
7
|
-
output: [
|
|
8
|
-
{
|
|
9
|
-
file: 'dist/datatable-axios.cjs.js',
|
|
10
|
-
format: 'cjs',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
file: 'dist/datatable-axios.esm.js',
|
|
14
|
-
format: 'esm',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
file: 'dist/datatable-axios.umd.js',
|
|
18
|
-
format: 'umd',
|
|
19
|
-
name: 'datatable-axios',
|
|
20
|
-
globals: {
|
|
21
|
-
axios: 'axios', // Provide the global name for axios
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
plugins: [resolve(), commonjs()],
|
|
26
|
-
external: ['axios'], // Add any external dependencies
|
|
27
|
-
}
|
package/src/axios.js
DELETED
package/src/datatable.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import axios from "./axios"
|
|
2
|
-
// Create a URLSearchParams object to parse the query string
|
|
3
|
-
const searchParams = new URLSearchParams(window.location.search)
|
|
4
|
-
|
|
5
|
-
// Get individual query parameter values
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class datatable {
|
|
9
|
-
constructor() {
|
|
10
|
-
// this.page = router.currentRoute.value.query.page
|
|
11
|
-
// this.paginate = router.currentRoute.value.query.paginate
|
|
12
|
-
// this.search = router.currentRoute.value.query.search
|
|
13
|
-
}
|
|
14
|
-
async get(url) {
|
|
15
|
-
// const page = router.currentRoute.value.query.page
|
|
16
|
-
// const paginate = router.currentRoute.value.query.paginate
|
|
17
|
-
// const search = router.currentRoute.value.query.search
|
|
18
|
-
const page = searchParams.get('page')
|
|
19
|
-
const paginate = searchParams.get('paginate')
|
|
20
|
-
const search = searchParams.get('search')
|
|
21
|
-
|
|
22
|
-
return new Promise(async (resolve) => {
|
|
23
|
-
if (!page && !paginate && !search) {
|
|
24
|
-
await window.axios.get(url).then(response => {
|
|
25
|
-
resolve(response)
|
|
26
|
-
})
|
|
27
|
-
} else {
|
|
28
|
-
await window.axios.get(`${url}?page=${page}&paginate=${paginate}&search=${search}`).then(response => {
|
|
29
|
-
resolve(response)
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
async post(url) {
|
|
35
|
-
// const page = router.currentRoute.value.query.page
|
|
36
|
-
// const paginate = router.currentRoute.value.query.paginate
|
|
37
|
-
// const search = router.currentRoute.value.query.search
|
|
38
|
-
const page = searchParams.get('page')
|
|
39
|
-
const paginate = searchParams.get('paginate')
|
|
40
|
-
const search = searchParams.get('search')
|
|
41
|
-
|
|
42
|
-
return new Promise(async (resolve) => {
|
|
43
|
-
if (!page && !paginate && !search) {
|
|
44
|
-
await window.axios.post(url).then(response => {
|
|
45
|
-
resolve(response)
|
|
46
|
-
})
|
|
47
|
-
} else {
|
|
48
|
-
await window.axios.post(`${url}?page=${page}&paginate=${paginate}&search=${search}`).then(response => {
|
|
49
|
-
resolve(response)
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// const datatableAxios = new datatable()
|
|
56
|
-
export default datatable
|
package/src/index.js
DELETED
package/vite.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
build: {
|
|
3
|
-
lib: {
|
|
4
|
-
entry: 'src/index.js',
|
|
5
|
-
name: 'datatable-axios'
|
|
6
|
-
}, rollupOptions: {
|
|
7
|
-
external: ['axios'], // Add any external dependencies
|
|
8
|
-
output: {
|
|
9
|
-
globals: {
|
|
10
|
-
axios: 'axios', // Specify the global variable name for axios
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
}
|