@eturnity/eturnity_reusable_components 1.2.0-beta.3 → 1.2.1-beta.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.2.0-beta.3",
3
+ "version": "1.2.1-beta.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -1,158 +1,100 @@
1
1
  <template>
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
- <main-table titleText="My Table">
5
- <thead>
6
- <tr>
7
- <th>Column 1</th>
8
- <th>Column 2</th>
9
- <th>Column 3</th>
10
- <div />
11
- </tr>
12
- </thead>
13
- <tbody>
14
- <tr>
15
- <!-- <table-dropdown
16
- :colSpan="3"
17
- :tableItems="getDropdownValues()"
18
- @toggle-dropdown-open="toggleDropdownOpen()"
19
- @item-selected="onItemSelected({ item: $event, index })"
20
- :isOpen="isDropdownOpen()"
21
- :optionItems="itemOptions"
22
- :optionsDisplay="['display_name', 'company_item_number', 'model']"
23
- /> -->
24
- <td>Test</td>
25
- <div class="icons-container">
26
- <three-dots :options="listOptions" :isLoading="false" />
27
- </div>
28
- </tr>
29
- </tbody>
30
- </main-table>
31
- <br />
32
- <br />
33
- <toggle
34
- @on-toggle-change="onInputChange($event)"
35
- :isChecked="inputValue"
36
- label="My Label Text"
37
- infoTextMessage="This is my test message"
38
- infoTextAlign="right"
39
- labelAlign="right"
40
- :disabled="false"
41
- />
42
- <br />
43
4
  <input-number
44
- placeholder="Enter distance"
45
- :numberPrecision="2"
46
- :value="inputValue"
47
- @input-change="onInputChange($event)"
48
- />
49
- <br />
50
- <page-subtitle text="My Subtitle" infoText="My info Text" />
51
- <spinner size="30px" />
52
- <checkbox
53
- label="Do you accept the Terms?"
54
- :isChecked="true"
55
- size="small"
56
- :isDisabled="false"
5
+ :value="num"
6
+ @input-change="num = $event"
7
+ unitName="t"
8
+ id="biebie"
9
+ test="koko"
10
+ @keydown="keydownHandler"
57
11
  />
58
- <external-button text="Click me!" minWidth="500px" />
59
12
  </page-container>
60
13
  </ThemeProvider>
61
14
  </template>
62
15
 
63
16
  <script>
64
- import { ThemeProvider } from "vue-styled-components"
65
- import theme from "./assets/theme"
66
- import styled from "vue-styled-components"
67
- import MainTable from "@/components/tables/mainTable"
68
- import ThreeDots from "@/components/threeDots"
69
- import Toggle from "@/components/inputs/toggle"
70
- import InputNumber from "@/components/inputs/inputNumber"
71
- import Checkbox from "@/components/inputs/checkbox"
72
- import PageSubtitle from "@/components/pageSubtitle"
73
- import Spinner from "@/components/spinner"
74
- import ExternalButton from "@/components/buttons/externalButton"
75
- // import TableDropdown from "@/components/tableDropdown"
17
+ import { ThemeProvider } from 'vue-styled-components'
18
+ import theme from './assets/theme'
19
+ import styled from 'vue-styled-components'
20
+ import InputNumber from '@/components/inputs/inputNumber'
76
21
 
77
22
  const PageContainer = styled.div`
78
23
  padding: 40px;
79
24
  `
80
25
 
