diff --git a/src/components/Form/FormGroup.vue b/src/components/Form/FormGroup.vue
index dde6937c8..c30f269c6 100644
--- a/src/components/Form/FormGroup.vue
+++ b/src/components/Form/FormGroup.vue
@@ -93,10 +93,13 @@ export default {
FieldHtml,
FieldMetadataSetting,
FieldOptions,
+<<<<<<< HEAD
<<<<<<< HEAD
FieldOrcid,
=======
FieldCheckbox,
+=======
+>>>>>>> c89f0b3 (pkp/pkp-lib#5885 removed unnecessary fields and controls with field range component enhancement)
FieldRangeSlider,
>>>>>>> 81f8819 (pkp/pkp-lib#5885 updated and added new UI component)
FieldPreparedContent,
diff --git a/src/components/Form/fields/FieldCheckbox.vue b/src/components/Form/fields/FieldCheckbox.vue
deleted file mode 100644
index de0a300cb..000000000
--- a/src/components/Form/fields/FieldCheckbox.vue
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
diff --git a/src/components/Form/fields/FieldRangeSlider.vue b/src/components/Form/fields/FieldRangeSlider.vue
index c08a8dee7..182bc503e 100644
--- a/src/components/Form/fields/FieldRangeSlider.vue
+++ b/src/components/Form/fields/FieldRangeSlider.vue
@@ -15,18 +15,18 @@
>
@@ -71,15 +81,27 @@ export default {
/** The disable state of range slider */
disable: {
type: Boolean,
- required: false,
default: false,
},
+ /** Range slider should be disable if input field value set to NULL on render */
+ disableOnNull: {
+ type: Boolean,
+ default: true,
+ },
+
/** The current value for this field. */
value: {
type: Number,
required: false,
- default: 0,
+ default: null,
+ },
+
+ /** Range value to set on reset when enabiling/disbaling. */
+ onResetValue: {
+ type: Number,
+ required: false,
+ default: null,
},
/** The min value of the slider range. */
@@ -98,7 +120,7 @@ export default {
step: {
type: Number,
required: false,
- deault: 1,
+ default: 1,
},
/** Slider value update label on realtime */
@@ -112,7 +134,7 @@ export default {
size: {
type: String,
required: true,
- default: 'small',
+ default: 'normal',
validator: function (value) {
return ['small', 'normal', 'large'].indexOf(value) !== -1;
},
@@ -127,20 +149,76 @@ export default {
return ['before', 'after'].indexOf(value) !== -1;
},
},
+
+ /** Should allow the toggle to slider state disable/enable */
+ allowStateToggle: {
+ type: Boolean,
+ default: true,
+ },
+
+ /** The disable/enable control label when disable */
+ controlLabelOnDisable: {
+ type: String,
+ required: function () {
+ return this.allowStateToggle;
+ },
+ },
+
+ /** The disable/enable control label when enable */
+ controlLabelOnEnable: {
+ type: String,
+ required: function () {
+ return this.allowStateToggle;
+ },
+ },
},
data() {
return {
sliderSize: {
- small: 'range-sm',
- normal: '',
- large: 'range-lg',
+ small: {
+ '--thumb-height': '0.5em',
+ '--track-height': '0.075em',
+ },
+ normal: {
+ '--thumb-height': '0.8em',
+ '--track-height': '0.125em',
+ },
+ large: {
+ '--thumb-height': '1.2em',
+ '--track-height': '0.250em',
+ },
},
+
+ rangeDisableState: this.disable,
};
},
+ computed: {
+ toggleControlLabelText() {
+ return this.rangeDisableState
+ ? this.controlLabelOnDisable
+ : this.controlLabelOnEnable;
+ },
+ },
+ created() {
+ if (
+ this.disableOnNull &&
+ (this.value === null || this.value === undefined)
+ ) {
+ this.rangeDisableState = true;
+ }
+ },
+ methods: {
+ toogleRangeState() {
+ this.rangeDisableState = !this.rangeDisableState;
+ this.currentValue = this.rangeDisableState
+ ? null
+ : this.value ?? this.onResetValue;
+ },
+ },
};
-