0.15.0 • Published 5 months ago

dracoder-vue-library v0.15.0

Weekly downloads
-
License
-
Repository
gitlab
Last release
5 months ago

Vue 3 library components

Available form components

1. BaseInput

Input tag component

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the input field.
typeStringNo'text'El tipo de input (ex.: text, password, email).
modelValueString\|NumberNo''Variable value, use as v-model="variable".
labelString\|nullNonullInput label.
displayString\|nullNonullIf the value is null, the label and input are displayed as block. If the value is inline, the label is displayed to the left of the input.
placeholderStringNo''Input placeholder.
disabledBooleanNofalseDisable input.
prependIconString\|nullNonullFont awesome icon class to show icon on input's left.
appendIconString\|nullNonullFont awesome icon class to show icon on input's right.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
wrapperClassStringNo'col-12'CSS class for the wrapper element around the input field.
inputClassStringNonullCSS class for the input field itself.
labelClassStringNonullCSS class for the label element.
validationErrorClassStringNonullCSS class for displaying validation errors.
import {BaseInput} from 'dracoder-vue-library';
<BaseInput
    id="example-text"
    v-model="inputValue"
    label="Example input"
    :validation="v$.inputValue"
    placeholder="Example input"
/>

2. BaseTextarea

Textarea component.

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the textarea field.
modelValueString\|NumberNo''Variable value, use as v-model="variable".
labelString\|nullNonullTextarea label.
displayString\|nullNonullIf the value is null, the label and textarea are displayed as block. If the value is inline, the label is displayed to the left of the textarea.
placeholderStringNo''Textarea placeholder.
disabledBooleanNofalseDisable textarea.
iconString\|nullNonullFont awesome icon class to show icon on textarea's left.
internalIconString\|nullNonullFont awesome icon class to show icon on textarea's right.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
wrapperClassStringNo'col-12'CSS class for the wrapper element around the textarea field.
inputClassStringNonullCSS class for the textarea field itself.
labelClassStringNonullCSS class for the label element.
validationErrorClassStringNonullCSS class for displaying validation errors.
import {BaseTextarea} from 'dracoder-vue-library';
<BaseTextarea
    id="example-text-area"
    v-model="baseTextAreaValue"
    label="Textarea example"
    placeholder="Text area content example"
    wrapper-class="col-12"
    :validation="v$.baseTextAreaValue"
    rows="5"
/>

3. BaseWysiwygEditor

Rich text component (WYSIWYG).

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the textarea field.
htmlString\|NumberNo''Variable value, used as v-model="inputValue"
labelString\|nullNonullTextarea label.
placeholderStringNo''Textarea placeholder.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
validationErrorClassStringNonullCSS class for displaying validation errors.
disabledBooleanNofalseDisable textarea.
wrapperClassStringNo'col-12'CSS class for the wrapper element around the textarea field.
labelClassStringNonullCSS class for the label element.
import {BaseWysiwygEditor} from 'dracoder-vue-library';
<BaseWysiwygEditor
    id="description"
    v-model:html="baseWysiwygEditorValue"
    :label="$t('Example wysiwyg editor')"
    :validation="v$.baseWysiwygEditorValue"
/>

4. BaseMultiselect

Select multiple options component.

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the input field.
modelValueArrayYes''Variable value, used as v-model="inputValue"
labelString\|nullNonullInput label.
displayString\|nullNonullIf the value is null, the label and input are displayed as block. If the value is inline, the label is displayed to the left of the input.
placeholderStringNo''Input placeholder.
disabledBooleanNofalseDisable input.
iconString\|nullNonullFont awesome icon class to show icon on input's left.
internalIconString\|nullNonullFont awesome icon class to show icon on input's right.
appendIconString\|nullNonullFont awesome icon class to show icon on input's right.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
optionsArrayYes | Available options array.
trackByStringYes | Key element for search in options.
optionLabelStringYes | Key element for show selected object.
customFunctionLabelFunctionNonullCustom function that returns key element for show selected object.
readonlyBooleanNofalseShow input as readonly .
emptyListMessageStringNo'No options available'Message shown if search returns no results.
validationErrorClassStringNonullCSS class for displaying validation errors.
multiselectClassStringNonull'CSS class for input.
wrapperClassStringNo'col-12'CSS class for the wrapper element around the input field.
labelClassStringNonullCSS class for the label element.
import {BaseMultiselect} from 'dracoder-vue-library';

