@eturnity/eturnity_reusable_components 1.0.66 → 1.0.70

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.0.66",
3
+ "version": "1.0.70",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
Binary file
@@ -28,6 +28,7 @@
28
28
  // checkColor="blue"
29
29
  // size="small"
30
30
  // backgroundColor="red"
31
+ // :isDisabled="true"
31
32
  // />
32
33
  import styled from "vue-styled-components"
33
34
 
@@ -297,7 +297,7 @@ export default {
297
297
  this.isFocused = true
298
298
  },
299
299
  formatWithCurrency(value) {
300
- if (value && !this.isFocused) {
300
+ if ((value || value === 0) && !this.isFocused) {
301
301
  let input = numberToString({
302
302
  value: value,
303
303
  numberPrecision: this.numberPrecision,
@@ -1,9 +1,12 @@
1
1
  <template>
2
2
  <container>
3
3
  <flex-wrapper :size="size">
4
- <label-text v-if="labelAlign === 'left'" :size="size">{{
5
- label
6
- }}</label-text>
4
+ <label-text
5
+ v-if="labelAlign === 'left'"
6
+ :size="size"
7
+ @click="onToggleChange"
8
+ >{{ label }}</label-text
9
+ >
7
10
  <toggle-wrapper
8
11
  role="checkbox"
9
12
  :checked="isChecked"
@@ -2,7 +2,30 @@
2
2
  <dropdown-row :colspan="colSpan" @click="toggleOpen" ref="dropdownItem">
3
3
  <component-container :colSpan="colSpan">
4
4
  <component-item v-for="(item, index) in tableItems" :key="index">
5
- {{ item.value }}
5
+ <template-button
6
+ @click.stop="onTemplateClick(item.row)"
7
+ v-if="item.type && item.type === 'template' && item.value === ''"
8
+ :key="idx"
9
+ >{{ $gettext("Use template...") }}</template-button
10
+ >
11
+ <template-link
12
+ v-else-if="item.type && item.type === 'template' && item.value !== ''"
13
+ @click.stop="onSelectedTemplateClick(item.row)"
14
+ >
15
+ <img
16
+ :src="require('../../assets/icons/file_icon.png')"
17
+ alt="icon"
18
+ width="12"
19
+ height="16"
20
+ />
21
+ <div>{{ item.value }}</div>
22
+ </template-link>
23
+ <no-template v-else-if="item.type && item.type === 'no-template'">
24
+ {{ $gettext("No main component template") }}
25
+ </no-template>
26
+ <span v-else>
27
+ {{ item.value }}
28
+ </span>
6
29
  </component-item>
7
30
  <et-popover
8
31
  v-if="showArchived"
@@ -50,9 +73,23 @@
50
73
  :tabindex="0"
51
74
  @keyup.enter.native="onItemClick(item)"
52
75
  >
53
- <span v-for="(option, idx) in optionsDisplay" :key="idx">
54
- {{ item[option] }}
55
- </span>
76
+ <template v-for="(option, idx) in optionsDisplay">
77
+ <span v-if="option !== 'template'" :key="idx">
78
+ {{ item[option] }}
79
+ </span>
80
+ <template-button
81
+ @click.stop="onTemplateClick(item)"
82
+ v-else-if="option === 'template' && item.has_template"
83
+ :key="idx"
84
+ >{{ $gettext("Use template...") }}</template-button
85
+ >
86
+ <no-template
87
+ v-else-if="option === 'template' && !item.has_template"
88
+ :key="idx"
89
+ >
90
+ {{ $gettext("No main component template") }}
91
+ </no-template>
92
+ </template>
56
93
  </options-item>
57
94
  </options-wrapper>
58
95
  </options-container>
@@ -96,7 +133,7 @@ const ComponentContainer = styled("div", containerAttrs)`
96
133
  grid-template-columns: repeat(${(props) => props.colSpan}, minmax(0, 1fr)) auto;
97
134
  grid-gap: 12px;
98
135
  align-items: center;
99
- background-color: #fff;
136
+ background-color: ${(props) => props.theme.colors.white};
100
137
  border-radius: 4px;
101
138
  padding: 5px 4px;
102
139
  `
@@ -124,7 +161,7 @@ const OptionsContainer = styled("div", optionsAttrs)`
124
161
  overflow: auto;
125
162
  border: 1px solid ${(props) => props.theme.colors.grey3};
126
163
  z-index: 9999;
127
- background: #fff;
164
+ background: ${(props) => props.theme.colors.white};
128
165
  border-radius: 4px;
129
166
  `
130
167
 
@@ -167,10 +204,35 @@ const SearchContainer = styled.div`
167
204
  position: sticky;
168
205
  top: 0;
169
206
  padding-top: 6px;
170
- background: #fff;
207
+ background: ${(props) => props.theme.colors.white};
171
208
  height: 40px;
172
209
  `
173
210
 
211
+ const TemplateButton = styled.div`
212
+ cursor: pointer;
213
+ background-color: #263238;
214
+ color: ${(props) => props.theme.colors.white};
215
+ padding: 4px 10px;
216
+ display: inline-block;
217
+ border-radius: 4px;
218
+ text-align: center;
219
+ `
220
+
221
+ const NoTemplate = styled.div`
222
+ color: ${(props) => props.theme.colors.gray1};
223
+ font-style: italic;
224
+ overflow: hidden;
225
+ text-overflow: ellipsis;
226
+ `
227
+
228
+ const TemplateLink = styled.div`
229
+ color: ${(props) => props.theme.colors.purple};
230
+ cursor: pointer;
231
+ display: grid;
232
+ grid-template-columns: auto 1fr;
233
+ grid-gap: 12px;
234
+ `
235
+
174
236
  export default {
175
237
  name: "table-dropdown",
176
238
  components: {
@@ -186,6 +248,9 @@ export default {
186
248
  OptionsWrapper,
187
249
  OptionsItem,
188
250
  SearchContainer,
251
+ TemplateButton,
252
+ NoTemplate,
253
+ TemplateLink,
189
254
  },
190
255
  props: {
191
256
  colSpan: {
@@ -247,6 +312,12 @@ export default {
247
312
  block: "center",
248
313
  })
249
314
  },
315
+ onTemplateClick(item) {
316
+ this.$emit("on-template-click", item)
317
+ },
318
+ onSelectedTemplateClick(item) {
319
+ this.$emit("on-selected-template-click", item)
320
+ },
250
321
  onItemClick(item) {
251
322
  this.$emit("item-selected", item)
252
323
  },
@@ -285,5 +356,10 @@ export default {
285
356
  }
286
357
  },
287
358
  },
359
+ mounted() {
360
+ console.log("optionsDisplay", this.optionsDisplay)
361
+ console.log("optionItems", this.optionItems)
362
+ console.log("tableItems", this.tableItems)
363
+ },
288
364
  }
289
365
  </script>