@eturnity/eturnity_reusable_components 1.0.91 → 1.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
:inputWidth="inputWidth"
|
|
18
18
|
:value="value"
|
|
19
19
|
@input="onChangeHandler"
|
|
20
|
+
:noBorder="noBorder"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
:isDisabled="disabled"
|
|
20
23
|
/>
|
|
21
24
|
</input-wrapper>
|
|
22
25
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
@@ -44,11 +47,20 @@ const LabelWrapper = styled.div`
|
|
|
44
47
|
margin-bottom: 12px;
|
|
45
48
|
`
|
|
46
49
|
|
|
47
|
-
const inputProps = {
|
|
50
|
+
const inputProps = {
|
|
51
|
+
isError: Boolean,
|
|
52
|
+
inputWidth: String,
|
|
53
|
+
noBorder: Boolean,
|
|
54
|
+
isDisabled: Boolean,
|
|
55
|
+
}
|
|
48
56
|
const InputContainer = styled("input", inputProps)`
|
|
49
57
|
border: ${(props) =>
|
|
50
58
|
props.isError
|
|
51
59
|
? "1px solid " + props.theme.colors.red
|
|
60
|
+
: props.noBorder
|
|
61
|
+
? "none"
|
|
62
|
+
: props.hasLength
|
|
63
|
+
? "1px solid " + props.theme.colors.black
|
|
52
64
|
: "1px solid " + props.theme.colors.mediumGray};
|
|
53
65
|
padding: ${(props) =>
|
|
54
66
|
props.hasUnit ? "11px 40px 11px 10px" : "11px 5px 11px 10px"};
|
|
@@ -59,6 +71,9 @@ const InputContainer = styled("input", inputProps)`
|
|
|
59
71
|
width: 100%;
|
|
60
72
|
box-sizing: border-box; // to allow width of 100% with padding
|
|
61
73
|
font-weight: 500;
|
|
74
|
+
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
|
|
75
|
+
background-color: ${(props) =>
|
|
76
|
+
props.isDisabled ? props.theme.colors.grey5 : "#fff"};
|
|
62
77
|
|
|
63
78
|
&::placeholder {
|
|
64
79
|
color: ${(props) =>
|
|
@@ -84,16 +99,16 @@ const ErrorMessage = styled.div`
|
|
|
84
99
|
export default {
|
|
85
100
|
// import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
86
101
|
// To use:
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
102
|
+
// <input-text
|
|
103
|
+
// placeholder="Company name"
|
|
104
|
+
// :value="companyName"
|
|
105
|
+
// @input-change="onInputChange({ value: $event, type: 'companyName' })"
|
|
106
|
+
// :isError="checkErrors()"
|
|
107
|
+
// :errorMessage="This is my error message"
|
|
108
|
+
// infoTextAlign="right" // left by default
|
|
109
|
+
// infoTextMessage="My info message"
|
|
110
|
+
// label="Question 5"
|
|
111
|
+
// />
|
|
97
112
|
name: "input-text",
|
|
98
113
|
components: {
|
|
99
114
|
Container,
|
|
@@ -134,6 +149,14 @@ export default {
|
|
|
134
149
|
label: {
|
|
135
150
|
required: false,
|
|
136
151
|
},
|
|
152
|
+
noBorder: {
|
|
153
|
+
required: false,
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
156
|
+
disabled: {
|
|
157
|
+
required: false,
|
|
158
|
+
default: false,
|
|
159
|
+
},
|
|
137
160
|
},
|
|
138
161
|
methods: {
|
|
139
162
|
onChangeHandler($event) {
|
|
@@ -114,15 +114,18 @@
|
|
|
114
114
|
// :optionItems="groupComponents" // list of options
|
|
115
115
|
// :optionsLoading="dropdownOptionsLoading"
|
|
116
116
|
// :optionsDisplay="['display_name', 'company_item_number']" // Array. what should be displayed
|
|
117
|
+
// :disabled="true"
|
|
117
118
|
// />
|
|
118
119
|
import styled from "vue-styled-components"
|
|
119
120
|
import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
|
120
121
|
import SearchInput from "@eturnity/eturnity_reusable_components/src/components/inputs/searchInput"
|
|
121
122
|
|
|
122
|
-
const
|
|
123
|
+
const rowAttrs = { disabled: Boolean }
|
|
124
|
+
const DropdownRow = styled("td", rowAttrs)`
|
|
125
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "auto")};
|
|
126
|
+
`
|
|
123
127
|
|
|
124
128
|
const ComponentItem = styled.div`
|
|
125
|
-
/* padding-left: 12px; */
|
|
126
129
|
overflow: hidden;
|
|
127
130
|
text-overflow: ellipsis;
|
|
128
131
|
`
|
|
@@ -283,6 +286,10 @@ export default {
|
|
|
283
286
|
required: true,
|
|
284
287
|
default: [], // should be like ['display_name', 'company_item_number', 'description']
|
|
285
288
|
},
|
|
289
|
+
disabled: {
|
|
290
|
+
required: false,
|
|
291
|
+
default: false,
|
|
292
|
+
},
|
|
286
293
|
},
|
|
287
294
|
data() {
|
|
288
295
|
return {
|
|
@@ -291,6 +298,9 @@ export default {
|
|
|
291
298
|
},
|
|
292
299
|
methods: {
|
|
293
300
|
toggleOpen() {
|
|
301
|
+
if (this.disabled) {
|
|
302
|
+
return
|
|
303
|
+
}
|
|
294
304
|
if (!this.isOpen) {
|
|
295
305
|
document.addEventListener("click", this.clickOutside)
|
|
296
306
|
this.$emit("dropdown-search", "")
|