const multiselectValue = ref()
const multiselectOptions = [
    {id: 1, fullName: 'John Doe'},
    {id: 2, fullName: 'Jane Doe'},
    {id: 3, fullName: 'John Smith'},
    {id: 4, fullName: 'Jane Smith'},
]
<BaseMultiselect
    id="example-multiselect"
    v-model="multiselectValue"
    label="Example multiselect"
    placeholder="Multiselect option"
    option-label="fullName"
    track-by="id"
    :options="multiselectOptions"
    :validation="v$.multiselectValue"
/>

5. BaseSelector

Single value selector component

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the input field.
modelValueString\|Number\|nullYes''Variable value, used as v-model="inputValue".
labelString\|nullNonullInput label.
displayString\|nullNonullIf the value is null, the label and input are displayed as block. If the value is inline, the label is displayed to the left of the input.
placeholderStringNo''Input placeholder.
disabledBooleanNofalseDisable input.
internalIconString\|nullNonullFont awesome icon class to show icon on input's right.
appendIconString\|nullNonullFont awesome icon class to show icon on input's right.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
optionsArrayYes | Available options array.
trackByStringYes | Key element for search in options.
optionLabelStringYes | Key element for show selected object.
customFunctionLabelFunctionNonullCustom function that returns key element for show selected object.
readonlyBooleanNofalseShow input as readonly.
emptyListMessageStringNo'No options available'Message shown if search returns no results.
validationErrorClassStringNonullCSS class for displaying validation errors.
multiselectClassStringNonull'CSS class for input.
wrapperClassStringNo'col-12'CSS class for the wrapper element around the input field.
labelClassStringNonullCSS class for the label element.
import {BaseSelector} from 'dracoder-vue-library';

const selectValue = ref()
const selectOptions = [
    {id: 1, fullName: 'John Doe'},
    {id: 2, fullName: 'Jane Doe'},
    {id: 3, fullName: 'John Smith'},
    {id: 4, fullName: 'Jane Smith'},
]
<BaseSelector
    id="base-selector-example"
    v-model="selectValue"
    label="Base selector example"
    placeholder="Select example"
    option-label="fullName"
    track-by="id"
    :options="selectOptions"
    :validation="v$.selectValue"
    class="w-1/3"
/>

6. BaseSwitch

Checkbox component as switch

Props:

PropTypeRequiredDefaultDescription
idStringYes-The unique identifier for the input field.
modelValueBooleanYes''Variable value, used as v-model="inputValue".
labelString\|nullNonullInput label.
displayString\|nullNonullIf the value is null, the label and input are displayed as block. If the value is inline, the label is displayed to the left of the input.
disabledBooleanNofalseDisable input.
enableStatusBooleanNotrueShow status label.
labelCheckedString\|nullNonullText label for checked status.
labelUncheckedString\|nullNonullText label for unchecked status.
readonlyBooleanNofalseShow input as readonly.
labelClassStringNonullCSS class for the label element.
import {BaseSwitch} from 'dracoder-vue-library';
<BaseSwitch
    id="autoSelected"
    v-model="baseSwitchValue"
    :enable-status="true"
    label-checked="Select automatically"
    label-unchecked="Select automatically"
/>

7. BaseInputFile

Upload file component.

Props:

PropTypeRequiredDefaultDescription
idStringNo'base-input-file'The unique identifier for the input field.
attachmentObject\|Array\|String\|nullYes''File variable, used as v-model:attachment="fileValue".
multipleBooleanNofalseAllow multiple files.
onlyImageBooleanNofalseAllow to upload only image.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
import {BaseInputFile} from 'dracoder-vue-library';
<label class="font-bold mb-1 text-secondary">{{ $t('Example input file') }}</label>
<base-input-file
    id="sitemap"
    v-model:attachment="baseInputFileValue"
    accept-types=".svg"
    wrapper-class="mt-4 col-12"
    :validation="v$.baseInputFileValue"
