@carbon/vue 2.33.0 → 2.34.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/carbon-vue.common.js +1676 -1457
  3. package/dist/carbon-vue.common.js.map +1 -1
  4. package/dist/carbon-vue.umd.js +1676 -1457
  5. package/dist/carbon-vue.umd.js.map +1 -1
  6. package/dist/carbon-vue.umd.min.js +3 -3
  7. package/dist/carbon-vue.umd.min.js.map +1 -1
  8. package/package.json +4 -4
  9. package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +1 -1
  10. package/src/components/cv-accordion/cv-accordion-item.vue +1 -4
  11. package/src/components/cv-accordion/cv-accordion-skeleton.vue +1 -1
  12. package/src/components/cv-accordion/cv-accordion.vue +1 -1
  13. package/src/components/cv-breadcrumb/_cv-breadcrumb-item-skeleton.vue +1 -1
  14. package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +1 -1
  15. package/src/components/cv-breadcrumb/cv-breadcrumb-skeleton.vue +1 -1
  16. package/src/components/cv-breadcrumb/cv-breadcrumb.vue +1 -1
  17. package/src/components/cv-button/cv-button-set.vue +1 -1
  18. package/src/components/cv-button/cv-button.vue +1 -1
  19. package/src/components/cv-button/cv-icon-button.vue +1 -1
  20. package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +1 -1
  21. package/src/components/cv-checkbox/cv-checkbox.vue +1 -4
  22. package/src/components/cv-code-snippet/_cv-code-snippet-inline.vue +1 -2
  23. package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +1 -2
  24. package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +1 -2
  25. package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +1 -1
  26. package/src/components/cv-combo-box/cv-combo-box.vue +3 -6
  27. package/src/components/cv-content-switcher/cv-content-switcher-button.vue +1 -2
  28. package/src/components/cv-content-switcher/cv-content-switcher.vue +1 -1
  29. package/src/components/cv-data-table/_cv-data-table-row-inner.vue +3 -3
  30. package/src/components/cv-data-table/cv-data-table-action.vue +1 -1
  31. package/src/components/cv-data-table/cv-data-table-heading.vue +1 -2
  32. package/src/components/cv-data-table/cv-data-table-row.vue +2 -3
  33. package/src/components/cv-data-table/cv-data-table-skeleton.vue +2 -2
  34. package/src/components/cv-data-table/cv-data-table.vue +3 -5
  35. package/src/components/cv-date-picker/cv-date-picker.vue +37 -15
  36. package/src/components/cv-date-picker/plugins/appendToPlugin.js +52 -0
  37. package/src/components/cv-date-picker/plugins/fixEventsPlugin.js +75 -0
  38. package/src/components/cv-date-picker/plugins/monthSelectPlugin.js +66 -0
  39. package/src/components/cv-date-picker/plugins/rangePlugin.js +45 -0
  40. package/src/components/cv-dropdown/cv-dropdown-item.vue +1 -1
  41. package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +1 -1
  42. package/src/components/cv-dropdown/cv-dropdown.vue +10 -8
  43. package/src/components/cv-feedback-button/_cv-feedback-button.vue +1 -1
  44. package/src/components/cv-file-uploader/cv-file-uploader-skeleton.vue +1 -1
  45. package/src/components/cv-file-uploader/cv-file-uploader.vue +1 -3
  46. package/src/components/cv-form/cv-form-group.vue +1 -1
  47. package/src/components/cv-form/cv-form-item.vue +1 -1
  48. package/src/components/cv-form/cv-form.vue +1 -1
  49. package/src/components/cv-grid/cv-column.vue +77 -0
  50. package/src/components/cv-grid/cv-grid.vue +32 -0
  51. package/src/components/cv-grid/cv-row.vue +30 -0
  52. package/src/components/cv-grid/index.js +5 -0
  53. package/src/components/cv-inline-loading/cv-inline-loading.vue +1 -1
  54. package/src/components/cv-inline-notification/cv-inline-notification.vue +2 -3
  55. package/src/components/cv-link/cv-link.vue +2 -3
  56. package/src/components/cv-list/cv-list-item.vue +1 -1
  57. package/src/components/cv-list/cv-list.vue +1 -1
  58. package/src/components/cv-loading/cv-loading.vue +1 -1
  59. package/src/components/cv-modal/cv-modal.vue +3 -4
  60. package/src/components/cv-multi-select/cv-multi-select.vue +3 -6
  61. package/src/components/cv-number-input/cv-number-input-skeleton.vue +1 -1
  62. package/src/components/cv-number-input/cv-number-input.vue +3 -6
  63. package/src/components/cv-overflow-menu/cv-overflow-menu-item.vue +1 -1
  64. package/src/components/cv-overflow-menu/cv-overflow-menu.vue +1 -3
  65. package/src/components/cv-pagination/cv-pagination.vue +1 -1
  66. package/src/components/cv-progress/cv-progress-step.vue +1 -1
  67. package/src/components/cv-progress/cv-progress.vue +1 -1
  68. package/src/components/cv-radio-button/cv-radio-button.vue +1 -4
  69. package/src/components/cv-radio-button/cv-radio-group.vue +1 -1
  70. package/src/components/cv-search/cv-search.vue +1 -4
  71. package/src/components/cv-select/cv-select-optgroup.vue +1 -1
  72. package/src/components/cv-select/cv-select-option.vue +1 -1
  73. package/src/components/cv-select/cv-select.vue +3 -6
  74. package/src/components/cv-skeleton-text/cv-skeleton-text.vue +1 -1
  75. package/src/components/cv-slider/cv-slider-skeleton.vue +1 -1
  76. package/src/components/cv-slider/cv-slider.vue +1 -4
  77. package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +1 -4
  78. package/src/components/cv-structured-list/_cv-structured-list-item-standard.vue +1 -1
  79. package/src/components/cv-structured-list/cv-structured-list-data.vue +1 -1
  80. package/src/components/cv-structured-list/cv-structured-list-heading.vue +1 -1
  81. package/src/components/cv-structured-list/cv-structured-list.vue +1 -1
  82. package/src/components/cv-tabs/cv-tab.vue +1 -1
  83. package/src/components/cv-tabs/cv-tabs-skeleton.vue +1 -1
  84. package/src/components/cv-tabs/cv-tabs.vue +1 -1
  85. package/src/components/cv-tag/cv-tag-skeleton.vue +1 -1
  86. package/src/components/cv-tag/cv-tag.vue +1 -2
  87. package/src/components/cv-text-area/cv-text-area.vue +3 -6
  88. package/src/components/cv-text-input/cv-text-input.vue +3 -6
  89. package/src/components/cv-tile/_cv-tile-clickable.vue +2 -4
  90. package/src/components/cv-tile/_cv-tile-expandable.vue +1 -2
  91. package/src/components/cv-tile/_cv-tile-selectable.vue +1 -4
  92. package/src/components/cv-tile/cv-tile.vue +1 -3
  93. package/src/components/cv-time-picker/cv-time-picker.vue +3 -6
  94. package/src/components/cv-toast-notification/cv-toast-notification.vue +3 -4
  95. package/src/components/cv-toggle/cv-toggle-skeleton.vue +1 -2
  96. package/src/components/cv-toggle/cv-toggle.vue +1 -4
  97. package/src/components/cv-toolbar/cv-toolbar-divider.vue +1 -1
  98. package/src/components/cv-toolbar/cv-toolbar-option.vue +1 -1
  99. package/src/components/cv-toolbar/cv-toolbar-search.vue +1 -1
  100. package/src/components/cv-toolbar/cv-toolbar-title.vue +1 -1
  101. package/src/components/cv-toolbar/cv-toolbar.vue +1 -1
  102. package/src/components/cv-tooltip/cv-definition-tooltip.vue +1 -2
  103. package/src/components/cv-tooltip/cv-interactive-tooltip.vue +1 -2
  104. package/src/components/cv-tooltip/cv-tooltip.vue +1 -1
  105. package/src/components/cv-ui-shell/_cv-side-nav-footer.vue +1 -1
  106. package/src/components/cv-ui-shell/_cv-side-nav-link-text.vue +1 -1
  107. package/src/components/cv-ui-shell/cv-content.vue +1 -1
  108. package/src/components/cv-ui-shell/cv-header-global-action.vue +1 -2
  109. package/src/components/cv-ui-shell/cv-header-menu-button.vue +1 -2
  110. package/src/components/cv-ui-shell/cv-header-menu-item.vue +2 -3
  111. package/src/components/cv-ui-shell/cv-header-menu.vue +1 -1
  112. package/src/components/cv-ui-shell/cv-header-name.vue +2 -3
  113. package/src/components/cv-ui-shell/cv-header-nav.vue +1 -1
  114. package/src/components/cv-ui-shell/cv-header-panel.vue +2 -2
  115. package/src/components/cv-ui-shell/cv-header-side-nav-items.vue +1 -1
  116. package/src/components/cv-ui-shell/cv-header.vue +3 -3
  117. package/src/components/cv-ui-shell/cv-side-nav-icon.vue +1 -1
  118. package/src/components/cv-ui-shell/cv-side-nav-items.vue +1 -1
  119. package/src/components/cv-ui-shell/cv-side-nav-link.vue +3 -4
  120. package/src/components/cv-ui-shell/cv-side-nav-menu-item.vue +2 -3
  121. package/src/components/cv-ui-shell/cv-side-nav-menu.vue +3 -3
  122. package/src/components/cv-ui-shell/cv-side-nav.vue +2 -2
  123. package/src/components/cv-ui-shell/cv-skip-to-content.vue +2 -3
  124. package/src/components/cv-ui-shell/cv-switcher-item-link.vue +2 -3
  125. package/src/components/cv-ui-shell/cv-switcher-item.vue +1 -1
  126. package/src/components/cv-ui-shell/cv-switcher.vue +1 -1
  127. package/src/index.js +2 -0
  128. package/src/mixins/index.js +12 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/vue",
