Skip to content

Commit

Permalink
🔨 Move AddressEntry from single file to global declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
gluons committed Oct 15, 2017
1 parent bdc8582 commit a5a840b
Show file tree
Hide file tree
Showing 19 changed files with 10 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/components/AddressForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Component from 'vue-class-component';
import store from '@/store';
import AddressEntry from '@/interface/AddressEntry';
import { loadDataSource } from '@/lib/datasource-utils';
import TypeaheadInput from './TypeaheadInput.vue';
Expand Down
1 change: 0 additions & 1 deletion src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ul.typeahead-autocomplete(:style='style', v-if='hasData')
import Vue from 'vue';
import Component from 'vue-class-component';
import AddressEntry from '@/interface/AddressEntry';
import { addressToString, getDataItemKeys } from '@/lib/utils';
@Component({
Expand Down
1 change: 0 additions & 1 deletion src/components/TypeaheadInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import Vue from 'vue';
import Component from 'vue-class-component';
import AddressEntry from '@/interface/AddressEntry';
import { getPossibles } from '@/lib/datasource-utils';
import { getDataItemKeys } from '@/lib/utils';
import Autocomplete from './Autocomplete.vue';
Expand Down
2 changes: 0 additions & 2 deletions src/interface/AddressEntry.ts → src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ interface AddressEntry {
amphoe_code?: any;
province_code?: any;
}

export default AddressEntry;
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import AddressForm from '@/components/AddressForm.vue';
import V from 'vue';
import Vue from 'vue';

/* tslint:disable: no-namespace */
declare global {
interface Window {
Vue: typeof Vue;
}
}

/**
* Install as Vue plugin.
*
* @param {typeof V} Vue Vue instance.
* @param {typeof Vue} vue Vue instance.
*/
function install(Vue: typeof V): void {
function install(vue: typeof Vue): void {
Vue.component('address-form', AddressForm);
}

Expand Down
1 change: 0 additions & 1 deletion src/lib/datasource-utils/get-possibles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import { calculateSimilarity } from '@/lib/utils';
import * as filter from 'array-filter';

Expand Down
1 change: 0 additions & 1 deletion src/lib/datasource-utils/load-data-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import database from '@/data/db.json';
import AddressEntry from '@/interface/AddressEntry';
import preprocess from './preprocess';

/**
Expand Down
2 changes: 0 additions & 2 deletions src/lib/datasource-utils/preprocess.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';

/**
* Preprocess data from JSON database.
*
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/address-to-string.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import highlightQuery from './highlight-query';

export const SEPARATOR: string = '»';
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/calculate-similarity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import * as stringSimilarity from 'string-similarity';

/**
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/get-data-item-keys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import * as filter from 'array-filter';

/**
Expand Down
1 change: 0 additions & 1 deletion src/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import { ActionContext, ActionTree } from 'vuex';
import { DATA_SOURCE } from './mutation-types';
import { State } from './state';
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/input-module/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ActionContext, ActionTree } from 'vuex';

import AddressEntry from '@/interface/AddressEntry';
import { LIST, VALUE } from '@/store/mutation-types';
import { State as RootState } from '@/store/state';
import { InputState } from './state';
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/input-module/getters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GetterTree } from 'vuex';

import AddressEntry from '@/interface/AddressEntry';
import { State as RootState } from '@/store/state';
import { InputState } from './state';

Expand Down
1 change: 0 additions & 1 deletion src/store/modules/input-module/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MutationTree } from 'vuex';

import AddressEntry from '@/interface/AddressEntry';
import { LIST, VALUE } from '@/store/mutation-types';
import { InputState } from './state';

Expand Down
2 changes: 0 additions & 2 deletions src/store/modules/input-module/state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';

export class InputState {
public value: string = '';
public autocompleteList: AddressEntry[] = [];
Expand Down
1 change: 0 additions & 1 deletion src/store/mutations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';
import { MutationTree } from 'vuex';
import { DATA_SOURCE } from './mutation-types';
import { State } from './state';
Expand Down
2 changes: 0 additions & 2 deletions src/store/state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import AddressEntry from '@/interface/AddressEntry';

export class State {
public dataSource: AddressEntry[] = null;
}
3 changes: 0 additions & 3 deletions src/vue-shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}
declare interface Window {
Vue: any
}

0 comments on commit a5a840b

Please sign in to comment.