@eturnity/eturnity_reusable_components 7.12.7-EPDM-10335.0 → 7.12.7-EPDM-10528.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.
Files changed (52) hide show
  1. package/.storybook/preview.js +1 -1
  2. package/package.json +23 -19
  3. package/src/App.vue +2 -2
  4. package/src/assets/svgIcons/house_3d-1.svg +8 -0
  5. package/src/assets/svgIcons/house_3d.svg +8 -0
  6. package/src/components/addNewButton/index.vue +3 -5
  7. package/src/components/buttons/buttonIcon/index.vue +1 -1
  8. package/src/components/buttons/closeButton/index.vue +1 -1
  9. package/src/components/buttons/mainButton/index.vue +8 -7
  10. package/src/components/deleteIcon/DeleteIcon.stories.js +7 -7
  11. package/src/components/deleteIcon/index.vue +21 -25
  12. package/src/components/draggableInputHandle/index.vue +25 -24
  13. package/src/components/dropdown/index.vue +110 -129
  14. package/src/components/errorMessage/index.vue +5 -10
  15. package/src/components/filter/filterSettings.vue +97 -58
  16. package/src/components/filter/index.vue +3 -3
  17. package/src/components/filter/parentDropdown.vue +2 -2
  18. package/src/components/icon/iconCollection.vue +2 -2
  19. package/src/components/icon/index.vue +70 -67
  20. package/src/components/iconWrapper/index.vue +4 -1
  21. package/src/components/infoCard/index.vue +3 -2
  22. package/src/components/infoText/index.vue +1 -1
  23. package/src/components/inputs/checkbox/index.vue +6 -21
  24. package/src/components/inputs/inputNumber/index.vue +11 -8
  25. package/src/components/inputs/inputNumberQuestion/index.vue +1 -1
  26. package/src/components/inputs/inputText/index.vue +3 -3
  27. package/src/components/inputs/radioButton/index.vue +1 -1
  28. package/src/components/inputs/searchInput/index.vue +11 -28
  29. package/src/components/inputs/select/index.vue +67 -195
  30. package/src/components/inputs/select/option/index.vue +11 -36
  31. package/src/components/inputs/slider/index.vue +16 -16
  32. package/src/components/inputs/switchField/index.vue +2 -2
  33. package/src/components/inputs/textAreaInput/index.vue +1 -1
  34. package/src/components/inputs/toggle/index.vue +2 -2
  35. package/src/components/label/index.vue +31 -27
  36. package/src/components/modals/modal/index.vue +6 -2
  37. package/src/components/navigationTabs/index.vue +20 -27
  38. package/src/components/pageSubtitle/index.vue +1 -1
  39. package/src/components/pageTitle/index.vue +4 -4
  40. package/src/components/pagination/index.vue +1 -1
  41. package/src/components/progressBar/index.vue +1 -1
  42. package/src/components/projectMarker/index.vue +9 -16
  43. package/src/components/sideMenu/index.vue +1 -1
  44. package/src/components/spinner/index.vue +11 -7
  45. package/src/components/tableDropdown/index.vue +37 -30
  46. package/src/components/tables/mainTable/exampleNested.vue +1 -1
  47. package/src/components/tables/mainTable/index.vue +9 -10
  48. package/src/components/tables/viewTable/index.vue +2 -2
  49. package/src/components/threeDots/index.vue +1 -1
  50. package/src/components/videoThumbnail/index.vue +100 -95
  51. package/src/main.js +11 -4
  52. package/src/components/icon/iconCache.js +0 -23
@@ -1,4 +1,4 @@
1
- import { ThemeProvider } from "vue3-styled-components"
1
+ import { ThemeProvider } from "vue-styled-components"
2
2
 
3
3
  const theme = {
4
4
  colors: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.12.7-EPDM-10335.0",
3
+ "version": "7.12.7-EPDM-10528.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -10,26 +10,30 @@
10
10
  "build-storybook": "build-storybook"
11
11
  },