>
  <template #label>
    <label class="mb-1 select-none font-bold text-secondary" for="sitemap">
      Example input file
    </label>
    <button type="button" class="ms-2 text-sm underline">
      <i class="fa fa-circle-question me-1"></i>¿Cual debe ser el formato de mi mapa de sitio?
    </button>
  </template>
</base-input-file>

8. BaseImageUploader

Image files uploader components

Props:

PropTypeRequiredDefaultDescription
idStringNo'base-image-uploader'The unique identifier for the input field.
newImagesFile[]\|File\|ProductImage\|nullYesnullVariable value, used as v-model:newImages="inputValue".
labelString\|nullNonullInput label.
readonlyBooleanNofalseShow input as readonly.
displayString\|nullNonullIf the value is null, the label and input are displayed as block. If the value is inline, the label is displayed to the left of the input.
validationObject\|nullNonullVuelidate object if needed: (ex.: :validation="v$.name").
multipleBooleanNofalseAllow multiple files.
previewImageParentClassStringNo'h-44 w-44 rounded-lg relative'CSS class for the wrapper of selected images.
wrapperClassStringNo'col-12'CSS class for the wrapper element around the input field.
labelClassStringNonullCSS class for the label element.
previewOnlyBooleanNofalseAllow preview of selected images.
import {BaseImageUploader} from 'dracoder-vue-library';
<BaseImageUploader
    id="example-image-uploader"
    v-model:image="baseImageUploaderValue"
    :label="$t('Example multiple image uploader')"
    :validation="v$.baseImageUploaderValue"
    :multiple="true"
    wrapper-class="col-12 py-3"
    content-class="min-height-400"
/>

9. BaseAccordion

Accordion component.

Child components: BaseAccordionHeader BaseAccordionContent

import {BaseAccordion, BaseAccordionHeader, BaseAccordionContent} from "dracoder-vue-library";
<label class="font-bold mb-1 text-secondary">{{ $t('Example accordion') }}</label>
<base-accordion id="example-accordion">
  <base-accordion-header
      role="button"
      data-parent="#example-accordion"
  >
    <i class="fa fa-circle text-xs"></i>
    <span class="">{{ $t('Example title accordion') }}</span>
  </base-accordion-header>
  <base-accordion-content>
    <div v-for="a in 3" :key="a">
      <div class="ps-5">
        {{ a }} {{ $t('Example content') }}
      </div>
    </div>
  </base-accordion-content>
</base-accordion>

10. BaseButton

Generic button with loader.

Props:

PropTypeRequiredDefaultDescription
typeStringNo'submit'Button type value.
textStringNo''Button text.
iconClassString\|nullNo''Font awesome icon class for button.
loadingBooleanNofalseShow spinner and disable button when boolean is true.
fullSpinnerBooleanNofalseShow only spinner and hide text when loading.

Emits:

  • @click: Trigger when button is clicked.
import {BaseButton} from 'dracoder-vue-library';
<BaseButton
    class="button btn btn-primary "
    text="Execute"
    @click="executeValidation()"
/>

Componentes Tablas


BaseDataTable

Table with paginator and sort functionalities.

Props Table

Prop NameTypeRequiredDefaultDescription
headerArrayNo[]The table headers, including titles and optional classes or sorting properties.
fieldsDatatableFieldItem[]No[]Fields defining how each row of data is displayed, including type, formatter, and props.
dataItemClassStringNo''CSS class applied to each data row.
emptyDataMessageStringNo''Message displayed when no data is available.
endpointFunction\|nullNonullFunction called to fetch data from an API endpoint.
showDefaultSearchBooleanNotrueWhether to show the default search input.
customFiltersObject\|nullNonullCustom filters to apply to the data. For example: {date: '2000-01-01'}
selectQtyOfResultsBooleanNofalseWhether to show the dropdown to select the number of results per page.
disableRouterReplacementBooleanNofalseWhether to disable router replacement for query parameters.
paginatedBooleanNotrueIndicates if the table data should be paginated.
showInvalidBodyBooleanNofalseWhether to show invalid body styling.
sortOrderStringNo'ASC'The default sort order (ASC or DESC).
searchPlaceholderStringNo'Buscar'Placeholder text for the search input.
searchContainerClassStringNo'flex flex-grow'CSS class for the search container.
defaultOrderByString\|nullNonullThe default field to sort by.

