@eturnity/eturnity_reusable_components 1.2.22-3d-master.4 → 1.2.22-3d-master.5

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.22-3d-master.4",
3
+ "version": "1.2.22-3d-master.5",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -14,7 +14,8 @@
14
14
  "core-js": "^3.6.5",
15
15
  "vue": "^2.6.11",
16
16
  "vue-styled-components": "^1.6.0",
17
- "html-loader": "^0.5.5"
17
+ "html-loader": "^0.5.5",
18
+ "v-click-outside": "^2.1.4"
18
19
  },
19
20
  "devDependencies": {
20
21
  "@storybook/addon-actions": "^6.2.8",
package/src/App.vue CHANGED
@@ -2,10 +2,12 @@
2
2
  <ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
3
3
  <page-container>
4
4
  <br />
5
- <<<<<<< HEAD
6
- =======
5
+
7
6
  <iconWrapper name="bell"/>
8
7
  <modal backdrop="dark" :isLoading="false" :isOpen="true">
8
+
9
+ <modal backdrop="dark" :isLoading="false" :isOpen="false">
10
+
9
11
  <main-table titleText="My Table">
10
12
  <thead>
11
13
  <tr>
@@ -34,6 +36,23 @@
34
36
  </tbody>
35
37
  </main-table>
36
38
  </modal>
39
+ <row-container>
40
+ <div v-for='(item, index) in markersArray' :key="item.index">
41
+ <project-marker
42
+ :activeLanguage="'en-us'"
43
+ :markerData="item"
44
+ :isLimitedPartner="false"
45
+ :isGroupSupport="false"
46
+ :isEditable="true"
47
+ :gettext="gettext"
48
+ :date="'23.07.2022'"
49
+ @editHandler="consoleLog('edit index ' + index)"
50
+ @deleteHandler="consoleLog('delete id ' + item.id)"
51
+ />
52
+ </div>
53
+ </row-container>
54
+ <br />
55
+ <iconCollection />
37
56
  <br />
38
57
  <toggle
39
58
  @on-toggle-change="onInputChange($event)"
@@ -96,7 +115,6 @@
96
115
  </template>
97
116
 
98
117
  <script>
99
- <<<<<<< HEAD
100
118
  import { ThemeProvider } from "vue-styled-components"
101
119
  import theme from "./assets/theme"
102
120
  import styled from "vue-styled-components"
@@ -109,21 +127,6 @@ import PageSubtitle from "@/components/pageSubtitle"
109
127
  import Spinner from "@/components/spinner"
110
128
  import ExternalButton from "@/components/buttons/externalButton"
111
129
  import InputText from "@/components/inputs/inputText"
112
- =======
113
- import { ThemeProvider } from 'vue-styled-components'
114
- import theme from './assets/theme'
115
- import styled from 'vue-styled-components'
116
- import MainTable from '@/components/tables/mainTable'
117
- import ThreeDots from '@/components/threeDots'
118
- import iconWrapper from '@/components/iconWrapper'
119
- import Toggle from '@/components/inputs/toggle'
120
- import InputNumber from '@/components/inputs/inputNumber'
121
- import Checkbox from '@/components/inputs/checkbox'
122
- import PageSubtitle from '@/components/pageSubtitle'
123
- import Spinner from '@/components/spinner'
124
- import ExternalButton from '@/components/buttons/externalButton'
125
- import Modal from '@/components/modals/modal'
126
- >>>>>>> EPDM-5448
127
130
  // import TableDropdown from "@/components/tableDropdown"
128
131
  const InputAnnexContainer = styled.div`
129
132
  display: grid;
@@ -135,6 +138,12 @@ const PageContainer = styled.div`
135
138
  padding: 40px;
136
139
  `
137
140
 
141
+ const RowContainer = styled.div`
142
+ display: inline-flex;
143
+ gap: 10px;
144
+ flex-wrap: wrap;
145
+ `
146
+
138
147
  export default {
139
148
  name: 'App',
140
149
  components: {
@@ -148,6 +157,9 @@ export default {
148
157
  ExternalButton,
149
158
  iconWrapper,
150
159
  Modal,
160
+ ProjectMarker,
161
+ iconCollection,
162
+ RowContainer
151
163
  },
152
164
  data() {
153
165
  return {
@@ -207,6 +219,7 @@ export default {
207
219
  id: 4,
208
220
  },
209
221
  ],
222
+ markersArray: [{"id":1180,"choice":"project-on-hold","translations":{"fr":{"name":"fr - Project on hold"},"en-us":{"name":"Project on hold"},"it-ch":{"name":"it-ch - Project on hold"},"de-ch":{"name":"de-ch - Project on hold"},"fr-be":{"name":"fr-be - Project on hold"}},"color":"#D27CCA","can_be_deleted":true}, {"id":266,"choice":"transferred","translations":{"en-us":{"name":"Transferred"},"fr":{"name":"fr - Transferred"},"de-ch":{"name":"de-ch - Transferred"},"it-ch":{"name":"it-ch - Transferred"},"fr-be":{"name":"fr-be - Transferred"}},"color":"#20A4CA","can_be_deleted":false},{"id":267,"choice":"sold","translations":{"en-us":{"name":"Sold"},"fr":{"name":"Vendu"},"de-ch":{"name":"Verkauft"},"it-ch":{"name":"Venduto"},"fr-be":{"name":"Vendu"}},"color":"#008351","can_be_deleted":false},{"id":268,"choice":"lost","translations":{"en-us":{"name":"Lost"},"fr":{"name":"Perdu"},"de-ch":{"name":"Verloren"},"it-ch":{"name":"Perso"},"fr-be":{"name":"Perdu"}},"color":"#A52019","can_be_deleted":false},{"id":1181,"choice":"project-created","translations":{"fr":{"name":"Project created"},"en-us":{"name":"Project created"},"it-ch":{"name":"Project created"},"de-ch":{"name":"Project created"},"fr-be":{"name":"Project created"}},"color":"#FDB813","can_be_deleted":true}]
210
223
  }
211
224
  },
212
225
  methods: {
@@ -273,4 +286,4 @@ body {
273
286
  height: 100%;
274
287
  margin: 0;
275
288
  }
276
- </style>
289
+ </style>
@@ -0,0 +1,4 @@
1
+ <svg fill="none" height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M9.87865 8.47868L8.47865 9.87868L0.121287 1.52132L1.52129 0.121318L5.69997 4.3L9.87865 8.47868Z" fill="black"/>
3
+ <path d="M1.5213 9.87868L0.121302 8.47868L8.47866 0.12132L9.87866 1.52132L1.5213 9.87868Z" fill="black"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg fill="none" height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3 9.98993L3.47934e-07 6.01003L10 6.01003V7.98993L3 7.98993L3 9.98993Z" fill="black"/>
3
+ <path d="M7 0.0100708L10 3.98997H0L1.19209e-07 2.01007L7 2.01007V0.0100708Z" fill="black"/>
4
+ </svg>
@@ -1,4 +1,8 @@
1
1
  <template>
2
+ <<<<<<< HEAD
3
+ =======
4
+ <wrapper :isDisabled="isDisabled" :size="size" :cursor="cursor">
5
+ >>>>>>> master
2
6
  <icon-image
3
7
  :disabled="disabled"
4
8
  :size="size"
@@ -22,14 +26,16 @@
22
26
 
23
27
  import styled from 'vue-styled-components'
24
28
 
25
- const IconImageProps = { color: String, hoveredColor: String, size: String ,disabled:Boolean}
26
- const IconImage = styled('div', IconImageProps)`
27
- display: inline-flex;
29
+ const wrapperAttrs = { isDisabled: Boolean, size: String, cursor: String }
30
+ const Wrapper = styled('div', wrapperAttrs)`
31
+ display: inline-block;
28
32
  width: ${(props) => props.size};
29
33
  height: ${(props) => props.size};
30
- justify-content:center;
31
- align-items:center;
32
- cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
34
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : props.cursor)};
35
+ line-height: 0;
36
+ `
37
+ const IconImageProps = { color: String, hoveredColor: String, size: String }
38
+ const IconImage = styled('div', IconImageProps)`
33
39
  svg {
34
40
  width: 100%;
35
41
  height: 100%;
@@ -65,10 +71,14 @@ export default {
65
71
  size: {
66
72
  required: false,
67
73
  default: '30px'
74
+ },
75
+ cursor: {
76
+ required: false,
77
+ default: 'pointer'
68
78
  }
69
79
  },
70
80
  data() {
71
81
  return {}
72
82
  }
73
83
  }
74
- </script>
84
+ </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <component-wrapper :layout="layout">
3
3
  <radio-wrapper v-for="(item, index) in options" :key="item.value">
4
- <label-container :size="size" :isDisabled="item.disabled">
4
+ <label-container :size="size" :isDisabled="item.disabled" :isChecked="selectedOption === item.value">
5
5
  <radio
6
6
  type="radio"
7
7
  :value="selectedOption"
@@ -76,14 +76,6 @@ const Radio = styled.input`
76
76
  cursor: pointer;
77
77
  height: 0;
78
78
  width: 0;
79
-
80
- &:checked ~ .checkmark {
81
- background-color: white;
82
-
83
- &:after {
84
- display: block;
85
- }
86
- }
87
79
  `
88
80
 
89
81
  const RadioWrapper = styled.div`
@@ -91,22 +83,22 @@ const RadioWrapper = styled.div`
91
83
  grid-gap: 10px;
92
84
  `
93
85
 
94
- const containerProps = { size: String, isDisabled: Boolean }
86
+ const containerProps = { size: String, isDisabled: Boolean, isChecked: Boolean }
95
87
  const LabelContainer = styled("label", containerProps)`
96
88
  display: grid;
97
89
  grid-template-columns: auto 1fr auto;
98
90
  grid-gap: 15px;
99
91
  align-items: center;
100
92
  color: ${(props) =>
101
- props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
93
+ props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
102
94
  position: relative;
103
95
  cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
104
96
  font-size: ${(props) =>
105
97
  props.size === "large"
106
98
  ? "16px"
107
99
  : props.size === "medium"
108
- ? "13px"
109
- : "10px"};
100
+ ? "13px"
101
+ : "10px"};
110
102
  user-select: none;
111
103
  flex: auto;
112
104
  align-self: baseline;
@@ -116,14 +108,14 @@ const LabelContainer = styled("label", containerProps)`
116
108
  props.size === "large"
117
109
  ? "23px"
118
110
  : props.size === "medium"
119
- ? "16px"
120
- : "12px"};
111
+ ? "16px"
112
+ : "12px"};
121
113
  width: ${(props) =>
122
114
  props.size === "large"
123
115
  ? "23px"
124
116
  : props.size === "medium"
125
- ? "16px"
126
- : "12px"};
117
+ ? "16px"
118
+ : "12px"};
127
119
  background-color: #fff;