81
26
  export default {
82
- name: "App",
27
+ name: 'App',
83
28
  components: {
84
29
  ThemeProvider,
85
30
  PageContainer,
86
- MainTable,
87
- ThreeDots,
88
- Toggle,
89
- InputNumber,
90
- PageSubtitle,
91
- Spinner,
92
- Checkbox,
93
- ExternalButton,
31
+ InputNumber
94
32
  // TableDropdown,
95
33
  },
96
34
  data() {
97
35
  return {
36
+ num: 42,
98
37
  inputValue: null,
99
- checkedOption: "button_1",
38
+ checkedOption: 'button_1',
100
39
  question: {
101
40
  number_format_precision: 4,
102
41
  number_min_allowed: 0,
103
42
  number_max_allowed: 10,
104
- unit_short_name: "cm",
43
+ unit_short_name: 'cm'
105
44
  },
106
45
  dropdownOpen: false,
107
46
  isChecked: false,
108
47
  listOptions: [
109
48
  {
110
- name: "Option 1",
111
- value: "option_1",
112
- disabled: true,
49
+ name: 'Option 1',
50
+ value: 'option_1',
51
+ disabled: true
113
52
  },
114
53
  {
115
- name: "Option 2",
116
- value: "option_2",
54
+ name: 'Option 2',
55
+ value: 'option_2'
117
56
  },
118
57
  {
119
- name: "Option 3",
120
- value: "option_3",
58
+ name: 'Option 3',
59
+ value: 'option_3'
121
60
  },
122
61
  {
123
- name: "Option 4",
124
- value: "option_4",
125
- },
62
+ name: 'Option 4',
63
+ value: 'option_4'
64
+ }
126
65
  ],
127
66
  itemOptions: [
128
67
  {
129
- display_name: "Test 1",
130
- company_item_number: "123",
131
- model: "BTB-2145 Long Text Long Text Long Text Long Text Long Text",
132
- id: 1,
68
+ display_name: 'Test 1',
69
+ company_item_number: '123',
70
+ model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
71
+ id: 1
133
72
  },
134
73
  {
135
- display_name: "Test 2",
136
- company_item_number: "1234",
137
- model: "BTB-123",
138
- id: 2,
74
+ display_name: 'Test 2',
75
+ company_item_number: '1234',
76
+ model: 'BTB-123',
77
+ id: 2
139
78
  },
140
79
  {
141
- display_name: "Test 3",
142
- company_item_number: "12345",
143
- model: "BTB-543",
144
- id: 3,
80
+ display_name: 'Test 3',
81
+ company_item_number: '12345',
82
+ model: 'BTB-543',
83
+ id: 3
145
84
  },
146
85
  {
147
- display_name: "Test 4",
148
- company_item_number: "123456",
149
- model: "BTB-4930",
150
- id: 4,
151
- },
152
- ],
86
+ display_name: 'Test 4',
87
+ company_item_number: '123456',
88
+ model: 'BTB-4930',
89
+ id: 4
90
+ }
91
+ ]
153
92
  }
154
93
  },
155
94
  methods: {
95
+ keydownHandler(e) {
96
+ console.log('test', e)
97
+ },
156
98
  getTheme() {
157
99
  return theme
158
100
  },
@@ -163,7 +105,7 @@ export default {
163
105
  return this.dropdownOpen
164
106
  },
165
107
  onClickButton() {
166
- console.log("Test")
108
+ console.log('Test')
167
109
  },
168
110
  toggleDropdownOpen() {
169
111
  this.dropdownOpen = !this.dropdownOpen
@@ -174,21 +116,21 @@ export default {
174
116
  {
175
117
  value: this.getComponentInfo({
176
118
  row: this.itemOptions[0],
177
- value: "display_name",
178
- }),
119
+ value: 'display_name'
120
+ })
179
121
  },
180
122
  {
181
123
  value: this.getComponentInfo({
182
124
  row: this.itemOptions[0],
183
- value: "company_item_number",
184
- }),
125
+ value: 'company_item_number'
126
+ })
185
127
  },
186
128
  {
187
129
  value: this.getComponentInfo({
188
130
  row: this.itemOptions[0],
189
- value: "model",
190
- }),
191
- },
131
+ value: 'model'
132
+ })
133
+ }
192
134
  ]
193
135
  return items
194
136
  },
@@ -199,11 +141,11 @@ export default {
199
141
  } else if (row[value]) {
200
142
  item = row[value]
201
143
  } else {
202
- item = "-"
144
+ item = '-'
203
145
  }
204
146
  return item
205
- },
206
- },
147
+ }
148
+ }
207
149
  }
208
150
  </script>
209
151
 
@@ -213,4 +155,4 @@ body {
213
155
  height: 100%;
214
156
  margin: 0;
215
157
  }
