@carbon/vue 2.34.0-canary.0 → 2.35.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.
- package/CHANGELOG.md +29 -0
- package/README.md +25 -18
- package/dist/carbon-vue.common.js +2649 -2113
- package/dist/carbon-vue.common.js.map +1 -1
- package/dist/carbon-vue.umd.js +2649 -2113
- 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 +6 -6
- package/src/components/cv-accordion/_cv-accordion-item-skeleton.vue +1 -1
- package/src/components/cv-accordion/cv-accordion-item.vue +5 -4
- package/src/components/cv-accordion/cv-accordion-skeleton.vue +18 -2
- package/src/components/cv-accordion/cv-accordion.vue +19 -2
- 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/button-mixin.js +12 -7
- package/src/components/cv-button/cv-button-set.vue +5 -2
- package/src/components/cv-button/cv-button.vue +1 -1
- package/src/components/cv-button/cv-icon-button.vue +2 -2
- 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 +13 -8
- package/src/components/cv-code-snippet/_cv-code-snippet-multiline.vue +13 -8
- package/src/components/cv-code-snippet/_cv-code-snippet-oneline.vue +10 -12
- package/src/components/cv-code-snippet/cv-code-snippet-skeleton.vue +1 -1
- package/src/components/cv-code-snippet/cv-code-snippet.vue +17 -1
- package/src/components/cv-combo-box/cv-combo-box.vue +2 -5
- package/src/components/cv-content-switcher/cv-content-switcher-button.vue +1 -2
- package/src/components/cv-content-switcher/cv-content-switcher.vue +20 -3
- package/src/components/cv-data-table/_cv-data-table-row-inner.vue +1 -1
- 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 +1 -2
- package/src/components/cv-data-table/cv-data-table.vue +2 -4
- package/src/components/cv-date-picker/cv-date-picker.vue +36 -14
- 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 +9 -7
- 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 +6 -2
- package/src/components/cv-modal/cv-modal.vue +29 -2
- package/src/components/cv-multi-select/cv-multi-select.vue +8 -12
- package/src/components/cv-number-input/cv-number-input-skeleton.vue +1 -1
- package/src/components/cv-number-input/cv-number-input.vue +2 -5
- 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 +2 -5
- 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 +2 -5
- 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 +2 -5
- 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 +2 -5
- package/src/components/cv-text-input/cv-text-input.vue +2 -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 +2 -4
- 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 +1 -1
- 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 +2 -3
- 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 +1 -1
- 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/directives/clickout.js +21 -9
- package/src/index.js +2 -0
- package/src/mixins/index.js +12 -0
- package/src/mixins/theme-mixin.js +14 -2
|
@@ -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: {
|
|
@@ -310,7 +308,7 @@ export default {
|
|
|
310
308
|
return this.overflowMenu === true || (this.overflowMenu && this.overflowMenu.length > 0);
|
|
311
309
|
},
|
|
312
310
|
tableStyle() {
|
|
313
|
-
return this.autoWidth ? { width: 'initial' } : { width: '100%' };
|
|
311
|
+
return this.autoWidth ? { width: 'initial', display: 'inline-block' } : { width: '100%' };
|
|
314
312
|
},
|
|
315
313
|
internalPagination() {
|
|
316
314
|
if (typeof this.pagination === 'object') {
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
`${this.carbonPrefix}--date-picker ${this.carbonPrefix}--date-picker--${this.kind}`,
|
|
8
8
|
{
|
|
9
9
|
[`${carbonPrefix}--date-picker--simple`]: this.kind === 'short',
|
|
10
|
-
[`${carbonPrefix}--date-picker--light`]:
|
|
10
|
+
[`${carbonPrefix}--date-picker--light`]: isLight,
|
|
11
11
|
'cv-date-pciker': !formItem,
|
|
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',
|
|
@@ -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
|
},
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* COPIED FROM carbon-components-react
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {number} monthNumber The month number.
|
|
7
|
+
* @param {boolean} shorthand `true` to use shorthand month.
|
|
8
|
+
* @param {Locale} locale The Flatpickr locale data.
|
|
9
|
+
* @returns {string} The month string.
|
|
10
|
+
*/
|
|
11
|
+
const monthToStr = (monthNumber, shorthand, locale) => locale.months[shorthand ? 'shorthand' : 'longhand'][monthNumber];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {object} config Plugin configuration.
|
|
15
|
+
* @param {boolean} [config.shorthand] `true` to use shorthand month.
|
|
16
|
+
* @param {string} config.selectorFlatpickrMonthYearContainer The CSS selector for the container of month/year selection UI.
|
|
17
|
+
* @param {string} config.selectorFlatpickrYearContainer The CSS selector for the container of year selection UI.
|
|
18
|
+
* @param {string} config.selectorFlatpickrCurrentMonth The CSS selector for the text-based month selection UI.
|
|
19
|
+
* @param {string} config.classFlatpickrCurrentMonth The CSS class for the text-based month selection UI.
|
|
20
|
+
* @returns {Plugin} A Flatpickr plugin to use text instead of `<select>` for month picker.
|
|
21
|
+
*/
|
|
22
|
+
export default config => fp => {
|
|
23
|
+
const setupElements = () => {
|
|
24
|
+
if (!fp.monthElements) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
fp.monthElements.forEach(elem => {
|
|
28
|
+
if (!elem.parentNode) return;
|
|
29
|
+
elem.parentNode.removeChild(elem);
|
|
30
|
+
});
|
|
31
|
+
fp.monthElements.splice(
|
|
32
|
+
0,
|
|
33
|
+
fp.monthElements.length,
|
|
34
|
+
...fp.monthElements.map(() => {
|
|
35
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
36
|
+
const monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
|
|
37
|
+
monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
38
|
+
fp.yearElements[0]
|
|
39
|
+
.closest(config.selectorFlatpickrMonthYearContainer)
|
|
40
|
+
.insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
|
|
41
|
+
return monthElement;
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const updateCurrentMonth = () => {
|
|
47
|
+
const monthStr = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
|
|
48
|
+
fp.yearElements.forEach(elem => {
|
|
49
|
+
const currentMonthContainer = elem.closest(config.selectorFlatpickrMonthYearContainer);
|
|
50
|
+
Array.prototype.forEach.call(currentMonthContainer.querySelectorAll('.cur-month'), monthElement => {
|
|
51
|
+
monthElement.textContent = monthStr;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const register = () => {
|
|
57
|
+
fp.loadedPlugins.push('carbonFlatpickrMonthSelectPlugin');
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
onMonthChange: updateCurrentMonth,
|
|
62
|
+
onValueUpdate: updateCurrentMonth,
|
|
63
|
+
onOpen: updateCurrentMonth,
|
|
64
|
+
onReady: [setupElements, updateCurrentMonth, register],
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import rangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* COPIED FROM carbon-components-react
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} config Plugin configuration.
|
|
9
|
+
* @returns {Plugin} An extension of Flatpickr `rangePlugin` that does the following:
|
|
10
|
+
* * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
|
|
11
|
+
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
12
|
+
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
13
|
+
*/
|
|
14
|
+
export default config => {
|
|
15
|
+
const factory = rangePlugin(Object.assign({ position: 'left' }, config));
|
|
16
|
+
|
|
17
|
+
return fp => {
|
|
18
|
+
const origSetDate = fp.setDate;
|
|
19
|
+
|
|
20
|
+
const init = () => {
|
|
21
|
+
fp.setDate = function setDate(dates, triggerChange, format) {
|
|
22
|
+
origSetDate.call(this, dates, triggerChange, format);
|
|
23
|
+
// If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
|
|
24
|
+
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
25
|
+
if (!triggerChange) {
|
|
26
|
+
const { _input: inputFrom } = fp;
|
|
27
|
+
const { input: inputTo } = config;
|
|
28
|
+
[inputFrom, inputTo].forEach((input, i) => {
|
|
29
|
+
if (input) {
|
|
30
|
+
input.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const origRangePlugin = factory(fp);
|
|
38
|
+
const { onReady: origOnReady } = origRangePlugin;
|
|
39
|
+
|
|
40
|
+
return Object.assign(origRangePlugin, {
|
|
41
|
+
onReady: [init, origOnReady],
|
|
42
|
+
onPreCalendarPosition() {},
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
<div
|
|
21
21
|
:class="[
|
|
22
22
|
`${carbonPrefix}--dropdown__wrapper`,
|
|
23
|
-
|
|
23
|
+
`${carbonPrefix}--list-box__wrapper`,
|
|
24
|
+
{
|
|
25
|
+
[`${carbonPrefix}--dropdown__wrapper--inline`]: inline,
|
|
26
|
+
[`${carbonPrefix}--list-box__wrapper--inline`]: inline,
|
|
27
|
+
'cv-dropdown': !formItem,
|
|
28
|
+
},
|
|
24
29
|
]"
|
|
25
30
|
:style="wrapperStyleOverride"
|
|
26
31
|
>
|
|
@@ -38,9 +43,10 @@
|
|
|
38
43
|
:class="[
|
|
39
44
|
`${carbonPrefix}--dropdown ${carbonPrefix}--list-box`,
|
|
40
45
|
{
|
|
41
|
-
[`${carbonPrefix}--dropdown--light`]:
|
|
46
|
+
[`${carbonPrefix}--dropdown--light`]: isLight,
|
|
42
47
|
[`${carbonPrefix}--dropdown--up`]: up,
|
|
43
48
|
[`${carbonPrefix}--dropdown--open`]: open,
|
|
49
|
+
[`${carbonPrefix}--list-box--expanded`]: open,
|
|
44
50
|
[`${carbonPrefix}--dropdown--invalid`]: isInvalid,
|
|
45
51
|
[`${carbonPrefix}--dropdown--disabled`]: disabled,
|
|
46
52
|
[`${carbonPrefix}--dropdown--inline`]: inline,
|
|
@@ -77,7 +83,6 @@
|
|
|
77
83
|
/>
|
|
78
84
|
<div
|
|
79
85
|
:class="[`${carbonPrefix}--list-box__menu-icon`, { [`${carbonPrefix}--list-box__menu-icon--open`]: open }]"
|
|
80
|
-
role="button"
|
|
81
86
|
>
|
|
82
87
|
<chevron-down-16 :aria-label="open ? 'Close menu' : 'Open menu'" />
|
|
83
88
|
</div>
|
|
@@ -114,13 +119,10 @@
|
|
|
114
119
|
</template>
|
|
115
120
|
|
|
116
121
|
<script>
|
|
117
|
-
import themeMixin from '../../mixins
|
|
118
|
-
import uidMixin from '../../mixins/uid-mixin';
|
|
119
|
-
import methodsMixin from '../../mixins/methods-mixin';
|
|
122
|
+
import { themeMixin, uidMixin, methodsMixin, carbonPrefixMixin } from '../../mixins';
|
|
120
123
|
import CvDropdownItem from './cv-dropdown-item';
|
|
121
124
|
import WarningFilled16 from '@carbon/icons-vue/es/warning--filled/16';
|
|
122
125
|
import ChevronDown16 from '@carbon/icons-vue/es/chevron--down/16';
|
|
123
|
-
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
124
126
|
import clickout from '../../directives/clickout';
|
|
125
127
|
|
|
126
128
|
export default {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<script>
|
|
10
10
|
import CvSkeletonText from '../cv-skeleton-text/cv-skeleton-text';
|
|
11
11
|
import CvButtonSkeleton from '../cv-button/cv-button-skeleton';
|
|
12
|
-
import carbonPrefixMixin from '../../mixins
|
|
12
|
+
import { carbonPrefixMixin } from '../../mixins';
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
15
|
name: 'CvFileUploaderSkeleton',
|
|
@@ -110,15 +110,13 @@
|
|
|
110
110
|
</template>
|
|
111
111
|
|
|
112
112
|
<script>
|
|
113
|
-
import uidMixin from '../../mixins
|
|
113
|
+
import { uidMixin, carbonPrefixMixin, methodsMixin } from '../../mixins';
|
|
114
114
|
import CvFormItem from '../cv-form/cv-form-item';
|
|
115
115
|
import CheckmarkFilled16 from '@carbon/icons-vue/es/checkmark--filled/16';
|
|
116
116
|
import WarningFilled16 from '@carbon/icons-vue/es/warning--filled/16';
|
|
117
117
|
import Close16 from '@carbon/icons-vue/es/close/16';
|
|
118
118
|
import CvWrapper from '../cv-wrapper/_cv-wrapper';
|
|
119
|
-
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
120
119
|
import { STATES, KINDS } from './consts.js';
|
|
121
|
-
import methodsMixin from '../../mixins/methods-mixin';
|
|
122
120
|
|
|
123
121
|
export default {
|
|
124
122
|
name: 'CvFileUploader',
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cv-column" :class="classes">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
9
|
+
|
|
10
|
+
const breakpointProp = {
|
|
11
|
+
type: [Boolean, Number, Object],
|
|
12
|
+
validator: value => {
|
|
13
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
14
|
+
return true;
|
|
15
|
+
} else if (typeof value === 'object') {
|
|
16
|
+
return 'span' in value && typeof value.span === 'number' && 'offset' in value && typeof value.offset === 'number';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return false;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'CvColumn',
|
|
25
|
+
mixins: [carbonPrefixMixin],
|
|
26
|
+
props: {
|
|
27
|
+
sm: breakpointProp,
|
|
28
|
+
md: breakpointProp,
|
|
29
|
+
lg: breakpointProp,
|
|
30
|
+
xlg: breakpointProp,
|
|
31
|
+
max: breakpointProp,
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
classes() {
|
|
35
|
+
const classnames = [];
|
|
36
|
+
|
|
37
|
+
const breakpoints = [
|
|
38
|
+
{ name: 'sm', value: this.sm },
|
|
39
|
+
{ name: 'md', value: this.md },
|
|
40
|
+
{ name: 'lg', value: this.lg },
|
|
41
|
+
{ name: 'xlg', value: this.xlg },
|
|
42
|
+
{ name: 'max', value: this.max },
|
|
43
|
+
].filter(breakpoint => breakpoint.value !== false);
|
|
44
|
+
|
|
45
|
+
for (let i = 0; i < breakpoints.length; i += 1) {
|
|
46
|
+
const { name, value } = breakpoints[i];
|
|
47
|
+
|
|
48
|
+
if (typeof value === 'boolean') {
|
|
49
|
+
// auto-column
|
|
50
|
+
classnames.push(`${this.carbonPrefix}--col-${name}`);
|
|
51
|
+
} else if (typeof value === 'number') {
|
|
52
|
+
classnames.push(`${this.carbonPrefix}--col-${name}-${value}`);
|
|
53
|
+
} else {
|
|
54
|
+
const { span, offset } = value;
|
|
55
|
+
|
|
56
|
+
if (typeof span === 'boolean') {
|
|
57
|
+
classnames.push(`${this.carbonPrefix}--col-${name}`);
|
|
58
|
+
} else if (typeof span === 'number') {
|
|
59
|
+
classnames.push(`${this.carbonPrefix}--col-${name}-${span}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof offset === 'number') {
|
|
63
|
+
classnames.push(`${this.carbonPrefix}--offset-${name}-${offset}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (classnames.length === 0) {
|
|
69
|
+
// no breakpoints were defined. use auto-column
|
|
70
|
+
classnames.push(`${this.carbonPrefix}--col`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return classnames;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="cv-grid"
|
|
4
|
+
:class="[
|
|
5
|
+
`${carbonPrefix}--grid`,
|
|
6
|
+
{
|
|
7
|
+
[`${carbonPrefix}--grid--full-width`]: fullWidth,
|
|
8
|
+
[`${carbonPrefix}--grid--condensed`]: kind === 'condensed',
|
|
9
|
+
[`${carbonPrefix}--grid--narrow`]: kind === 'narrow',
|
|
10
|
+
},
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: 'CvGrid',
|
|
22
|
+
mixins: [carbonPrefixMixin],
|
|
23
|
+
props: {
|
|
24
|
+
fullWidth: Boolean,
|
|
25
|
+
kind: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'wide',
|
|
28
|
+
validator: val => ['wide', 'narrow', 'condensed'].includes(val),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="cv-row"
|
|
4
|
+
:class="[
|
|
5
|
+
`${carbonPrefix}--row`,
|
|
6
|
+
{
|
|
7
|
+
[`${carbonPrefix}--row--condensed`]: kind === 'condensed',
|
|
8
|
+
[`${carbonPrefix}--row--narrow`]: kind === 'narrow',
|
|
9
|
+
},
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'CvRow',
|
|
21
|
+
mixins: [carbonPrefixMixin],
|
|
22
|
+
props: {
|
|
23
|
+
kind: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'wide',
|
|
26
|
+
validator: val => ['wide', 'narrow', 'condensed'].includes(val),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import { STATES } from './consts';
|
|
30
30
|
import ErrorFilled16 from '@carbon/icons-vue/lib/error--filled/16';
|
|
31
31
|
import CheckmarkFilled16 from '@carbon/icons-vue/lib/checkmark--filled/16';
|
|
32
|
-
import carbonPrefixMixin from '../../mixins
|
|
32
|
+
import { carbonPrefixMixin } from '../../mixins';
|
|
33
33
|
|
|
34
34
|
export default {
|
|
35
35
|
name: 'CvInlineLoading',
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<component :is="icon" :class="`${carbonPrefix}--inline-notification__icon`" />
|
|
18
18
|
<div :class="`${carbonPrefix}--inline-notification__text-wrapper`">
|
|
19
19
|
<p :class="`${carbonPrefix}--inline-notification__title`">{{ title }}</p>
|
|
20
|
-
<p :class="`${carbonPrefix}--inline-notification__subtitle`"
|
|
20
|
+
<p :class="`${carbonPrefix}--inline-notification__subtitle`" v-html="subTitle"></p>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
<button
|
|
@@ -46,13 +46,12 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script>
|
|
49
|
-
import notificationMixin from '../../mixins
|
|
49
|
+
import { notificationMixin, carbonPrefixMixin } from '../../mixins';
|
|
50
50
|
import ErrorFilled20 from '@carbon/icons-vue/es/error--filled/20';
|
|
51
51
|
import CheckmarkFilled20 from '@carbon/icons-vue/es/checkmark--filled/20';
|
|
52
52
|
import WarningFilled20 from '@carbon/icons-vue/es/warning--filled/20';
|
|
53
53
|
import Close20 from '@carbon/icons-vue/es/close/20';
|
|
54
54
|
import InformationFilled20 from '@carbon/icons-vue/es/information--filled/20';
|
|
55
|
-
import carbonPrefixMixin from '../../mixins/carbon-prefix-mixin';
|
|
56
55
|
|
|
57
56
|
export default {
|
|
58
57
|
name: 'CvInlineNotification',
|