128
120
  border-radius: 100%;
129
121
  border: 1px solid ${(props) => props.theme.colors.mediumGray};
@@ -133,32 +125,29 @@ const LabelContainer = styled("label", containerProps)`
133
125
 
134
126
  &:after {
135
127
  content: "";
136
- display: none;
128
+ display: ${(props) => props.isChecked ? 'block' : 'none'};
129
+ width: ${(props) =>
130
+ props.size === "large"
131
+ ? "10px"
132
+ : props.size === "medium"
133
+ ? "8px"
134
+ : "6px"};
135
+ height: ${(props) =>
136
+ props.size === "large"
137
+ ? "10px"
138
+ : props.size === "medium"
139
+ ? "8px"
140
+ : "6px"};
141
+ border-radius: 100%;
142
+ background: ${(props) => props.theme.colors.primary};
137
143
  }
138
144
  }
139
-
140
- .checkmark:after {
141
- width: ${(props) =>
142
- props.size === "large"
143
- ? "10px"
144
- : props.size === "medium"
145
- ? "8px"
146
- : "6px"};
147
- height: ${(props) =>
148
- props.size === "large"
149
- ? "10px"
150
- : props.size === "medium"
151
- ? "8px"
152
- : "6px"};
153
- border-radius: 100%;
154
- background: ${(props) => props.theme.colors.primary};
155
- }
156
145
  `
