Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NcSelect for NcActionInput type multiselect #3760

Merged
merged 2 commits into from
Feb 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 38 additions & 15 deletions src/components/NcActionInput/NcActionInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ For the multiselect component, all events will be passed through. Please see the
</template>
Please pick a fruit
</NcActionInput>
<NcActionInput
v-model="multiSelected"
type="multiselect"
label="label"
track-by="id"
:multiple="true"
:options="[{label:'Apple', id: 'apple'}, {label:'Banana', id: 'banana'}, {label:'Cherry', id: 'cherry'}]">
<template #icon>
<Pencil :size="20" />
</template>
Please pick a fruit object
</NcActionInput>
</NcActions>
</template>
<script>
Expand All @@ -99,6 +111,7 @@ For the multiselect component, all events will be passed through. Please see the
return {
color: '#0082C9',
text: 'This is the input text',
multiSelected: [],
}
},
}
Expand All @@ -115,12 +128,14 @@ For the multiselect component, all events will be passed through. Please see the
}"
class="action-input"
@mouseleave="onLeave">
<!-- @slot Manually provide icon -->
<slot name="icon">
<span :class="[isIconUrl ? 'action-input__icon--url' : icon]"
:style="{ backgroundImage: isIconUrl ? `url(${icon})` : null }"
class="action-input__icon" />
</slot>
<span class="action-input__icon-wrapper">
<!-- @slot Manually provide icon -->
<slot name="icon">
<span :class="[isIconUrl ? 'action-input__icon--url' : icon]"
:style="{ backgroundImage: isIconUrl ? `url(${icon})` : null }"
class="action-input__icon" />
</slot>
</span>

<!-- form and input -->
<form ref="form"
Expand Down Expand Up @@ -149,10 +164,11 @@ For the multiselect component, all events will be passed through. Please see the
@input="$emit('input', $event)"
@change="$emit('change', $event)" />

<NcMultiselect v-else-if="isMultiselectType"
<NcSelect v-else-if="isMultiselectType"
:value="value"
:placeholder="text"
:disabled="disabled"
:append-to-body="false"
:class="{ focusable: isFocusable }"
class="action-input__multi"
v-bind="$attrs"
Expand Down Expand Up @@ -194,7 +210,7 @@ For the multiselect component, all events will be passed through. Please see the

<script>
import NcDatetimePicker from '../NcDatetimePicker/index.js'
import NcMultiselect from '../NcMultiselect/index.js'
import NcSelect from '../NcSelect/index.js'
import ActionGlobalMixin from '../../mixins/actionGlobal.js'
import GenRandomId from '../../utils/GenRandomId.js'

Expand All @@ -207,7 +223,7 @@ export default {
components: {
ArrowRight,
NcDatetimePicker,
NcMultiselect,
NcSelect,
NcDateTimePickerNative,
},

Expand Down Expand Up @@ -435,13 +451,20 @@ $input-margin: 4px;

font-weight: normal;

&:deep(.material-design-icon) {
width: $clickable-area;
height: $clickable-area;
opacity: $opacity_full;
&__icon-wrapper {
display: flex;
align-self: center;
align-items: center;
justify-content: center;

.material-design-icon__svg {
vertical-align: middle;
&:deep(.material-design-icon) {
width: $clickable-area;
height: $clickable-area;
opacity: $opacity_full;

.material-design-icon__svg {
vertical-align: middle;
}
}
}

Expand Down