12
12
  "dependencies": {
13
- "@storybook/vue3": "7.0.18",
14
- "@vue/compat": "3.3.4",
15
- "@vueform/slider": "2.1.10",
16
- "@vuepic/vue-datepicker": "6.1.0",
17
- "click-outside-vue3": "4.0.1",
13
+ "@vueform/slider": "1.0.5",
18
14
  "html-loader": "0.5.5",
19
- "postcss": "8.4.25",
20
- "vue": "3.3.4",
21
- "vue3-styled-components": "1.2.1",
22
- "vuedraggable": "4.1.0"
15
+ "postcss": "^8.4.25",
16
+ "v-click-outside": "2.1.4",
17
+ "vue": "2.6.11",
18
+ "vue-styled-components": "1.6.0",
19
+ "vue2-datepicker": "3.11.1",
20
+ "vuedraggable": "2.24.3",
21
+ "core-js": "3.31.1"
23
22
  },
24
23
  "devDependencies": {
25
- "@babel/core": "7.12.16",
26
- "@babel/eslint-parser": "7.12.16",
27
- "@vue/cli-plugin-babel": "5.0.8",
28
- "@vue/cli-plugin-eslint": "5.0.8",
29
- "@vue/cli-service": "5.0.8",
30
- "@vue/compiler-sfc": "3.3.4",
31
- "eslint": "7.32.0",
32
- "eslint-plugin-vue": "8.0.3"
24
+ "@storybook/addon-actions": "6.2.8",
25
+ "@storybook/addon-docs": "6.4.19",
26
+ "@storybook/addon-essentials": "6.2.8",
27
+ "@storybook/addon-links": "6.2.8",
28
+ "@storybook/vue": "6.4.19",
29
+ "@vue/cli-plugin-babel": "~4.5.0",
30
+ "@vue/cli-plugin-eslint": "~4.5.0",
31
+ "@vue/cli-service": "~4.5.0",
32
+ "@vue/composition-api": "1.0.0-rc.10",
33
+ "babel-eslint": "10.1.0",
34
+ "eslint": "6.7.2",
35
+ "eslint-plugin-vue": "6.2.2",
36
+ "vue-template-compiler": "2.6.11"
33
37
  },
34
38
  "eslintConfig": {
35
39
  "root": true,
@@ -41,7 +45,7 @@
41
45
  "eslint:recommended"
42
46
  ],
43
47
  "parserOptions": {
44
- "parser": "@babel/eslint-parser"
48
+ "parser": "babel-eslint"
45
49
  },
46
50
  "rules": {}
47
51
  },
package/src/App.vue CHANGED
@@ -55,9 +55,9 @@
55
55
  </template>
56
56
 
57
57
  <script>
58
- import { ThemeProvider } from 'vue3-styled-components'
58
+ import { ThemeProvider } from 'vue-styled-components'
59
59
  import theme from './assets/theme'
60
- import styled from 'vue3-styled-components'
60
+ import styled from 'vue-styled-components'
61
61
  import InputNumber from '@/components/inputs/inputNumber'
62
62
 