157
146
 
158
147
  const textAttrs = { isDisabled: Boolean }
159
148
  const LabelText = styled("div", textAttrs)`
160
149
  color: ${(props) =>
161
- props.isDisabled ? props.theme.colors.disabled : props.theme.colors.black};
150
+ props.isDisabled ? props.theme.colors.grey2 : props.theme.colors.black};
162
151
  `
163
152
 
164
153
  const RadioImage = styled.img`
@@ -228,11 +217,15 @@ export default {
228
217
  required: false,
229
218
  default: "medium", // small, medium, large
230
219
  },
220
+ name: {
221
+ required: false,
222
+ default: ''
223
+ }
231
224
  },
232
225
  data() {
233
226
  return {
234
- radioName: "",
235
227
  selectedImage: null,
228
+ radioName: ''
236
229
  }
237
230
  },
238
231
  methods: {
@@ -247,7 +240,7 @@ export default {
247
240
  },
248
241
  },
249
242
  created() {
250
- this.radioName = Math.round(Math.random() * 10000)
243
+ this.radioName = this.name.length === 0 ? Math.round(Math.random() * 10000) : this.name
251
244
  },
252
245
  }
253
246
  </script>
@@ -59,7 +59,8 @@ const InputWrapper = styled.span`
59
59
  img {
60
60
  position: absolute;
61
61
  right: 10px;
62
- top: 0;
62
+ top: 50%;
63
+ transform: translateY(-50%);
63
64
  }
