Skip to content

Commit 52d3b38

Browse files
Merge pull request #5932 from Countly/journey+content-main
Journey and Content version 1 bug fixes and improvements
2 parents e5fd701 + 2198bf1 commit 52d3b38

File tree

5 files changed

+87
-20
lines changed

5 files changed

+87
-20
lines changed

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

+24-8
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@
8080
type: Array
8181
},
8282

83-
titleMaxLength: {
84-
default: 50,
85-
type: Number
86-
},
87-
8883
toggle: {
8984
default: false,
9085
type: Boolean
@@ -104,6 +99,11 @@
10499
type: String
105100
},
106101

102+
valueMaxLength: {
103+
default: 50,
104+
type: Number
105+
},
106+
107107
version: {
108108
default: null,
109109
type: String
@@ -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() {
@@ -516,6 +527,11 @@
516527
template: CV.T('/javascripts/countly/vue/templates/UI/option-swapper.html'),
517528

518529
props: {
530+
disabled: {
531+
default: false,
532+
type: Boolean
533+
},
534+
519535
highlightOnSelect: {
520536
default: true,
521537
type: Boolean

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

+17-8
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
title: {type: String, required: true},
4949
saveButtonLabel: {type: String, required: false, default: CV.i18n("common.save")},
5050
saveButtonVisibility: {type: Boolean, required: false, default: true},
51+
saveButtonDisabled: {type: Boolean, required: false, default: false},
5152
cancelButtonLabel: {type: String, required: false, default: CV.i18n("common.cancel")},
5253
cancelButtonVisibility: {type: Boolean, required: false, default: true},
54+
cancelButtonDisabled: {type: Boolean, required: false, default: false},
5355
dialogType: {type: String, required: false, default: "success"},
5456
testId: {type: String, default: 'cly-vue-confirm-dialog-test-id', required: false},
5557
alignCenter: {type: Boolean, default: true}
@@ -76,9 +78,12 @@
7678
},
7779
customClass: function() {
7880
return this.alignCenter ? "el-dialog--centered" : "";
79-
}
81+
},
8082
},
8183
methods: {
84+
buttonStyle: function(disabled) {
85+
return disabled ? { opacity: 0.5 } : {};
86+
},
8287
confirmClicked: function() {
8388
this.$emit("confirm");
8489
},
@@ -91,12 +96,16 @@
9196
<template v-for="(_, name) in forwardedSlots" v-slot:[name]="slotData">\
9297
<slot :name="name"/>\
9398
</template>\
94-
<template v-slot:footer><div class="cly-vue-formdialog__buttons is-single-step bu-is-justify-content-flex-end bu-is-flex">\
95-
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-cancel-button\'" @click="cancelClicked" type="secondary" v-if="cancelButtonVisibility">{{cancelLabel}}</el-button>\
96-
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-save-button\'" @click="confirmClicked" type="success" v-if="confirmStyle==\'success\' && saveButtonVisibility" >{{saveLabel}}</el-button>\
97-
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-warning-button\'" @click="confirmClicked" type="warning" v-else-if="confirmStyle==\'warning\' && saveButtonVisibility" >{{saveLabel}}</el-button>\
98-
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-danger-button\'" @click="confirmClicked" type="danger" v-else-if="saveButtonVisibility" >{{saveLabel}}</el-button>\
99-
</div></template>\
99+
<template v-slot:footer>\
100+
<slot name="footer">\
101+
<div class="cly-vue-formdialog__buttons is-single-step bu-is-justify-content-flex-end bu-is-flex">\
102+
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-cancel-button\'" @click="cancelClicked" type="secondary" :disabled="cancelButtonDisabled" :style="buttonStyle(cancelButtonDisabled)" v-if="cancelButtonVisibility">{{cancelLabel}}</el-button>\
103+
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-save-button\'" @click="confirmClicked" type="success" :disabled="saveButtonDisabled" :style="buttonStyle(saveButtonDisabled)" v-if="confirmStyle==\'success\' && saveButtonVisibility" >{{saveLabel}}</el-button>\
104+
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-warning-button\'" @click="confirmClicked" type="warning" :disabled="saveButtonDisabled" :style="buttonStyle(saveButtonDisabled)" v-else-if="confirmStyle==\'warning\' && saveButtonVisibility" >{{saveLabel}}</el-button>\
105+
<el-button size="small" :data-test-id="testId + \'-cly-confirm-dialog-danger-button\'" @click="confirmClicked" type="danger" :disabled="saveButtonDisabled" :style="buttonStyle(saveButtonDisabled)" v-else-if="saveButtonVisibility" >{{saveLabel}}</el-button>\
106+
</div>\
107+
</slot>\
108+
</template>\
100109
</el-dialog>'
101110
}));
102111

@@ -261,4 +270,4 @@
261270
countlyVue.mixins.hasFormDialogs = hasFormDialogsMixin;
262271

263272

264-
}(window.countlyVue = window.countlyVue || {}));
273+
}(window.countlyVue = window.countlyVue || {}));

frontend/express/public/javascripts/countly/vue/templates/UI/option-swapper.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
<!-- :style="{'width': width + 'px'}" -->
2-
<div class="cly-option-swapper">
1+
<div
2+
class="cly-option-swapper"
3+
:class="{
4+
'cly-option-swapper--disabled': disabled
5+
}"
6+
>
37
<div
48
v-for="(option, index) in options"
59
:key="`cly-option-swapper-option-${index}`"
610
v-tooltip="option.tooltip"
711
class="cly-option-swapper__option"
812
:class="{
913
'cly-option-swapper__option--active': option.value === selectedOption,
10-
'cly-option-swapper__option--disabled': option.disabled,
14+
'cly-option-swapper__option--disabled': option.disabled || disabled,
1115
'cly-option-swapper__option--first': index === 0,
1216
'cly-option-swapper__option--last': index === (options.length - 1),
1317
'cly-option-swapper__option--no-highlight': !highlightOnSelect

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

+32-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;
@@ -4804,6 +4829,12 @@
48044829
background: #F6F6F6;
48054830
}
48064831
}
4832+
4833+
// .cly-option-swapper--disabled
4834+
&--disabled {
4835+
cursor: not-allowed;
4836+
opacity: 0.5;
4837+
}
48074838
}
48084839

48094840
.cly-list-drawer {

0 commit comments

Comments
 (0)