63
63
  const PageContainer = styled.div`
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">
2
+ <mask id="path-1-inside-1_57915_53334" fill="white">
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4.0303 2.75757L0 5.30302V11.2424L3.41022 12.4091V8.96996L4.53143 9.41845V12.7926L8.0606 14V8.0606L4.0303 2.75757Z"/>
4
+ </mask>
5
+ <path d="M0 5.30302L-0.694191 4.20389L-1.3 4.5865V5.30302H0ZM4.0303 2.75757L5.06531 1.97096L4.344 1.02187L3.33611 1.65843L4.0303 2.75757ZM0 11.2424H-1.3V12.1716L-0.420794 12.4724L0 11.2424ZM3.41022 12.4091L2.98943 13.6391L4.71022 14.2278V12.4091H3.41022ZM3.41022 8.96996L3.89303 7.76294L2.11022 7.04982V8.96996H3.41022ZM4.53143 9.41845H5.83143V8.5383L5.01424 8.21143L4.53143 9.41845ZM4.53143 12.7926H3.23143V13.7219L4.11064 14.0227L4.53143 12.7926ZM8.0606 14L7.63981 15.23L9.3606 15.8187V14H8.0606ZM8.0606 8.0606H9.3606V7.62266L9.09561 7.27399L8.0606 8.0606ZM0.694191 6.40216L4.72449 3.8567L3.33611 1.65843L-0.694191 4.20389L0.694191 6.40216ZM1.3 11.2424V5.30302H-1.3V11.2424H1.3ZM3.83102 11.1791L0.420794 10.0124L-0.420794 12.4724L2.98943 13.6391L3.83102 11.1791ZM4.71022 12.4091V8.96996H2.11022V12.4091H4.71022ZM2.92741 10.177L4.04862 10.6255L5.01424 8.21143L3.89303 7.76294L2.92741 10.177ZM3.23143 9.41845V12.7926H5.83143V9.41845H3.23143ZM8.48139 12.77L4.95223 11.5626L4.11064 14.0227L7.63981 15.23L8.48139 12.77ZM6.7606 8.0606V14H9.3606V8.0606H6.7606ZM2.99529 3.54418L7.02559 8.8472L9.09561 7.27399L5.06531 1.97096L2.99529 3.54418Z" fill="#0068DE" mask="url(#path-1-inside-1_57915_53334)"/>
6
+ <path d="M8.55859 13.2165V8.37967L13.498 6.08638V10.9232L8.55859 13.2165Z" fill="#0068DE" stroke="#0068DE"/>
7
+ <path d="M8.21608 7.43759L4.80515 2.94953L9.81611 0.623007L13.227 5.11107L8.21608 7.43759Z" fill="#0068DE" stroke="#0068DE"/>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16" fill="none">
2
+ <mask id="path-1-inside-1_57915_3657" fill="white">
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M4.03081 3.71851L0 6.28736V12.2814L3.41065 13.4587V9.98801L4.532 10.4406V13.8458L8.06161 15.0643V9.07028L4.03081 3.71851Z"/>
4
+ </mask>
5
+ <path d="M0 6.28736L-0.698673 5.19107L-1.3 5.5743V6.28736H0ZM4.03081 3.71851L5.06922 2.9364L4.34595 1.9761L3.33213 2.62221L4.03081 3.71851ZM0 12.2814H-1.3V13.2079L-0.424205 13.5102L0 12.2814ZM3.41065 13.4587L2.98645 14.6876L4.71065 15.2828V13.4587H3.41065ZM3.41065 9.98801L3.89722 8.78251L2.11065 8.0614V9.98801H3.41065ZM4.532 10.4406H5.832V9.56343L5.01858 9.23511L4.532 10.4406ZM4.532 13.8458H3.232V14.7723L4.1078 15.0747L4.532 13.8458ZM8.06161 15.0643L7.63741 16.2931L9.36161 16.8883V15.0643H8.06161ZM8.06161 9.07028H9.36161V8.63549L9.10003 8.28818L8.06161 9.07028ZM0.698673 7.38365L4.72948 4.8148L3.33213 2.62221L-0.698673 5.19107L0.698673 7.38365ZM1.3 12.2814V6.28736H-1.3V12.2814H1.3ZM3.83485 12.2299L0.424205 11.0525L-0.424205 13.5102L2.98645 14.6876L3.83485 12.2299ZM4.71065 13.4587V9.98801H2.11065V13.4587H4.71065ZM2.92408 11.1935L4.04543 11.6461L5.01858 9.23511L3.89722 8.78251L2.92408 11.1935ZM3.232 10.4406V13.8458H5.832V10.4406H3.232ZM8.48582 13.8354L4.95621 12.617L4.1078 15.0747L7.63741 16.2931L8.48582 13.8354ZM6.76161 9.07028V15.0643H9.36161V9.07028H6.76161ZM2.99239 4.50061L7.0232 9.85239L9.10003 8.28818L5.06922 2.9364L2.99239 4.50061Z" fill="white" mask="url(#path-1-inside-1_57915_3657)"/>
6
+ <path d="M8.5625 14.2779V9.38818L13.5026 7.07375V11.9634L8.5625 14.2779Z" fill="white" stroke="white"/>
7
+ <path d="M8.21735 8.44534L4.80134 3.90984L9.81609 1.56045L13.2321 6.09596L8.21735 8.44534Z" fill="white" stroke="white"/>
8
+ </svg>
@@ -1,15 +1,14 @@
1
1
  <template>
2
2
  <page-container :shouldPosition="shouldPosition">
3
3
  <button-container :data-id="dataId">
4
- <PlusButtonSvg />
4
+ <plus-button :src="require('../../assets/icons/plus_button.svg')" />
5
5
  </button-container>
6
6
  </page-container>
7
7
  </template>
8
8
 
9
9
  <script>
10
10
  // import AddNewButton from "@eturnity/eturnity_reusable_components/src/components/addNewButton"
11
- import styled from 'vue3-styled-components'
12
- import PlusButtonSvg from '../../assets/icons/plus_button.svg'
11
+ import styled from 'vue-styled-components'
13
12
 
14
13
  const pageAttrs = { shouldPosition: Boolean }
15
14
  const PageContainer = styled('div', pageAttrs)`