64
65
  `
65
66
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <subtitle-text :color="color" :hasInfoText="!!infoText">
2
+ <subtitle-text :color="color" :marginBottom="marginBottom" :hasInfoText="!!infoText">
3
3
  <span>
4
4
  {{ text }}
5
5
  </span>
@@ -24,7 +24,7 @@
24
24
  import styled from "vue-styled-components"
25
25
  import InfoText from "../infoText"
26
26
 
27
- const textAttrs = { color: String, hasInfoText: Boolean }
27
+ const textAttrs = { color: String, hasInfoText: Boolean, marginBottom: String }
28
28
  const SubtitleText = styled("div", textAttrs)`
29
29
  display: grid;
30
30
  align-items: center;
@@ -33,7 +33,7 @@ const SubtitleText = styled("div", textAttrs)`
33
33
  props.hasInfoText ? "auto auto 1fr" : "1fr"};
34
34
  color: ${(props) => (props.color ? props.color : props.theme.colors.gray1)};
35
35
  font-size: 13px;
36
- margin-bottom: 30px;
36
+ margin-bottom: ${(props) => (props.marginBottom ? props.marginBottom : '30px')};
37
37
  line-height: 1.5;
38
38
  position: relative;
39
39
  `
@@ -59,6 +59,10 @@ export default {
59
59
  required: false,
60
60
  default: "left",
61
61
  },
62
+ marginBottom: {
63
+ required: false,
64
+ default: "30px",
65
+ }
62
66
  },
63
67
  }
64
68
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <title-text :color="color">{{ text }}</title-text>
2
+ <title-text :color="color" :fontSize="fontSize" :uppercase="uppercase">{{ text }}</title-text>
3
3
  </template>
4
4
 
5
5
  <script>
@@ -11,12 +11,12 @@
11
11
  // />
12
12
  import styled from "vue-styled-components"
13
13
 
14
- const textAttrs = { color: String }
14
+ const textAttrs = { color: String, fontSize: String, uppercase: Boolean }
15
15
  const TitleText = styled("div", textAttrs)`
16
16
  color: ${(props) => (props.color ? props.color : props.theme.colors.black)};
17
17
  font-weight: bold;
18
- font-size: 16px;
19
- text-transform: uppercase;
18
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
19
+ text-transform: ${(props) => (props.uppercase ? 'uppercase' : 'none')};
20
20
  margin-bottom: 20px;
21
21
  `
22
22
 
@@ -32,6 +32,14 @@ export default {
32
32
  color: {
33
33
  required: false,
34
34
  },
35
+ fontSize: {
36
+ required: false,
37
+ default: '16px'
38
+ },
39
+ uppercase: {
40
+ required: false,
41
+ default: true
42
+ }
35
43
  },
36
44
  }
37
45
  </script>
