refactor: ArrayType moved to common.type, dead code removal
This commit is contained in:
parent
ec1035a9a0
commit
f3410db883
@ -1,5 +1,4 @@
|
|||||||
import { VueConstructor } from 'vue'
|
import { VueConstructor } from 'vue'
|
||||||
import isPlainObject from 'is-plain-object'
|
|
||||||
|
|
||||||
import library from '@/libs/library'
|
import library from '@/libs/library'
|
||||||
import rules from '@/validation/rules'
|
import rules from '@/validation/rules'
|
||||||
@ -103,7 +102,7 @@ export default class Formulario {
|
|||||||
const options = this.options as FormularioOptions
|
const options = this.options as FormularioOptions
|
||||||
const path = vm.$route && vm.$route.path ? vm.$route.path : false
|
const path = vm.$route && vm.$route.path ? vm.$route.path : false
|
||||||
const pathPrefix = path ? vm.$route.path.replace(/[/\\.\s]/g, '-') : 'global'
|
const pathPrefix = path ? vm.$route.path.replace(/[/\\.\s]/g, '-') : 'global'
|
||||||
if (!Object.prototype.hasOwnProperty.call(this.idRegistry, pathPrefix)) {
|
if (!has(this.idRegistry, pathPrefix)) {
|
||||||
this.idRegistry[pathPrefix] = 0
|
this.idRegistry[pathPrefix] = 0
|
||||||
}
|
}
|
||||||
return `${options.idPrefix}${pathPrefix}-${++this.idRegistry[pathPrefix]}`
|
return `${options.idPrefix}${pathPrefix}-${++this.idRegistry[pathPrefix]}`
|
||||||
@ -120,28 +119,6 @@ export default class Formulario {
|
|||||||
throw new Error(`VueFormulario extend() should be passed an object (was ${typeof extendWith})`)
|
throw new Error(`VueFormulario extend() should be passed an object (was ${typeof extendWith})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine what "class" of input this element is given the "type".
|
|
||||||
*/
|
|
||||||
classify (type: string) {
|
|
||||||
if (has(this.options.library, type)) {
|
|
||||||
return this.options.library[type].classification
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'unknown'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine what type of component to render given the "type".
|
|
||||||
*/
|
|
||||||
component (type: string) {
|
|
||||||
if (has(this.options.library, type)) {
|
|
||||||
return this.options.library[type].component
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get validation rules by merging any passed in with global rules.
|
* Get validation rules by merging any passed in with global rules.
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
export type ArrayType = [any]
|
||||||
export type ObjectType = { [key: string]: any }
|
export type ObjectType = { [key: string]: any }
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import FileUpload from '@/FileUpload'
|
import FileUpload from '@/FileUpload'
|
||||||
|
import {
|
||||||
type ArrayType = [any]
|
ArrayType,
|
||||||
type ObjectType = { [key: string]: any }
|
ObjectType,
|
||||||
|
} from '@/common.types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to map over an object.
|
* Function to map over an object.
|
||||||
|
Loading…
Reference in New Issue
Block a user