@@ -47,8 +46,7 @@ export default {
47
46
  components: {
48
47
  PageContainer,
49
48
  ButtonContainer,
50
- PlusButton,
51
- PlusButtonSvg
49
+ PlusButton
52
50
  },
53
51
  props: {
54
52
  shouldPosition: {
@@ -32,7 +32,7 @@
32
32
  // />
33
33
 
34
34
  import Icon from "../../icon"
35
- import styled from "vue3-styled-components"
35
+ import styled from "vue-styled-components"
36
36
  import Theme from "@/assets/theme";
37
37
 
38
38
  const PageContainer = styled.div``
@@ -13,7 +13,7 @@
13
13
  // <close-button
14
14
  // color="#fff"
15
15
  // />
16
- import styled from 'vue3-styled-components'
16
+ import styled from 'vue-styled-components'
17
17
 
18
18
  const Container = styled.div`
19
19
  position: relative;
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <page-container>
3
3
  <button-container
4
- :id="id"
5
4
  :type="type"
6
5
  :minWidth="minWidth"
7
6
  :isDisabled="isDisabled"
8
7
  :customColor="customColor"
9
8
  :noWrap="noWrap"
10
9
  :data-id="dataId"
10
+ :fontColor="fontColor"
11
11
  >
12
12
  {{ text }}
13
13
  </button-container>
@@ -26,7 +26,7 @@
26
26
  // :data-id="test_data_id"
27
27
  // />
28
28
 
29
- import styled from 'vue3-styled-components'
29
+ import styled from 'vue-styled-components'
30
30
 
31
31
  const PageContainer = styled.div``
32
32
 
@@ -35,12 +35,14 @@ const ButtonAttrs = {
35
35
  isDisabled: Boolean,
36
36
  minWidth: String,
37
37
  customColor: String,
38
+ fontColor: String,
38
39
  noWrap: Boolean
39
40
  }
40
41
  const ButtonContainer = styled('div', ButtonAttrs)`
41
42
  padding: 7px 15px;
42
43
  font-size: 13px;
43
- color: ${(props) => props.theme.colors.white};
44
+ color: ${(props) =>
45
+ props.fontColor ? props.fontColor : props.theme.colors.white};
44
46
  background-color: ${(props) =>
45
47
  props.isDisabled
46
48
  ? props.theme.colors.disabled
@@ -91,6 +93,9 @@ export default {
91
93
  required: false,
92
94
  default: null
93
95
  },
96
+ fontColor: {
97
+ required: false
98
+ },
94
99
  noWrap: {
95
100
  required: false,
96
101
  default: false
@@ -99,10 +104,6 @@ export default {
99
104
  required: false,
100
105
  default: null
101
106
  },
102
- id: {
103
- required: false,
104
- default: null
105
- },
106
107
  dataId: {
107
108
  type: String,
108
109
  default: ''
@@ -1,8 +1,8 @@
1
- import DeleteIcon from './index.vue'
1
+ import DeleteIcon from "./index.vue"
2
2
 
3
3
  export default {
4
- title: 'DeleteIcon',
5
- component: DeleteIcon
4
+ title: "DeleteIcon",
5
+ component: DeleteIcon,
6
6
  // argTypes: {},
7
7
  }
8
8
 
@@ -11,19 +11,19 @@ const Template = (args, { argTypes }) => ({
11
11
  components: { DeleteIcon },
12
12
  // The story's `args` need to be mapped into the template through the `setup()` method
13
13
  props: Object.keys(argTypes),
14
- template: '<delete-icon v-bind="$props" />'
14
+ template: '<delete-icon v-bind="$props" />',
15
15
 
16
16
  // import DeleteIcon from "@eturnity/eturnity_reusable_components/src/components/deleteIcon"
17
17
  // To use:
18
- // <delete-icon color="gray" @click="onDeleteItem(item)" :isDisabled="true" />
18
+ // <delete-icon color="gray" @click.native="onDeleteItem(item)" :isDisabled="true" />
19
19
  })
20
20
 
21
21
  export const Default = Template.bind({})
22
22
  Default.args = {
23
- isDisabled: false
23
+ isDisabled: false,
24
24
  }
25
25
 
26
26
  export const Disabled = Template.bind({})
27
27
  Disabled.args = {
28
- isDisabled: true
28
+ isDisabled: true,
29
29
  }
@@ -4,62 +4,58 @@
4
4
  @mouseleave="isHovered = false"
5
5
  :isDisabled="isDisabled"
6
6
  >
7
- <delete-icon-red v-if="isHovered && !isDisabled" :hoverBg="hoverBg" />
8
- <delete-icon-gray v-else />
7
+ <icon-image
8
+ v-if="isHovered && !isDisabled"
9
+ :hoverBg="hoverBg"
10
+ :src="require('../../assets/icons/delete_icon.svg')"
11
+ />
12
+ <icon-image
13
+ v-else
14
+ :src="require('../../assets/icons/delete_icon_gray.svg')"
15
+ />
9
16
  </wrapper>
10
17
  </template>
11
18
 
12
19
  <script>
13
20
  // To use:
14
- // <delete-icon @click="onDeleteItem(item)" :isDisabled="true" />
15
- import styled from 'vue3-styled-components'
16
- import SvgDelete from '../../assets/icons/delete_icon.svg'
17
- import SvgDeleteGray from '../../assets/icons/delete_icon_gray.svg'
21
+ // <delete-icon @click.native="onDeleteItem(item)" :isDisabled="true" />
22
+ import styled from "vue-styled-components"
18
23
 
19
24
  const wrapperAttrs = { isDisabled: Boolean }
20
- const Wrapper = styled('div', wrapperAttrs)`
25
+ const Wrapper = styled("div", wrapperAttrs)`
21
26
  width: 30px;
22
27
  height: 30px;
23
- cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
28
+ cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
24
29
  `
25
30
 
26
31
  const IconImageAttrs = { hoverBg: String }
27
- const DeleteIconRed = styled(SvgDelete, IconImageAttrs)`
32
+ const IconImage = styled('img', IconImageAttrs)`
28
33
  &:hover {
29
- background-color: ${(props) =>
30
- props.hoverBg ? props.hoverBg : props.theme.colors.grey5};
31
- border-radius: 4px;
32
- }
33
- `
34
-
35
- const DeleteIconGray = styled(SvgDeleteGray, IconImageAttrs)`
36
- &:hover {
37
- background-color: ${(props) => props.theme.colors.grey5};
34
+ background-color: ${(props) => props.hoverBg ? props.hoverBg : props.theme.colors.grey5};
38
35
  border-radius: 4px;
39
36
  }
40
37
  `
41
38
 
42
39
  export default {
43
- name: 'delete-icon',
40
+ name: "delete-icon",
44
41
  components: {
45
42
  Wrapper,
46
- DeleteIconRed,
47
- DeleteIconGray
43
+ IconImage,
48
44
  },
49
45
  props: {
50
46
  isDisabled: {
51
47
  required: false,
52
- default: false
48
+ default: false,
53
49
  },
54
50
  hoverBg: {
55
51
  required: false,
56
- default: ''
52
+ default: '',
57
53
  }
58
54
  },
59
55
  data() {
60
56
  return {
61
- isHovered: false
57
+ isHovered: false,
62
58
  }
63
- }
59
+ },
64
60
  }
65
61
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Handle :height="height" class="handle">
2
+ <Handle :height = "height" class="handle">
3
3
  <Dot></Dot>
4
4
  <Dot></Dot>
5
5
  <Dot></Dot>
@@ -7,34 +7,35 @@
7
7
  </template>
8
8
 
9
9
  <script>
10
- import styled from 'vue3-styled-components'
11
10
 
12
- const Handle = styled('div', { height: String })`
13
- position: absolute;
14
- left: 0;
15
- margin-right: 10px;
16
- display: flex;
17
- align-items: stretch;
18
- flex-direction: column;
19
- justify-content: center;
20
- width: 14px;
21
- height: ${(props) => props.height};
22
- padding: 0 5px;
23
- background-color: #f3f3f7;
24
- cursor: pointer;
25
- align-items: center;
26
- `
11
+ import styled from 'vue-styled-components'
12
+
13
+ const Handle = styled('div',{ height : String })`
14
+ position:absolute;
15
+ left:0;
16
+ margin-right:10px;
17
+ display: flex;
18
+ align-items: stretch;
19
+ flex-direction: column;
20
+ justify-content: center;
21
+ width: 14px;
22
+ height:${props=> props.height};
23
+ padding: 0 5px;
24
+ background-color: #f3f3f7;
25
+ cursor: pointer;
26
+ align-items: center;
27
+ `
27
28
  const Dot = styled.div`
28
- display: inline-block;
29
- width: 4px;
30
- height: 4px;
31
- margin: 2px;
32
- background-color: #0068de;
33
- `
29
+ display: inline-block;
30
+ width: 4px;
31
+ height: 4px;
32
+ margin:2px;
33
+ background-color: #0068de;
34
+ `
34
35
 
35
36
  export default {
36
37
  name: 'draggableInputHandle',
37
- props: ['height'],
38
+ props:['height'],
38
39
  components: {
39
40
  Handle,
40
41
  Dot
@@ -1,138 +1,119 @@
1
1
  <template>
2
- <wrapper ref="dropdown" :openingMode="openingMode">
3
- <WrapperButton @click="isOpenByClick = !isOpenByClick">
4
- <slot name="trigger" />
5
- </WrapperButton>
6
- <WrapperDropdown
7
- class="dropdown-content"
8
- :class="{ openDropdown: isOpenByClick && openingMode == 'click' }"
9
- :justify="justify"
10
- :position="position"
11
- :width="width"
12
- :backgroundColor="backgroundColor"
13
- >
14
- <DropdownWindow
15
- :gap="gap"
16
- :backgroundColor="backgroundColor"
17
- :width="width"
18
- >
19
- <slot name="dropdown" />
20
- </DropdownWindow>
21
- </WrapperDropdown>
22
- </wrapper>
23
- </template>
2
+ <wrapper ref="dropdown" :openingMode="openingMode">
3
+ <WrapperButton @click="isOpenByClick=!isOpenByClick">
4
+ <slot name="trigger"/>
5
+ </WrapperButton>
6
+ <WrapperDropdown class="dropdown-content" :class="{openDropdown:isOpenByClick && openingMode=='click'}" :justify="justify" :position="position" :width="width" :backgroundColor="backgroundColor">
7
+ <DropdownWindow :gap="gap" :backgroundColor="backgroundColor" :width="width">
8
+ <slot name="dropdown"/>
9
+ </DropdownWindow>
10
+ </WrapperDropdown>
11
+ </wrapper>
12
+ </template>
13
+
14
+ <script>
15
+ // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
16
+ // How to use:
17
+ //<DropdownComponent
18
+ // width="300px"
19
+ // backgroundColor="red">
24
20
 
25
- <script>
26
- // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
27
- // How to use:
28
- //<DropdownComponent
29
- // width="300px"
30
- // backgroundColor="red">
21
+ // <DropdownComponent/>
22
+
23
+ import styled from 'vue-styled-components'
24
+
25
+ const wrapperAttrs = { width: String, backgroundColor:String,openingMode:String,gap:String,justify:String }
26
+ const Wrapper = styled('div', wrapperAttrs)`
27
+ display: inline-block;
28
+ position: relative;
31
29
 
32
- // <DropdownComponent/>
33
-
34
- import styled from 'vue3-styled-components'
35
-
36
- const wrapperAttrs = {
37
- width: String,
38
- backgroundColor: String,
39
- openingMode: String,
40
- gap: String,
41
- justify: String
42
- }
43
- const Wrapper = styled('div', wrapperAttrs)`
44
- display: inline-block;
45
- position: relative;
46
-
47
- &:hover .dropdown-content {
48
- ${(props) => (props.openingMode == 'hover' ? 'display:block' : '')}
49
- }
50
- & .openDropdown {
51
- ${(props) =>
52
- props.openingMode == 'click' ? 'display:block !important' : ''}
53
- }
54
- `
55
- const WrapperDropdown = styled('div', wrapperAttrs)`
56
- margin-top: 0;
57
- display: none;
58
- position: absolute;
59
- z-index: 1;
60
- ${(props) => (props.justify == 'right' ? 'right:0;' : '')}
61
- `
62
- const DropdownWindow = styled('div', wrapperAttrs)`
63
- width: ${(props) => props.width};
64
- background-color: ${(props) =>
65
- props.theme.colors[props.backgroundColor] || props.backgroundColor};
66
- margin-top: ${(props) => props.gap};
67
- border-radius: 4px;
68
- position: relative;
69
- min-width: 160px;
70
- box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.302);
71
- z-index: 1;
72
- `
73
-
74
- const WrapperButton = styled('div', wrapperAttrs)`
75
- display: inline-block;
76
- `
77
-
78
- export default {
79
- name: 'DropdownComponent',
80
- components: {
81
- WrapperDropdown,
82
- WrapperButton,
83
- Wrapper,
84
- DropdownWindow
85
- },
86
- props: {
87
- width: {
88
- required: false,
89
- default: '300px'
30
+ &:hover .dropdown-content {
31
+ ${props=>props.openingMode=='hover'?"display:block":""}
32
+ }
33
+ & .openDropdown{
34
+ ${props=>props.openingMode=='click'?"display:block !important":""}
35
+ }
36
+ `
37
+ const WrapperDropdown = styled('div', wrapperAttrs)`
38
+ margin-top: 0;
39
+ display: none;
40
+ position: absolute;
41
+ z-index: 1;
42
+ ${(props) => props.justify=="right"?"right:0;":""}
43
+ `
44
+ const DropdownWindow = styled('div', wrapperAttrs)`
45
+ width: ${(props) => props.width};
46
+ background-color: ${(props) => props.theme.colors[props.backgroundColor] || props.backgroundColor};
47
+ margin-top: ${(props) => props.gap};
48
+ border-radius: 4px;
49
+ position: relative;
50
+ min-width: 160px;
51
+ box-shadow: -1px 0px 5px rgba(0, 0, 0, 0.302);
52
+ z-index: 1;
53
+ `
54
+
55
+ const WrapperButton = styled('div', wrapperAttrs)`
56
+ display: inline-block;
57
+ `
58
+
59
+ export default {
60
+ name: 'DropdownComponent',
61
+ components: {
62
+ WrapperDropdown,
63
+ WrapperButton,
64
+ Wrapper,
65
+ DropdownWindow
90
66
  },
91
- gap: {
92
- required: false,
93
- default: '10px'
67
+ props: {
68
+ width: {
69
+ required: false,
70
+ default: '300px'
71
+ },
72
+ gap: {
73
+ required: false,
74
+ default: '10px'
75
+ },
76
+ position: {
77
+ required: false,
78
+ default: 'bottom'
79
+ },
80
+ justify: {
81
+ required: false,
82
+ default: 'left'
83
+ },
84
+ openingMode: {
85
+ required: false,
86
+ default: 'hover'
87
+ },
88
+ backgroundColor: {
89
+ required: false,
90
+ default: 'white'
91
+ }
94
92
  },
95
- position: {
96
- required: false,
97
- default: 'bottom'
93
+ data() {
94
+ return {
95
+ isOpenByClick:false
96
+ }
98
97
  },
99
- justify: {
100
- required: false,
101
- default: 'left'
98
+ methods:{
99
+ clickOutside(event) {
100
+ if (this.openingMode!="click") return
101
+ if (
102
+ this.$refs.dropdown.$el == event.target ||
103
+ this.$refs.dropdown.$el.contains(event.target)
104
+ ) {
105
+ return
106
+ } else {
107
+ this.isOpenByClick=false
108
+ }
109
+ },
102
110
  },
103
- openingMode: {
104
- required: false,
105
- default: 'hover'
111
+ mounted() {
112
+ document.addEventListener('click', this.clickOutside)
113
+ },
114
+ beforeDestroy() {
115
+ document.removeEventListener('click', this.clickOutside)
106
116
  },
107
- backgroundColor: {
108
- required: false,
109
- default: 'white'
110
- }
111
- },
112
- data() {
113
- return {
114
- isOpenByClick: false
115
- }
116
- },
117
- methods: {
118
- clickOutside(event) {
119
- if (this.openingMode != 'click') return
120
- if (
121
- this.$refs.dropdown &&
122
- (this.$refs.dropdown.$el == event.target ||
123
- this.$refs.dropdown.$el.contains(event.target))
124
- ) {
125
- return
126
- } else {
127
- this.isOpenByClick = false
128
- }
129
- }
130
- },
131
- mounted() {
132
- document.addEventListener('click', this.clickOutside)
133
- },
134
- beforeDestroy() {
135
- document.removeEventListener('click', this.clickOutside)
136
117
  }
137
- }
138
- </script>
118
+ </script>
119
+