@carbon/vue 2.20.1-canary.0 → 2.20.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 +21 -0
- package/dist/carbon-vue.common.js +41 -106
- package/dist/carbon-vue.common.js.map +1 -1
- package/dist/carbon-vue.umd.js +41 -106
- package/dist/carbon-vue.umd.js.map +1 -1
- package/dist/carbon-vue.umd.min.js +4 -4
- package/dist/carbon-vue.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/components/cv-date-picker/cv-date-picker.vue +1 -1
- package/src/components/cv-number-input/cv-number-input.vue +32 -97
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.20.1 (jan 16th 2020)
|
|
4
|
+
|
|
5
|
+
- fix: Disable number input up down buttons when component disabled
|
|
6
|
+
|
|
7
|
+
## 2.20.1-canary.3 (jan 16th 2020)
|
|
8
|
+
|
|
9
|
+
- fix: Merge missing commits from last release
|
|
10
|
+
|
|
11
|
+
## 2.20.1-canary.2 (jan 16th 2020)
|
|
12
|
+
|
|
13
|
+
### fix
|
|
14
|
+
|
|
15
|
+
- Reverted to using stepUp/stepDOwn input methods for number input after checking IE11 support.
|
|
16
|
+
- Initial value of date picker was not being set
|
|
17
|
+
|
|
18
|
+
## 2.20.1-canary.1 (jan 10th 2020)
|
|
19
|
+
|
|
20
|
+
### fix
|
|
21
|
+
|
|
22
|
+
- Decimal number edits e.g. 10.001 with step 001. Using the keyboard to delete .001 caused .000 to be reapplied.
|
|
23
|
+
|
|
3
24
|
## 2.20.1-canary.0 (jan 3rd 2020)
|
|
4
25
|
|
|
5
26
|
### fix
|
|
@@ -252,15 +252,15 @@ var component = Object(componentNormalizer["a" /* default */])(
|
|
|
252
252
|
"use strict";
|
|
253
253
|
__webpack_require__.r(__webpack_exports__);
|
|
254
254
|
|
|
255
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0f4df6f3-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/cv-date-picker/cv-date-picker.vue?vue&type=template&id=
|
|
256
|
-
var
|
|
255
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0f4df6f3-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/cv-date-picker/cv-date-picker.vue?vue&type=template&id=71bd2208&
|
|
256
|
+
var cv_date_pickervue_type_template_id_71bd2208_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('cv-wrapper',{staticClass:"cv-date-picker bx--form-item",attrs:{"tag-type":_vm.formItem ? 'div' : ''}},[_c('div',{ref:"date-picker",staticClass:"bx--date-picker",class:[_vm.kindClasses, { 'bx--date-picker--light': _vm.theme === 'light', 'cv-date-pciker': !_vm.formItem }],attrs:{"data-date-picker":['single', 'range'].includes(_vm.kind),"data-date-picker-type":_vm.kind}},[_c('div',{class:{
|
|
257
257
|
'bx--date-picker-container': ['single', 'range'].includes(_vm.kind),
|
|
258
258
|
'bx--date-picker--nolabel': _vm.getDateLabel !== undefined,
|
|
259
259
|
},on:{"change":_vm.onChange}},[(_vm.getDateLabel.length > 0)?_c('label',{staticClass:"bx--label",attrs:{"for":(_vm.uid + "-input-1")}},[_vm._v(_vm._s(_vm.getDateLabel))]):_vm._e(),_c('div',{staticClass:"bx--date-picker-input__wrapper"},[_c('input',{ref:"date",staticClass:"bx--date-picker__input",attrs:{"data-invalid":_vm.isInvalid,"type":"text","id":(_vm.uid + "-input-1"),"pattern":_vm.pattern,"placeholder":_vm.placeholder,"data-date-picker-input":"","data-date-picker-input-from":_vm.kind === 'range'}}),(['single', 'range'].includes(_vm.kind))?_c('Calendar16',{staticClass:"bx--date-picker__icon",attrs:{"data-date-picker-icon":""},on:{"click":function($event){return _vm.cal.open()}}}):_vm._e()],1),(_vm.isInvalid)?_c('div',{staticClass:"bx--form-requirement"},[_vm._t("invalid-message",[_vm._v(_vm._s(_vm.invalidMessage || _vm.invalidDateMessage))])],2):_vm._e()]),(_vm.kind === 'range')?_c('div',{class:{ 'bx--date-picker-container': _vm.kind === 'range' }},[(_vm.getDateEndLabel.length > 0)?_c('label',{staticClass:"bx--label",attrs:{"for":(_vm.uid + "-input-2")}},[_vm._v(_vm._s(_vm.getDateEndLabel))]):_vm._e(),_c('div',{staticClass:"bx--date-picker-input__wrapper"},[_c('input',{ref:"todate",staticClass:"bx--date-picker__input",attrs:{"type":"text","id":(_vm.uid + "-input-2"),"pattern":_vm.pattern,"placeholder":_vm.placeholder,"data-date-picker-input":"","data-date-picker-input-to":_vm.kind === 'range'}}),_c('Calendar16',{staticClass:"bx--date-picker__icon",attrs:{"data-date-picker-icon":""},on:{"click":function($event){return _vm.openTodateCal()}}})],1)]):_vm._e()])])}
|
|
260
260
|
var staticRenderFns = []
|
|
261
261
|
|
|
262
262
|
|
|
263
|
-
// CONCATENATED MODULE: ./src/components/cv-date-picker/cv-date-picker.vue?vue&type=template&id=
|
|
263
|
+
// CONCATENATED MODULE: ./src/components/cv-date-picker/cv-date-picker.vue?vue&type=template&id=71bd2208&
|
|
264
264
|
|
|
265
265
|
// EXTERNAL MODULE: ./node_modules/flatpickr/dist/flatpickr.js
|
|
266
266
|
var flatpickr = __webpack_require__("cf06");
|
|
@@ -469,7 +469,7 @@ l10n_default.a.en.weekdays.shorthand.forEach((day, index) => {
|
|
|
469
469
|
},
|
|
470
470
|
data() {
|
|
471
471
|
return {
|
|
472
|
-
dataValue:
|
|
472
|
+
dataValue: this.value,
|
|
473
473
|
dataOptions: {},
|
|
474
474
|
isInvalid: false,
|
|
475
475
|
};
|
|
@@ -683,7 +683,7 @@ var componentNormalizer = __webpack_require__("2877");
|
|
|
683
683
|
|
|
684
684
|
var component = Object(componentNormalizer["a" /* default */])(
|
|
685
685
|
cv_date_picker_cv_date_pickervue_type_script_lang_js_,
|
|
686
|
-
|
|
686
|
+
cv_date_pickervue_type_template_id_71bd2208_render,
|
|
687
687
|
staticRenderFns,
|
|
688
688
|
false,
|
|
689
689
|
null,
|
|
@@ -21552,16 +21552,16 @@ var virtual_CheckmarkFilled16 = {
|
|
|
21552
21552
|
"use strict";
|
|
21553
21553
|
__webpack_require__.r(__webpack_exports__);
|
|
21554
21554
|
|
|
21555
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0f4df6f3-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/cv-number-input/cv-number-input.vue?vue&type=template&id=
|
|
21556
|
-
var
|
|
21555
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"0f4df6f3-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/cv-number-input/cv-number-input.vue?vue&type=template&id=5e4d985e&
|
|
21556
|
+
var cv_number_inputvue_type_template_id_5e4d985e_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('cv-wrapper',{staticClass:"cv-number-input bx--form-item",attrs:{"tag-type":_vm.formItem ? 'div' : ''}},[_c('div',{staticClass:"bx--number",class:{
|
|
21557
21557
|
'bx--number--light': _vm.theme === 'light',
|
|
21558
21558
|
'bx--number--helpertext': _vm.isHelper,
|
|
21559
21559
|
'cv-number-input': !_vm.formItem,
|
|
21560
|
-
},attrs:{"data-numberinput":"","data-invalid":_vm.isInvalid}},[_c('label',{staticClass:"bx--label",attrs:{"for":_vm.uid}},[_vm._v(_vm._s(_vm.label))]),(_vm.isHelper)?_c('div',{staticClass:"bx--form__helper-text"},[_vm._t("helper-text",[_vm._v(_vm._s(_vm.helperText))])],2):_vm._e(),_c('div',{staticClass:"bx--number__input-wrapper"},[_c('input',_vm._g(_vm._b({
|
|
21560
|
+
},attrs:{"data-numberinput":"","data-invalid":_vm.isInvalid}},[_c('label',{staticClass:"bx--label",attrs:{"for":_vm.uid}},[_vm._v(_vm._s(_vm.label))]),(_vm.isHelper)?_c('div',{staticClass:"bx--form__helper-text"},[_vm._t("helper-text",[_vm._v(_vm._s(_vm.helperText))])],2):_vm._e(),_c('div',{staticClass:"bx--number__input-wrapper"},[_c('input',_vm._g(_vm._b({ref:"input",attrs:{"id":_vm.uid,"type":"number","disabled":_vm.disabled,"step":_vm.step,"min":_vm.min,"max":_vm.max},domProps:{"value":_vm.internalValue}},'input',_vm.$attrs,false),_vm.inputListeners)),(_vm.isInvalid)?_c('WarningFilled16',{staticClass:"bx--number__invalid"}):_vm._e(),_c('div',{staticClass:"bx--number__controls"},[_c('button',{staticClass:"bx--number__control-btn up-icon",attrs:{"type":"button","aria-label":_vm.ariaLabelForUpButton,"disabled":_vm.disabled},on:{"click":_vm.doUp}},[_c('CaretUpGlyph')],1),_c('button',{staticClass:"bx--number__control-btn down-icon",attrs:{"type":"button","aria-label":_vm.ariaLabelForDownButton,"disabled":_vm.disabled},on:{"click":_vm.doDown}},[_c('CaretDownGlyph')],1)])],1),(_vm.isInvalid)?_c('div',{staticClass:"bx--form-requirement"},[_vm._t("invalid-message",[_vm._v(_vm._s(_vm.invalidMessage))])],2):_vm._e()])])}
|
|
21561
21561
|
var staticRenderFns = []
|
|
21562
21562
|
|
|
21563
21563
|
|
|
21564
|
-
// CONCATENATED MODULE: ./src/components/cv-number-input/cv-number-input.vue?vue&type=template&id=
|
|
21564
|
+
// CONCATENATED MODULE: ./src/components/cv-number-input/cv-number-input.vue?vue&type=template&id=5e4d985e&
|
|
21565
21565
|
|
|
21566
21566
|
// EXTERNAL MODULE: ./src/mixins/uid-mixin.js
|
|
21567
21567
|
var uid_mixin = __webpack_require__("fceb");
|
|
@@ -21732,6 +21732,10 @@ var _cv_wrapper = __webpack_require__("5d36");
|
|
|
21732
21732
|
//
|
|
21733
21733
|
//
|
|
21734
21734
|
//
|
|
21735
|
+
//
|
|
21736
|
+
//
|
|
21737
|
+
//
|
|
21738
|
+
//
|
|
21735
21739
|
|
|
21736
21740
|
|
|
21737
21741
|
|
|
@@ -21748,6 +21752,7 @@ const maxDecimalPlaces = 10; // Stanard floating point accuracy goes at 14 cauti
|
|
|
21748
21752
|
components: { CaretDownGlyph: caret_down, CaretUpGlyph: caret_up, WarningFilled16: _16["a" /* default */], CvWrapper: _cv_wrapper["a" /* default */] },
|
|
21749
21753
|
inheritAttrs: false,
|
|
21750
21754
|
props: {
|
|
21755
|
+
disabled: Boolean,
|
|
21751
21756
|
formItem: { type: Boolean, default: true },
|
|
21752
21757
|
helperText: { type: String, default: undefined },
|
|
21753
21758
|
invalidMessage: { type: String, default: undefined },
|
|
@@ -21785,7 +21790,13 @@ const maxDecimalPlaces = 10; // Stanard floating point accuracy goes at 14 cauti
|
|
|
21785
21790
|
},
|
|
21786
21791
|
watch: {
|
|
21787
21792
|
value() {
|
|
21788
|
-
this.
|
|
21793
|
+
// NOTE: DELIBERATE USE OF != TO COMPARE this.interanlValue and this.value
|
|
21794
|
+
if (typeof this.value !== 'number' || this.internalValue != this.value) {
|
|
21795
|
+
// prevents this.value of 1 updating this.internalValue of 1.0
|
|
21796
|
+
// which improves the typing experience
|
|
21797
|
+
// does not matter if this.value is string or number
|
|
21798
|
+
this.internalValue = this.value.toString();
|
|
21799
|
+
}
|
|
21789
21800
|
},
|
|
21790
21801
|
},
|
|
21791
21802
|
computed: {
|
|
@@ -21794,108 +21805,40 @@ const maxDecimalPlaces = 10; // Stanard floating point accuracy goes at 14 cauti
|
|
|
21794
21805
|
// https://vuejs.org/v2/guide/components-custom-events.html#Customizing-Component-v-model
|
|
21795
21806
|
inputListeners() {
|
|
21796
21807
|
return Object.assign({}, this.$listeners, {
|
|
21797
|
-
input:
|
|
21808
|
+
input: ev => this.onInput(ev.target.value),
|
|
21798
21809
|
});
|
|
21799
21810
|
},
|
|
21800
|
-
internalNumberValue() {
|
|
21801
|
-
let numVal = parseFloat(this.internalValue, 10);
|
|
21802
|
-
|
|
21803
|
-
if (isNaN(numVal)) {
|
|
21804
|
-
numVal = parseFloat(this.min, 10) || 0;
|
|
21805
|
-
}
|
|
21806
|
-
return this.roundToPrecision(numVal);
|
|
21807
|
-
},
|
|
21808
|
-
internalMinValue() {
|
|
21809
|
-
let numVal = parseFloat(this.min, 10);
|
|
21810
|
-
|
|
21811
|
-
if (isNaN(numVal)) {
|
|
21812
|
-
return undefined;
|
|
21813
|
-
}
|
|
21814
|
-
return this.roundToPrecision(numVal);
|
|
21815
|
-
},
|
|
21816
|
-
internalMaxValue() {
|
|
21817
|
-
let numVal = parseFloat(this.max, 10);
|
|
21818
|
-
|
|
21819
|
-
if (isNaN(numVal)) {
|
|
21820
|
-
return undefined;
|
|
21821
|
-
}
|
|
21822
|
-
return this.roundToPrecision((this.internalStepValue * numVal) / this.internalStepValue);
|
|
21823
|
-
},
|
|
21824
|
-
internalStepValue() {
|
|
21825
|
-
let numVal = parseFloat(this.step, 10);
|
|
21826
|
-
|
|
21827
|
-
if (isNaN(numVal) || numVal <= 0) {
|
|
21828
|
-
numVal = 1;
|
|
21829
|
-
}
|
|
21830
|
-
return numVal;
|
|
21831
|
-
},
|
|
21832
|
-
stepDecimalPlaces() {
|
|
21833
|
-
if (Math.floor(this.internalStepValue) === this.internalStepValue) return 0;
|
|
21834
|
-
return Math.min(maxDecimalPlaces, this.internalStepValue.toString().split('.')[1].length || 0);
|
|
21835
|
-
},
|
|
21836
|
-
// stepPrecision() {
|
|
21837
|
-
// return Math.pow(10, -1 * this.stepDecimalPlaces);
|
|
21838
|
-
// },
|
|
21839
21811
|
},
|
|
21840
21812
|
methods: {
|
|
21813
|
+
onInput(val) {
|
|
21814
|
+
this.internalValue = val;
|
|
21815
|
+
this.emitValue();
|
|
21816
|
+
},
|
|
21841
21817
|
checkSlots() {
|
|
21842
21818
|
// NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
|
|
21843
21819
|
this.isInvalid = !!(this.$slots['invalid-message'] || (this.invalidMessage && this.invalidMessage.length));
|
|
21844
21820
|
this.isHelper = !!(this.$slots['helper-text'] || (this.helperText && this.helperText.length));
|
|
21845
21821
|
},
|
|
21846
|
-
_doUpDown(up) {
|
|
21847
|
-
let value;
|
|
21848
|
-
let min = this.internalMinValue;
|
|
21849
|
-
let min0 = min || 0;
|
|
21850
|
-
let max = this.internalMaxValue;
|
|
21851
|
-
let step = this.internalStepValue;
|
|
21852
|
-
// be wary of floating point error
|
|
21853
|
-
// steps should be from min value to less than or equal to max
|
|
21854
|
-
let steps = Math.round((this.internalNumberValue - min0) / step);
|
|
21855
|
-
|
|
21856
|
-
if (up) {
|
|
21857
|
-
value = this.roundToPrecision(min0 + step * (steps + 1));
|
|
21858
|
-
|
|
21859
|
-
if (max !== undefined && value > max) {
|
|
21860
|
-
steps = Math.round((max - min0) / step);
|
|
21861
|
-
value = min0 + step * steps;
|
|
21862
|
-
if (value > max) {
|
|
21863
|
-
value = value - step;
|
|
21864
|
-
}
|
|
21865
|
-
value = this.roundToPrecision(value);
|
|
21866
|
-
}
|
|
21867
|
-
|
|
21868
|
-
if (this.roundToPrecision(value - this.internalNumberValue - step, maxDecimalPlaces) > 0) {
|
|
21869
|
-
// this is simpler than trying to prevent rounding errors
|
|
21870
|
-
value = value - step;
|
|
21871
|
-
}
|
|
21872
|
-
|
|
21873
|
-
this.internalValue = this.valueAsString(value);
|
|
21874
|
-
} else {
|
|
21875
|
-
value = this.roundToPrecision(min0 + step * (steps - 1));
|
|
21876
|
-
|
|
21877
|
-
if (min !== undefined && value < min) {
|
|
21878
|
-
value = min;
|
|
21879
|
-
}
|
|
21880
21822
|
|
|
21881
|
-
if (this.roundToPrecision(value - this.internalNumberValue + step, maxDecimalPlaces) < 0) {
|
|
21882
|
-
// this is simpler than trying to prevent rounding errors
|
|
21883
|
-
value = value + step;
|
|
21884
|
-
}
|
|
21885
|
-
|
|
21886
|
-
this.internalValue = this.valueAsString(value);
|
|
21887
|
-
}
|
|
21888
|
-
this.emitValue();
|
|
21889
|
-
},
|
|
21890
21823
|
doUp() {
|
|
21891
|
-
this.
|
|
21824
|
+
this.$refs.input.stepUp();
|
|
21892
21825
|
},
|
|
21893
21826
|
doDown() {
|
|
21894
|
-
this.
|
|
21827
|
+
this.$refs.input.stepDown();
|
|
21895
21828
|
},
|
|
21896
21829
|
emitValue() {
|
|
21897
21830
|
if (typeof this.value === 'number') {
|
|
21898
|
-
this.$emit('input', this.internalNumberValue);
|
|
21831
|
+
// this.$emit('input', this.internalNumberValue);
|
|
21832
|
+
|
|
21833
|
+
if (this.internalValue != this.value) {
|
|
21834
|
+
const ePos = this.internalValue.indexOf('e-');
|
|
21835
|
+
const dotPos = this.internalValue.indexOf('.');
|
|
21836
|
+
if (ePos > -1 || dotPos > -1) {
|
|
21837
|
+
this.$emit('input', parseFloat(this.internalValue));
|
|
21838
|
+
} else {
|
|
21839
|
+
this.$emit('input', parseInt(this.internalValue));
|
|
21840
|
+
}
|
|
21841
|
+
}
|
|
21899
21842
|
} else {
|
|
21900
21843
|
this.$emit('input', this.internalValue);
|
|
21901
21844
|
}
|
|
@@ -21903,20 +21846,12 @@ const maxDecimalPlaces = 10; // Stanard floating point accuracy goes at 14 cauti
|
|
|
21903
21846
|
valueAsString(val) {
|
|
21904
21847
|
let strVal;
|
|
21905
21848
|
if (typeof val === 'number') {
|
|
21906
|
-
strVal = val.
|
|
21849
|
+
strVal = val.toString();
|
|
21907
21850
|
} else {
|
|
21908
21851
|
strVal = val;
|
|
21909
21852
|
}
|
|
21910
|
-
|
|
21911
21853
|
return strVal;
|
|
21912
21854
|
},
|
|
21913
|
-
roundToPrecision(x, optDecimalPlaces) {
|
|
21914
|
-
// let sign = x >= 0 ? 1 : -1;
|
|
21915
|
-
// let y = x + sign * (this.stepPrecision === undefined ? 0.5 : this.stepPrecision / 2);
|
|
21916
|
-
// return y - (y % (this.stepPrecision === undefined ? 1 : this.stepPrecision));
|
|
21917
|
-
let decimalPlaces = optDecimalPlaces || this.stepDecimalPlaces;
|
|
21918
|
-
return parseFloat(x.toFixed(decimalPlaces));
|
|
21919
|
-
},
|
|
21920
21855
|
},
|
|
21921
21856
|
});
|
|
21922
21857
|
|
|
@@ -21935,7 +21870,7 @@ var componentNormalizer = __webpack_require__("2877");
|
|
|
21935
21870
|
|
|
21936
21871
|
var component = Object(componentNormalizer["a" /* default */])(
|
|
21937
21872
|
cv_number_input_cv_number_inputvue_type_script_lang_js_,
|
|
21938
|
-
|
|
21873
|
+
cv_number_inputvue_type_template_id_5e4d985e_render,
|
|
21939
21874
|
staticRenderFns,
|
|
21940
21875
|
false,
|
|
21941
21876
|
null,
|