@@ -0,0 +1,285 @@
1
+ <template>
2
+ <page-container :withDate="!!date">
3
+ <marker-container
4
+ v-if="markerData"
5
+ :backgroundColor="markerData.color"
6
+ :hasIcon="!!iconName"
7
+ :isEditionAllowed="editionAllowed"
8
+ :isActive="activated"
9
+ :cursor="cursor"
10
+ @click.native="editionAllowed
11
+ ? activated = !activated
12
+ : ''
13
+ "
14
+ >
15
+ <icon
16
+ v-if="!!iconName"
17
+ :name="iconName"
18
+ color="white"
19
+ size="10px"
20
+ :cursor="cursor"
21
+ />
22
+ <span>{{ markerData.translations[activeLanguage].name }}</span>
23
+ <dot-wrapper
24
+ v-if="editionAllowed"
25
+ class="dotContainer"
26
+ >
27
+ <dot-icon />
28
+ <dot-icon />
29
+ <dot-icon />
30
+ </dot-wrapper>
31
+ <edit-container
32
+ v-if="activated"
33
+ v-click-outside="clickOutsideActionHandler"
34
+ >
35
+ <edit-item @click.native="deleteModalOpened = !deleteModalOpened">
36
+ <delete-icon />
37
+ <div>{{ $gettext('Delete') }}</div>
38
+ </edit-item>
39
+ <edit-item @click.native="onEditClick">
40
+ <icon-container>
41
+ <icon
42
+ name="edit_button"
43
+ size="14px"
44
+ />
45
+ </icon-container>
46
+ <div>{{ $gettext('Edit') }}</div>
47
+ </edit-item>
48
+ </edit-container>
49
+ </marker-container>
50
+ <date v-if="!!date">
51
+ {{ date }}
52
+ </date>
53
+ <modal
54
+ :isOpen="deleteModalOpened"
55
+ @on-close="closeDeleteModal"
56
+ :preventOutsideClose="true"
57
+ >
58
+ <modal-container>
59
+ <page-title :text="$gettext('delete_confirm_text')" />
60
+ <page-subtitle :text="$gettext('delete_confirm_subtext')" />
61
+ <cta-container>
62
+ <main-button
63
+ @click.native="onDelete"
64
+ :text="$gettext('Delete')"
65
+ />
66
+ <main-button
67
+ type="cancel"
68
+ @click.native="closeDeleteModal"
69
+ :text="$gettext('Cancel')"
70
+ />
71
+ </cta-container>
72
+ </modal-container>
73
+ </modal>
74
+ </page-container>
75
+ </template>
76
+
77
+ <script>
78
+ // import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/projectMarker"
79
+ // To use:
80
+ // <project-marker
81
+ // :activeLanguage="'en-us'"
82
+ // :markerData="{"choice":"sold","translations":{"en-us":{"name":"Sold"}}","color":"#000"}"
83
+ // :isLimitedPartner="false"
84
+ // :isGroupSupport="false"
85
+ // :isEditable='false'
86
+ // :date="'23.07.2022'"
87
+ // @editHandler="onMarkerEdit($event)"
88
+ // @deleteHandler="onMarkerDelete($event)"
89
+ // />
90
+
91
+ import styled from "vue-styled-components"
92
+ import Icon from "../icon"
93
+ import Modal from '../modals/modal'
94
+ import PageTitle from '../pageTitle'
95
+ import DeleteIcon from '../deleteIcon'
96
+ import PageSubtitle from '../pageSubtitle'
97
+ import MainButton from '../buttons/mainButton'
98
+
99
+ const PageContainerAttrs = {
100
+ withDate: Boolean
101
+ }
102
+ const PageContainer = styled('div', PageContainerAttrs)`
103
+ display: flex;
104
+ align-items: center;
105
+ gap: 10px;
106
+ font-size: 12px;
107
+ line-height: 14px;
108
+ `
109
+
110
+ const ModalContainer = styled.div`
111
+ padding: 40px;
112
+ min-width: 500px;
113
+ `
114
+
115
+ const CtaContainer = styled.div`
116
+ display: flex;
117
+ gap: 20px;
118
+ margin-top: 30px;
119
+ `
120
+
121
+ const MarkerAttrs = {
122
+ backgroundColor: String,
123
+ hasIcon: Boolean,
124
+ isEditionAllowed: Boolean,
125
+ isActive: Boolean,
126
+ cursor: String
127
+ }
128
+ const MarkerContainer = styled('div', MarkerAttrs)`
129
+ display: grid;
130
+ grid-template-columns: ${(props) =>
131
+ props.hasIcon || props.isEditionAllowed ? 'auto 1fr' : '1fr'};
132
+ grid-gap: 5px;
133
+ position: relative;
134
+ align-items: center;
135
+ padding: 2px 7px;
136
+ color: ${(props) => props.theme.colors.white};
137
+ background-color: ${(props) =>
138
+ props.backgroundColor ? props.backgroundColor : props.theme.colors.grey3};
139
+ border-radius: 4px;
140
+ white-space: nowrap;
141
+ cursor: ${(props) => props.isEditionAllowed ? 'pointer' : props.cursor};
142
+
143
+ .dotContainer {
144
+ display: ${(props) => (props.isActive ? 'flex' : 'none')};
145
+ }
146
+
147
+ &:hover {
148
+ .dotContainer {
149
+ display: flex;
150
+ }
151
+ }
152
+ `
153
+
154
+ const DotWrapper = styled.div`
155
+ display: flex;
156
+ gap: 2px;
157
+ cursor: pointer;
158
+ `
159
+
160
+ const DotIcon = styled.div`
161
+ width: 4px;
162
+ height: 4px;
163
+ border-radius: 100%;
164
+ background-color: ${(props) => props.theme.colors.white};
165
+ `
166
+
167
+ const EditContainer = styled.div`
168
+ position: absolute;
169
+ z-index: 99;
170
+ top: 22px;
171
+ display: grid;
172
+ background-color: ${(props) => props.theme.colors.white};
173
+ border: 1px solid ${(props) => props.theme.colors.grey4};
174
+ border-radius: 4px;
175
+ cursor: pointer;
176
+ overflow: hidden;
177
+ `
178
+
179
+ const EditItem = styled.div`
180
+ display: flex;
181
+ align-items: center;
182
+ gap: 12px;
183
+ color: ${(props) => props.theme.colors.black};
184
+ font-size: 13px;
185
+ padding: 4px 18px;
186
+
187
+ &:hover {
188
+ background-color: ${(props) => props.theme.colors.grey5};
189
+ }
190
+ `
191
+
192
+ const IconContainer = styled.div`
193
+ padding: 8px;
194
+ line-height: 0;
195
+ `
196
+
197
+ const Date = styled.div``
198
+
199
+ export default {
200
+ name: "project-marker",
201
+ components: {
202
+ PageContainer,
203
+ MarkerContainer,
204
+ DotWrapper,
205
+ DotIcon,
206
+ EditContainer,
207
+ EditItem,
208
+ DeleteIcon,
209
+ IconContainer,
210
+ Icon,
211
+ Modal,
212
+ ModalContainer,
213
+ CtaContainer,
214
+ PageTitle,
215
+ PageSubtitle,
216
+ MainButton,
217
+ Date
218
+ },
219
+ props: {
220
+ markerData: {
221
+ required: true
222
+ },
223
+ activeLanguage: {
224
+ required: true
225
+ },
226
+ date: {
227
+ required: false,
228
+ default: null
229
+ },
230
+ isEditable: {
231
+ required: false,
232
+ default: false
233
+ },
234
+ isGroupSupport: {
235
+ required: false,
236
+ default: false
237
+ },
238
+ isLimitedPartner: {
239
+ required: false,
240
+ default: false
241
+ },
242
+ cursor: {
243
+ required: false,
244
+ default: 'default'
245
+ }
246
+ },
247
+ data() {
248
+ return {
249
+ activated: false,
250
+ deleteModalOpened: false
251
+ }
252
+ },
253
+ computed: {
254
+ editionAllowed() {
255
+ return (this.markerData.can_be_deleted && (!this.isLimitedPartner || this.isGroupSupport)) && this.isEditable
256
+ },
257
+ iconName() {
258
+ if (this.markerData.choice === 'sold') {
259
+ return 'all_good'
260
+ } else if (this.markerData.choice === 'lost') {
261
+ return 'cross'
262
+ } else if (this.markerData.choice === 'transferred') {
263
+ return 'transfer'
264
+ } else {
265
+ return ''
266
+ }
267
+ }
268
+ },
269
+ methods: {
270
+ clickOutsideActionHandler() {
271
+ this.activated = false
272
+ },
273
+ closeDeleteModal() {
274
+ this.deleteModalOpened = false
275
+ },
276
+ onEditClick() {
277
+ this.$emit("editHandler")
278
+ },
279
+ onDelete() {
280
+ this.closeDeleteModal()
281
+ this.$emit("deleteHandler")
282
+ }
283
+ }
284
+ }
285
+ </script>
@@ -8,7 +8,7 @@
8
8
  <spinner-wrapper v-if="isLoading">