Table interfaces

    type DatatableFieldItem =
    | DatatableFieldItemText
    | DataTableFieldItemDots
    | DatatableFieldItemComponent
    | DatatableFieldItemButton
    | DatatableFieldItemArray
    | DatatableFieldItemCheckbox
    | DatatableFieldItemLink
    
    
    type DatatableFieldItemTypeText = 'text'
    
    interface DatatableFieldItemText {
        type: DatatableFieldItemTypeText
        value: string
        formatter?: Function
        translatable?: boolean
        class?: string
    }
    
    /** DOTS **/
    type DatatableFieldItemTypeDots = 'dots'
    
    interface DatatableFieldItemDotsPropsField {
        label: string
        icon: string
        class?: string
        action: Function
    }
    
    interface DatatableFieldItemDotsProps {
    fields: DatatableFieldItemDotsPropsField[]
    }
    
    interface DataTableFieldItemDots {
        type: DatatableFieldItemTypeDots
        component: Component
        props: DatatableFieldItemDotsProps
        class?: string
    }
    
    /** COMPONENT **/
    type DatatableFieldItemTypeComponent = 'component'
    
    interface DatatableFieldItemComponent {
        type: DatatableFieldItemTypeComponent
        component: Component
        props?: any
        staticProps?: any
        class?: string
    }
    
    /** BUTTON **/
    type DatatableFieldItemTypeButton = 'button'
    
    interface DatatableFieldItemButtonData {
        class?: string
        icon: string
        action: Function
        disabled?: Function
        title?: string
        text?: string
    }
    
    interface DatatableFieldItemButton {
        type: DatatableFieldItemTypeButton
        class?: string
        text?: string
        value: DatatableFieldItemButtonData[]
    }
    
    /** CHECKBOX **/
    type DatatableFieldItemTypeCheckbox = 'checkbox'
    
    interface DatatableFieldItemCheckbox {
        type: DatatableFieldItemTypeCheckbox
        class?: string
        title?: string
        formatter?: Function
        disabled?: Function
        value: string
        action: Function
    }
    
    /** LINK **/
    type DatatableFieldItemTypeLink = 'link'
    
    interface DatatableFieldItemLink {
        type: DatatableFieldItemTypeLink
        class?: string
        title?: string
        path: Function
        value: string
        formatter?: Function
        disabled?: Function
        translatable?: boolean
    }
    
    /** ARRAY **/
    type DatatableFieldItemTypeArray = 'array'
    
    interface DatatableFieldItemArray {
        type: DatatableFieldItemTypeArray
        class?: string
        text?: string
        value: string
        formatter?: Function
    }

Emitted Events

Event NamePayloadDescription
onEndpointCalledNoneEmitted when the API endpoint is successfully called.
changeCurrentPageNumber (page)Emitted when the current page changes in the paginator.

Slots Documentation

Slot NameDescription
leftActionsCustom content or actions to display on the left side above the table.
filterActionsCustom filter actions to be displayed next to the default search bar.
rightActionsCustom content or actions to display on the right side above the table.
table-rowSlot to customize how each table row is rendered. Props provided: data (array of rows) and search.
import {BaseDataTable} from 'dracoder-vue-library';
<BaseDataTable
    :endpoint="getMockedData"
    :fields="fields"
    :header="header"
    :show-default-search="false"
    empty-data-message="No se encontraron resultados"
/>

Toasts

useCatchToast(error: Object|string): Show error toast, with message obtained from object or string useSuccessToast(message: string): Show green toast, with message


0.11.0

5 months ago

0.12.0

5 months ago

0.13.0

5 months ago

0.14.0

5 months ago

0.15.0

5 months ago

0.10.0

5 months ago

0.9.0

5 months ago

0.8.0

5 months ago

0.7.0

5 months ago

0.6.0

5 months ago

0.5.0

5 months ago

0.4.0

5 months ago

0.3.0

5 months ago

0.1.0

5 months ago

0.0.0

5 months ago