Skip to content

Commit

Permalink
build: package
Browse files Browse the repository at this point in the history
  • Loading branch information
dolymood committed Feb 19, 2024
1 parent 8a54ffd commit 784cfa4
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 60 deletions.
2 changes: 1 addition & 1 deletion lib/cube.min.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/cube.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/form/form.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/form/form.min.js

Large diffs are not rendered by default.

57 changes: 41 additions & 16 deletions lib/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5506,7 +5506,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
var EVENT_INPUT = 'input';

var EVENT_TYPE_MOUSE = 'mouse';

function isMouseEvent(e) {
return e.type.indexOf(EVENT_TYPE_MOUSE) > -1;
}
exports.default = {
name: COMPONENT_NAME,
props: {
Expand All @@ -5525,11 +5527,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
justify: {
type: Boolean,
default: false
},
allowHalf: {
type: Boolean,
default: false
}
},
data: function data() {
return {
tempValue: this.value
tempValue: 0
};
},
created: function created() {
Expand All @@ -5542,16 +5548,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
watch: {
value: function value(val) {
if (val !== this.tempValue) {
this.tempValue = val;
value: {
immediate: true,
handler: function handler(val) {
if (val !== this.tempValue) {
this.tempValue = this.handleNum(val);
}
}
}
},
methods: {
handleStart: function handleStart(e) {
if (!this.disabled) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (isMouseEvent(e)) {
this.mousePressed = true;
document.addEventListener('mouseup', this.handleEnd);
document.addEventListener('mousemove', this.handleMove);
Expand All @@ -5562,26 +5571,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
handleMove: function handleMove(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) === -1 ? e.touches[0] : e);
if (this.disabled) return;

if (!isMouseEvent(e)) {
this.computeTempValue(e.touches[0]);
} else if (this.mousePressed) {
this.computeTempValue(e);
}
},
handleEnd: function handleEnd(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (this.disabled) return;
if (!isMouseEvent(e) || this.mousePressed) {
if (isMouseEvent(e)) {
this.mousePressed = false;
document.removeEventListener('mouseup', this.handleEnd);
document.removeEventListener('mousemove', this.handleMove);
}
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) > -1 ? e : e.changedTouches[0]);
this.computeTempValue(isMouseEvent(e) ? e : e.changedTouches[0]);
this.$emit(EVENT_INPUT, this.tempValue);
}
},
handleNum: function handleNum(num) {
if (this.allowHalf) {
var baseNum = Math.ceil(num) - 0.5;
num = num <= baseNum ? baseNum : baseNum + 0.5;
} else {
num = Math.ceil(num);
}
return num;
},
computeTempValue: function computeTempValue(touch) {
var leftAmount = Math.ceil((touch.clientX - this.left) / this.containerWidth * this.max);
if (leftAmount > 0 && leftAmount <= this.max) {
this.tempValue = leftAmount;
} else if (leftAmount <= 0) {
var num = (touch.clientX - this.left) / this.containerWidth * this.max;
num = this.handleNum(num);
if (num > 0 && num <= this.max) {
this.tempValue = num;
} else if (num <= 0) {
this.tempValue = 0;
} else {
this.tempValue = this.max;
Expand Down Expand Up @@ -5649,7 +5673,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
return _c('li', {
staticClass: "cube-rate-item",
class: {
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue,
'cube-rate-item_half_active': _vm.index === _vm.$parent.tempValue + 0.5
}
}, [_vm._t("default", [_c('div', {
staticClass: "cube-rate-item-def"
Expand Down
2 changes: 1 addition & 1 deletion lib/form/style.css

Large diffs are not rendered by default.

59 changes: 42 additions & 17 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7295,7 +7295,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}

var Cube = {
version: "1.12.51",
version: "1.12.52",
install: install,
BScroll: _module.BetterScroll,
createAPI: _module.createAPI
Expand Down Expand Up @@ -13161,7 +13161,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
var EVENT_INPUT = 'input';

var EVENT_TYPE_MOUSE = 'mouse';

function isMouseEvent(e) {
return e.type.indexOf(EVENT_TYPE_MOUSE) > -1;
}
exports.default = {
name: COMPONENT_NAME,
props: {
Expand All @@ -13180,11 +13182,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
justify: {
type: Boolean,
default: false
},
allowHalf: {
type: Boolean,
default: false
}
},
data: function data() {
return {
tempValue: this.value
tempValue: 0
};
},
created: function created() {
Expand All @@ -13197,16 +13203,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
watch: {
value: function value(val) {
if (val !== this.tempValue) {
this.tempValue = val;
value: {
immediate: true,
handler: function handler(val) {
if (val !== this.tempValue) {
this.tempValue = this.handleNum(val);
}
}
}
},
methods: {
handleStart: function handleStart(e) {
if (!this.disabled) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (isMouseEvent(e)) {
this.mousePressed = true;
document.addEventListener('mouseup', this.handleEnd);
document.addEventListener('mousemove', this.handleMove);
Expand All @@ -13217,26 +13226,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
handleMove: function handleMove(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) === -1 ? e.touches[0] : e);
if (this.disabled) return;

if (!isMouseEvent(e)) {
this.computeTempValue(e.touches[0]);
} else if (this.mousePressed) {
this.computeTempValue(e);
}
},
handleEnd: function handleEnd(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (this.disabled) return;
if (!isMouseEvent(e) || this.mousePressed) {
if (isMouseEvent(e)) {
this.mousePressed = false;
document.removeEventListener('mouseup', this.handleEnd);
document.removeEventListener('mousemove', this.handleMove);
}
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) > -1 ? e : e.changedTouches[0]);
this.computeTempValue(isMouseEvent(e) ? e : e.changedTouches[0]);
this.$emit(EVENT_INPUT, this.tempValue);
}
},
handleNum: function handleNum(num) {
if (this.allowHalf) {
var baseNum = Math.ceil(num) - 0.5;
num = num <= baseNum ? baseNum : baseNum + 0.5;
} else {
num = Math.ceil(num);
}
return num;
},
computeTempValue: function computeTempValue(touch) {
var leftAmount = Math.ceil((touch.clientX - this.left) / this.containerWidth * this.max);
if (leftAmount > 0 && leftAmount <= this.max) {
this.tempValue = leftAmount;
} else if (leftAmount <= 0) {
var num = (touch.clientX - this.left) / this.containerWidth * this.max;
num = this.handleNum(num);
if (num > 0 && num <= this.max) {
this.tempValue = num;
} else if (num <= 0) {
this.tempValue = 0;
} else {
this.tempValue = this.max;
Expand Down Expand Up @@ -13304,7 +13328,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
return _c('li', {
staticClass: "cube-rate-item",
class: {
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue,
'cube-rate-item_half_active': _vm.index === _vm.$parent.tempValue + 0.5
}
}, [_vm._t("default", [_c('div', {
staticClass: "cube-rate-item-def"
Expand Down
57 changes: 41 additions & 16 deletions lib/rate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
var EVENT_INPUT = 'input';

var EVENT_TYPE_MOUSE = 'mouse';

function isMouseEvent(e) {
return e.type.indexOf(EVENT_TYPE_MOUSE) > -1;
}
exports.default = {
name: COMPONENT_NAME,
props: {
Expand All @@ -186,11 +188,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
justify: {
type: Boolean,
default: false
},
allowHalf: {
type: Boolean,
default: false
}
},
data: function data() {
return {
tempValue: this.value
tempValue: 0
};
},
created: function created() {
Expand All @@ -203,16 +209,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
watch: {
value: function value(val) {
if (val !== this.tempValue) {
this.tempValue = val;
value: {
immediate: true,
handler: function handler(val) {
if (val !== this.tempValue) {
this.tempValue = this.handleNum(val);
}
}
}
},
methods: {
handleStart: function handleStart(e) {
if (!this.disabled) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (isMouseEvent(e)) {
this.mousePressed = true;
document.addEventListener('mouseup', this.handleEnd);
document.addEventListener('mousemove', this.handleMove);
Expand All @@ -223,26 +232,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
handleMove: function handleMove(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) === -1 ? e.touches[0] : e);
if (this.disabled) return;

if (!isMouseEvent(e)) {
this.computeTempValue(e.touches[0]);
} else if (this.mousePressed) {
this.computeTempValue(e);
}
},
handleEnd: function handleEnd(e) {
if (!this.disabled && (e.type.indexOf(EVENT_TYPE_MOUSE) === -1 || this.mousePressed)) {
if (e.type.indexOf(EVENT_TYPE_MOUSE) > -1) {
if (this.disabled) return;
if (!isMouseEvent(e) || this.mousePressed) {
if (isMouseEvent(e)) {
this.mousePressed = false;
document.removeEventListener('mouseup', this.handleEnd);
document.removeEventListener('mousemove', this.handleMove);
}
this.computeTempValue(e.type.indexOf(EVENT_TYPE_MOUSE) > -1 ? e : e.changedTouches[0]);
this.computeTempValue(isMouseEvent(e) ? e : e.changedTouches[0]);
this.$emit(EVENT_INPUT, this.tempValue);
}
},
handleNum: function handleNum(num) {
if (this.allowHalf) {
var baseNum = Math.ceil(num) - 0.5;
num = num <= baseNum ? baseNum : baseNum + 0.5;
} else {
num = Math.ceil(num);
}
return num;
},
computeTempValue: function computeTempValue(touch) {
var leftAmount = Math.ceil((touch.clientX - this.left) / this.containerWidth * this.max);
if (leftAmount > 0 && leftAmount <= this.max) {
this.tempValue = leftAmount;
} else if (leftAmount <= 0) {
var num = (touch.clientX - this.left) / this.containerWidth * this.max;
num = this.handleNum(num);
if (num > 0 && num <= this.max) {
this.tempValue = num;
} else if (num <= 0) {
this.tempValue = 0;
} else {
this.tempValue = this.max;
Expand Down Expand Up @@ -313,7 +337,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
return _c('li', {
staticClass: "cube-rate-item",
class: {
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue
'cube-rate-item_active': _vm.index <= _vm.$parent.tempValue,
'cube-rate-item_half_active': _vm.index === _vm.$parent.tempValue + 0.5
}
}, [_vm._t("default", [_c('div', {
staticClass: "cube-rate-item-def"
Expand Down
2 changes: 1 addition & 1 deletion lib/rate/rate.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 784cfa4

Please sign in to comment.