9
9
  <spinner />
10
10
  </spinner-wrapper>
11
- <table-container v-else>
11
+ <table-container v-else :cellPaddings="cellPaddings">
12
12
  <slot />
13
13
  </table-container>
14
14
  </table-wrapper>
@@ -63,7 +63,8 @@ const SpinnerWrapper = styled.div`
63
63
  justify-items: center;
64
64
  `
65
65
 
66
- const TableContainer = styled.table`
66
+ const containerAttrs = { cellPaddings: String }
67
+ const TableContainer = styled("table", containerAttrs)`
67
68
  width: 100%;
68
69
  border-collapse: collapse;
69
70
  border: none;
@@ -114,7 +115,7 @@ const TableContainer = styled.table`
114
115
  }
115
116
 
116
117
  td {
117
- padding: 6px 6px 7px 4px;
118
+ padding: ${(props) => props.cellPaddings ? props.cellPaddings : "6px 6px 7px 4px" };
118
119
  border-bottom: 1px solid ${(props) => props.theme.colors.grey4};
119
120
 
120
121
  &.empty {
@@ -352,6 +353,10 @@ export default {
352
353
  required: false,
353
354
  default: true,
354
355
  },
356
+ cellPaddings: {
357
+ required: false,
358
+ default: '',
359
+ },
355
360
  isLoading: {
356
361
  required: false,
357
362
  default: false,
@@ -10,7 +10,8 @@
10
10
  @click.stop
11
11
  :top="getItemLocation('top')"
12
12
  :right="getItemLocation('right')"
13
- :containerWidth="childOpen ? 420 : 220"
13
+ :containerWidth="childOpen ? 440 : 240"
14
+ ref="dropdownContainer"
14
15
  >
15
16
  <loading-container v-if="isLoading">
16
17
  <spinner />
@@ -26,13 +27,13 @@
26
27
  @click.stop="
27
28
  onSelect({
28
29
  item: child,
29
- hasChildren: hasChildren(child),
30
+ hasChildren: hasChildren(child)
30
31
  })
31
32
  "
32
33
  @keyup.enter.stop="
33
34
  onSelect({
34
35
  item: child,
35
- hasChildren: hasChildren(child),
36
+ hasChildren: hasChildren(child)
36
37
  })
37
38
  "
38
39
  >
@@ -51,7 +52,10 @@
51
52
  @mouseover="onItemHover({ index, item })"
52
53
  :isDisabled="item.disabled"
53
54
  >
54
- <arrow-left :hasChildren="hasChildren(item)" />
55
+ <arrow-left
56
+ :hasChildren="hasChildren(item)"
57
+ v-if="hasChildren(item)"
58
+ />
55
59
  <span>
56
60
  {{ item.name }}
57
61
  </span>
@@ -117,8 +121,8 @@
117
121
  // },
118
122
  // ],
119
123
 
120
- import styled from "vue-styled-components"
121
- import Spinner from "../spinner"
124
+ import styled from 'vue-styled-components'
125
+ import Spinner from '../spinner'
122
126
 
123
127
  const PageContainer = styled.div`
