bge-ui 1.4.2 → 1.4.4
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/dist/index.js +130 -93
- package/dist/slider/index.vue.d.ts +14 -2
- package/package.json +1 -1
- package/src/checkbox/index.vue +3 -3
- package/src/slider/index.vue +59 -13
package/dist/index.js
CHANGED
|
@@ -4666,7 +4666,7 @@ function toValue(r) {
|
|
|
4666
4666
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
4667
4667
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
4668
4668
|
const toString = Object.prototype.toString;
|
|
4669
|
-
const isObject = (
|
|
4669
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
4670
4670
|
const noop$1 = () => {
|
|
4671
4671
|
};
|
|
4672
4672
|
const isIOS$1 = /* @__PURE__ */ getIsIOS();
|
|
@@ -5366,7 +5366,7 @@ var range = function range2(rule, value, source, errors2, options) {
|
|
|
5366
5366
|
var min2 = typeof rule.min === "number";
|
|
5367
5367
|
var max2 = typeof rule.max === "number";
|
|
5368
5368
|
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
5369
|
-
var
|
|
5369
|
+
var val = value;
|
|
5370
5370
|
var key = null;
|
|
5371
5371
|
var num = typeof value === "number";
|
|
5372
5372
|
var str = typeof value === "string";
|
|
@@ -5382,20 +5382,20 @@ var range = function range2(rule, value, source, errors2, options) {
|
|
|
5382
5382
|
return false;
|
|
5383
5383
|
}
|
|
5384
5384
|
if (arr) {
|
|
5385
|
-
|
|
5385
|
+
val = value.length;
|
|
5386
5386
|
}
|
|
5387
5387
|
if (str) {
|
|
5388
|
-
|
|
5388
|
+
val = value.replace(spRegexp, "_").length;
|
|
5389
5389
|
}
|
|
5390
5390
|
if (len) {
|
|
5391
|
-
if (
|
|
5391
|
+
if (val !== rule.len) {
|
|
5392
5392
|
errors2.push(format$1(options.messages[key].len, rule.fullField, rule.len));
|
|
5393
5393
|
}
|
|
5394
|
-
} else if (min2 && !max2 &&
|
|
5394
|
+
} else if (min2 && !max2 && val < rule.min) {
|
|
5395
5395
|
errors2.push(format$1(options.messages[key].min, rule.fullField, rule.min));
|
|
5396
|
-
} else if (max2 && !min2 &&
|
|
5396
|
+
} else if (max2 && !min2 && val > rule.max) {
|
|
5397
5397
|
errors2.push(format$1(options.messages[key].max, rule.fullField, rule.max));
|
|
5398
|
-
} else if (min2 && max2 && (
|
|
5398
|
+
} else if (min2 && max2 && (val < rule.min || val > rule.max)) {
|
|
5399
5399
|
errors2.push(format$1(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
5400
5400
|
}
|
|
5401
5401
|
};
|
|
@@ -6219,8 +6219,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6219
6219
|
emit("blur");
|
|
6220
6220
|
emit("update:modelValue", input.value);
|
|
6221
6221
|
}
|
|
6222
|
-
watch(() => props.modelValue, (
|
|
6223
|
-
input.value =
|
|
6222
|
+
watch(() => props.modelValue, (val) => {
|
|
6223
|
+
input.value = val;
|
|
6224
6224
|
formItemContext && formItemContext.validate && formItemContext.validate().catch((err) => err);
|
|
6225
6225
|
});
|
|
6226
6226
|
function handleChange() {
|
|
@@ -8895,16 +8895,16 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
8895
8895
|
const props = __props;
|
|
8896
8896
|
const formItemContext = inject(formItemContextKey$3, void 0);
|
|
8897
8897
|
const input = ref(false);
|
|
8898
|
-
watch(() => props.modelValue, (
|
|
8899
|
-
if (typeof
|
|
8898
|
+
watch(() => props.modelValue, (val) => {
|
|
8899
|
+
if (typeof val === "number" || typeof val === "string" || typeof val === "boolean") {
|
|
8900
8900
|
input.value = true;
|
|
8901
|
-
if (
|
|
8901
|
+
if (val === props.trueValue) {
|
|
8902
8902
|
input.value = true;
|
|
8903
8903
|
} else {
|
|
8904
8904
|
input.value = false;
|
|
8905
8905
|
}
|
|
8906
8906
|
} else {
|
|
8907
|
-
if (
|
|
8907
|
+
if (val.includes(props.trueValue)) {
|
|
8908
8908
|
input.value = true;
|
|
8909
8909
|
} else {
|
|
8910
8910
|
input.value = false;
|
|
@@ -8913,15 +8913,15 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
8913
8913
|
formItemContext && formItemContext.validate && formItemContext.validate().catch((err) => err);
|
|
8914
8914
|
});
|
|
8915
8915
|
onMounted(() => {
|
|
8916
|
-
if (typeof
|
|
8916
|
+
if (typeof props.modelValue === "number" || typeof props.modelValue === "string" || typeof props.modelValue === "boolean") {
|
|
8917
8917
|
input.value = true;
|
|
8918
|
-
if (
|
|
8918
|
+
if (props.modelValue === props.trueValue) {
|
|
8919
8919
|
input.value = true;
|
|
8920
8920
|
} else {
|
|
8921
8921
|
input.value = false;
|
|
8922
8922
|
}
|
|
8923
8923
|
} else {
|
|
8924
|
-
if (
|
|
8924
|
+
if (props.modelValue.includes(props.trueValue)) {
|
|
8925
8925
|
input.value = true;
|
|
8926
8926
|
} else {
|
|
8927
8927
|
input.value = false;
|
|
@@ -9065,8 +9065,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
9065
9065
|
const props = __props;
|
|
9066
9066
|
const formItemContext = inject(formItemContextKey$2, void 0);
|
|
9067
9067
|
const input = ref(false);
|
|
9068
|
-
watch(() => props.modelValue, (
|
|
9069
|
-
if (
|
|
9068
|
+
watch(() => props.modelValue, (val) => {
|
|
9069
|
+
if (val === props.trueValue) {
|
|
9070
9070
|
input.value = true;
|
|
9071
9071
|
} else {
|
|
9072
9072
|
input.value = false;
|
|
@@ -10590,14 +10590,22 @@ function toFixedPoint(str, e, z) {
|
|
|
10590
10590
|
return str;
|
|
10591
10591
|
}
|
|
10592
10592
|
var BigNumber = clone();
|
|
10593
|
-
const _hoisted_1$e = {
|
|
10593
|
+
const _hoisted_1$e = {
|
|
10594
|
+
key: 0,
|
|
10595
|
+
class: "bge-slider__scale"
|
|
10596
|
+
};
|
|
10594
10597
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
10595
10598
|
__name: "index",
|
|
10596
10599
|
props: {
|
|
10597
10600
|
marks: {
|
|
10598
10601
|
type: Object,
|
|
10599
|
-
default: () => {
|
|
10600
|
-
|
|
10602
|
+
default: () => ({
|
|
10603
|
+
0: "",
|
|
10604
|
+
25: "",
|
|
10605
|
+
50: "",
|
|
10606
|
+
75: "",
|
|
10607
|
+
100: ""
|
|
10608
|
+
})
|
|
10601
10609
|
},
|
|
10602
10610
|
modelValue: {
|
|
10603
10611
|
type: Number,
|
|
@@ -10632,7 +10640,6 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
10632
10640
|
currentY: 0,
|
|
10633
10641
|
startPosition: 0,
|
|
10634
10642
|
newPosition: 0,
|
|
10635
|
-
stopValue: 0,
|
|
10636
10643
|
newValue: 0
|
|
10637
10644
|
});
|
|
10638
10645
|
function onDragStart(event) {
|
|
@@ -10704,21 +10711,51 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
10704
10711
|
setTimeout(() => emit("blur"));
|
|
10705
10712
|
}
|
|
10706
10713
|
const tooltip = ref();
|
|
10714
|
+
const maxValue = computed(() => {
|
|
10715
|
+
if (props.marks) {
|
|
10716
|
+
return Object.keys(props.marks)[Object.keys(props.marks).length - 1];
|
|
10717
|
+
}
|
|
10718
|
+
return 100;
|
|
10719
|
+
});
|
|
10720
|
+
const minValue = computed(() => {
|
|
10721
|
+
if (props.marks) {
|
|
10722
|
+
return Object.keys(props.marks)[0];
|
|
10723
|
+
}
|
|
10724
|
+
return 0;
|
|
10725
|
+
});
|
|
10726
|
+
const marksPercents = computed(() => {
|
|
10727
|
+
const result = {};
|
|
10728
|
+
Object.keys(props.marks).forEach((mark) => {
|
|
10729
|
+
const percent = new BigNumber(new BigNumber(mark).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0);
|
|
10730
|
+
result[mark] = percent;
|
|
10731
|
+
});
|
|
10732
|
+
return result;
|
|
10733
|
+
});
|
|
10734
|
+
const stopValue = computed(() => {
|
|
10735
|
+
let value = 0;
|
|
10736
|
+
Object.keys(props.marks).forEach((item, index2) => {
|
|
10737
|
+
if (props.modelValue >= Number(item)) {
|
|
10738
|
+
value = index2;
|
|
10739
|
+
}
|
|
10740
|
+
});
|
|
10741
|
+
return value;
|
|
10742
|
+
});
|
|
10707
10743
|
function setPosition(percent) {
|
|
10708
10744
|
state2.sliderBarStyle = `width: ${percent}%`;
|
|
10709
10745
|
state2.sliderButtonStyle = `left: ${percent}%`;
|
|
10710
|
-
state2.
|
|
10711
|
-
state2.newValue = Math.floor(percent);
|
|
10746
|
+
state2.newValue = Math.floor(Number(new BigNumber(percent).div(100).multipliedBy(new BigNumber(maxValue.value).minus(minValue.value)).plus(minValue.value).toFixed(0)));
|
|
10712
10747
|
emit("input", state2.newValue);
|
|
10713
10748
|
emit("update:modelValue", state2.newValue);
|
|
10749
|
+
const newPercent = new BigNumber(new BigNumber(state2.newValue).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0);
|
|
10750
|
+
if (newPercent !== percent) {
|
|
10751
|
+
setPosition(newPercent);
|
|
10752
|
+
}
|
|
10714
10753
|
setTimeout(() => {
|
|
10715
10754
|
tooltip.value && tooltip.value.popper.value && tooltip.value.popper.value.update();
|
|
10716
10755
|
}, 50);
|
|
10717
10756
|
}
|
|
10718
|
-
watch(() => props.modelValue, (
|
|
10719
|
-
|
|
10720
|
-
percent = percent > 100 ? 100 : percent;
|
|
10721
|
-
percent = percent < 0 ? 0 : percent;
|
|
10757
|
+
watch(() => props.modelValue, () => {
|
|
10758
|
+
const percent = new BigNumber(new BigNumber(props.modelValue).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0);
|
|
10722
10759
|
setPosition(percent);
|
|
10723
10760
|
}, {
|
|
10724
10761
|
immediate: true
|
|
@@ -10771,15 +10808,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
10771
10808
|
}, null, 32))
|
|
10772
10809
|
], 36),
|
|
10773
10810
|
createElementVNode("div", {
|
|
10774
|
-
class: normalizeClass(`bge-slider__stops bge-slider__stop-${
|
|
10811
|
+
class: normalizeClass(`bge-slider__stops bge-slider__stop-${stopValue.value}`)
|
|
10775
10812
|
}, [
|
|
10776
10813
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.marks, (mark, key) => {
|
|
10777
10814
|
return openBlock(), createElementBlock("div", {
|
|
10778
10815
|
key,
|
|
10779
10816
|
class: "bge-slider__stop",
|
|
10780
|
-
style: normalizeStyle(`left: ${key}%;`)
|
|
10817
|
+
style: normalizeStyle(`left: ${marksPercents.value[key]}%;`)
|
|
10781
10818
|
}, [
|
|
10782
|
-
|
|
10819
|
+
mark ? (openBlock(), createElementBlock("div", _hoisted_1$e, toDisplayString(mark), 1)) : createCommentVNode("", true)
|
|
10783
10820
|
], 4);
|
|
10784
10821
|
}), 128))
|
|
10785
10822
|
], 2)
|
|
@@ -10916,8 +10953,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
10916
10953
|
});
|
|
10917
10954
|
const _export_sfc = (sfc, props) => {
|
|
10918
10955
|
const target = sfc.__vccOpts || sfc;
|
|
10919
|
-
for (const [key,
|
|
10920
|
-
target[key] =
|
|
10956
|
+
for (const [key, val] of props) {
|
|
10957
|
+
target[key] = val;
|
|
10921
10958
|
}
|
|
10922
10959
|
return target;
|
|
10923
10960
|
};
|
|
@@ -14729,8 +14766,8 @@ const errors = {
|
|
|
14729
14766
|
prop: (name) => `"${name}" prop must be enabled!`,
|
|
14730
14767
|
dateArr: (name) => `You need to use array as "model-value" binding in order to support "${name}"`
|
|
14731
14768
|
};
|
|
14732
|
-
const convertType = (
|
|
14733
|
-
return
|
|
14769
|
+
const convertType = (val) => {
|
|
14770
|
+
return val;
|
|
14734
14771
|
};
|
|
14735
14772
|
const getNumVal = (num) => {
|
|
14736
14773
|
if (num === 0)
|
|
@@ -15562,8 +15599,8 @@ const getDefaultUI = (ui) => {
|
|
|
15562
15599
|
Object.keys(ui).map((item) => {
|
|
15563
15600
|
const key = item;
|
|
15564
15601
|
const value = ui[key];
|
|
15565
|
-
const
|
|
15566
|
-
return [item,
|
|
15602
|
+
const val = typeof ui[key] === "string" ? { [value]: true } : Object.fromEntries(value.map((k) => [k, true]));
|
|
15603
|
+
return [item, val];
|
|
15567
15604
|
})
|
|
15568
15605
|
)
|
|
15569
15606
|
};
|
|
@@ -15719,7 +15756,7 @@ const useExternalInternalMapper = (emit, props, isInputFocused) => {
|
|
|
15719
15756
|
const mapYearExternalToInternal = (value) => {
|
|
15720
15757
|
if (Array.isArray(value)) {
|
|
15721
15758
|
if (defaultedMultiDates.value.enabled) {
|
|
15722
|
-
return value.map((
|
|
15759
|
+
return value.map((val) => convertCustomModeType(val, setYear(getDate(), val)));
|
|
15723
15760
|
}
|
|
15724
15761
|
return checkRangeEnabled(
|
|
15725
15762
|
() => [
|
|
@@ -15756,7 +15793,7 @@ const useExternalInternalMapper = (emit, props, isInputFocused) => {
|
|
|
15756
15793
|
const today = set(getDate(), { date: 1 });
|
|
15757
15794
|
if (Array.isArray(value)) {
|
|
15758
15795
|
if (defaultedMultiDates.value.enabled) {
|
|
15759
|
-
return value.map((
|
|
15796
|
+
return value.map((val) => convertCustomModeType(val, setDateMonthOrYear(today, +val.month, +val.year)));
|
|
15760
15797
|
}
|
|
15761
15798
|
return checkRangeEnabled(
|
|
15762
15799
|
() => [
|
|
@@ -15903,22 +15940,22 @@ const useExternalInternalMapper = (emit, props, isInputFocused) => {
|
|
|
15903
15940
|
}
|
|
15904
15941
|
return convertModelToTz(new Date(value));
|
|
15905
15942
|
};
|
|
15906
|
-
const toModelType = (
|
|
15907
|
-
if (!
|
|
15943
|
+
const toModelType = (val) => {
|
|
15944
|
+
if (!val)
|
|
15908
15945
|
return "";
|
|
15909
15946
|
if (props.utc) {
|
|
15910
|
-
return dateToUtc(
|
|
15947
|
+
return dateToUtc(val, props.utc === "preserve", props.enableSeconds);
|
|
15911
15948
|
}
|
|
15912
15949
|
if (props.modelType) {
|
|
15913
15950
|
if (props.modelType === "timestamp")
|
|
15914
|
-
return +convertZonedModelToLocal(
|
|
15951
|
+
return +convertZonedModelToLocal(val);
|
|
15915
15952
|
if (props.modelType === "iso")
|
|
15916
|
-
return convertZonedModelToLocal(
|
|
15953
|
+
return convertZonedModelToLocal(val).toISOString();
|
|
15917
15954
|
if (props.modelType === "format" && (typeof props.format === "string" || !props.format))
|
|
15918
|
-
return formatDateFn(convertZonedModelToLocal(
|
|
15919
|
-
return formatDateFn(convertZonedModelToLocal(
|
|
15955
|
+
return formatDateFn(convertZonedModelToLocal(val));
|
|
15956
|
+
return formatDateFn(convertZonedModelToLocal(val), props.modelType, true);
|
|
15920
15957
|
}
|
|
15921
|
-
return convertZonedModelToLocal(
|
|
15958
|
+
return convertZonedModelToLocal(val);
|
|
15922
15959
|
};
|
|
15923
15960
|
const emitValue = (value, useTz = false, returnOnly = false) => {
|
|
15924
15961
|
if (returnOnly)
|
|
@@ -16770,9 +16807,9 @@ const useValidation = (props) => {
|
|
|
16770
16807
|
}
|
|
16771
16808
|
return true;
|
|
16772
16809
|
};
|
|
16773
|
-
const isValidYear = (
|
|
16774
|
-
if (
|
|
16775
|
-
const activeYear = getYear(
|
|
16810
|
+
const isValidYear = (val) => {
|
|
16811
|
+
if (val) {
|
|
16812
|
+
const activeYear = getYear(val);
|
|
16776
16813
|
return activeYear >= +props.yearRange[0] && activeYear <= props.yearRange[1];
|
|
16777
16814
|
}
|
|
16778
16815
|
return true;
|
|
@@ -17236,7 +17273,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
17236
17273
|
handleRangeTextInput(value);
|
|
17237
17274
|
} else if (defaultedMultiDates.value.enabled) {
|
|
17238
17275
|
const dates = value.split(`;`);
|
|
17239
|
-
parsedDate.value = dates.map((
|
|
17276
|
+
parsedDate.value = dates.map((val) => parser(val.trim())).filter((val) => val);
|
|
17240
17277
|
} else {
|
|
17241
17278
|
parsedDate.value = parser(value);
|
|
17242
17279
|
}
|
|
@@ -17764,9 +17801,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
17764
17801
|
}
|
|
17765
17802
|
});
|
|
17766
17803
|
};
|
|
17767
|
-
const onClick = (
|
|
17768
|
-
if (!
|
|
17769
|
-
emit("selected",
|
|
17804
|
+
const onClick = (val) => {
|
|
17805
|
+
if (!val.disabled) {
|
|
17806
|
+
emit("selected", val.value);
|
|
17770
17807
|
}
|
|
17771
17808
|
};
|
|
17772
17809
|
const toggle = () => {
|
|
@@ -17803,9 +17840,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
17803
17840
|
return;
|
|
17804
17841
|
checkStopPropagation(ev, defaultedConfig.value, true);
|
|
17805
17842
|
};
|
|
17806
|
-
const setHoverValue = (
|
|
17807
|
-
hoverValue.value =
|
|
17808
|
-
emit("hover-value",
|
|
17843
|
+
const setHoverValue = (val) => {
|
|
17844
|
+
hoverValue.value = val;
|
|
17845
|
+
emit("hover-value", val);
|
|
17809
17846
|
};
|
|
17810
17847
|
const onTab = () => {
|
|
17811
17848
|
toggle();
|
|
@@ -18388,7 +18425,7 @@ const useMonthPicker = (props, emit) => {
|
|
|
18388
18425
|
const getModelMonthYear = () => {
|
|
18389
18426
|
if (modelValue.value) {
|
|
18390
18427
|
if (Array.isArray(modelValue.value)) {
|
|
18391
|
-
return modelValue.value.map((
|
|
18428
|
+
return modelValue.value.map((val) => getMonthYear(val));
|
|
18392
18429
|
}
|
|
18393
18430
|
return getMonthYear(modelValue.value);
|
|
18394
18431
|
}
|
|
@@ -18875,17 +18912,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18875
18912
|
() => (type4) => isValueDisabled(type4, props[type4]) || isOverlayValueDisabled(type4, props[type4])
|
|
18876
18913
|
);
|
|
18877
18914
|
const timeValues = computed(() => ({ hours: props.hours, minutes: props.minutes, seconds: props.seconds }));
|
|
18878
|
-
const isOverlayValueDisabled = (type4,
|
|
18915
|
+
const isOverlayValueDisabled = (type4, val) => {
|
|
18879
18916
|
if (defaultedRange.value.enabled && !defaultedRange.value.disableTimeRangeValidation) {
|
|
18880
|
-
return !props.validateTime(type4,
|
|
18917
|
+
return !props.validateTime(type4, val);
|
|
18881
18918
|
}
|
|
18882
18919
|
return false;
|
|
18883
18920
|
};
|
|
18884
18921
|
const disabledRangedArrows = (type4, inc) => {
|
|
18885
18922
|
if (defaultedRange.value.enabled && !defaultedRange.value.disableTimeRangeValidation) {
|
|
18886
18923
|
const inVal = inc ? +props[`${type4}Increment`] : -+props[`${type4}Increment`];
|
|
18887
|
-
const
|
|
18888
|
-
return !props.validateTime(type4,
|
|
18924
|
+
const val = props[type4] + inVal;
|
|
18925
|
+
return !props.validateTime(type4, val);
|
|
18889
18926
|
}
|
|
18890
18927
|
return false;
|
|
18891
18928
|
};
|
|
@@ -18939,10 +18976,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18939
18976
|
return true;
|
|
18940
18977
|
return Boolean((_a = disabledTimes[type4]) == null ? void 0 : _a.includes(value));
|
|
18941
18978
|
};
|
|
18942
|
-
const getAmPmDiff = (
|
|
18979
|
+
const getAmPmDiff = (val, type4) => {
|
|
18943
18980
|
if (type4 !== "hours")
|
|
18944
|
-
return
|
|
18945
|
-
return amPm.value === "AM" ?
|
|
18981
|
+
return val;
|
|
18982
|
+
return amPm.value === "AM" ? val : val + 12;
|
|
18946
18983
|
};
|
|
18947
18984
|
const getGridItems = (type4) => {
|
|
18948
18985
|
const timeRange = props.is24 ? 24 : 12;
|
|
@@ -18962,16 +18999,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18962
18999
|
return { active, disabled };
|
|
18963
19000
|
});
|
|
18964
19001
|
};
|
|
18965
|
-
const sanitizeMinutesAndSeconds = (
|
|
18966
|
-
const sanitizeHours = (
|
|
18967
|
-
const isDateInRange = (
|
|
19002
|
+
const sanitizeMinutesAndSeconds = (val) => val >= 0 ? val : 59;
|
|
19003
|
+
const sanitizeHours = (val) => val >= 0 ? val : 23;
|
|
19004
|
+
const isDateInRange = (val, type4) => {
|
|
18968
19005
|
const minTime = props.minTime ? setTime(sanitizeTime(props.minTime)) : null;
|
|
18969
19006
|
const maxTime = props.maxTime ? setTime(sanitizeTime(props.maxTime)) : null;
|
|
18970
19007
|
const selectedDate = setTime(
|
|
18971
19008
|
sanitizeTime(
|
|
18972
19009
|
timeValues.value,
|
|
18973
19010
|
type4,
|
|
18974
|
-
type4 === "minutes" || type4 === "seconds" ? sanitizeMinutesAndSeconds(
|
|
19011
|
+
type4 === "minutes" || type4 === "seconds" ? sanitizeMinutesAndSeconds(val) : sanitizeHours(val)
|
|
18975
19012
|
)
|
|
18976
19013
|
);
|
|
18977
19014
|
if (minTime && maxTime)
|
|
@@ -19917,13 +19954,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
19917
19954
|
return { active, disabled, highlighted };
|
|
19918
19955
|
});
|
|
19919
19956
|
});
|
|
19920
|
-
const toggleWrap = (
|
|
19957
|
+
const toggleWrap = (val, type4, show) => {
|
|
19921
19958
|
if (show !== void 0) {
|
|
19922
|
-
|
|
19959
|
+
val.value = show;
|
|
19923
19960
|
} else {
|
|
19924
|
-
|
|
19961
|
+
val.value = !val.value;
|
|
19925
19962
|
}
|
|
19926
|
-
if (!
|
|
19963
|
+
if (!val.value) {
|
|
19927
19964
|
overlayOpen.value = false;
|
|
19928
19965
|
emit("overlay-closed", type4);
|
|
19929
19966
|
} else {
|
|
@@ -19958,7 +19995,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
19958
19995
|
index: 1,
|
|
19959
19996
|
toggle: toggleMonthPicker,
|
|
19960
19997
|
modelValue: monthModelBind.value,
|
|
19961
|
-
updateModelValue: (
|
|
19998
|
+
updateModelValue: (val) => monthModelBind.value = val,
|
|
19962
19999
|
text: getMonthDisplayVal.value.text,
|
|
19963
20000
|
showSelectionGrid: showMonthPicker.value,
|
|
19964
20001
|
items: groupedMonths.value,
|
|
@@ -19970,7 +20007,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
19970
20007
|
index: 2,
|
|
19971
20008
|
toggle: toggleYearPicker,
|
|
19972
20009
|
modelValue: yearModelBind.value,
|
|
19973
|
-
updateModelValue: (
|
|
20010
|
+
updateModelValue: (val) => yearModelBind.value = val,
|
|
19974
20011
|
text: formatNumber(props.year, props.locale),
|
|
19975
20012
|
showSelectionGrid: showYearPicker.value,
|
|
19976
20013
|
items: groupedYears.value,
|
|
@@ -20978,16 +21015,16 @@ const useDatePicker = (props, emit, triggerCalendarTransition, updateFlow) => {
|
|
|
20978
21015
|
postRangeSelect();
|
|
20979
21016
|
}
|
|
20980
21017
|
};
|
|
20981
|
-
const updateMonthYear = (instance,
|
|
21018
|
+
const updateMonthYear = (instance, val) => {
|
|
20982
21019
|
var _a;
|
|
20983
|
-
setCalendarMonthYear(instance,
|
|
21020
|
+
setCalendarMonthYear(instance, val.month, val.year, true);
|
|
20984
21021
|
if (defaultedMultiCalendars.value.count && !defaultedMultiCalendars.value.solo) {
|
|
20985
21022
|
autoChangeMultiCalendars(instance);
|
|
20986
21023
|
}
|
|
20987
|
-
emit("update-month-year", { instance, month:
|
|
21024
|
+
emit("update-month-year", { instance, month: val.month, year: val.year });
|
|
20988
21025
|
triggerCalendarTransition(defaultedMultiCalendars.value.solo ? instance : void 0);
|
|
20989
21026
|
const flowActive = ((_a = props.flow) == null ? void 0 : _a.length) ? props.flow[props.flowStep] : void 0;
|
|
20990
|
-
if (!
|
|
21027
|
+
if (!val.fromNav && (flowActive === FlowStep.month || flowActive === FlowStep.year)) {
|
|
20991
21028
|
updateFlow();
|
|
20992
21029
|
}
|
|
20993
21030
|
};
|
|
@@ -21382,7 +21419,7 @@ const useQuarterPicker = (props, emit) => {
|
|
|
21382
21419
|
const isQuarterActive = computed(() => (date4) => {
|
|
21383
21420
|
if (modelValue.value) {
|
|
21384
21421
|
if (Array.isArray(modelValue.value)) {
|
|
21385
|
-
return modelValue.value.some((
|
|
21422
|
+
return modelValue.value.some((val) => isSameQuarter(date4, val));
|
|
21386
21423
|
}
|
|
21387
21424
|
return isSameQuarter(modelValue.value, date4);
|
|
21388
21425
|
}
|
|
@@ -22585,17 +22622,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
22585
22622
|
const emit = __emit;
|
|
22586
22623
|
const inputValue = ref();
|
|
22587
22624
|
const formItemContext = inject(formItemContextKey, void 0);
|
|
22588
|
-
function inputValueCallback(
|
|
22589
|
-
inputValue.value =
|
|
22625
|
+
function inputValueCallback(val) {
|
|
22626
|
+
inputValue.value = val.split(" - ");
|
|
22590
22627
|
}
|
|
22591
|
-
watch(() => props.modelValue, (
|
|
22592
|
-
date4.value =
|
|
22628
|
+
watch(() => props.modelValue, (val) => {
|
|
22629
|
+
date4.value = val;
|
|
22593
22630
|
formItemContext && formItemContext.validate && formItemContext.validate().catch((err) => err);
|
|
22594
22631
|
});
|
|
22595
|
-
watch(date4, (
|
|
22596
|
-
emit("input",
|
|
22597
|
-
emit("change",
|
|
22598
|
-
emit("update:modelValue",
|
|
22632
|
+
watch(date4, (val) => {
|
|
22633
|
+
emit("input", val);
|
|
22634
|
+
emit("change", val);
|
|
22635
|
+
emit("update:modelValue", val);
|
|
22599
22636
|
});
|
|
22600
22637
|
onMounted(() => {
|
|
22601
22638
|
if (props.modelValue) {
|
|
@@ -22694,13 +22731,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22694
22731
|
const isChecked = ref(false);
|
|
22695
22732
|
const emit = __emit;
|
|
22696
22733
|
const props = __props;
|
|
22697
|
-
watch(() => props.modelValue, (
|
|
22698
|
-
isChecked.value =
|
|
22734
|
+
watch(() => props.modelValue, (val) => {
|
|
22735
|
+
isChecked.value = val === props.trueValue;
|
|
22699
22736
|
}, {
|
|
22700
22737
|
immediate: true
|
|
22701
22738
|
});
|
|
22702
|
-
watch(isChecked, (
|
|
22703
|
-
if (
|
|
22739
|
+
watch(isChecked, (val) => {
|
|
22740
|
+
if (val) {
|
|
22704
22741
|
emit("update:modelValue", props.trueValue);
|
|
22705
22742
|
emit("change", props.trueValue);
|
|
22706
22743
|
} else {
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
marks: {
|
|
3
3
|
type: ObjectConstructor;
|
|
4
|
-
default: () =>
|
|
4
|
+
default: () => {
|
|
5
|
+
0: string;
|
|
6
|
+
25: string;
|
|
7
|
+
50: string;
|
|
8
|
+
75: string;
|
|
9
|
+
100: string;
|
|
10
|
+
};
|
|
5
11
|
};
|
|
6
12
|
modelValue: {
|
|
7
13
|
type: NumberConstructor;
|
|
@@ -27,7 +33,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
27
33
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
34
|
marks: {
|
|
29
35
|
type: ObjectConstructor;
|
|
30
|
-
default: () =>
|
|
36
|
+
default: () => {
|
|
37
|
+
0: string;
|
|
38
|
+
25: string;
|
|
39
|
+
50: string;
|
|
40
|
+
75: string;
|
|
41
|
+
100: string;
|
|
42
|
+
};
|
|
31
43
|
};
|
|
32
44
|
modelValue: {
|
|
33
45
|
type: NumberConstructor;
|
package/package.json
CHANGED
package/src/checkbox/index.vue
CHANGED
|
@@ -95,15 +95,15 @@ watch(() => props.modelValue, (val) => {
|
|
|
95
95
|
})
|
|
96
96
|
|
|
97
97
|
onMounted(() => {
|
|
98
|
-
if (typeof
|
|
98
|
+
if (typeof props.modelValue === 'number' || typeof props.modelValue === 'string' || typeof props.modelValue === 'boolean') {
|
|
99
99
|
input.value = true
|
|
100
|
-
if (
|
|
100
|
+
if (props.modelValue === props.trueValue) {
|
|
101
101
|
input.value = true
|
|
102
102
|
} else {
|
|
103
103
|
input.value = false
|
|
104
104
|
}
|
|
105
105
|
} else {
|
|
106
|
-
if (
|
|
106
|
+
if (props.modelValue.includes(props.trueValue)) {
|
|
107
107
|
input.value = true
|
|
108
108
|
} else {
|
|
109
109
|
input.value = false
|
package/src/slider/index.vue
CHANGED
|
@@ -15,23 +15,29 @@
|
|
|
15
15
|
|
|
16
16
|
<div v-else class="slider-button" @mouseover="state.hovering = true" @mouseleave="state.hovering = false"></div>
|
|
17
17
|
</div>
|
|
18
|
-
<div :class="`bge-slider__stops bge-slider__stop-${
|
|
19
|
-
<div v-for="(mark, key) in marks" :key="key" class="bge-slider__stop" :style="`left: ${key}%;`">
|
|
20
|
-
<div class="bge-slider__scale">{{ mark }}</div>
|
|
18
|
+
<div :class="`bge-slider__stops bge-slider__stop-${stopValue}`">
|
|
19
|
+
<div v-for="(mark, key) in marks" :key="key" class="bge-slider__stop" :style="`left: ${marksPercents[key]}%;`">
|
|
20
|
+
<div v-if="mark" class="bge-slider__scale">{{ mark }} </div>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
</template>
|
|
26
26
|
<script lang="ts" setup>
|
|
27
|
-
import { ref, reactive, watch } from 'vue'
|
|
27
|
+
import { ref, reactive, watch, computed } from 'vue'
|
|
28
28
|
import UiTooltip from '../tooltip/index.vue'
|
|
29
29
|
import BigNumber from 'bignumber.js'
|
|
30
30
|
|
|
31
31
|
const props = defineProps({
|
|
32
32
|
marks: {
|
|
33
33
|
type: Object,
|
|
34
|
-
default: () => {
|
|
34
|
+
default: () => ({
|
|
35
|
+
0: '',
|
|
36
|
+
25: '',
|
|
37
|
+
50: '',
|
|
38
|
+
75: '',
|
|
39
|
+
100: ''
|
|
40
|
+
})
|
|
35
41
|
},
|
|
36
42
|
modelValue: {
|
|
37
43
|
type: Number,
|
|
@@ -63,7 +69,6 @@ const state = reactive({
|
|
|
63
69
|
currentY: 0,
|
|
64
70
|
startPosition: 0,
|
|
65
71
|
newPosition: 0,
|
|
66
|
-
stopValue: 0,
|
|
67
72
|
newValue: 0
|
|
68
73
|
})
|
|
69
74
|
|
|
@@ -149,22 +154,63 @@ function onSliderClick (event: any) {
|
|
|
149
154
|
|
|
150
155
|
const tooltip = ref()
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
const maxValue = computed(() => {
|
|
158
|
+
if (props.marks) {
|
|
159
|
+
return Object.keys(props.marks)[Object.keys(props.marks).length - 1]
|
|
160
|
+
}
|
|
161
|
+
return 100
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
const minValue = computed(() => {
|
|
165
|
+
if (props.marks) {
|
|
166
|
+
return Object.keys(props.marks)[0]
|
|
167
|
+
}
|
|
168
|
+
return 0
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const marksPercents = computed(() => {
|
|
172
|
+
const result: any = {}
|
|
173
|
+
Object.keys(props.marks).forEach((mark: string) => {
|
|
174
|
+
const percent = new BigNumber(new BigNumber(mark).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0)
|
|
175
|
+
result[mark] = percent
|
|
176
|
+
})
|
|
177
|
+
return result
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
// const percent = computed(() => {
|
|
181
|
+
// return new BigNumber(new BigNumber(props.modelValue).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0)
|
|
182
|
+
// })
|
|
183
|
+
|
|
184
|
+
const stopValue = computed(() => {
|
|
185
|
+
let value = 0
|
|
186
|
+
Object.keys(props.marks).forEach(((item: string, index: number) => {
|
|
187
|
+
if (props.modelValue >= Number(item)) {
|
|
188
|
+
value = index
|
|
189
|
+
}
|
|
190
|
+
}))
|
|
191
|
+
return value
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
function setPosition (percent: string) {
|
|
153
195
|
state.sliderBarStyle = `width: ${percent}%`
|
|
154
196
|
state.sliderButtonStyle = `left: ${percent}%`
|
|
155
|
-
state.stopValue = Math.floor(percent / 100 * (Object.values(props.marks).length - 1))
|
|
156
|
-
state.newValue = Math.floor(percent)
|
|
197
|
+
// state.stopValue = Math.floor(Number(percent.value) / 100 * (Object.values(props.marks).length - 1))
|
|
198
|
+
// state.newValue = Math.floor(Number(percent.value))
|
|
199
|
+
// state.stopValue = Number(new BigNumber(percent).div(100).multipliedBy(new BigNumber(maxValue.value).minus(minValue.value)).plus(minValue.value).toFixed(0))
|
|
200
|
+
state.newValue = Math.floor(Number(new BigNumber(percent).div(100).multipliedBy(new BigNumber(maxValue.value).minus(minValue.value)).plus(minValue.value).toFixed(0)))
|
|
157
201
|
emit('input', state.newValue)
|
|
158
202
|
emit('update:modelValue', state.newValue)
|
|
203
|
+
const newPercent = new BigNumber(new BigNumber(state.newValue).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0)
|
|
204
|
+
if (newPercent !== percent) {
|
|
205
|
+
setPosition(newPercent)
|
|
206
|
+
}
|
|
159
207
|
setTimeout(() => {
|
|
160
208
|
tooltip.value && tooltip.value.popper.value && tooltip.value.popper.value.update()
|
|
161
209
|
}, 50)
|
|
162
210
|
}
|
|
163
211
|
|
|
164
|
-
watch(() => props.modelValue, (
|
|
165
|
-
|
|
166
|
-
percent = percent > 100 ? 100 : percent
|
|
167
|
-
percent = percent < 0 ? 0 : percent
|
|
212
|
+
watch(() => props.modelValue, () => {
|
|
213
|
+
const percent = new BigNumber(new BigNumber(props.modelValue).minus(minValue.value)).div(new BigNumber(maxValue.value).minus(minValue.value)).multipliedBy(100).toFixed(0)
|
|
168
214
|
setPosition(percent)
|
|
169
215
|
}, {
|
|
170
216
|
immediate: true
|