vue-ui-grid
Advanced tools
Comparing version 0.1.42 to 0.1.43
{ | ||
"name": "vue-ui-grid", | ||
"version": "0.1.42", | ||
"version": "0.1.43", | ||
"main": "dist/vue-ui-grid.common.js", | ||
@@ -11,3 +11,5 @@ "types": "index.d.ts", | ||
"test:unit": "vue-cli-service test:unit", | ||
"lint": "vue-cli-service lint" | ||
"lint": "vue-cli-service lint", | ||
"docs:dev": "vuepress dev docs", | ||
"docs:build": "vuepress build docs" | ||
}, | ||
@@ -39,3 +41,3 @@ "files": [ | ||
"@vue/test-utils": "1.0.0-beta.29", | ||
"apollo-boost": "^0.4.4", | ||
"apollo-boost": "^0.4.7", | ||
"axios": "^0.19.0", | ||
@@ -47,3 +49,2 @@ "bootstrap": "^4.3.1", | ||
"graphql": "^14.5.8", | ||
"luxon": "^1.19.3", | ||
"pug": "^2.0.4", | ||
@@ -54,7 +55,8 @@ "pug-plain-loader": "^1.0.0", | ||
"typescript": "~3.5.3", | ||
"vue": "^2.6.10", | ||
"vue": "^2.6.11", | ||
"vue-apollo": "^3.0.0", | ||
"vue-class-component": "^7.0.2", | ||
"vue-property-decorator": "^8.3.0", | ||
"vue-template-compiler": "^2.6.10" | ||
"vue-template-compiler": "^2.6.11", | ||
"vuepress": "^1.2.0" | ||
}, | ||
@@ -61,0 +63,0 @@ "repository": { |
# vue-ui-grid | ||
Simple, fast, powerful grid package for vuejs | ||
## Demo | ||
https://mihnsen.github.io/vue-ui-grid/ | ||
## Installation | ||
@@ -4,0 +9,0 @@ ``` |
import Vue from 'vue' | ||
import VueApollo from 'vue-apollo' | ||
import ApolloClient from 'apollo-boost' | ||
import ApolloClient from 'apollo-boost/lib/index' | ||
@@ -10,3 +10,3 @@ Vue.use(VueApollo) | ||
// uri: 'https://api.graphcms.com/simple/v1/awesomeTalksClone' | ||
uri: 'http://localhost:6002/v1/graphql' | ||
uri: 'http://localhost:3102/v1/graphql' | ||
}) | ||
@@ -13,0 +13,0 @@ |
@@ -12,13 +12,27 @@ import Vue from 'vue' | ||
axios.defaults.baseURL = 'http://localhost:3091/api/' | ||
axios.defaults.baseURL = 'https://reqres.in/api' | ||
axios.interceptors.response.use((response) => { | ||
return response | ||
}, (error) => { | ||
// Do something with response error | ||
if (error.response && error.response.status === 401) { | ||
// TODO logout | ||
} | ||
console.log('error', error) | ||
return Promise.reject(error.response) | ||
}) | ||
Vue.use(VueUIGrid, { | ||
graphql: true, | ||
debug: true, | ||
ajax: true, | ||
fetchData: axios.get, | ||
pageKey: 'page', | ||
perPageKey: 'per_page', | ||
extractData: (responseData: any) => { | ||
const data = responseData.data | ||
// console.log('hello', data) | ||
return { | ||
items: data.items, | ||
total: data.totalItems | ||
items: data.data, | ||
total: data.total | ||
} | ||
@@ -28,10 +42,31 @@ }, | ||
graphqlFilter(column: any, value: string) { | ||
graphql: true, | ||
// filterKey: 'filter', | ||
// limitKey: 'last', | ||
// offsetKey: 'skip', | ||
// graphqlFilter(column: any, value: string) { | ||
// let result = '' | ||
// if (column) { | ||
// result = `${column.field}_contains: "${value}"` | ||
// } | ||
// return result | ||
// }, | ||
// graphqlOrder(by: string, type: string) { | ||
// console.log(by, type) | ||
// const typeStr = type.toUpperCase() | ||
// return `orderBy: ${by}_${typeStr}` | ||
// }, | ||
// aggregateQuery: 'count', | ||
// graphqlDataCounter: (data: any) => data.count | ||
graphqlFilter(field: string, fieldType: string, value: string) { | ||
let result = '' | ||
if (column) { | ||
if (column.type === 'uuid') { | ||
result = `${column.field}: { _eq: "${value}" }` | ||
if (field) { | ||
if (fieldType === 'uuid') { | ||
result = `${field}: { _eq: "${value}" }` | ||
} else { | ||
result = `${column.field}: { _like: "%${value}%" }` | ||
result = `${field}: { _ilike: "%${value}%" }` | ||
} | ||
@@ -38,0 +73,0 @@ } |
@@ -7,3 +7,10 @@ import Vue from 'vue' | ||
declare interface GraphGrid { | ||
declare interface AjaxGridExtracedData { | ||
items: Array<any>; | ||
total: number; | ||
} | ||
declare interface VGrid { | ||
debug: boolean; | ||
hasSortType?: boolean; | ||
offsetKey: string; | ||
@@ -16,10 +23,2 @@ filterKey: string; | ||
graphqlDataCounter(data: any): number; | ||
} | ||
declare interface AjaxGridExtracedData { | ||
items: Array<any>; | ||
total: number; | ||
} | ||
declare interface AjaxGrid { | ||
pageKey: string; | ||
@@ -36,5 +35,4 @@ perPageKey: string; | ||
interface Vue { | ||
$graphGrid: GraphGrid; | ||
$ajaxGrid: AjaxGrid; | ||
$vgrid: VGrid; | ||
} | ||
} |
@@ -21,2 +21,9 @@ import Grid from './components/grid/BasicGrid.vue' | ||
const gridOption = { | ||
debug: options.debug | ||
} | ||
let graphqlOption = {} | ||
let ajaxOption = {} | ||
if (options.graphql) { | ||
@@ -27,3 +34,3 @@ Vue.component('VGraphGrid', GraphGrid) | ||
Vue.prototype.$graphGrid = { | ||
graphqlOption = { | ||
filterKey: options.filterKey || 'where', | ||
@@ -44,7 +51,8 @@ limitKey: options.limitKey || 'limit', | ||
Vue.prototype.$ajaxGrid = { | ||
ajaxOption = { | ||
extractData: options.extractData, | ||
pageKey: options.pageKey || 'page', | ||
hasSortType: options.hasSortType, | ||
sortKey: options.sortKey || 'sort', | ||
sortTypeKey: options.sortTypeKey, | ||
sortTypeKey: options.sortTypeKey || 'sort_type', | ||
perPageKey: options.perPageKey || 'limit', | ||
@@ -57,2 +65,8 @@ fetchData: options.fetchData || 'limit', | ||
} | ||
Vue.prototype.$vgrid = { | ||
...gridOption, | ||
...ajaxOption, | ||
...graphqlOption | ||
} | ||
} | ||
@@ -59,0 +73,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1396060
93
27075
152
12