124
128
  display: grid;
@@ -155,11 +159,11 @@ const DotItem = styled.div`
155
159
  `
156
160
 
157
161
  const dropdownAttrs = { top: Number, right: Number, containerWidth: Number }
158
- const DropdownContainer = styled("div", dropdownAttrs)`
162
+ const DropdownContainer = styled('div', dropdownAttrs)`
159
163
  z-index: 99;
160
164
  height: 200px;
161
- top: ${(props) => props.top + "px"};
162
- left: ${(props) => props.right - props.containerWidth + "px"};
165
+ top: ${(props) => props.top + 'px'};
166
+ left: ${(props) => props.right - props.containerWidth + 'px'};
163
167
  position: absolute;
164
168
  display: grid;
165
169
  grid-template-columns: auto auto;
@@ -180,19 +184,21 @@ const OptionsContainer = styled.div`
180
184
  border: 1px solid ${(props) => props.theme.colors.grey3};
181
185
  display: grid;
182
186
  grid-template-columns: 1fr;
183
- min-width: 200px;
187
+ min-width: 220px;
188
+ max-width: 220px;
184
189
  width: max-content;
185
190
  border-radius: 4px;
186
191
  background-color: #fff;
187
192
  max-height: 220px;
188
193
  overflow: auto;
189
194
  height: max-content;
195
+ white-space: normal;
190
196
  `
191
197
 
192
198
  const optionAttrs = { isDisabled: Boolean }
193
- const OptionItem = styled("div", optionAttrs)`
199
+ const OptionItem = styled('div', optionAttrs)`
194
200
  padding: 12px;
195
- cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
201
+ cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
196
202
  font-size: 13px;
197
203
  position: relative;
