@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.
- package/CHANGELOG.md +25 -0
- package/dist/carbon-vue.common.js +1676 -1457
- package/dist/carbon-vue.common.js.map +1 -1
- package/dist/carbon-vue.umd.js +1676 -1457
- package/dist/carbon-vue.umd.js.map +1 -1
- package/dist/carbon-vue.umd.min.js +3 -3
- package/dist/carbon-vue.umd.min.js.map +1 -1
- package/package.json +4 -4
- package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +1 -1
- package/src/components/cv-accordion/cv-accordion-item.vue +1 -4
- package/src/components/cv-accordion/cv-accordion-skeleton.vue +1 -1
- package/src/components/cv-accordion/cv-accordion.vue +1 -1
- package/src/components/cv-breadcrumb/_cv-breadcrumb-item-skeleton.vue +1 -1
- package/src/components/cv-breadcrumb/cv-breadcrumb-item.vue +1 -1
- package/src/components/cv-breadcrumb/cv-breadcrumb-skeleton.vue +1 -1
- package/src/components/cv-breadcrumb/cv-breadcrumb.vue +1 -1
- package/src/components/cv-button/cv-button-set.vue +1 -1
- package/src/components/cv-button/cv-button.vue +1 -1
- package/src/components/cv-button/cv-icon-button.vue +1 -1
- package/src/components/cv-checkbox/cv-checkbox-skeleton.vue +1 -1
- package/src/components/cv-checkbox/cv-checkbox.vue +1 -4
- package/src/components/cv-code-snippet/_cv-code-snippet-inline.vue +1 -2
- package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +1 -2
- package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +1 -2
- package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +1 -1
- package/src/components/cv-combo-box/cv-combo-box.vue +3 -6
- package/src/components/cv-content-switcher/cv-content-switcher-button.vue +1 -2
- package/src/components/cv-content-switcher/cv-content-switcher.vue +1 -1
- package/src/components/cv-data-table/_cv-data-table-row-inner.vue +3 -3
- package/src/components/cv-data-table/cv-data-table-action.vue +1 -1
- package/src/components/cv-data-table/cv-data-table-heading.vue +1 -2
- package/src/components/cv-data-table/cv-data-table-row.vue +2 -3
- package/src/components/cv-data-table/cv-data-table-skeleton.vue +2 -2
- package/src/components/cv-data-table/cv-data-table.vue +3 -5
- package/src/components/cv-date-picker/cv-date-picker.vue +37 -15
- package/src/components/cv-date-picker/plugins/appendToPlugin.js +52 -0
- package/src/components/cv-date-picker/plugins/fixEventsPlugin.js +75 -0
- package/src/components/cv-date-picker/plugins/monthSelectPlugin.js +66 -0
- package/src/components/cv-date-picker/plugins/rangePlugin.js +45 -0
- package/src/components/cv-dropdown/cv-dropdown-item.vue +1 -1
- package/src/components/cv-dropdown/cv-dropdown-skeleton.vue +1 -1
- package/src/components/cv-dropdown/cv-dropdown.vue +10 -8
- package/src/components/cv-feedback-button/_cv-feedback-button.vue +1 -1
- package/src/components/cv-file-uploader/cv-file-uploader-skeleton.vue +1 -1
- package/src/components/cv-file-uploader/cv-file-uploader.vue +1 -3
- package/src/components/cv-form/cv-form-group.vue +1 -1
- package/src/components/cv-form/cv-form-item.vue +1 -1
- package/src/components/cv-form/cv-form.vue +1 -1
- package/src/components/cv-grid/cv-column.vue +77 -0
- package/src/components/cv-grid/cv-grid.vue +32 -0
- package/src/components/cv-grid/cv-row.vue +30 -0
- package/src/components/cv-grid/index.js +5 -0
- package/src/components/cv-inline-loading/cv-inline-loading.vue +1 -1
- package/src/components/cv-inline-notification/cv-inline-notification.vue +2 -3
- package/src/components/cv-link/cv-link.vue +2 -3
- package/src/components/cv-list/cv-list-item.vue +1 -1
- package/src/components/cv-list/cv-list.vue +1 -1
- package/src/components/cv-loading/cv-loading.vue +1 -1
- package/src/components/cv-modal/cv-modal.vue +3 -4
- package/src/components/cv-multi-select/cv-multi-select.vue +3 -6
- package/src/components/cv-number-input/cv-number-input-skeleton.vue +1 -1
- package/src/components/cv-number-input/cv-number-input.vue +3 -6
- package/src/components/cv-overflow-menu/cv-overflow-menu-item.vue +1 -1
- package/src/components/cv-overflow-menu/cv-overflow-menu.vue +1 -3
- package/src/components/cv-pagination/cv-pagination.vue +1 -1
- package/src/components/cv-progress/cv-progress-step.vue +1 -1
- package/src/components/cv-progress/cv-progress.vue +1 -1
- package/src/components/cv-radio-button/cv-radio-button.vue +1 -4
- package/src/components/cv-radio-button/cv-radio-group.vue +1 -1
- package/src/components/cv-search/cv-search.vue +1 -4
- package/src/components/cv-select/cv-select-optgroup.vue +1 -1
- package/src/components/cv-select/cv-select-option.vue +1 -1
- package/src/components/cv-select/cv-select.vue +3 -6
- package/src/components/cv-skeleton-text/cv-skeleton-text.vue +1 -1
- package/src/components/cv-slider/cv-slider-skeleton.vue +1 -1
- package/src/components/cv-slider/cv-slider.vue +1 -4
- package/src/components/cv-structured-list/_cv-structured-list-item-selectable.vue +1 -4
- package/src/components/cv-structured-list/_cv-structured-list-item-standard.vue +1 -1
- package/src/components/cv-structured-list/cv-structured-list-data.vue +1 -1
- package/src/components/cv-structured-list/cv-structured-list-heading.vue +1 -1
- package/src/components/cv-structured-list/cv-structured-list.vue +1 -1
- package/src/components/cv-tabs/cv-tab.vue +1 -1
- package/src/components/cv-tabs/cv-tabs-skeleton.vue +1 -1
- package/src/components/cv-tabs/cv-tabs.vue +1 -1
- package/src/components/cv-tag/cv-tag-skeleton.vue +1 -1
- package/src/components/cv-tag/cv-tag.vue +1 -2
- package/src/components/cv-text-area/cv-text-area.vue +3 -6
- package/src/components/cv-text-input/cv-text-input.vue +3 -6
- package/src/components/cv-tile/_cv-tile-clickable.vue +2 -4
- package/src/components/cv-tile/_cv-tile-expandable.vue +1 -2
- package/src/components/cv-tile/_cv-tile-selectable.vue +1 -4
- package/src/components/cv-tile/cv-tile.vue +1 -3
- package/src/components/cv-time-picker/cv-time-picker.vue +3 -6
- package/src/components/cv-toast-notification/cv-toast-notification.vue +3 -4
- package/src/components/cv-toggle/cv-toggle-skeleton.vue +1 -2
- package/src/components/cv-toggle/cv-toggle.vue +1 -4
- package/src/components/cv-toolbar/cv-toolbar-divider.vue +1 -1
- package/src/components/cv-toolbar/cv-toolbar-option.vue +1 -1
- package/src/components/cv-toolbar/cv-toolbar-search.vue +1 -1
- package/src/components/cv-toolbar/cv-toolbar-title.vue +1 -1
- package/src/components/cv-toolbar/cv-toolbar.vue +1 -1
- package/src/components/cv-tooltip/cv-definition-tooltip.vue +1 -2
- package/src/components/cv-tooltip/cv-interactive-tooltip.vue +1 -2
- package/src/components/cv-tooltip/cv-tooltip.vue +1 -1
- package/src/components/cv-ui-shell/_cv-side-nav-footer.vue +1 -1
- package/src/components/cv-ui-shell/_cv-side-nav-link-text.vue +1 -1
- package/src/components/cv-ui-shell/cv-content.vue +1 -1
- package/src/components/cv-ui-shell/cv-header-global-action.vue +1 -2
- package/src/components/cv-ui-shell/cv-header-menu-button.vue +1 -2
- package/src/components/cv-ui-shell/cv-header-menu-item.vue +2 -3
- package/src/components/cv-ui-shell/cv-header-menu.vue +1 -1
- package/src/components/cv-ui-shell/cv-header-name.vue +2 -3
- package/src/components/cv-ui-shell/cv-header-nav.vue +1 -1
- package/src/components/cv-ui-shell/cv-header-panel.vue +2 -2
- package/src/components/cv-ui-shell/cv-header-side-nav-items.vue +1 -1
- package/src/components/cv-ui-shell/cv-header.vue +3 -3
- package/src/components/cv-ui-shell/cv-side-nav-icon.vue +1 -1
- package/src/components/cv-ui-shell/cv-side-nav-items.vue +1 -1
- package/src/components/cv-ui-shell/cv-side-nav-link.vue +3 -4
- package/src/components/cv-ui-shell/cv-side-nav-menu-item.vue +2 -3
- package/src/components/cv-ui-shell/cv-side-nav-menu.vue +3 -3
- package/src/components/cv-ui-shell/cv-side-nav.vue +2 -2
- package/src/components/cv-ui-shell/cv-skip-to-content.vue +2 -3
- package/src/components/cv-ui-shell/cv-switcher-item-link.vue +2 -3
- package/src/components/cv-ui-shell/cv-switcher-item.vue +1 -1
- package/src/components/cv-ui-shell/cv-switcher.vue +1 -1
- package/src/index.js +2 -0
- 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.
|
|
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.
|
|
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.
|
|
74
|
+
"vue-template-compiler": "^2.6.12"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
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
|
|
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
|
|
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
|
|
17
|
+
import { carbonPrefixMixin } from '../../mixins';
|
|
18
18
|
|
|
19
19
|
export default {
|
|
20
20
|
name: 'CvAccordionSkeleton',
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
10
|
import CvBreadcrumbItemSkeleton from './_cv-breadcrumb-item-skeleton';
|
|
11
|
-
import carbonPrefixMixin from '../../mixins
|
|
11
|
+
import { carbonPrefixMixin } from '../../mixins';
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
name: 'CvBreadcrumbSkeleton',
|
|
@@ -33,10 +33,7 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script>
|
|
36
|
-
import checkMixin from '../../mixins
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -113,13 +113,10 @@
|
|
|
113
113
|
</template>
|
|
114
114
|
|
|
115
115
|
<script>
|
|
116
|
-
import themeMixin from '../../mixins
|
|
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
|
-
|
|
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
|
|
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
|
|
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',
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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() {
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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 ?
|
|
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
|
|
76
|
-
import
|
|
77
|
-
import
|
|
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
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
|
|
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
|
+
};
|