@detools/vue-form
Version:
Form State Management for VueJS
93 lines (72 loc) • 1.96 kB
JavaScript
import noop from 'lodash/noop'
export const BUTTONS_POSITION = {
START: 'start',
CENTER: 'center',
END: 'end',
LABEL: 'label',
}
const formProps = {
// v-model
value: Object,
cancel: [String, Boolean],
save: [String, Boolean],
submit: [String, Boolean],
labelWidth: String,
labelSuffix: String,
labelPosition: String,
statusIcon: {
type: Boolean,
default: true,
},
buttonsPosition: {
type: String,
default: () => 'start',
validator: value => Object.values(BUTTONS_POSITION).includes(value),
},
buttonsClassName: String,
buttonsStyles: [Object, Array],
buttonsSticky: Boolean,
initialValues: {
type: Object,
default: () => ({}),
},
messages: Object,
handleSubmit: {
type: Function,
default: noop,
},
handleSave: Function,
handleDisabled: {
type: Function,
default: noop,
},
handleCancel: Function,
validate: Function,
asyncValidate: Function,
asyncBlurFields: Array,
// Extra form props
// This prop tells us that we can't submit a form (some extra check outside form)
// It should be an error message that describes what type of error exists outside form
disabled: [String, Object],
// Activates Popover
confirmMessage: String,
// Popover Enhancements
confirmNo: String,
confirmYes: String,
confirmWidth: [String, Number],
confirmPlacement: String,
confirmTrigger: String,
// Async callback to activate popover
confirmHandler: Function,
// Extra buttons between Cancel and Save for now
renderExtraButtons: Function,
// Best way when filtering data grids
keepValueOnRemove: Boolean,
// A property that will stop watching initialValues
doNotWatchInitialValues: Boolean,
// This flag indicates that default state for the form is ok to submit
allowSubmitPristineForm: Boolean,
// This flag describes behavior of save button as submit
performAllChecksOnSave: Boolean,
}
export default formProps