216
- </style>
158
+ </style>
@@ -14,6 +14,7 @@
14
14
  </label-wrapper>
15
15
  <input-wrapper>
16
16
  <input-container
17
+ v-bind="$attrs"
17
18
  ref="inputField1"
18
19
  :hasUnit="unitName && !!unitName.length"
19
20
  :placeholder="displayedPlaceholder"
@@ -30,6 +31,7 @@
30
31
  :textAlign="textAlign"
31
32
  :fontSize="fontSize"
32
33
  :fontColor="fontColor"
34
+ v-on="$listeners"
33
35
  />
34
36
  <unit-container
35
37
  v-if="unitName && showLinearUnitName"
@@ -71,7 +73,7 @@
71
73
  import styled from 'vue-styled-components'
72
74
  import {
73
75
  stringToNumber,
74
- numberToString,
76
+ numberToString
75
77
  } from '../../../helpers/numberConverter'
76
78
  import InfoText from '../../infoText'
77
79
 
@@ -89,15 +91,15 @@ const inputProps = {
89
91
  noBorder: Boolean,
90
92
  textAlign: String,
91
93
  fontSize: String,
92
- fontColor: String,
94
+ fontColor: String
93
95
  }
94
96
  const InputContainer = styled('input', inputProps)`
95
97
  border: ${(props) =>
96
98
  props.isError
97
99
  ? '1px solid ' + props.theme.colors.red
98
100
  : props.noBorder
99
- ? "none"
100
- : "1px solid " + props.theme.colors.mediumGray};
101
+ ? 'none'
102
+ : '1px solid ' + props.theme.colors.mediumGray};
101
103
  padding: ${(props) =>
102
104
  props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
103
105
  border-radius: 4px;
@@ -178,101 +180,102 @@ export default {
178
180
  ErrorMessage,
179
181
  LabelWrapper,
180
182
  LabelText,
181
- InfoText,
183
+ InfoText
182
184
  },
185
+ inheritAttrs: false,
183
186
  data() {
184
187
  return {
185
188
  textInput: '',
186
- isFocused: false,
189
+ isFocused: false
187
190
  }
188
191
  },
189
192
  computed: {
190
193
  displayedPlaceholder() {
191
194
  if (this.placeholder) return this.placeholder
192
195
  return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
193
- },
196
+ }
194
197
  },
195
198
  props: {
196
199
  placeholder: {
197
200
  required: false,
198
- default: '',
201
+ default: ''
199
202
  },
200
203
  isError: {
201
204
  required: false,
202
- default: false,
205
+ default: false
203
206
  },
204
207
  inputWidth: {
205
208
  required: false,
206
- default: null,
209
+ default: null
207
210
  },
208
211
  minWidth: {
209
212
  required: false,
210
- default: null,
213
+ default: null
211
214
  },
212
215
  value: {
213
216
  required: true,
214
- default: null,
217
+ default: null
215
218
  },
216
219
  clearInput: {
217
220
  required: false,
218
- default: false,
221
+ default: false
219
222
  },
220
223
  errorMessage: {
221
224
  required: false,
222
- default: 'Please insert a correct number',
225
+ default: 'Please insert a correct number'
223
226
  },
224
227
  numberPrecision: {
225
228
  required: false,
226
- default: 0,
229
+ default: 0
227
230
  },
228
231
  unitName: {
229
232
  required: false,
230
- default: '',
233
+ default: ''
231
234
  },
232
235
  showLinearUnitName: {
233
236
  required: false,
234
- default: false,
237
+ default: false
235
238
  },
236
239
  disabled: {
237
240
  required: false,
238
- default: false,
241
+ default: false
239
242
  },
240
243
  noBorder: {
241
244
  required: false,
242
- default: false,
245
+ default: false
243
246
  },
244
247
  textAlign: {
245
248
  required: false,
246
- default: 'left',
249
+ default: 'left'
247
250
  },
248
251
  fontSize: {
249
252
  required: false,
250
- default: '13px',
253
+ default: '13px'
251
254
  },
252
255
  labelText: {
253
256
  required: false,
254
- default: null,
257
+ default: null
255
258
  },
256
259
  labelInfoText: {
257
260
  required: false,
258
- default: null,
261
+ default: null
259
262
  },
260
263
  labelInfoAlign: {
261
264
  required: false,
262
- default: 'right',
265
+ default: 'right'
263
266
  },
264
267
  minNumber: {
265
268
  required: false,
266
- default: null,
269
+ default: null
267
270
  },
268
271
  fontColor: {
269
272
  required: false,
270
- default: null,
273
+ default: null
271
274
  },
272
275
  numberToStringEnabled: {
273
276
  required: false,
274
- default: true,
275
- },
277
+ default: true
278
+ }
276
279
  },
277
280
  methods: {
278
281
  onChangeHandler(event) {
@@ -300,15 +303,15 @@ export default {
300
303
  } else {
301
304
  let num = stringToNumber({
302
305
  value: item,
303
- numberPrecision: false,
306
+ numberPrecision: false
304
307
  })
305
308
  return num
306
309
  }
307
310
  })
308
- let evaluated = eval(formatted.join(""))
311
+ let evaluated = eval(formatted.join(''))
309
312
  evaluated = stringToNumber({
310
313
  value: evaluated,
311
- numberPrecision: this.numberPrecision,
314
+ numberPrecision: this.numberPrecision
312
315
  })
313
316
  return evaluated
314
317
  },
@@ -321,7 +324,7 @@ export default {
321
324
  this.textInput = numberToString({
322
325
  value:
323
326
  evaluatedInput && value.length ? evaluatedInput : this.minNumber,
324
- numberPrecision: this.numberPrecision,
327
+ numberPrecision: this.numberPrecision
325
328
  })
326
329
  }
327
330
  let adjustedMinValue =
@@ -352,33 +355,33 @@ export default {
352
355
  let input = this.numberToStringEnabled
353
356
  ? numberToString({
354
357
  value: adjustedMinValue,
355
- numberPrecision: this.numberPrecision,
358
+ numberPrecision: this.numberPrecision
356
359
  })
357
360
  : adjustedMinValue
358
- let unit = this.showLinearUnitName ? "" : this.unitName
359
- return input + " " + unit
361
+ let unit = this.showLinearUnitName ? '' : this.unitName
362
+ return input + ' ' + unit
360
363
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
361
364
  return ''
362
365
  } else {
363
366
  return this.numberToStringEnabled
364
367
  ? numberToString({
365
368
  value: adjustedMinValue,
366
- numberPrecision: this.numberPrecision,
369
+ numberPrecision: this.numberPrecision
367
370
  })
368
371
  : adjustedMinValue
369
372
  }
370
- },
373
+ }
371
374
  },
372
375
  created() {
373
376
  if (this.value) {
374
377
  this.textInput = numberToString({
375
378
  value: this.value,
376
- numberPrecision: this.numberPrecision,
379
+ numberPrecision: this.numberPrecision
377
380
  })
378
381
  } else if (this.minNumber !== null) {
379
382
  this.textInput = numberToString({
380
383
  value: this.minNumber,
381
- numberPrecision: this.numberPrecision,
384
+ numberPrecision: this.numberPrecision
382
385
  })
383
386
  }
384
387
  },
@@ -388,7 +391,7 @@ export default {
388
391
  // If the value is typed, then we should clear the textInput on Continue
389
392
  this.textInput = ''
390
393
  }
391
- },
392
- },
394
+ }
395
+ }
393
396
  }
394
397
  </script>
@@ -3,15 +3,19 @@
3
3
  :isOpen="isOpen"
4
4
  :class="{ visible: isOpen, hidden: !isOpen }"
5
5
  @click.native="onOutsideClose()"
6
+ :backdrop="backdrop"
7
+ :fullwidthSpinner="fullwidthSpinner"
6
8
  >
7
9
  <modal-container @click.stop>
8
- <spinner v-if="isLoading" size="50px" :fullWidth="true" />
10
+ <spinner v-if="isLoading" size="50px" :fullWidth="fullwidthSpinner" />
11
+ <content-container :visible="!isLoading">
12
+ <slot />
13
+ </content-container>
9
14
  <close-button
10
15
  v-if="!hideClose"
11
16
  @click.native="onCloseModal()"
12
17
  class="close"
13
18
  />
14
- <slot />
15
19
  </modal-container>
16
20
  </page-wrapper>
17
21
  </template>
@@ -28,7 +32,12 @@ import styled from 'vue-styled-components'
28
32
  import CloseButton from '../../buttons/closeButton'
29
33
  import Spinner from '../../spinner'
30
34
 
31
- const pageAttrs = { isOpen: Boolean }
35
+ const contentAttrs = { visible: Boolean }
36
+ const ContentContainer = styled('div', contentAttrs)`
37
+ visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
38
+ `
39
+
40
+ const pageAttrs = { isOpen: Boolean, backdrop: String }
32
41
  const PageWrapper = styled('div', pageAttrs)`