198
204
 
@@ -222,7 +228,7 @@ const OptionChild = styled.div`
222
228
  `
223
229
 
224
230
  const arrowAttrs = { hasChildren: Boolean }
225
- const ArrowLeft = styled("span", arrowAttrs)`
231
+ const ArrowLeft = styled('span', arrowAttrs)`
226
232
  border: solid #9f9f9f;
227
233
  border-width: 0 1.5px 1.5px 0;
228
234
  display: inline-block;
@@ -230,16 +236,18 @@ const ArrowLeft = styled("span", arrowAttrs)`
230
236
  margin-bottom: 1px;
231
237
  transform: rotate(135deg);
232
238
  margin-right: 3px;
233
- visibility: ${(props) => (props.hasChildren ? "visible" : "hidden")};
239
+ visibility: ${(props) => (props.hasChildren ? 'visible' : 'hidden')};
234
240
  `
235
241
 
236
242
  const childAttrs = { isOpen: Boolean }
237
- const ChildrenContainer = styled("div", childAttrs)`
243
+ const ChildrenContainer = styled('div', childAttrs)`
238
244
  border: ${(props) =>
239
- props.isOpen ? "1px solid" + props.theme.colors.grey3 : "none"};
245
+ props.isOpen ? '1px solid' + props.theme.colors.grey3 : 'none'};
240
246
  display: grid;
241
247
  grid-template-columns: 1fr;
242
248
  min-width: 200px;
249
+ max-width: 200px;
250
+ white-space: normal;
243
251
  width: max-content;
244
252
  border-radius: 4px;
245
253
  background-color: #fff;
@@ -250,7 +258,7 @@ const ChildrenContainer = styled("div", childAttrs)`
250
258
  `
251
259
 
252
260
  export default {
253
- name: "three-dots",
261
+ name: 'three-dots',
254
262
  components: {
255
263
  PageContainer,
256
264
  ButtonContainer,
@@ -262,22 +270,23 @@ export default {
262
270
  ArrowLeft,
263
271
  DropdownContainer,
264
272
  Spinner,
265
- LoadingContainer,
273
+ LoadingContainer
266
274
  },
267
275
  props: {
268
276
  options: {
269
- required: true,
277
+ required: true
270
278
  },
271
279
  isLoading: {
272
280
  required: false,
273
- default: false,
274
- },
281
+ default: false
282
+ }
275
283
  },
276
284
  data() {
277
285
  return {
278
286
  isOpen: false,
279
287
  hoverItem: null,
280
288
  childOpen: null,
289
+ containerWidth: 16
281
290
  }
282
291
  },
283
292
  methods: {
@@ -285,15 +294,15 @@ export default {
285
294
  this.isOpen = !this.isOpen
286
295
 
287
296
  if (this.isOpen) {
288
- document.addEventListener("click", this.clickOutside)
297
+ document.addEventListener('click', this.clickOutside)
289
298
  } else {
290
- document.removeEventListener("click", this.clickOutside)
299
+ document.removeEventListener('click', this.clickOutside)
291
300
  }
292
301
  },
293
302
  getItemLocation(value) {
294
303
  let ref = this.$refs.dropdownItem
295
304
  let location = ref.$el.getBoundingClientRect()[value]
296
- if (value === "top") {
305
+ if (value === 'top') {
297
306
  location = location + window.scrollY
298
307
  }
299
308
  return location
@@ -310,7 +319,7 @@ export default {
310
319
  if (hasChildren || item.disabled) {
311
320
  return
312
321
  }
313
- this.$emit("on-select", item)
322
+ this.$emit('on-select', item)
314
323
  this.isOpen = false
315
324
  },
316
325
  clickOutside(event) {
@@ -318,7 +327,7 @@ export default {
318
327
  return
319
328
  }
320
329
  this.toggleButton()
321
- },
322
- },
330
+ }
331
+ }
323
332
  }
324
333
  </script>
package/src/main.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import Vue from "vue"
2
2
  import App from "./App.vue"
3
3
  import VueCompositionAPI from "@vue/composition-api"
4
+ import vClickOutside from 'v-click-outside'
4
5
 
5
6
  Vue.config.productionTip = false
6
7
 
7
8
  Vue.use(VueCompositionAPI)
9
+ Vue.use(vClickOutside)
8
10
 
9
11
  new Vue({
10
12
  render: (h) => h(App),