Skip to content

Commit 68a9fbc

Browse files
committed
feat(smart-select): allow to specify input icon position
1 parent db9d799 commit 68a9fbc

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/core/components/smart-select/smart-select-class.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ class SmartSelect extends Framework7Class {
325325
const optionIconIos =
326326
theme === 'ios' && (optionData.optionIconIos || ss.params.optionIconIos);
327327
const optionIconMd = theme === 'md' && (optionData.optionIconMd || ss.params.optionIconMd);
328+
const optionInputIconPosition =
329+
optionData.inputIconPosition || ss.params.inputIconPosition || '';
328330

329331
const optionHasMedia = optionImage || optionIcon || optionIconIos || optionIconMd;
330332
const optionColor = optionData.optionColor;
@@ -353,6 +355,7 @@ class SmartSelect extends Framework7Class {
353355
icon: optionIcon,
354356
iconIos: optionIconIos,
355357
iconMd: optionIconMd,
358+
inputIconPosition: optionInputIconPosition,
356359
color: optionColor,
357360
className: optionClassName,
358361
disabled: $optionEl[0].disabled,
@@ -432,7 +435,11 @@ class SmartSelect extends Framework7Class {
432435

433436
itemHtml = (
434437
<li class={`${item.className || ''}${disabled ? ' disabled' : ''}`}>
435-
<label class={`item-${item.inputType} item-content`}>
438+
<label
439+
class={`item-${item.inputType} ${
440+
item.inputIconPosition ? `item-${item.inputType}-icon-${item.inputIconPosition}` : ''
441+
} item-content`}
442+
>
436443
<input
437444
type={item.inputType}
438445
name={item.inputName}

src/core/components/smart-select/smart-select.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export namespace SmartSelect {
9393
optionIconIos?: string;
9494
/** Same as `optionIcon` but will apply only when MD theme is active */
9595
optionIconMd?: string;
96+
/** Specify checkbox/radio icon position, can be 'start' or 'end' (default 'start') */
97+
inputIconPosition?: string;
9698

9799
/** Function to render smart select page, must return full page HTML string */
98100
renderPage?: (items: any[]) => string;

src/core/components/smart-select/smart-select.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default {
3636
navbarColorTheme: undefined,
3737
routableModals: false,
3838
url: 'select/',
39+
inputIconPosition: 'start',
3940
cssClass: '',
4041
/*
4142
Custom render functions

0 commit comments

Comments
 (0)