Bind attrs to textarea and input as well and add actioninput docs

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-07-26 16:40:34 +02:00
Родитель 008648dce5
Коммит ffa2cb2aed
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 60C25B8C072916CF
3 изменённых файлов: 27 добавлений и 7 удалений

Просмотреть файл

@ -20,29 +20,44 @@
- -
--> -->
<docs>
This component is made to be used inside of the [Actions](#Actions) component slots.
All undocumented attributes will be bound to the input or the datepicker. e.g. `maxlength`, `not-before`...
```
<Actions>
<ActionInput icon="icon-edit" value="This is an input" />
<ActionInput icon="icon-close" :disabled="true" value="This is a disabled input" />
<ActionInput icon="icon-edit" type="date" value="This is a date picker" />
</Actions>
```
</docs>
<template> <template>
<li> <li>
<span :class="{'action-input--picker': isDatePickerType}" class="action-input"> <span :class="{ 'action-input--picker': isDatePickerType }" class="action-input">
<!-- icon --> <!-- icon -->
<span :class="[isIconUrl ? 'action-input__icon--url' : icon]" <span :class="[isIconUrl ? 'action-input__icon--url' : icon]"
:style="{ backgroundImage: isIconUrl ? `url(${icon})` : null }" :style="{ backgroundImage: isIconUrl ? `url(${icon})` : null }"
class="action-input__icon" /> class="action-input__icon" />
<!-- form and input --> <!-- form and input -->
<form ref="form" class="action-input__form" :disabled="disabled" <form ref="form" class="action-input__form"
@submit.prevent="onSubmit"> :disabled="disabled" @submit.prevent="onSubmit">
<input :id="id" type="submit" class="action-input__submit"> <input :id="id" type="submit" class="action-input__submit">
<DatetimePicker v-if="isDatePickerType" <DatetimePicker v-if="isDatePickerType"
:value="value" :placeholder="text"
:disabled="disabled" :type="isDatePickerType" :disabled="disabled" :type="isDatePickerType"
:value="value" class="action-input__picker" class="action-input__picker"
v-bind="$attrs" v-bind="$attrs"
@input="onInput" @change="onChange" /> @input="onInput" @change="onChange" />
<template v-else> <template v-else>
<input :type="type" :value="value" <input :type="type" :value="value"
:placeholder="text" :disabled="disabled" :placeholder="text" :disabled="disabled"
required class="action-input__input focusable" v-bind="$attrs"
class="action-input__input focusable"
@input="onInput" @change="onChange"> @input="onInput" @change="onChange">
<!-- allow the custom font to inject a ::before <!-- allow the custom font to inject a ::before
not possible on input[type=submit] --> not possible on input[type=submit] -->

Просмотреть файл

@ -22,6 +22,7 @@
<docs> <docs>
This component is made to be used inside of the [Actions](#Actions) component slots. This component is made to be used inside of the [Actions](#Actions) component slots.
All undocumented attributes will be bound to the textarea. e.g. `maxlength`
``` ```
<Actions> <Actions>
@ -41,8 +42,8 @@ This component is made to be used inside of the [Actions](#Actions) component sl
class="action-text-editable__icon" /> class="action-text-editable__icon" />
<!-- form and input --> <!-- form and input -->
<form ref="form" class="action-text-editable__form" :disabled="disabled" <form ref="form" class="action-text-editable__form"
@submit.prevent="onSubmit"> :disabled="disabled" @submit.prevent="onSubmit">
<input :id="id" type="submit" class="action-text-editable__submit"> <input :id="id" type="submit" class="action-text-editable__submit">
<!-- title --> <!-- title -->
@ -51,6 +52,7 @@ This component is made to be used inside of the [Actions](#Actions) component sl
</strong> </strong>
<textarea :disabled="disabled" :value="value" <textarea :disabled="disabled" :value="value"
v-bind="$attrs"
class="action-text-editable__textarea focusable" class="action-text-editable__textarea focusable"
@input="onInput" /> @input="onInput" />

Просмотреть файл

@ -1,5 +1,8 @@
div[data-preview] { div[data-preview] {
@import 'server.css'; @import 'server.css';
* {
box-sizing: border-box;
}
} }
body { body {