Skip to content

Commit c08daca

Browse files
authored
Merge pull request #5921 from Countly/SER-2150-content-general-issue-for-input-boxes
[Feat] Add suffix to input number
2 parents 3e7d43b + e8fa989 commit c08daca

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

frontend/express/public/javascripts/countly/vue/components/content.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@
385385
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_COLOR_PICKER = 'color-picker';
386386
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_DROPDOWN = 'dropdown';
387387
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT = 'input';
388-
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT_NUMBER = 'input-number';
388+
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_NUMBER = 'number';
389389
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SLIDER = 'slider';
390390
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SWAPPER = 'swapper';
391391
const COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SWITCH = 'switch';
@@ -395,7 +395,7 @@
395395
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_COLOR_PICKER]: 'cly-colorpicker',
396396
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_DROPDOWN]: 'el-select',
397397
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT]: 'el-input',
398-
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT_NUMBER]: 'el-input-number',
398+
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_NUMBER]: 'el-input-number',
399399
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SLIDER]: 'el-slider',
400400
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SWAPPER]: 'cly-option-swapper',
401401
[COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SWITCH]: 'el-switch',
@@ -475,13 +475,21 @@
475475
return countlyCommon.unescapeHtml(this.value) || '';
476476
}
477477

478+
if (this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_NUMBER) {
479+
return +this.value || 0;
480+
}
481+
478482
return this.value || null;
479483
},
480484
set(newValue) {
481485
this.$emit('input', newValue);
482486
}
483487
},
484488

489+
controlsProp() {
490+
return this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_NUMBER ? false : null;
491+
},
492+
485493
isDropdownInput() {
486494
return this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_DROPDOWN;
487495
},
@@ -495,7 +503,10 @@
495503
},
496504

497505
isSuffixVisible() {
498-
return this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT && this.suffix;
506+
return (
507+
this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_INPUT ||
508+
this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_NUMBER
509+
) && this.suffix;
499510
},
500511

501512
isSwapperInput() {

frontend/express/public/javascripts/countly/vue/templates/content/UI/content-sidebar-input.html

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
v-model="componentValue"
2626
class="cly-vue-content-builder-sidebar-input__component"
2727
:class="{ 'cly-vue-content-builder-sidebar-input__component--slider': isSliderInput }"
28+
:controls="controlsProp"
2829
:disabled="disabled"
2930
:options="options"
3031
>
@@ -44,6 +45,12 @@
4445
/>
4546
</template>
4647
</component>
48+
<div
49+
v-if="isSuffixVisible && type === 'number'"
50+
class="cly-vue-content-builder-sidebar-input__number-input-suffix"
51+
>
52+
{{ suffix }}
53+
</div>
4754
</slot>
4855
</div>
4956
</div>

frontend/express/public/stylesheets/vue/clyvue.scss

+26-1
Original file line numberDiff line numberDiff line change
@@ -4616,6 +4616,18 @@
46164616
width: auto;
46174617
box-shadow: none;
46184618

4619+
// .cly-vue-content-builder-sidebar-input__component.el-input-number
4620+
&.el-input-number {
4621+
position: relative;
4622+
4623+
// .cly-vue-content-builder-sidebar-input__component.el-input-number .el-input__inner
4624+
& .el-input__inner {
4625+
text-align: left;
4626+
padding: 6px 10px;
4627+
padding-right: 34px;
4628+
}
4629+
}
4630+
46194631
// .cly-vue-content-builder-sidebar-input__component .el-input__count
46204632
& .el-input__count {
46214633
position: absolute;
@@ -4710,7 +4722,7 @@
47104722

47114723
// .cly-vue-content-builder-sidebar-input__input-container--small .cly-vue-content-builder-sidebar-input__component
47124724
&--small .cly-vue-content-builder-sidebar-input__component {
4713-
max-width: 64px;
4725+
max-width: 70px;
47144726
}
47154727

47164728
// .cly-vue-content-builder-sidebar-input__input-container--large .cly-vue-content-builder-sidebar-input__component
@@ -4740,6 +4752,19 @@
47404752
line-height: 16px;
47414753
}
47424754

4755+
// .cly-vue-content-builder-sidebar-input__number-input-suffix
4756+
&__number-input-suffix {
4757+
position: absolute;
4758+
top: 0;
4759+
right: 0;
4760+
padding: 6px 10px;
4761+
padding-left: 0;
4762+
color: #81868D;
4763+
width: 16px;
4764+
font-size: 14px;
4765+
line-height: 20px;
4766+
}
4767+
47434768
// .cly-vue-content-builder-sidebar-input__sub-header
47444769
&__sub-header {
47454770
color: #81868D;

0 commit comments

Comments
 (0)