33
42
  position: fixed;
34
43
  display: grid;
@@ -36,7 +45,10 @@ const PageWrapper = styled('div', pageAttrs)`
36
45
  left: 0;
37
46
  width: 100%;
38
47
  height: 100%;
39
- background-color: rgba(255, 255, 255, 0.9);
48
+ background-color: ${(props) =>
49
+ props.backdrop == 'dark'
50
+ ? 'rgba(0, 0, 0, 0.4)'
51
+ : 'rgba(255, 255, 255, 0.9)'};
40
52
  z-index: 99999;
41
53
  overflow: auto;
42
54
 
@@ -98,7 +110,8 @@ export default {
98
110
  PageWrapper,
99
111
  ModalContainer,
100
112
  CloseButton,
101
- Spinner
113
+ Spinner,
114
+ ContentContainer
102
115
  },
103
116
  props: {
104
117
  isOpen: {
@@ -116,6 +129,14 @@ export default {
116
129
  hideClose: {
117
130
  required: false,
118
131
  default: false
132
+ },
133
+ backdrop: {
134
+ required: false,
135
+ default: 'white'
136
+ },
137
+ fullwidthSpinner: {
138
+ required: false,
139
+ default: true
119
140
  }
120
141
  },
121
142
  methods: {
@@ -135,4 +156,4 @@ export default {
135
156
  }
136
157
  }
137
158
  }
138
- </script>
159
+ </script>
@@ -26,5 +26,6 @@ export const Default = Template.bind({
26
26
  preventOutsideClose: true,
27
27
  isLoading: false,
28
28
  hideClose: false,
29
- });
29
+ backdrop: 'dark',
30
+ })
30
31
  Default.args = {};
@@ -18,7 +18,7 @@
18
18
  <script>
19
19
  // import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
20
20
  // <spinner size="30px" />
21
- import styled from "vue-styled-components"
21
+ import styled from 'vue-styled-components'
22
22
 
23
23
  const SpinnerContainer = styled.div`
24
24
  position: fixed;
@@ -37,29 +37,32 @@ const Container = styled.div`
37
37
  display: grid;
38
38
  align-items: center;
39
39
  justify-items: center;
40
+ position: absolute;
41
+ width: 100%;
42
+ height: 100%;
40
43
  `
41
44
 
42
45
  const spinnerAttrs = { size: String }
43
- const SpinnerWrapper = styled("img", spinnerAttrs)`
44
- width: ${(props) => (props.size ? props.size : "60px")};
46
+ const SpinnerWrapper = styled('img', spinnerAttrs)`
47
+ width: ${(props) => (props.size ? props.size : '60px')};
45
48
  `
46
49
 
47
50
  export default {
48
- name: "spinner",
51
+ name: 'spinner',
49
52
  components: {
50
53
  Container,
51
54
  SpinnerWrapper,
52
- SpinnerContainer,
55
+ SpinnerContainer
53
56
  },
54
57
  props: {
55
58
  fullWidth: {
56
59
  required: false,
57
- default: false,
60
+ default: false
58
61
  },
59
62
  size: {
60
63
  required: false,
61
- default: null,
62
- },
63
- },
64
+ default: null
65
+ }
66
+ }
64
67
  }
65
- </script>
68
+ </script>