3
3
  "description": "A collection of components for the Carbon Design System built using Vue.js",
4
- "version": "2.33.0",
4
+ "version": "2.34.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -66,12 +66,12 @@
66
66
  "@carbon/icons-vue": "10.10.2",
67
67
  "carbon-components": "10.16.0",
68
68
  "flatpickr": "4.6.3",
69
- "vue": "^2.6.11"
69
+ "vue": "^2.6.12"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@vue/cli-service": "^3.11.0",
73
73
  "eslint-plugin-prettier": "^3.1.1",
74
- "vue-template-compiler": "^2.6.10"
74
+ "vue-template-compiler": "^2.6.12"
75
75
  },
76
- "gitHead": "3bd9728ebf1676a3193c76794aed1ba41c4d8be0"
76
+ "gitHead": "5dda51139702bbd900e288e818c948a8bc530729"
77
77
  }
@@ -13,7 +13,7 @@
13
13
  <script>
14
14
  import CvSkeletonText from '../cv-skeleton-text/cv-skeleton-text';
15
15
  import ChevronRight16 from '@carbon/icons-vue/es/chevron--right/16';
16
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
16
+ import { carbonPrefixMixin } from '../../mixins';
17
17
 
18
18
  export default {
19
19
  name: 'CvAccordionItemSkeleton',
@@ -39,10 +39,7 @@
39
39
 
40
40
  <script>
41
41
  import ChevronRight16 from '@carbon/icons-vue/es/chevron--right/16';
42
- import uidMixin from '../../mixins/uid-mixin';
43
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
44
- import methodsMixin from '../../mixins/methods-mixin';
45
-
42
+ import { uidMixin, carbonPrefixMixin, methodsMixin } from '../../mixins';
46
43
  export default {
47
44
  name: 'CvAccordionItem',
48
45
  mixins: [uidMixin, carbonPrefixMixin, methodsMixin({ button: ['blur', 'focus'] })],
@@ -14,7 +14,7 @@
14
14
  <script>
15
15
  import CvSkeletonText from '../cv-skeleton-text/cv-skeleton-text';
16
16
  import CvAccordionItemSkeleton from './_cv-accordion-item-skeleton';
17
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
17
+ import { carbonPrefixMixin } from '../../mixins';
18
18
 
19
19
  export default {
20
20
  name: 'CvAccordionSkeleton',
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
+ import { carbonPrefixMixin } from '../../mixins';
9
9
 
10
10
  export default {
11
11
  name: 'CvAccordion',
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
+ import { carbonPrefixMixin } from '../../mixins';
9
9
  export default {
10
10
  name: 'CvBreadcrumbItemSkeleton',
11
11
  mixins: [carbonPrefixMixin],
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
 
13
13
  <script>
14
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
14
+ import { carbonPrefixMixin } from '../../mixins';
15
15
  export default {
16
16
  name: 'CvBreadcrumbItem',
17
17
  mixins: [carbonPrefixMixin],
@@ -8,7 +8,7 @@
8
8
 
9
9
  <script>
10
10
  import CvBreadcrumbItemSkeleton from './_cv-breadcrumb-item-skeleton';
11
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
11
+ import { carbonPrefixMixin } from '../../mixins';
12
12
 
13
13
  export default {
14
14
  name: 'CvBreadcrumbSkeleton',
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
 
11
11
  <script>
12
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
12
+ import { carbonPrefixMixin } from '../../mixins';
13
13
  export default {
14
14
  name: 'CvBreadcrumb',
15
15
  mixins: [carbonPrefixMixin],
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
+ import { carbonPrefixMixin } from '../../mixins';
9
9
 
10
10
  export default {
11
11
  name: 'CvButtonSet',
@@ -8,7 +8,7 @@
8
8
 
9
9
  <script>
10
10
  import buttonMixin from './button-mixin';
11
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
11
+ import { carbonPrefixMixin } from '../../mixins';
12
12
  import CvSvg from '../cv-svg/_cv-svg';
13
13
 
14
14
  export default {
@@ -19,7 +19,7 @@
19
19
 
20
20
  <script>
21
21
  import buttonMixin from './button-mixin';
22
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
22
+ import { carbonPrefixMixin } from '../../mixins';
23
23
  import CvSvg from '../cv-svg/_cv-svg';
24
24
 
25
25
  export default {
@@ -7,7 +7,7 @@
7
7
  </template>
8
8
 
9
9
  <script>
10
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
10
+ import { carbonPrefixMixin } from '../../mixins';
11
11
  export default {
12
12
  name: 'CvCheckboxSkeleton',
13
13
  mixins: [carbonPrefixMixin],
@@ -33,10 +33,7 @@
33
33
  </template>
34
34
 
35
35
  <script>
36
- import checkMixin from '../../mixins/check-mixin';
37
- import uidMixin from '../../mixins/uid-mixin';
38
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
39
- import methodsMixin from '../../mixins/methods-mixin';
36
+ import { checkMixin, uidMixin, carbonPrefixMixin, methodsMixin } from '../../mixins';
40
37
 
41
38
  export default {
42
39
  name: 'CvCheckbox',
@@ -17,8 +17,7 @@
17
17
 
18
18
  <script>
19
19
  import CvFeedbackButton from '../cv-feedback-button/_cv-feedback-button';
20
- import themeMixin from '../../mixins/theme-mixin';
21
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
20
+ import { themeMixin, carbonPrefixMixin } from '../../mixins';
22
21
 
23
22
  export default {
24
23
  name: 'CvCodeSnippetInline',
@@ -36,8 +36,7 @@ import CvButton from '../cv-button/cv-button';
36
36
 
37
37
  import Copy16 from '@carbon/icons-vue/es/copy/16';
38
38
  import ChevronDown16 from '@carbon/icons-vue/es/chevron--down/16';
39
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
40
- import themeMixin from '../../mixins/theme-mixin';
39
+ import { carbonPrefixMixin, themeMixin } from '../../mixins';
41
40
 
42
41
  export default {
43
42
  name: 'CvCodeSnippetMultiline',
@@ -19,8 +19,7 @@
19
19
  </template>
20
20
 
21
21
  <script>
22
- import themeMixin from '../../mixins/theme-mixin';
23
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
22
+ import { themeMixin, carbonPrefixMixin } from '../../mixins';
24
23
  import CvFeedbackButton from '../cv-feedback-button/_cv-feedback-button';
25
24
  import Copy16 from '@carbon/icons-vue/es/copy/16';
26
25
 
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
 
15
15
  <script>
16
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
16
+ import { carbonPrefixMixin } from '../../mixins';
17
17
 
18
18
  export default {
19
19
  name: 'CvCodeSnippetSkeleton',
@@ -113,13 +113,10 @@
113
113
  </template>
114
114
 
115
115
  <script>
116
- import themeMixin from '../../mixins/theme-mixin';
116
+ import { themeMixin, uidMixin, carbonPrefixMixin, methodsMixin } from '../../mixins';
117
117
  import WarningFilled16 from '@carbon/icons-vue/es/warning--filled/16';
118
118
  import ChevronDown16 from '@carbon/icons-vue/es/chevron--down/16';
119
119
  import Close16 from '@carbon/icons-vue/es/close/16';
120
- import uidMixin from '../../mixins/uid-mixin';
121
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
122
- import methodsMixin from '../../mixins/methods-mixin';
123
120
 
124
121
  export default {
125
122
  name: 'CvComboBox',
@@ -189,7 +186,7 @@ export default {
189
186
  this.highlighted = this.value ? this.value : this.highlight; // override highlight with value if provided
190
187
  this.checkSlots();
191
188
  },
192
- beforeUpdate() {
189
+ updated() {
193
190
  this.checkSlots();
194
191
  },
195
192
  computed: {
@@ -225,7 +222,7 @@ export default {
225
222
  },
226
223
  methods: {
227
224
  checkSlots() {
228
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
225
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
229
226
  this.isInvalid = !!(this.$slots['invalid-message'] || (this.invalidMessage && this.invalidMessage.length));
230
227
  this.isHelper = !!(this.$slots['helper-text'] || (this.helperText && this.helperText.length));
231
228
  },
@@ -34,9 +34,8 @@
34
34
  </template>
35
35
 
36
36
  <script>
37
- import uidMixin from '../../mixins/uid-mixin';
37
+ import { uidMixin, carbonPrefixMixin } from '../../mixins';
38
38
  import CvSvg from '../cv-svg/_cv-svg';
39
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
40
39
 
41
40
  export default {
42
41
  name: 'CvContentSwitcherButton',
@@ -6,7 +6,7 @@
6
6
 
7
7
  <script>
8
8
  import store from './cv-content-switcher-store';
9
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
9
+ import { carbonPrefixMixin } from '../../mixins';
10
10
 
11
11
  const toggleContent = (selector, on) => {
12
12
  // hide content
@@ -54,7 +54,7 @@ import CvCheckbox from '../cv-checkbox/cv-checkbox';
54
54
  import CvOverflowMenu from '../cv-overflow-menu/cv-overflow-menu';
55
55
  import CvOverflowMenuItem from '../cv-overflow-menu/cv-overflow-menu-item';
56
56
  import ChevronRight16 from '@carbon/icons-vue/es/chevron--right/16';
57
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
57
+ import { carbonPrefixMixin } from '../../mixins';
58
58
 
59
59
  export default {
60
60
  name: 'CvDataTableRowInner',
@@ -86,7 +86,7 @@ export default {
86
86
  mounted() {
87
87
  this.checkSlots();
88
88
  },
89
- beforeUpdate() {
89
+ updated() {
90
90
  this.checkSlots();
91
91
  },
92
92
  watch: {
@@ -121,7 +121,7 @@ export default {
121
121
  },
122
122
  methods: {
123
123
  checkSlots() {
124
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
124
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
125
125
  this.hasOverflowMenu = !!((this.overflowMenu && this.overflowMenu.length) || this.$slots['overflow-menu']);
126
126
  },
127
127
  onChange() {
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
8
+ import { carbonPrefixMixin } from '../../mixins';
9
9
  export default {
10
10
  name: 'cv-data-table-action',
11
11
  mixins: [carbonPrefixMixin],
@@ -30,8 +30,7 @@
30
30
  import ArrowDown16 from '@carbon/icons-vue/es/arrow--down/16';
31
31
  import Arrows16 from '@carbon/icons-vue/es/arrows/16';
32
32
  import CvWrapper from '../cv-wrapper/_cv-wrapper';
33
- import uidMixin from '../../mixins/uid-mixin';
34
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
33
+ import { uidMixin, carbonPrefixMixin } from '../../mixins';
35
34
 
36
35
  const nextOrder = {
37
36
  ascending: 'descending',
@@ -30,8 +30,7 @@
30
30
 
31
31
  <script>
32
32
  import CvDataTableRowInner from './_cv-data-table-row-inner';
33
- import uidMixin from '../../mixins/uid-mixin';
34
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
33
+ import { uidMixin, carbonPrefixMixin } from '../../mixins';
35
34
 
36
35
  export default {
37
36
  name: 'CvDataTableRow',
@@ -55,7 +54,7 @@ export default {
55
54
  },
56
55
  },
57
56
  mounted() {
58
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
57
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
59
58
  this.dataExpandable = !!this.$slots.expandedContent;
60
59
  this.$parent.$emit('cv:mounted', this);
61
60
  },
@@ -42,7 +42,7 @@ export default {
42
42
  mounted() {
43
43
  this.checkSlots();
44
44
  },
45
- beforeUpdate() {
45
+ updated() {
46
46
  this.checkSlots();
47
47
  },
48
48
  computed: {
@@ -55,7 +55,7 @@ export default {
55
55
  },
56
56
  methods: {
57
57
  checkSlots() {
58
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
58
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
59
59
  this.hasBatchActions = !!this.$slots['batch-actions'];
60
60
  this.hasHelperText = !!this.$slots['helper-text'];
61
61
  this.hasActions = !!this.$slots['actions'];
@@ -187,12 +187,10 @@ import CvButton from '../cv-button/cv-button';
187
187
  import CvCheckbox from '../cv-checkbox/cv-checkbox';
188
188
  import CvPagination from '../cv-pagination/cv-pagination';
189
189
  import CvWrapper from '../cv-wrapper/_cv-wrapper';
190
- import uidMixin from '../../mixins/uid-mixin';
190
+ import { uidMixin, carbonPrefixMixin } from '../../mixins';
191
191
  import Search16 from '@carbon/icons-vue/es/search/16';
192
192
  import Close16 from '@carbon/icons-vue/es/close/16';
193
193
  import ChevronRight16 from '@carbon/icons-vue/es/chevron--right/16';
194
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
195
-
196
194
  export default {
197
195
  name: 'CvDataTable',
198
196
  components: {
@@ -276,7 +274,7 @@ export default {
276
274
  this.updateRowsSelected();
277
275
  this.checkSlots();
278
276
  },
279
- beforeUpdate() {
277
+ updated() {
280
278
  this.checkSlots();
281
279
  },
282
280
  computed: {
@@ -341,7 +339,7 @@ export default {
341
339
  },
342
340
  methods: {
343
341
  checkSlots() {
344
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
342
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
345
343
  this.hasBatchActions = !!this.$slots['batch-actions'];
346
344
  this.hasActions = !!this.$slots.actions;
347
345
  this.hasToolbar = !!(this.$slots.actions || this.$listeners.search || this.$slots['batch-actions']);
@@ -12,7 +12,7 @@
12
12
  },
13
13
  ]"
14
14
  ref="date-picker"
15
- :id="formItem ? '' : uid"
15
+ :id="formItem ? undefined : uid"
16
16
  >
17
17
  <div
18
18
  :class="{
@@ -72,12 +72,14 @@
72
72
  <script>
73
73
  import Flatpickr from 'flatpickr';
74
74
  import l10n from 'flatpickr/dist/l10n/index';
75
- import RangePlugin from 'flatpickr/dist/plugins/rangePlugin';
76
- import uidMixin from '../../mixins/uid-mixin';
77
- import themeMixin from '../../mixins/theme-mixin';
75
+ // import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin';
76
+ import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin';
77
+ import carbonFlatpickrRangePlugin from './plugins/rangePlugin';
78
+ import carbonFlatpickrMonthSelectPlugin from './plugins/monthSelectPlugin';
79
+
80
+ import { uidMixin, themeMixin, carbonPrefixMixin } from '../../mixins';
78
81
  import Calendar16 from '@carbon/icons-vue/es/calendar/16';
79
82
  import CvWrapper from '../cv-wrapper/_cv-wrapper';
80
- import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
81
83
 
82
84
  // Weekdays shorthand for english locale
83
85
  l10n.en.weekdays.shorthand.forEach((day, index) => {
@@ -133,7 +135,7 @@ export default {
133
135
  },
134
136
  },
135
137
  invalidMessage: { type: String, default: undefined },
136
- value: [String, Object, Array],
138
+ value: [String, Object, Array, Date],
137
139
  },
138
140
  model: {
139
141
  prop: 'value',
@@ -199,7 +201,7 @@ export default {
199
201
  },
200
202
  methods: {
201
203
  checkSlots() {
202
- // NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
204
+ // NOTE: this.$slots is not reactive so needs to be managed on updated
203
205
  this.isInvalid = !!(
204
206
  this.$slots['invalid-message'] ||
205
207
  (this.invalidMessage && this.invalidMessage.length) ||
@@ -230,13 +232,33 @@ export default {
230
232
  }
231
233
  // _options.onValueUpdate = this.onChange;
232
234
 
233
- if (this.isRange) {
234
- // let curDate = new Date();
235
- // let anotherDate = new Date();
236
- // anotherDate = anotherDate.setDate(anotherDate.getDate() + 6);
237
- // _options.defaultDate = [curDate, anotherDate];
238
- _options.plugins = [new RangePlugin({ input: this.$refs.todate, position: 'left' })];
239
- }
235
+ _options.plugins = [
236
+ this.isRange
237
+ ? new carbonFlatpickrRangePlugin({
238
+ input: this.$refs.todate,
239
+ })
240
+ : () => {},
241
+ carbonFlatpickrMonthSelectPlugin({
242
+ selectorFlatpickrMonthYearContainer: '.flatpickr-current-month',
243
+ selectorFlatpickrYearContainer: '.numInputWrapper',
244
+ selectorFlatpickrCurrentMonth: '.cur-month',
245
+ classFlatpickrCurrentMonth: 'cur-month',
246
+ }),
247
+ carbonFlatpickrFixEventsPlugin({
248
+ inputFrom: this.$refs.date,
249
+ inputTo: this.$refs.todate,
250
+ }),
251
+ ];
252
+ _options.nextArrow = `
253
+ <svg width="16px" height="16px" viewBox="0 0 16 16">
254
+ <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
255
+ <rect width="16" height="16" style="fill:none" />
256
+ </svg>`;
257
+ _options.prevArrow = `
258
+ <svg width="16px" height="16px" viewBox="0 0 16 16">
259
+ <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
260
+ <rect width="16" height="16" style="fill:none" />
261
+ </svg>`;
240
262
 
241
263
  return _options;
242
264
  },
@@ -327,7 +349,7 @@ export default {
327
349
  // this.cal.setDate([curDate, anotherDate], true);
328
350
  // }, 2000);
329
351
  },
330
- beforeUpdate() {
352
+ updated() {
331
353
  this.checkSlots();
332
354
  },
333
355
  beforeDestroy() {
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2019
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * COPIED FROM carbon-components-react
12
+ */
13
+
14
+ /**
15
+ * @param {object} config Plugin configuration.
16
+ * @returns {Plugin} A Flatpickr plugin to put adjust the position of calendar dropdown.
17
+ */
18
+ export default config => fp => {
19
+ /**
20
+ * Adjusts the floating meun position after Flatpicker sets it.
21
+ */
22
+ const handlePreCalendarPosition = () => {
23
+ Promise.resolve().then(() => {
24
+ const { calendarContainer, config: fpConfig, _positionElement: positionElement } = fp;
25
+ const { appendTo } = fpConfig;
26
+ const { left: containerLeft, top: containerTop } = appendTo.getBoundingClientRect();
27
+ const { left: refLeft, bottom: refBottom } = positionElement.getBoundingClientRect();
28
+ if (
29
+ (appendTo !== appendTo.ownerDocument.body || containerLeft !== 0 || containerTop !== 0) &&
30
+ appendTo.ownerDocument.defaultView.getComputedStyle(appendTo).getPropertyValue('position') === 'static'
31
+ ) {
32
+ throw new Error('Floating menu container must not have `position:static`.');
33
+ }
34
+ // `2` for negative mergin on calendar dropdown
35
+ calendarContainer.style.top = `${refBottom - containerTop + 2}px`;
36
+ calendarContainer.style.left = `${refLeft - containerLeft}px`;
37
+ });
38
+ };
39
+
40
+ /**
41
+ * Registers this Flatpickr plugin.
42
+ */
43
+ const register = () => {
44
+ fp.loadedPlugins.push('carbonFlatpickrAppendToPlugin');
45
+ };
46
+
47
+ return {
48
+ appendTo: config.appendTo,
49
+ onReady: register,
50
+ onPreCalendarPosition: handlePreCalendarPosition,
51
+ };
52
+ };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2018
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /*
9
+ * COPIED FROM carbon-components-react - amended to remove keyboard code dependency
10
+ */
11
+
12
+ /**
13
+ * @param {object} config Plugin configuration.
14
+ * @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
15
+ */
16
+ export default config => fp => {
17
+ /**
18
+ * Handles `keydown` event.
19
+ */
20
+ const handleKeydown = event => {
21
+ const { inputFrom, inputTo } = config;
22
+ const { target } = event;
23
+ if (inputFrom === target || inputTo === target) {
24
+ if (event.key === 'Enter') {
25
+ // Makes sure the hitting enter key picks up pending values of both `<input>`
26
+ // Workaround for: https://github.com/flatpickr/flatpickr/issues/1942
27
+ fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
28
+ event.stopPropagation();
29
+ } else if (event.key === 'Left' || event.key === 'Right') {
30
+ // Prevents Flatpickr code from canceling the event if left/right arrow keys are hit on `<input>`,
31
+ // so user can move the keyboard cursor for editing dates
32
+ // Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
33
+ event.stopPropagation();
34
+ } else if (event.key === 'Down') {
35
+ event.preventDefault();
36
+ fp.open();
37
+ }
38
+ }
39
+ };
40
+
41
+ /**
42
+ * Releases event listeners used in this Flatpickr plugin.
43
+ */
44
+ const release = () => {
45
+ const { inputFrom, inputTo } = config;
46
+ if (inputTo) {
47
+ inputTo.removeEventListener('keydown', handleKeydown, true);
48
+ }
49
+ inputFrom.removeEventListener('keydown', handleKeydown, true);
50
+ };
51
+
52
+ /**
53
+ * Sets up event listeners used for this Flatpickr plugin.
54
+ */
55
+ const init = () => {
56
+ release();
57
+ const { inputFrom, inputTo } = config;
58
+ inputFrom.addEventListener('keydown', handleKeydown, true);
59
+ if (inputTo) {
60
+ inputTo.addEventListener('keydown', handleKeydown, true);
61
+ }
62
+ };
63
+
64
+ /**
65
+ * Registers this Flatpickr plugin.
66
+ */
67
+ const register = () => {
68
+ fp.loadedPlugins.push('carbonFlatpickrFixEventsPlugin');
69
+ };
70
+
71
+ return {
72
+ onReady: [register, init],
73
+ onDestroy: [release],
74
+ };
75
+ };