mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix timepicker build
This commit is contained in:
1 file changed
+16
-15
@@ -1,4 +1,3 @@
|
|||||||
// @ts-nocheck
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
import Picker from 'pickadate/lib/picker';
|
import Picker from 'pickadate/lib/picker';
|
||||||
|
|
||||||
@@ -22,6 +21,11 @@ export default class TimePicker {
|
|||||||
interval: 15,
|
interval: 15,
|
||||||
disable: [],
|
disable: [],
|
||||||
enable: 1,
|
enable: 1,
|
||||||
|
select: undefined,
|
||||||
|
highlight: undefined,
|
||||||
|
min: undefined,
|
||||||
|
max: undefined,
|
||||||
|
view: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
key = {
|
key = {
|
||||||
@@ -39,6 +43,8 @@ export default class TimePicker {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$node: any;
|
||||||
|
|
||||||
constructor(picker, public settings) {
|
constructor(picker, public settings) {
|
||||||
const clock = this;
|
const clock = this;
|
||||||
const elementValue = picker.$node[0].value;
|
const elementValue = picker.$node[0].value;
|
||||||
@@ -131,15 +137,15 @@ export default class TimePicker {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
create(type, value, options) {
|
create(type, value?, options?) {
|
||||||
const clock = this;
|
const clock = this;
|
||||||
value = value === undefined ? type : value;
|
value = value === undefined ? type : value;
|
||||||
if (_.isDate(value)) {
|
if (_.isDate(value)) {
|
||||||
value = [value.getHours(), value.getMinutes()];
|
value = [value.getHours(), value.getMinutes()];
|
||||||
}
|
}
|
||||||
if ($.isPlainObject(value) && _.isInteger(value.pick)) {
|
if (value && typeof value === 'object' && _.isInteger(value.pick)) {
|
||||||
value = value.pick;
|
value = value.pick;
|
||||||
} else if ($.isArray(value)) {
|
} else if (Array.isArray(value)) {
|
||||||
value = +value[0] * MINUTES_IN_HOUR + (+value[1]);
|
value = +value[0] * MINUTES_IN_HOUR + (+value[1]);
|
||||||
}
|
}
|
||||||
if (type == 'max' && value < clock.item.min.pick) {
|
if (type == 'max' && value < clock.item.min.pick) {
|
||||||
@@ -157,7 +163,7 @@ export default class TimePicker {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
normalize(type, value/* , options */) {
|
normalize(type, value, _options) {
|
||||||
const { interval } = this.item;
|
const { interval } = this.item;
|
||||||
const minTime = this.item.min && this.item.min.pick || 0;
|
const minTime = this.item.min && this.item.min.pick || 0;
|
||||||
value -= type == 'min' ? 0 : (value - minTime) % interval;
|
value -= type == 'min' ? 0 : (value - minTime) % interval;
|
||||||
@@ -165,17 +171,12 @@ export default class TimePicker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
measure(type, value, options) {
|
measure(type, value, options) {
|
||||||
const clock = this;
|
value ||= type == 'min' ? [0, 0] : [HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1];
|
||||||
if (!value) {
|
|
||||||
value = type == 'min' ? [0, 0] : [HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
value = clock.parse(type, value);
|
value = this.parse(type, value);
|
||||||
} else if ($.isPlainObject(value) && _.isInteger(value.pick)) {
|
} else if (value && typeof value === 'object' && _.isInteger(value.pick)) {
|
||||||
value = clock.normalize(type, value.pick, options);
|
value = this.normalize(type, value.pick, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +186,7 @@ export default class TimePicker {
|
|||||||
return this.create(timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject);
|
return this.create(timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject);
|
||||||
}; // TimePicker.prototype.scope
|
}; // TimePicker.prototype.scope
|
||||||
|
|
||||||
parse(type, value, options) {
|
parse(type, value, options?) {
|
||||||
let hour; let minutes; let item; let parseValue;
|
let hour; let minutes; let item; let parseValue;
|
||||||
const clock = this;
|
const clock = this;
|
||||||
const parsingObject = {};
|
const parsingObject = {};
|
||||||
|
|||||||
Reference in new issue
Block a user