@tripup-company/element-ui-extended 0.0.6 → 0.0.10

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.
@@ -0,0 +1,23 @@
1
+ import { Icontact } from "../types/icontact";
2
+ import { BaseModel } from "./base-model";
3
+
4
+ export class ContactModel extends BaseModel implements Icontact {
5
+ id?: number;
6
+ title?: string;
7
+ first_name?: string;
8
+ last_name?: string;
9
+ email: string;
10
+ phone?: string;
11
+ mobile?: string;
12
+ position?: string;
13
+ comments_guid?: string;
14
+ city: string;
15
+ state?: string;
16
+ zip_code: string;
17
+ street?: string;
18
+ country?: string;
19
+
20
+ constructor(data = []) {
21
+ super(data);
22
+ }
23
+ }
@@ -0,0 +1,13 @@
1
+ import { Meta } from "../types/meta";
2
+ import { BaseModel } from "./base-model";
3
+ import { Pagination } from "../types/pagination";
4
+
5
+ export default class MetaModel extends BaseModel implements Meta {
6
+ include: [];
7
+ custom: [];
8
+ pagination: Pagination;
9
+
10
+ constructor(data = []) {
11
+ super(data);
12
+ }
13
+ }
@@ -0,0 +1,39 @@
1
+ export default class ListQueryService {
2
+ key: string;
3
+ storageService: any;
4
+
5
+ constructor(key: any, storageService: any) {
6
+ this.key = key;
7
+ this.storageService = storageService;
8
+ }
9
+ updateSort(column) {
10
+ const sortTypes = {
11
+ ascending: 'asc',
12
+ descending: 'desc',
13
+ };
14
+ if (!sortTypes[column.order]) {
15
+ const query = this.getListQuery();
16
+ delete query['orderBy'];
17
+ delete query['sortedBy'];
18
+ this.setListQuery(query);
19
+ } else {
20
+ this.setListQuery(Object.assign(this.getListQuery(), { orderBy: column.prop, sortedBy: sortTypes[column.order] }));
21
+ }
22
+ }
23
+ getListQuery() {
24
+ let listQuery = {
25
+ meta: {
26
+ page: 1,
27
+ limit: 10,
28
+ }
29
+ };
30
+ listQuery = Object.assign(listQuery, this.storageService.get(this.key));
31
+ return listQuery;
32
+ }
33
+ updateListQuery(listQuery: any) {
34
+ this.setListQuery(Object.assign(this.getListQuery(), listQuery));
35
+ }
36
+ setListQuery(listQuery: any) {
37
+ this.storageService.set(this.key, listQuery);
38
+ }
39
+ }
@@ -0,0 +1,27 @@
1
+ export class LocalStorageService {
2
+ key: string | undefined;
3
+ constructor(key = '') {
4
+ this.key = key;
5
+ }
6
+ get(key, defaultValue = {}) {
7
+ if (localStorage[this.key] === undefined) {
8
+ return defaultValue;
9
+ }
10
+ const json = JSON.parse(localStorage[this.key]);
11
+ if (json[key]) {
12
+ return json[key];
13
+ }
14
+ return defaultValue;
15
+ }
16
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
17
+ set(key, val) {
18
+ let data = localStorage[this.key];
19
+ if (data === undefined) {
20
+ data = {};
21
+ } else {
22
+ data = JSON.parse(data);
23
+ }
24
+ data[key] = val;
25
+ localStorage[this.key] = JSON.stringify(data);
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ const resolutions = {
2
+ quarterResolution: {
3
+ xl: 6, lg: 6, md: 6, sm: 6, xs: 6,
4
+ },
5
+ halfResolution: {
6
+ xl: 12, lg: 12, md: 12, sm: 12, xs: 12,
7
+ },
8
+ fullFromSm: {
9
+ xl: 12, lg: 12, md: 12, sm: 24, xs: 24,
10
+ },
11
+ fullFromLg: {
12
+ xl: 12, lg: 24, md: 24, sm: 24, xs: 24,
13
+ },
14
+ fullResolution: {
15
+ xl: 24, lg: 24, md: 24, sm: 24, xs: 24,
16
+ },
17
+ };
18
+
19
+ export default function getResolution(size) {
20
+ return resolutions[size];
21
+ }
@@ -0,0 +1,6 @@
1
+ export class Article {
2
+ constructor() {
3
+ this.name = "article";
4
+ }
5
+ }
6
+ //# sourceMappingURL=article.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"article.js","sourceRoot":"","sources":["article.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,OAAO;IAApB;QACS,SAAI,GAAG,SAAS,CAAC;IAC1B,CAAC;CAAA"}
@@ -0,0 +1,54 @@
1
+ import {
2
+ AxiosError,
3
+ AxiosRequestConfig,
4
+ AxiosResponse,
5
+ AxiosStatic,
6
+ } from "axios";
7
+
8
+ export interface AxiosInstance extends AxiosStatic {
9
+ $request<T = any>(config: AxiosRequestConfig): Promise<T>;
10
+ $get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
11
+ $delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
12
+ $head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
13
+ $options<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
14
+ $post<T = any>(
15
+ url: string,
16
+ data?: any,
17
+ config?: AxiosRequestConfig
18
+ ): Promise<T>;
19
+ $put<T = any>(
20
+ url: string,
21
+ data?: any,
22
+ config?: AxiosRequestConfig
23
+ ): Promise<T>;
24
+ $patch<T = any>(
25
+ url: string,
26
+ data?: any,
27
+ config?: AxiosRequestConfig
28
+ ): Promise<T>;
29
+ setBaseURL(baseURL: string): void;
30
+ setHeader(
31
+ name: string,
32
+ value?: string | false,
33
+ scopes?: string | string[]
34
+ ): void;
35
+ setToken(
36
+ token: string | false,
37
+ type?: string,
38
+ scopes?: string | string[]
39
+ ): void;
40
+ onRequest(
41
+ callback: (
42
+ config: AxiosRequestConfig
43
+ ) => void | AxiosRequestConfig | Promise<AxiosRequestConfig>
44
+ ): void;
45
+ onResponse<T = any>(
46
+ callback: (
47
+ response: AxiosResponse<T>
48
+ ) => void | AxiosResponse<T> | Promise<AxiosResponse<T>>
49
+ ): void;
50
+ onError(callback: (error: AxiosError) => any): void;
51
+ onRequestError(callback: (error: AxiosError) => any): void;
52
+ onResponseError(callback: (error: AxiosError) => any): void;
53
+ create(options?: AxiosRequestConfig): AxiosInstance;
54
+ }
@@ -0,0 +1,6 @@
1
+ import {Meta} from "./meta";
2
+
3
+ export interface Collection<T>{
4
+ data: T[];
5
+ meta: Meta
6
+ }
@@ -0,0 +1,3 @@
1
+ interface IError {
2
+ message: string
3
+ }
@@ -0,0 +1,17 @@
1
+ export interface Icontact {
2
+ id?: number;
3
+ title?: string;
4
+ first_name?: string;
5
+ last_name?: string;
6
+ email: string;
7
+ phone?: string;
8
+ mobile?: string;
9
+ position?: string;
10
+ comments_guid?: string;
11
+ city: string;
12
+ state?: string;
13
+ zip_code: string;
14
+ street?: string;
15
+ country?: string;
16
+
17
+ }
@@ -0,0 +1,7 @@
1
+ import { Pagination } from "./pagination";
2
+
3
+ export interface Meta {
4
+ include: [];
5
+ custom: [];
6
+ pagination: Pagination;
7
+ }
@@ -0,0 +1,8 @@
1
+ export interface Pagination {
2
+ total: number,
3
+ count: number,
4
+ per_page: number,
5
+ current_page: number,
6
+ total_pages: number,
7
+ links: []
8
+ }
@@ -1,83 +0,0 @@
1
- <template>
2
- <el-col v-if="column" :span="18" class="m-b-20">
3
- <el-col v-if="column.type !== 'checkbox'" class="m-b-5 p-l-0">
4
- <label>{{ column.label }}</label>
5
- </el-col>
6
- <el-input v-if="column.type==='string'" v-model="search.value" />
7
- </el-col>
8
- </template>
9
- <script>
10
- export default {
11
- props: {
12
- column: {
13
- type: Object,
14
- default() {
15
- return {};
16
- },
17
- },
18
- search: {
19
- type: Object,
20
- default() {
21
- return {};
22
- },
23
- },
24
- },
25
- data() {
26
- return {
27
- loading: false,
28
- selectKey: this.column.selectKey ?? 'key',
29
- selectLabel: this.column.selectLabel ?? 'label',
30
- selectValue: this.column.selectValue ?? 'key',
31
- filterable: this.column.filterable ?? false,
32
- remote: this.column.remote ?? false,
33
- remoteMethod: this.column.remoteMethod ?? null,
34
- selectListLocal: this.search.selectList ? this.search.selectList : (this.column.type === 'enum' ? this.column.values : this.boolValues),
35
- };
36
- },
37
- computed: {
38
- isMultiple() {
39
- return this.column.is_multiple ? this.column.is_multiple : false;
40
- },
41
- remoteMethodHandler: {
42
- get() {
43
- if (this.remoteMethod !== null) {
44
- return this.remoteCall;
45
- }
46
- return null;
47
- },
48
- },
49
- },
50
- watch: {
51
- search() {
52
- if (this.search.operator === '') {
53
- this.showFilter = false;
54
- }
55
- },
56
- },
57
- mounted() {
58
- if (this.column.operator) {
59
- this.search.operator = this.column.operator;
60
- }
61
- },
62
- methods: {
63
- async remoteCall(query) {
64
- this.loading = true;
65
- const response = await this.remoteMethod.all({ search: this.selectLabel + ':' + query, searchFields: this.selectLabel + ':like' });
66
- this.selectListLocal = response.data;
67
- this.search['selectList'] = response.data;
68
- this.loading = false;
69
- },
70
- updateSearch(key) {
71
- if (key && this.remote) {
72
- const obj = { [this.selectKey]: key };
73
- for (const item of this.selectListLocal) {
74
- if (item[this.selectKey] === key) {
75
- obj[this.selectLabel] = item[this.selectLabel];
76
- this.search.selectList = [obj];
77
- }
78
- }
79
- }
80
- },
81
- },
82
- };
83
- </script>
@@ -1,54 +0,0 @@
1
- <template>
2
- <el-row>
3
- <filter-top-row
4
- v-for="column in filters"
5
- :key="column.name"
6
- :column="column"
7
- :search="search[column.name]"
8
- />
9
- <el-col :span="6" class="m-t-20">
10
- <el-button @click="applyFilter">Filter</el-button>
11
- <el-button @click="resetFilter">Reset filter</el-button>
12
- </el-col>
13
- </el-row>
14
- </template>
15
-
16
- <script>
17
- import FilterConverter from "./filter-convertor.ts";
18
- import FilterTopRow from "./FilterTopRow";
19
- export default {
20
- name: "GenericTopFilter",
21
- props: {
22
- filters: {
23
- type: Array,
24
- default: () => {
25
- return {};
26
- },
27
- },
28
- search: {
29
- type: Object,
30
- default: () => {
31
- return {};
32
- },
33
- },
34
- },
35
- components: { FilterTopRow },
36
- data() {
37
- const filterConvertor = new FilterConverter();
38
- return {
39
- filterConvertor: filterConvertor,
40
- };
41
- },
42
- methods: {
43
- getFilter() {
44
- return this.filterConvertor.applyFilter(this.search);
45
- },
46
- applyFilter() {
47
- this.$emit("apply:filter", this.filterConvertor.applyFilter(this.search));
48
- },
49
- resetFilter() {
50
- this.$emit("reset:filter", {});
51
- },
52
- },
53
- };
54
- </script>