@eturnity/eturnity_reusable_components 1.1.99 → 1.2.0-beta.0
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
package/src/App.vue
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
<br />
|
|
5
|
+
<modal backdrop="dark" :isLoading="false" :isOpen="true">
|
|
6
|
+
<main-table titleText="My Table">
|
|
7
|
+
<thead>
|
|
8
|
+
<tr>
|
|
9
|
+
<th>Column 1</th>
|
|
10
|
+
<th>Column 2</th>
|
|
11
|
+
<th>Column 3</th>
|
|
12
|
+
<div />
|
|
13
|
+
</tr>
|
|
14
|
+
</thead>
|
|
15
|
+
<tbody>
|
|
16
|
+
<tr>
|
|
17
|
+
<!-- <table-dropdown
|
|
16
18
|
:colSpan="3"
|
|
17
19
|
:tableItems="getDropdownValues()"
|
|
18
20
|
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
@@ -21,14 +23,14 @@
|
|
|
21
23
|
:optionItems="itemOptions"
|
|
22
24
|
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
23
25
|
/> -->
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
<td>Test</td>
|
|
27
|
+
<div class="icons-container">
|
|
28
|
+
<three-dots :options="listOptions" :isLoading="false" />
|
|
29
|
+
</div>
|
|
30
|
+
</tr>
|
|
31
|
+
</tbody>
|
|
32
|
+
</main-table>
|
|
33
|
+
</modal>
|
|
32
34
|
<br />
|
|
33
35
|
<toggle
|
|
34
36
|
@on-toggle-change="onInputChange($event)"
|
|
@@ -61,17 +63,18 @@
|
|
|
61
63
|
</template>
|
|
62
64
|
|
|
63
65
|
<script>
|
|
64
|
-
import { ThemeProvider } from
|
|
65
|
-
import theme from
|
|
66
|
-
import styled from
|
|
67
|
-
import MainTable from
|
|
68
|
-
import ThreeDots from
|
|
69
|
-
import Toggle from
|
|
70
|
-
import InputNumber from
|
|
71
|
-
import Checkbox from
|
|
72
|
-
import PageSubtitle from
|
|
73
|
-
import Spinner from
|
|
74
|
-
import ExternalButton from
|
|
66
|
+
import { ThemeProvider } from 'vue-styled-components'
|
|
67
|
+
import theme from './assets/theme'
|
|
68
|
+
import styled from 'vue-styled-components'
|
|
69
|
+
import MainTable from '@/components/tables/mainTable'
|
|
70
|
+
import ThreeDots from '@/components/threeDots'
|
|
71
|
+
import Toggle from '@/components/inputs/toggle'
|
|
72
|
+
import InputNumber from '@/components/inputs/inputNumber'
|
|
73
|
+
import Checkbox from '@/components/inputs/checkbox'
|
|
74
|
+
import PageSubtitle from '@/components/pageSubtitle'
|
|
75
|
+
import Spinner from '@/components/spinner'
|
|
76
|
+
import ExternalButton from '@/components/buttons/externalButton'
|
|
77
|
+
import Modal from '@/components/modals/modal'
|
|
75
78
|
// import TableDropdown from "@/components/tableDropdown"
|
|
76
79
|
|
|
77
80
|
const PageContainer = styled.div`
|
|
@@ -79,7 +82,7 @@ const PageContainer = styled.div`
|
|
|
79
82
|
`
|
|
80
83
|
|
|
81
84
|
export default {
|
|
82
|
-
name:
|
|
85
|
+
name: 'App',
|
|
83
86
|
components: {
|
|
84
87
|
ThemeProvider,
|
|
85
88
|
PageContainer,
|
|
@@ -91,62 +94,62 @@ export default {
|
|
|
91
94
|
Spinner,
|
|
92
95
|
Checkbox,
|
|
93
96
|
ExternalButton,
|
|
94
|
-
|
|
97
|
+
Modal,
|
|
95
98
|
},
|
|
96
99
|
data() {
|
|
97
100
|
return {
|
|
98
101
|
inputValue: null,
|
|
99
|
-
checkedOption:
|
|
102
|
+
checkedOption: 'button_1',
|
|
100
103
|
question: {
|
|
101
104
|
number_format_precision: 4,
|
|
102
105
|
number_min_allowed: 0,
|
|
103
106
|
number_max_allowed: 10,
|
|
104
|
-
unit_short_name:
|
|
107
|
+
unit_short_name: 'cm',
|
|
105
108
|
},
|
|
106
109
|
dropdownOpen: false,
|
|
107
110
|
isChecked: false,
|
|
108
111
|
listOptions: [
|
|
109
112
|
{
|
|
110
|
-
name:
|
|
111
|
-
value:
|
|
113
|
+
name: 'Option 1',
|
|
114
|
+
value: 'option_1',
|
|
112
115
|
disabled: true,
|
|
113
116
|
},
|
|
114
117
|
{
|
|
115
|
-
name:
|
|
116
|
-
value:
|
|
118
|
+
name: 'Option 2',
|
|
119
|
+
value: 'option_2',
|
|
117
120
|
},
|
|
118
121
|
{
|
|
119
|
-
name:
|
|
120
|
-
value:
|
|
122
|
+
name: 'Option 3',
|
|
123
|
+
value: 'option_3',
|
|
121
124
|
},
|
|
122
125
|
{
|
|
123
|
-
name:
|
|
124
|
-
value:
|
|
126
|
+
name: 'Option 4',
|
|
127
|
+
value: 'option_4',
|
|
125
128
|
},
|
|
126
129
|
],
|
|
127
130
|
itemOptions: [
|
|
128
131
|
{
|
|
129
|
-
display_name:
|
|
130
|
-
company_item_number:
|
|
131
|
-
model:
|
|
132
|
+
display_name: 'Test 1',
|
|
133
|
+
company_item_number: '123',
|
|
134
|
+
model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
|
|
132
135
|
id: 1,
|
|
133
136
|
},
|
|
134
137
|
{
|
|
135
|
-
display_name:
|
|
136
|
-
company_item_number:
|
|
137
|
-
model:
|
|
138
|
+
display_name: 'Test 2',
|
|
139
|
+
company_item_number: '1234',
|
|
140
|
+
model: 'BTB-123',
|
|
138
141
|
id: 2,
|
|
139
142
|
},
|
|
140
143
|
{
|
|
141
|
-
display_name:
|
|
142
|
-
company_item_number:
|
|
143
|
-
model:
|
|
144
|
+
display_name: 'Test 3',
|
|
145
|
+
company_item_number: '12345',
|
|
146
|
+
model: 'BTB-543',
|
|
144
147
|
id: 3,
|
|
145
148
|
},
|
|
146
149
|
{
|
|
147
|
-
display_name:
|
|
148
|
-
company_item_number:
|
|
149
|
-
model:
|
|
150
|
+
display_name: 'Test 4',
|
|
151
|
+
company_item_number: '123456',
|
|
152
|
+
model: 'BTB-4930',
|
|
150
153
|
id: 4,
|
|
151
154
|
},
|
|
152
155
|
],
|
|
@@ -163,7 +166,7 @@ export default {
|
|
|
163
166
|
return this.dropdownOpen
|
|
164
167
|
},
|
|
165
168
|
onClickButton() {
|
|
166
|
-
console.log(
|
|
169
|
+
console.log('Test')
|
|
167
170
|
},
|
|
168
171
|
toggleDropdownOpen() {
|
|
169
172
|
this.dropdownOpen = !this.dropdownOpen
|
|
@@ -174,19 +177,19 @@ export default {
|
|
|
174
177
|
{
|
|
175
178
|
value: this.getComponentInfo({
|
|
176
179
|
row: this.itemOptions[0],
|
|
177
|
-
value:
|
|
180
|
+
value: 'display_name',
|
|
178
181
|
}),
|
|
179
182
|
},
|
|
180
183
|
{
|
|
181
184
|
value: this.getComponentInfo({
|
|
182
185
|
row: this.itemOptions[0],
|
|
183
|
-
value:
|
|
186
|
+
value: 'company_item_number',
|
|
184
187
|
}),
|
|
185
188
|
},
|
|
186
189
|
{
|
|
187
190
|
value: this.getComponentInfo({
|
|
188
191
|
row: this.itemOptions[0],
|
|
189
|
-
value:
|
|
192
|
+
value: 'model',
|
|
190
193
|
}),
|
|
191
194
|
},
|
|
192
195
|
]
|
|
@@ -199,7 +202,7 @@ export default {
|
|
|
199
202
|
} else if (row[value]) {
|
|
200
203
|
item = row[value]
|
|
201
204
|
} else {
|
|
202
|
-
item =
|
|
205
|
+
item = '-'
|
|
203
206
|
}
|
|
204
207
|
return item
|
|
205
208
|
},
|
|
@@ -213,4 +216,4 @@ body {
|
|
|
213
216
|
height: 100%;
|
|
214
217
|
margin: 0;
|
|
215
218
|
}
|
|
216
|
-
</style>
|
|
219
|
+
</style>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// <close-button
|
|
14
14
|
// color="#fff"
|
|
15
15
|
// />
|
|
16
|
-
import styled from
|
|
16
|
+
import styled from 'vue-styled-components'
|
|
17
17
|
|
|
18
18
|
const Container = styled.div`
|
|
19
19
|
position: relative;
|
|
@@ -27,8 +27,8 @@ const Wrapper = styled.div`
|
|
|
27
27
|
`
|
|
28
28
|
|
|
29
29
|
const lineAttrs = { color: String }
|
|
30
|
-
const Line = styled(
|
|
31
|
-
width:
|
|
30
|
+
const Line = styled('div', lineAttrs)`
|
|
31
|
+
width: 20px;
|
|
32
32
|
height: 2px;
|
|
33
33
|
background-color: ${(props) =>
|
|
34
34
|
props.color ? props.color : props.theme.colors.red};
|
|
@@ -45,17 +45,17 @@ const RightLine = styled(Line)`
|
|
|
45
45
|
`
|
|
46
46
|
|
|
47
47
|
export default {
|
|
48
|
-
name:
|
|
48
|
+
name: 'close-button',
|
|
49
49
|
components: {
|
|
50
50
|
Container,
|
|
51
51
|
Wrapper,
|
|
52
52
|
LeftLine,
|
|
53
|
-
RightLine
|
|
53
|
+
RightLine
|
|
54
54
|
},
|
|
55
55
|
props: {
|
|
56
56
|
color: {
|
|
57
|
-
required: false
|
|
58
|
-
}
|
|
59
|
-
}
|
|
57
|
+
required: false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
</script>
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
:isOpen="isOpen"
|
|
4
4
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
|
5
5
|
@click.native="onOutsideClose()"
|
|
6
|
+
:backdrop="backdrop"
|
|
6
7
|
>
|
|
7
8
|
<modal-container @click.stop>
|
|
8
9
|
<spinner v-if="isLoading" size="50px" :fullWidth="true" />
|
|
10
|
+
<content-container :visible="!isLoading">
|
|
11
|
+
<slot />
|
|
12
|
+
</content-container>
|
|
9
13
|
<close-button
|
|
10
14
|
v-if="!hideClose"
|
|
11
15
|
@click.native="onCloseModal()"
|
|
12
16
|
class="close"
|
|
13
17
|
/>
|
|
14
|
-
<slot />
|
|
15
18
|
</modal-container>
|
|
16
19
|
</page-wrapper>
|
|
17
20
|
</template>
|
|
@@ -24,19 +27,27 @@
|
|
|
24
27
|
// <div>Data....</div>
|
|
25
28
|
// </modal>
|
|
26
29
|
|
|
27
|
-
import styled from
|
|
28
|
-
import CloseButton from
|
|
29
|
-
import Spinner from
|
|
30
|
+
import styled from 'vue-styled-components'
|
|
31
|
+
import CloseButton from '../../buttons/closeButton'
|
|
32
|
+
import Spinner from '../../spinner'
|
|
30
33
|
|
|
31
|
-
const
|
|
32
|
-
const
|
|
34
|
+
const contentAttrs = { visible: Boolean }
|
|
35
|
+
const ContentContainer = styled('div', contentAttrs)`
|
|
36
|
+
visibility: ${(props) => (props.visible ? 'visible' : 'hidden')};
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
|
40
|
+
const PageWrapper = styled('div', pageAttrs)`
|
|
33
41
|
position: fixed;
|
|
34
42
|
display: grid;
|
|
35
43
|
top: 0;
|
|
36
44
|
left: 0;
|
|
37
45
|
width: 100%;
|
|
38
46
|
height: 100%;
|
|
39
|
-
background-color:
|
|
47
|
+
background-color: ${(props) =>
|
|
48
|
+
props.backdrop == 'dark'
|
|
49
|
+
? 'rgba(0, 0, 0, 0.4)'
|
|
50
|
+
: 'rgba(255, 255, 255, 0.9)'};
|
|
40
51
|
z-index: 99999;
|
|
41
52
|
overflow: auto;
|
|
42
53
|
|
|
@@ -73,8 +84,8 @@ const ModalContainer = styled.div`
|
|
|
73
84
|
|
|
74
85
|
.close {
|
|
75
86
|
position: absolute;
|
|
76
|
-
right:
|
|
77
|
-
top:
|
|
87
|
+
right: 20px;
|
|
88
|
+
top: 20px;
|
|
78
89
|
|
|
79
90
|
@media (max-width: 425px) {
|
|
80
91
|
right: 14px;
|
|
@@ -93,46 +104,51 @@ const ModalContainer = styled.div`
|
|
|
93
104
|
`
|
|
94
105
|
|
|
95
106
|
export default {
|
|
96
|
-
name:
|
|
107
|
+
name: 'modal',
|
|
97
108
|
components: {
|
|
98
109
|
PageWrapper,
|
|
99
110
|
ModalContainer,
|
|
100
111
|
CloseButton,
|
|
101
112
|
Spinner,
|
|
113
|
+
ContentContainer,
|
|
102
114
|
},
|
|
103
115
|
props: {
|
|
104
116
|
isOpen: {
|
|
105
117
|
required: true,
|
|
106
|
-
default: false
|
|
118
|
+
default: false
|
|
107
119
|
},
|
|
108
120
|
preventOutsideClose: {
|
|
109
121
|
required: false,
|
|
110
|
-
default: false
|
|
122
|
+
default: false
|
|
111
123
|
},
|
|
112
124
|
isLoading: {
|
|
113
125
|
required: false,
|
|
114
|
-
default: false
|
|
126
|
+
default: false
|
|
115
127
|
},
|
|
116
128
|
hideClose: {
|
|
117
129
|
required: false,
|
|
118
130
|
default: false,
|
|
119
131
|
},
|
|
132
|
+
backdrop: {
|
|
133
|
+
required: false,
|
|
134
|
+
default: 'white',
|
|
135
|
+
},
|
|
120
136
|
},
|
|
121
137
|
methods: {
|
|
122
138
|
onCloseModal() {
|
|
123
|
-
this.$emit(
|
|
139
|
+
this.$emit('on-close')
|
|
124
140
|
},
|
|
125
141
|
onOutsideClose() {
|
|
126
142
|
// If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
|
|
127
143
|
if (!this.preventOutsideClose) {
|
|
128
|
-
this.$emit(
|
|
144
|
+
this.$emit('on-close')
|
|
129
145
|
}
|
|
130
|
-
}
|
|
146
|
+
}
|
|
131
147
|
},
|
|
132
148
|
watch: {
|
|
133
149
|
isOpen: function (newVal) {
|
|
134
|
-
document.body.style.overflow = newVal ?
|
|
135
|
-
}
|
|
136
|
-
}
|
|
150
|
+
document.body.style.overflow = newVal ? 'hidden' : ''
|
|
151
|
+
}
|
|
152
|
+
}
|
|
137
153
|
}
|
|
138
154
|
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Modal from "./index.vue";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Modal",
|
|
5
|
+
component: Modal,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { Modal },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<modal v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
|
17
|
+
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
|
18
|
+
// To use:
|
|
19
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
|
|
20
|
+
// <div>Data....</div>
|
|
21
|
+
// </modal>
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({
|
|
25
|
+
isOpen: true,
|
|
26
|
+
preventOutsideClose: true,
|
|
27
|
+
isLoading: false,
|
|
28
|
+
hideClose: false,
|
|
29
|
+
backdrop: 'dark',
|
|
30
|
+
})
|
|
31
|
+
Default.args = {};
|