Skip to content

Commit

Permalink
Merge pull request #12867 from OlegZharkov/input-color
Browse files Browse the repository at this point in the history
Vuefy color input form element
  • Loading branch information
guerler authored Nov 13, 2021
2 parents ca3c38a + ce1be4e commit 29609b5
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 224 deletions.
40 changes: 40 additions & 0 deletions client/src/components/Form/Elements/FormColor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<b-row>
<b-col class="form-color-input">
<b-form-input class="cursor-pointer" :id="id" v-model="currentValue" type="color" size="sm" />
</b-col>
<b-col class="pl-0">
<label class="pt-1 cursor-pointer" :for="id">Select a color</label>
</b-col>
</b-row>
</template>

<script>
export default {
props: {
value: {
type: String,
default: "",
},
id: {
type: String,
required: true,
},
},
computed: {
currentValue: {
get() {
return this.value;
},
set(val) {
this.$emit("input", val);
},
},
},
};
</script>
<style scoped>
.form-color-input {
max-width: 3.6rem;
}
</style>
10 changes: 0 additions & 10 deletions client/src/components/Form/Elements/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import SelectLibrary from "mvc/ui/ui-select-library";
import SelectFtp from "mvc/ui/ui-select-ftp";
import RulesEdit from "mvc/ui/ui-rules-edit";
import FileSource from "mvc/ui/ui-file-source";
import ColorPicker from "mvc/ui/ui-color-picker";
import DataPicker from "mvc/ui/ui-data-picker";

// create form view
Expand All @@ -27,7 +26,6 @@ export default Backbone.View.extend({
integer: "_fieldSlider",
float: "_fieldSlider",
drill_down: "_fieldDrilldown",
color: "_fieldColor",
group_tag: "_fieldSelect",
library_data: "_fieldLibrary",
ftpfile: "_fieldFtp",
Expand Down Expand Up @@ -185,14 +183,6 @@ export default Backbone.View.extend({
});
},

/** Color picker field */
_fieldColor: function (input_def) {
return new ColorPicker({
id: `field-${input_def.id}`,
onchange: input_def.onchange,
});
},

/** Data dialog picker field */
_fieldDialog: function (input_def) {
return new DataPicker({
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/Form/FormElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
:id="id"
:info="attrs['info']"
/>
<FormColor v-else-if="type == 'color'" v-model="currentValue" :id="id" />
<FormParameter
v-else-if="backbonejs"
v-model="currentValue"
Expand All @@ -51,12 +52,14 @@ import FormBoolean from "./Elements/FormBoolean";
import FormHidden from "./Elements/FormHidden";
import FormInput from "./Elements/FormInput";
import FormParameter from "./Elements/FormParameter";
import FormColor from "./Elements/FormColor";
export default {
components: {
FormBoolean,
FormHidden,
FormInput,
FormColor,
FormParameter,
},
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,3 @@ export default {
},
};
</script>

<style scoped>
@import "./pointer.css";
</style>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import "./TopToolbar/pointer.css";

th:focus {
outline: none !important;
}
Expand Down
142 changes: 0 additions & 142 deletions client/src/mvc/ui/ui-color-picker.js

This file was deleted.

67 changes: 8 additions & 59 deletions client/src/style/scss/ui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,65 +353,6 @@ $ui-margin-horizontal-large: $margin-v * 2;
}
}

.ui-color-picker {
.ui-color-picker-header {
cursor: pointer;
}
.ui-color-picker-value {
float: left;
border-radius: 3px;
border: solid 1px #000000;
width: 12px;
height: 12px;
margin-right: 5px;
}
.ui-color-picker-label {
line-height: 1.2em;
margin-bottom: 5px;
}
.ui-color-picker-view {
height: 100%;
overflow: auto;
display: none;
float: left;
margin-bottom: 5px;
.ui-color-picker-panel {
width: 210px;
.ui-color-picker-content {
margin-bottom: 15px;
.badge {
padding-bottom: 2px;
}
.line {
.ui-color-picker-box {
cursor: pointer;
float: left;
margin-right: 5px;
border: solid 1px #c0c0c0;
width: 15px;
height: 15px;
border-radius: 2px;
.ui-color-picker-check {
color: black;
font-size: 1.2em;
position: relative;
left: 1px;
}
}
}
}
.ui-color-picker-content:first-child {
padding-top: 5px;
padding-bottom: 10px;
}
.ui-color-picker-content:last-child {
padding-top: 85px;
padding-bottom: 5px;
}
}
}
}

.ui-select {
position: relative;
.icon-dropdown {
Expand Down Expand Up @@ -487,3 +428,11 @@ $ui-margin-horizontal-large: $margin-v * 2;
border: 2px solid $state-success-bg;
background: lighten($state-success-bg, 10%);
}
// util class to make pointer cursor
.cursor-pointer {
cursor: pointer;
-webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */
user-select: none; /* Likely future */
}

0 comments on commit 29609b5

Please sign in to comment.