bkui-vue 0.0.1-beta.158 → 0.0.1-beta.160
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.cjs.js +41 -41
- package/dist/index.esm.js +1355 -232
- package/dist/index.umd.js +41 -41
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/backtop/backtop.css +8 -0
- package/lib/backtop/backtop.less +8 -0
- package/lib/backtop/backtop.variable.css +8 -0
- package/lib/backtop/index.js +1 -1
- package/lib/cascader/cascader.css +1 -1
- package/lib/cascader/cascader.d.ts +4 -5
- package/lib/cascader/cascader.less +1 -1
- package/lib/cascader/cascader.variable.css +1 -1
- package/lib/cascader/index.d.ts +12 -15
- package/lib/cascader/index.js +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -1
- package/lib/date-picker/date-picker.d.ts +1 -1
- package/lib/date-picker/index.d.ts +5 -3
- package/lib/date-picker/index.js +1 -1
- package/lib/date-picker/interface.d.ts +9 -0
- package/lib/date-picker/props.d.ts +39 -0
- package/lib/date-picker/time-picker.d.ts +381 -0
- package/lib/date-picker/utils.d.ts +22 -1
- package/lib/icon/folder.js +1 -0
- package/lib/icon/index.js +1 -1
- package/lib/input/input.css +1 -1
- package/lib/input/input.less +5 -5
- package/lib/input/input.variable.css +1 -1
- package/lib/link/link.css +12 -12
- package/lib/link/link.less +16 -14
- package/lib/link/link.variable.css +12 -12
- package/lib/popover/index.d.ts +5 -5
- package/lib/popover/popover.d.ts +2 -2
- package/lib/popover2/index.d.ts +6 -0
- package/lib/popover2/index.js +1 -1
- package/lib/popover2/popover2.d.ts +2 -0
- package/lib/shared/dom.d.ts +1 -0
- package/lib/shared/index.js +1 -1
- package/lib/steps/index.d.ts +4 -4
- package/lib/steps/steps.d.ts +1 -1
- package/lib/styles/index.d.ts +1 -0
- package/lib/time-picker/index.d.ts +904 -0
- package/lib/time-picker/index.js +1 -0
- package/lib/time-picker/time-picker.css +215 -0
- package/lib/time-picker/time-picker.less +260 -0
- package/lib/time-picker/time-picker.variable.css +328 -0
- package/lib/upload/index.d.ts +27 -27
- package/lib/upload/index.js +1 -1
- package/lib/upload/upload.d.ts +7 -7
- package/package.json +1 -1
- package/lib/icon/funnel.js +0 -1
package/dist/index.esm.js
CHANGED
@@ -87,6 +87,7 @@ var tagInput = "";
|
|
87
87
|
var container = "";
|
88
88
|
var cascader = "";
|
89
89
|
var colorPicker = "";
|
90
|
+
var timePicker = "";
|
90
91
|
const BKLAYERD_INDEX_EFAULT_VALUE = {
|
91
92
|
["bottom"]: 0,
|
92
93
|
["content"]: 1,
|
@@ -797,10 +798,10 @@ function getOppositeVariationPlacement(placement) {
|
|
797
798
|
function getWindowScroll(node) {
|
798
799
|
var win = getWindow$1(node);
|
799
800
|
var scrollLeft = win.pageXOffset;
|
800
|
-
var
|
801
|
+
var scrollTop2 = win.pageYOffset;
|
801
802
|
return {
|
802
803
|
scrollLeft,
|
803
|
-
scrollTop
|
804
|
+
scrollTop: scrollTop2
|
804
805
|
};
|
805
806
|
}
|
806
807
|
function getWindowScrollBarX$1(element) {
|
@@ -6385,9 +6386,9 @@ var lodash = { exports: {} };
|
|
6385
6386
|
}
|
6386
6387
|
var camelCase = createCompounder(function(result2, word2, index) {
|
6387
6388
|
word2 = word2.toLowerCase();
|
6388
|
-
return result2 + (index ?
|
6389
|
+
return result2 + (index ? capitalize2(word2) : word2);
|
6389
6390
|
});
|
6390
|
-
function
|
6391
|
+
function capitalize2(string) {
|
6391
6392
|
return upperFirst(toString(string).toLowerCase());
|
6392
6393
|
}
|
6393
6394
|
function deburr(string) {
|
@@ -6993,7 +6994,7 @@ var lodash = { exports: {} };
|
|
6993
6994
|
lodash2.add = add;
|
6994
6995
|
lodash2.attempt = attempt;
|
6995
6996
|
lodash2.camelCase = camelCase;
|
6996
|
-
lodash2.capitalize =
|
6997
|
+
lodash2.capitalize = capitalize2;
|
6997
6998
|
lodash2.ceil = ceil;
|
6998
6999
|
lodash2.clamp = clamp2;
|
6999
7000
|
lodash2.clone = clone2;
|
@@ -7934,6 +7935,27 @@ const off$2 = (() => {
|
|
7934
7935
|
}
|
7935
7936
|
};
|
7936
7937
|
})();
|
7938
|
+
function scrollTop(el, from = 0, to, duration = 500, endCallback) {
|
7939
|
+
const difference = Math.abs(from - to);
|
7940
|
+
const step = Math.ceil(difference / duration * 50);
|
7941
|
+
function scroll(start2, end2, step2) {
|
7942
|
+
if (start2 === end2) {
|
7943
|
+
endCallback == null ? void 0 : endCallback();
|
7944
|
+
return;
|
7945
|
+
}
|
7946
|
+
let d2 = start2 + step2 > end2 ? end2 : start2 + step2;
|
7947
|
+
if (start2 > end2) {
|
7948
|
+
d2 = start2 - step2 < end2 ? end2 : start2 - step2;
|
7949
|
+
}
|
7950
|
+
if (el === window) {
|
7951
|
+
window.scrollTo(d2, d2);
|
7952
|
+
} else {
|
7953
|
+
el.scrollTop = d2;
|
7954
|
+
}
|
7955
|
+
window.requestAnimationFrame(() => scroll(d2, end2, step2));
|
7956
|
+
}
|
7957
|
+
scroll(from, to, step);
|
7958
|
+
}
|
7937
7959
|
function classes(dynamicCls, constCls = "") {
|
7938
7960
|
return Object.entries(dynamicCls).filter((entry) => entry[1]).map((entry) => entry[0]).join(" ").concat(constCls ? ` ${constCls}` : "");
|
7939
7961
|
}
|
@@ -8792,7 +8814,7 @@ var Component$C = defineComponent({
|
|
8792
8814
|
const scrollHandler = lodash.exports.throttle(() => {
|
8793
8815
|
visible.value = el.value.scrollTop >= props2.visibilityHeight;
|
8794
8816
|
}, 30);
|
8795
|
-
const
|
8817
|
+
const scrollTop2 = () => {
|
8796
8818
|
el.value.scrollTo({
|
8797
8819
|
top: 0,
|
8798
8820
|
behavior: "smooth"
|
@@ -8828,11 +8850,9 @@ var Component$C = defineComponent({
|
|
8828
8850
|
bottom: styleBottom,
|
8829
8851
|
zIndex: zIndex.value
|
8830
8852
|
},
|
8831
|
-
"onClick":
|
8853
|
+
"onClick": scrollTop2
|
8832
8854
|
}, [(_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : createVNode(angleUp, {
|
8833
|
-
"
|
8834
|
-
fontSize: "14px"
|
8835
|
-
}
|
8855
|
+
"class": "bk-backtop-icon"
|
8836
8856
|
}, null)]) : ""];
|
8837
8857
|
}
|
8838
8858
|
});
|
@@ -12793,7 +12813,7 @@ var useFloating = (props2, ctx, refReference, refContent, refArrow, refRoot) =>
|
|
12793
12813
|
elContent.style.setProperty("z-index", `${props2.zIndex ? props2.zIndex : bkZIndexManager.getModalNextIndex()}`);
|
12794
12814
|
updatePopover();
|
12795
12815
|
ctx.emit("afterShow", {
|
12796
|
-
|
12816
|
+
isShow: true
|
12797
12817
|
});
|
12798
12818
|
};
|
12799
12819
|
const handlePopoverHide = () => {
|
@@ -12801,7 +12821,7 @@ var useFloating = (props2, ctx, refReference, refContent, refArrow, refRoot) =>
|
|
12801
12821
|
const elContent = resolveTargetElement((_a = refContent.value) == null ? void 0 : _a.$el);
|
12802
12822
|
elContent.style.setProperty("display", "none");
|
12803
12823
|
ctx.emit("afterHidden", {
|
12804
|
-
|
12824
|
+
isShow: false
|
12805
12825
|
});
|
12806
12826
|
};
|
12807
12827
|
const triggerPopover = () => {
|
@@ -13077,10 +13097,6 @@ var Component$p = defineComponent({
|
|
13077
13097
|
beforeInstanceUnmount();
|
13078
13098
|
document.body.removeEventListener("fullscreenchange", handleFullscrennChange);
|
13079
13099
|
});
|
13080
|
-
ctx.expose({
|
13081
|
-
show: show2,
|
13082
|
-
hide: hide2
|
13083
|
-
});
|
13084
13100
|
const handleClickOutside = (_e) => {
|
13085
13101
|
ctx.emit(EMITEVENTS$1.CLICK_OUTSIDE, {
|
13086
13102
|
isShow: localIsShow.value,
|
@@ -13103,7 +13119,9 @@ var Component$p = defineComponent({
|
|
13103
13119
|
content,
|
13104
13120
|
theme,
|
13105
13121
|
transBoundary,
|
13106
|
-
handleClickOutside
|
13122
|
+
handleClickOutside,
|
13123
|
+
hide: hide2,
|
13124
|
+
show: show2
|
13107
13125
|
};
|
13108
13126
|
},
|
13109
13127
|
render() {
|
@@ -14610,11 +14628,11 @@ var Component$j = defineComponent({
|
|
14610
14628
|
};
|
14611
14629
|
const handleScroll = (e) => {
|
14612
14630
|
const {
|
14613
|
-
scrollTop,
|
14631
|
+
scrollTop: scrollTop2,
|
14614
14632
|
clientHeight,
|
14615
14633
|
scrollHeight
|
14616
14634
|
} = e.target;
|
14617
|
-
if (
|
14635
|
+
if (scrollTop2 + clientHeight === scrollHeight) {
|
14618
14636
|
emit("scroll-end");
|
14619
14637
|
}
|
14620
14638
|
};
|
@@ -15351,7 +15369,7 @@ function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
|
|
15351
15369
|
}
|
15352
15370
|
const elScrollTop = el.scrollTop;
|
15353
15371
|
const elScrollLeft = el.scrollLeft;
|
15354
|
-
const { scrollTop, count, groupItemCount, startIndex, endIndex } = pagination2;
|
15372
|
+
const { scrollTop: scrollTop2, count, groupItemCount, startIndex, endIndex } = pagination2;
|
15355
15373
|
const { offsetHeight } = el;
|
15356
15374
|
let targetStartIndex = 0;
|
15357
15375
|
let targetEndIndex = 0;
|
@@ -15368,7 +15386,7 @@ function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
|
|
15368
15386
|
const endValue = getMatchedIndex(count, offsetHeight, groupItemCount, lineHeight);
|
15369
15387
|
targetEndIndex = endValue.startIndex + targetStartIndex + 1;
|
15370
15388
|
}
|
15371
|
-
if (elScrollTop !==
|
15389
|
+
if (elScrollTop !== scrollTop2 || targetStartIndex !== startIndex || targetEndIndex !== endIndex) {
|
15372
15390
|
const bottom2 = el.scrollHeight - el.offsetHeight - el.scrollTop;
|
15373
15391
|
typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
|
15374
15392
|
}
|
@@ -15382,8 +15400,8 @@ function visibleRender(e, wrapper, binding) {
|
|
15382
15400
|
handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
|
15383
15401
|
return;
|
15384
15402
|
}
|
15385
|
-
const { startIndex, endIndex, groupItemCount, count, scrollTop } = pagination2;
|
15386
|
-
computedVirtualIndex(lineHeight, handleScrollCallback, { scrollTop, startIndex, endIndex, groupItemCount, count }, wrapper, e);
|
15403
|
+
const { startIndex, endIndex, groupItemCount, count, scrollTop: scrollTop2 } = pagination2;
|
15404
|
+
computedVirtualIndex(lineHeight, handleScrollCallback, { scrollTop: scrollTop2, startIndex, endIndex, groupItemCount, count }, wrapper, e);
|
15387
15405
|
}
|
15388
15406
|
const throttledRender = (delay = 60) => lodash.exports.throttle((e, wrapper, binding) => visibleRender(e, wrapper, binding), delay);
|
15389
15407
|
const executeThrottledRender = (e, wrapper, binding, delay = 60) => {
|
@@ -15445,10 +15463,10 @@ var Component$f = defineComponent({
|
|
15445
15463
|
pos: {},
|
15446
15464
|
groupItemCount: props2.groupItemCount
|
15447
15465
|
});
|
15448
|
-
const handleScrollCallback = (event, startIndex, endIndex,
|
15466
|
+
const handleScrollCallback = (event, startIndex, endIndex, scrollTop2, translateY, scrollLeft, pos) => {
|
15449
15467
|
pagination2.startIndex = startIndex;
|
15450
15468
|
pagination2.endIndex = endIndex;
|
15451
|
-
pagination2.scrollTop =
|
15469
|
+
pagination2.scrollTop = scrollTop2;
|
15452
15470
|
pagination2.translateY = translateY;
|
15453
15471
|
pagination2.translateX = scrollLeft;
|
15454
15472
|
pagination2.pos = pos;
|
@@ -15499,11 +15517,11 @@ var Component$f = defineComponent({
|
|
15499
15517
|
innerHeight.value = props2.abosuteHeight;
|
15500
15518
|
}
|
15501
15519
|
};
|
15502
|
-
const afterListDataReset = (
|
15520
|
+
const afterListDataReset = (scrollTop2 = true) => {
|
15503
15521
|
var _a;
|
15504
15522
|
const el = (_a = refRoot.value) == null ? void 0 : _a.parentNode;
|
15505
15523
|
computedVirtualIndex(props2.lineHeight, handleScrollCallback, pagination2, el, null);
|
15506
|
-
if (
|
15524
|
+
if (scrollTop2 && refRoot.value) {
|
15507
15525
|
refRoot.value.scrollTo(0, 0);
|
15508
15526
|
}
|
15509
15527
|
};
|
@@ -18153,11 +18171,11 @@ var Component$c = defineComponent({
|
|
18153
18171
|
return;
|
18154
18172
|
}
|
18155
18173
|
const {
|
18156
|
-
scrollTop,
|
18174
|
+
scrollTop: scrollTop2,
|
18157
18175
|
offsetHeight,
|
18158
18176
|
scrollHeight
|
18159
18177
|
} = selectorListRef.value;
|
18160
|
-
if (
|
18178
|
+
if (scrollTop2 + offsetHeight >= scrollHeight) {
|
18161
18179
|
const curPage = pageState.curPage + 1;
|
18162
18180
|
if (curPage <= pageState.totalPage) {
|
18163
18181
|
pageState.isPageLoading = true;
|
@@ -20390,7 +20408,6 @@ var Confirm = defineComponent({
|
|
20390
20408
|
}, [this.showTime ? createVNode("a", {
|
20391
20409
|
"href": "javascript: void(0);",
|
20392
20410
|
"class": "bk-picker-confirm-time",
|
20393
|
-
"disabled": this.timeDisabled,
|
20394
20411
|
"onClick": this.handleToggleTime
|
20395
20412
|
}, [this.labels.time]) : "", this.clearable ? createVNode("a", {
|
20396
20413
|
"href": "javascript: void(0);",
|
@@ -22570,6 +22587,16 @@ const formatDate = (val, type, multiple, format2) => {
|
|
22570
22587
|
return formatter(val, format2 || f2);
|
22571
22588
|
};
|
22572
22589
|
const datePickerKey = Symbol("date-picker");
|
22590
|
+
const timePickerKey = Symbol("time-picker");
|
22591
|
+
function findChildComponents(context, componentName) {
|
22592
|
+
return context.$children.reduce((components2, child) => {
|
22593
|
+
if (child.$options.name === componentName) {
|
22594
|
+
components2.push(child);
|
22595
|
+
}
|
22596
|
+
const foundChilds = findChildComponents(child, componentName);
|
22597
|
+
return components2.concat(foundChilds);
|
22598
|
+
}, []);
|
22599
|
+
}
|
22573
22600
|
function iconBtnCls(direction, type = "") {
|
22574
22601
|
return [
|
22575
22602
|
"bk-picker-panel-icon-btn",
|
@@ -22645,6 +22672,17 @@ const isInRange = (time, a2, b2) => {
|
|
22645
22672
|
const [start2, end2] = [a2, b2].sort();
|
22646
22673
|
return time >= start2 && time <= end2;
|
22647
22674
|
};
|
22675
|
+
function firstUpperCase(str) {
|
22676
|
+
return str.toString()[0].toUpperCase() + str.toString().slice(1);
|
22677
|
+
}
|
22678
|
+
const mergeDateHMS = (date, ...hms) => {
|
22679
|
+
const newDate = new Date(date.getTime());
|
22680
|
+
newDate.setHours(hms[0]);
|
22681
|
+
newDate.setMinutes(hms[1]);
|
22682
|
+
newDate.setSeconds(hms[2]);
|
22683
|
+
return newDate;
|
22684
|
+
};
|
22685
|
+
const capitalize = (str) => str[0].toUpperCase() + str.slice(1);
|
22648
22686
|
const dateTableProps = {
|
22649
22687
|
tableDate: {
|
22650
22688
|
type: Date,
|
@@ -22762,6 +22800,652 @@ var DateTable = defineComponent({
|
|
22762
22800
|
}, [createVNode("em", null, [cell.desc])]))]);
|
22763
22801
|
}
|
22764
22802
|
});
|
22803
|
+
const datePickerProps = {
|
22804
|
+
type: {
|
22805
|
+
type: String,
|
22806
|
+
default: "date",
|
22807
|
+
validator(value) {
|
22808
|
+
const validList = ["year", "month", "date", "daterange", "datetime", "datetimerange", "time", "timerange"];
|
22809
|
+
if (validList.indexOf(value) < 0) {
|
22810
|
+
console.error(`type property is not valid: '${value}'`);
|
22811
|
+
return false;
|
22812
|
+
}
|
22813
|
+
return true;
|
22814
|
+
}
|
22815
|
+
},
|
22816
|
+
extPopoverCls: {
|
22817
|
+
type: String,
|
22818
|
+
default: ""
|
22819
|
+
},
|
22820
|
+
format: String,
|
22821
|
+
readonly: {
|
22822
|
+
type: Boolean,
|
22823
|
+
default: false
|
22824
|
+
},
|
22825
|
+
disabled: {
|
22826
|
+
type: Boolean,
|
22827
|
+
default: false
|
22828
|
+
},
|
22829
|
+
editable: {
|
22830
|
+
type: Boolean,
|
22831
|
+
default: true
|
22832
|
+
},
|
22833
|
+
clearable: {
|
22834
|
+
type: Boolean,
|
22835
|
+
default: true
|
22836
|
+
},
|
22837
|
+
open: {
|
22838
|
+
type: Boolean,
|
22839
|
+
default: null
|
22840
|
+
},
|
22841
|
+
multiple: {
|
22842
|
+
type: Boolean,
|
22843
|
+
default: false
|
22844
|
+
},
|
22845
|
+
timePickerOptions: {
|
22846
|
+
type: Object,
|
22847
|
+
default: () => ({})
|
22848
|
+
},
|
22849
|
+
splitPanels: {
|
22850
|
+
type: Boolean,
|
22851
|
+
default: true
|
22852
|
+
},
|
22853
|
+
startDate: Date,
|
22854
|
+
placeholder: {
|
22855
|
+
type: String,
|
22856
|
+
default: ""
|
22857
|
+
},
|
22858
|
+
placement: {
|
22859
|
+
type: String,
|
22860
|
+
default: "bottom-start",
|
22861
|
+
validator: (value) => {
|
22862
|
+
const validList = [
|
22863
|
+
"top",
|
22864
|
+
"top-start",
|
22865
|
+
"top-end",
|
22866
|
+
"bottom",
|
22867
|
+
"bottom-start",
|
22868
|
+
"bottom-end",
|
22869
|
+
"left",
|
22870
|
+
"left-start",
|
22871
|
+
"left-end",
|
22872
|
+
"right",
|
22873
|
+
"right-start",
|
22874
|
+
"right-end"
|
22875
|
+
];
|
22876
|
+
if (validList.indexOf(value) < 0) {
|
22877
|
+
console.error(`placement property is not valid: '${value}'`);
|
22878
|
+
return false;
|
22879
|
+
}
|
22880
|
+
return true;
|
22881
|
+
}
|
22882
|
+
},
|
22883
|
+
transfer: {
|
22884
|
+
type: Boolean,
|
22885
|
+
default: false
|
22886
|
+
},
|
22887
|
+
appendToBody: {
|
22888
|
+
type: Boolean,
|
22889
|
+
default: false
|
22890
|
+
},
|
22891
|
+
shortcuts: {
|
22892
|
+
type: Array,
|
22893
|
+
default: () => []
|
22894
|
+
},
|
22895
|
+
shortcutClose: {
|
22896
|
+
type: Boolean,
|
22897
|
+
default: false
|
22898
|
+
},
|
22899
|
+
modelValue: {
|
22900
|
+
type: [Date, String, Number, Array]
|
22901
|
+
},
|
22902
|
+
value: {
|
22903
|
+
type: [Date, String, Number, Array]
|
22904
|
+
},
|
22905
|
+
options: {
|
22906
|
+
type: Object,
|
22907
|
+
default: () => ({})
|
22908
|
+
},
|
22909
|
+
fontSize: {
|
22910
|
+
type: String,
|
22911
|
+
default: "normal"
|
22912
|
+
},
|
22913
|
+
upToNow: {
|
22914
|
+
type: Boolean,
|
22915
|
+
default: false
|
22916
|
+
},
|
22917
|
+
useShortcutText: {
|
22918
|
+
type: Boolean,
|
22919
|
+
default: false
|
22920
|
+
},
|
22921
|
+
shortcutSelectedIndex: {
|
22922
|
+
type: Number,
|
22923
|
+
default: -1
|
22924
|
+
},
|
22925
|
+
headerSlotCls: {
|
22926
|
+
type: String,
|
22927
|
+
default: ""
|
22928
|
+
},
|
22929
|
+
footerSlotCls: {
|
22930
|
+
type: String,
|
22931
|
+
default: ""
|
22932
|
+
},
|
22933
|
+
allowCrossDay: {
|
22934
|
+
type: Boolean,
|
22935
|
+
default: false
|
22936
|
+
},
|
22937
|
+
behavior: {
|
22938
|
+
type: String,
|
22939
|
+
default: "normal",
|
22940
|
+
validator(v2) {
|
22941
|
+
return ["simplicity", "normal"].indexOf(v2) > -1;
|
22942
|
+
}
|
22943
|
+
},
|
22944
|
+
disableDate: Function,
|
22945
|
+
withValidate: {
|
22946
|
+
type: Boolean,
|
22947
|
+
default: true
|
22948
|
+
}
|
22949
|
+
};
|
22950
|
+
const timePanelProps = {
|
22951
|
+
disabledHours: {
|
22952
|
+
type: Array,
|
22953
|
+
default: () => []
|
22954
|
+
},
|
22955
|
+
disabledMinutes: {
|
22956
|
+
type: Array,
|
22957
|
+
default: () => []
|
22958
|
+
},
|
22959
|
+
disabledSeconds: {
|
22960
|
+
type: Array,
|
22961
|
+
default: () => []
|
22962
|
+
},
|
22963
|
+
hideDisabledOptions: {
|
22964
|
+
type: Boolean,
|
22965
|
+
default: false
|
22966
|
+
},
|
22967
|
+
width: {
|
22968
|
+
type: Number,
|
22969
|
+
default: 261
|
22970
|
+
},
|
22971
|
+
enterMode: {
|
22972
|
+
type: Boolean,
|
22973
|
+
default: true
|
22974
|
+
}
|
22975
|
+
};
|
22976
|
+
const timePickerProps = {
|
22977
|
+
type: {
|
22978
|
+
type: String,
|
22979
|
+
default: "time",
|
22980
|
+
validator(value) {
|
22981
|
+
const validList = ["time", "timerange"];
|
22982
|
+
if (validList.indexOf(value) < 0) {
|
22983
|
+
console.error(`type property is not valid: '${value}'`);
|
22984
|
+
return false;
|
22985
|
+
}
|
22986
|
+
return true;
|
22987
|
+
}
|
22988
|
+
},
|
22989
|
+
allowCrossDay: {
|
22990
|
+
type: Boolean,
|
22991
|
+
default: false
|
22992
|
+
}
|
22993
|
+
};
|
22994
|
+
const timeSpinnerProps = {
|
22995
|
+
hours: {
|
22996
|
+
type: [Number, String],
|
22997
|
+
default: NaN
|
22998
|
+
},
|
22999
|
+
minutes: {
|
23000
|
+
type: [Number, String],
|
23001
|
+
default: NaN
|
23002
|
+
},
|
23003
|
+
seconds: {
|
23004
|
+
type: [Number, String],
|
23005
|
+
default: NaN
|
23006
|
+
},
|
23007
|
+
showSeconds: {
|
23008
|
+
type: Boolean,
|
23009
|
+
default: true
|
23010
|
+
},
|
23011
|
+
steps: {
|
23012
|
+
type: Array,
|
23013
|
+
default: () => []
|
23014
|
+
}
|
23015
|
+
};
|
23016
|
+
const timeParts = ["hours", "minutes", "seconds"];
|
23017
|
+
var TimeSpinner = defineComponent({
|
23018
|
+
name: "TimeSpinner",
|
23019
|
+
props: __spreadValues(__spreadValues({}, timeSpinnerProps), timePanelProps),
|
23020
|
+
emits: ["change", "pick-click"],
|
23021
|
+
setup(props2, {
|
23022
|
+
emit
|
23023
|
+
}) {
|
23024
|
+
const state = reactive({
|
23025
|
+
spinerSteps: [1, 1, 1].map((one, i2) => Math.abs(props2.steps[i2]) || one),
|
23026
|
+
compiled: false,
|
23027
|
+
focusedColumn: -1,
|
23028
|
+
focusedTime: [0, 0, 0]
|
23029
|
+
});
|
23030
|
+
const hoursList = computed(() => {
|
23031
|
+
const hours = [];
|
23032
|
+
const step = state.spinerSteps[0];
|
23033
|
+
const focusedHour = state.focusedColumn === 0 && state.focusedTime[0];
|
23034
|
+
const hourTmpl = {
|
23035
|
+
text: 0,
|
23036
|
+
selected: false,
|
23037
|
+
disabled: false,
|
23038
|
+
hide: false
|
23039
|
+
};
|
23040
|
+
for (let i2 = 0; i2 < 24; i2 += step) {
|
23041
|
+
const hour = JSON.parse(JSON.stringify(hourTmpl));
|
23042
|
+
hour.text = i2;
|
23043
|
+
hour.focused = i2 === focusedHour;
|
23044
|
+
if (props2.disabledHours.length && props2.disabledHours.indexOf(i2) > -1) {
|
23045
|
+
hour.disabled = true;
|
23046
|
+
if (props2.hideDisabledOptions) {
|
23047
|
+
hour.hide = true;
|
23048
|
+
}
|
23049
|
+
}
|
23050
|
+
if (props2.hours === i2) {
|
23051
|
+
hour.selected = true;
|
23052
|
+
}
|
23053
|
+
hours.push(hour);
|
23054
|
+
}
|
23055
|
+
return hours;
|
23056
|
+
});
|
23057
|
+
const minutesList = computed(() => {
|
23058
|
+
const minutes = [];
|
23059
|
+
const step = state.spinerSteps[1];
|
23060
|
+
const focusedMinute = state.focusedColumn === 1 && state.focusedTime[1];
|
23061
|
+
const minuteTmpl = {
|
23062
|
+
text: 0,
|
23063
|
+
selected: false,
|
23064
|
+
disabled: false,
|
23065
|
+
hide: false
|
23066
|
+
};
|
23067
|
+
for (let i2 = 0; i2 < 60; i2 += step) {
|
23068
|
+
const minute = JSON.parse(JSON.stringify(minuteTmpl));
|
23069
|
+
minute.text = i2;
|
23070
|
+
minute.focused = i2 === focusedMinute;
|
23071
|
+
if (props2.disabledMinutes.length && props2.disabledMinutes.indexOf(i2) > -1) {
|
23072
|
+
minute.disabled = true;
|
23073
|
+
if (props2.hideDisabledOptions) {
|
23074
|
+
minute.hide = true;
|
23075
|
+
}
|
23076
|
+
}
|
23077
|
+
if (props2.minutes === i2) {
|
23078
|
+
minute.selected = true;
|
23079
|
+
}
|
23080
|
+
minutes.push(minute);
|
23081
|
+
}
|
23082
|
+
return minutes;
|
23083
|
+
});
|
23084
|
+
const secondsList = computed(() => {
|
23085
|
+
const seconds = [];
|
23086
|
+
const step = state.spinerSteps[2];
|
23087
|
+
const focusedMinute = state.focusedColumn === 2 && state.focusedTime[2];
|
23088
|
+
const secondTmpl = {
|
23089
|
+
text: 0,
|
23090
|
+
selected: false,
|
23091
|
+
disabled: false,
|
23092
|
+
hide: false
|
23093
|
+
};
|
23094
|
+
for (let i2 = 0; i2 < 60; i2 += step) {
|
23095
|
+
const second = JSON.parse(JSON.stringify(secondTmpl));
|
23096
|
+
second.text = i2;
|
23097
|
+
second.focused = i2 === focusedMinute;
|
23098
|
+
if (props2.disabledSeconds.length && props2.disabledSeconds.indexOf(i2) > -1) {
|
23099
|
+
second.disabled = true;
|
23100
|
+
if (props2.hideDisabledOptions) {
|
23101
|
+
second.hide = true;
|
23102
|
+
}
|
23103
|
+
}
|
23104
|
+
if (props2.seconds === i2) {
|
23105
|
+
second.selected = true;
|
23106
|
+
}
|
23107
|
+
seconds.push(second);
|
23108
|
+
}
|
23109
|
+
return seconds;
|
23110
|
+
});
|
23111
|
+
const styles = computed(() => ({
|
23112
|
+
width: props2.showSeconds ? "33.33%" : "50%"
|
23113
|
+
}));
|
23114
|
+
watch(() => props2.hours, (val) => {
|
23115
|
+
if (!state.compiled) {
|
23116
|
+
return;
|
23117
|
+
}
|
23118
|
+
scroll("hours", hoursList.value.findIndex((obj) => obj.text === val));
|
23119
|
+
});
|
23120
|
+
watch(() => props2.minutes, (val) => {
|
23121
|
+
if (!state.compiled) {
|
23122
|
+
return;
|
23123
|
+
}
|
23124
|
+
scroll("minutes", minutesList.value.findIndex((obj) => obj.text === val));
|
23125
|
+
});
|
23126
|
+
watch(() => props2.seconds, (val) => {
|
23127
|
+
if (!state.compiled) {
|
23128
|
+
return;
|
23129
|
+
}
|
23130
|
+
scroll("seconds", minutesList.value.findIndex((obj) => obj.text === val));
|
23131
|
+
});
|
23132
|
+
watch(() => state.focusedTime, (updated, old) => {
|
23133
|
+
timeParts.forEach((part, i2) => {
|
23134
|
+
if (updated[i2] === old[i2] || typeof updated[i2] === "undefined") {
|
23135
|
+
return;
|
23136
|
+
}
|
23137
|
+
const valueIndex = this[`${part}List`].findIndex((obj) => obj.text === updated[i2]);
|
23138
|
+
scroll(part, valueIndex);
|
23139
|
+
});
|
23140
|
+
});
|
23141
|
+
onMounted(() => {
|
23142
|
+
nextTick(() => {
|
23143
|
+
state.compiled = true;
|
23144
|
+
bindWheelEvent();
|
23145
|
+
});
|
23146
|
+
});
|
23147
|
+
function getDomRef(type) {
|
23148
|
+
let domRef;
|
23149
|
+
if (type === "hours") {
|
23150
|
+
domRef = hoursRef;
|
23151
|
+
} else if (type === "minutes") {
|
23152
|
+
domRef = minutesRef;
|
23153
|
+
} else {
|
23154
|
+
domRef = secondsRef;
|
23155
|
+
}
|
23156
|
+
return domRef.value;
|
23157
|
+
}
|
23158
|
+
function getCellCls(cell) {
|
23159
|
+
return ["bk-time-picker-cells-cell", {
|
23160
|
+
["bk-time-picker-cells-cell-selected"]: cell.selected,
|
23161
|
+
["bk-time-picker-cells-cell-focused"]: cell.focused,
|
23162
|
+
["bk-time-picker-cells-cell-disabled"]: cell.disabled
|
23163
|
+
}];
|
23164
|
+
}
|
23165
|
+
function bindWheelEvent() {
|
23166
|
+
const bindFunction = (type) => {
|
23167
|
+
const domRef = getDomRef(type);
|
23168
|
+
domRef.addEventListener("wheel", lodash.exports.debounce(() => {
|
23169
|
+
handleWheel(type);
|
23170
|
+
}, 32), {
|
23171
|
+
passive: true
|
23172
|
+
});
|
23173
|
+
};
|
23174
|
+
bindFunction("hours");
|
23175
|
+
bindFunction("minutes");
|
23176
|
+
bindFunction("seconds");
|
23177
|
+
}
|
23178
|
+
function typeItemHeight(type) {
|
23179
|
+
const domRef = getDomRef(type);
|
23180
|
+
return domRef.querySelector("li").offsetHeight;
|
23181
|
+
}
|
23182
|
+
function scrollBarHeight(type) {
|
23183
|
+
const domRef = getDomRef(type);
|
23184
|
+
return domRef.offsetHeight;
|
23185
|
+
}
|
23186
|
+
function handleWheel(type) {
|
23187
|
+
const domRef = getDomRef(type);
|
23188
|
+
const value = Math.min(Math.round((domRef.scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
|
23189
|
+
let list;
|
23190
|
+
if (type === "hours") {
|
23191
|
+
list = hoursList;
|
23192
|
+
} else if (type === "minutes") {
|
23193
|
+
list = minutesList;
|
23194
|
+
} else {
|
23195
|
+
list = secondsList;
|
23196
|
+
}
|
23197
|
+
const item = list.value.find((data2) => data2.text === value);
|
23198
|
+
if (item.disabled) {
|
23199
|
+
return false;
|
23200
|
+
}
|
23201
|
+
nextTick(() => {
|
23202
|
+
emitChange({
|
23203
|
+
[type]: value
|
23204
|
+
});
|
23205
|
+
});
|
23206
|
+
}
|
23207
|
+
function handleClick(type, cell) {
|
23208
|
+
if (cell.disabled) {
|
23209
|
+
return;
|
23210
|
+
}
|
23211
|
+
const data2 = {
|
23212
|
+
[type]: cell.text
|
23213
|
+
};
|
23214
|
+
emitChange(data2);
|
23215
|
+
}
|
23216
|
+
function emitChange(changes) {
|
23217
|
+
emit("change", changes);
|
23218
|
+
emit("pick-click");
|
23219
|
+
}
|
23220
|
+
function scroll(type, index) {
|
23221
|
+
const domRef = getDomRef(type);
|
23222
|
+
const from = domRef.scrollTop;
|
23223
|
+
const to = 32 * getScrollIndex(type, index);
|
23224
|
+
scrollTop(domRef, from, to, 500);
|
23225
|
+
}
|
23226
|
+
function getScrollIndex(type, index) {
|
23227
|
+
const t2 = firstUpperCase(type);
|
23228
|
+
const disabled = props2[`disabled${t2}`];
|
23229
|
+
let ret = index;
|
23230
|
+
if (disabled.length && props2.hideDisabledOptions) {
|
23231
|
+
let count = 0;
|
23232
|
+
disabled.forEach((item) => item <= index ? count += 1 : "");
|
23233
|
+
ret -= count;
|
23234
|
+
}
|
23235
|
+
return ret;
|
23236
|
+
}
|
23237
|
+
function updateScroll() {
|
23238
|
+
nextTick(() => {
|
23239
|
+
timeParts.forEach((type) => {
|
23240
|
+
const domRef = getDomRef(type);
|
23241
|
+
let list;
|
23242
|
+
if (type === "hours") {
|
23243
|
+
list = hoursList;
|
23244
|
+
} else if (type === "minutes") {
|
23245
|
+
list = minutesList;
|
23246
|
+
} else {
|
23247
|
+
list = secondsList;
|
23248
|
+
}
|
23249
|
+
domRef.scrollTop = 32 * list.value.findIndex((obj) => obj.text === props2[type]);
|
23250
|
+
});
|
23251
|
+
});
|
23252
|
+
}
|
23253
|
+
function padTime(text) {
|
23254
|
+
return text < 10 ? `0${text}` : text;
|
23255
|
+
}
|
23256
|
+
const hoursRef = ref(null);
|
23257
|
+
const minutesRef = ref(null);
|
23258
|
+
const secondsRef = ref(null);
|
23259
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
23260
|
+
hoursList,
|
23261
|
+
minutesList,
|
23262
|
+
secondsList,
|
23263
|
+
styles,
|
23264
|
+
hoursRef,
|
23265
|
+
minutesRef,
|
23266
|
+
secondsRef,
|
23267
|
+
getCellCls,
|
23268
|
+
handleClick,
|
23269
|
+
updateScroll,
|
23270
|
+
padTime
|
23271
|
+
});
|
23272
|
+
},
|
23273
|
+
render() {
|
23274
|
+
return createVNode("div", {
|
23275
|
+
"class": ["bk-time-picker-cells", this.showSeconds ? "bk-time-picker-cells-with-seconds" : ""]
|
23276
|
+
}, [createVNode("div", {
|
23277
|
+
"class": "bk-time-picker-cells-title-wrapper"
|
23278
|
+
}, [createVNode("div", {
|
23279
|
+
"class": ["bk-time-picker-cells-title", this.focusedColumn === 0 ? "active" : ""],
|
23280
|
+
"style": this.styles
|
23281
|
+
}, [createTextVNode("\u65F6")]), createVNode("div", {
|
23282
|
+
"class": ["bk-time-picker-cells-title", this.focusedColumn === 1 ? "active" : ""],
|
23283
|
+
"style": this.styles
|
23284
|
+
}, [createTextVNode("\u5206")]), withDirectives(createVNode("div", {
|
23285
|
+
"class": ["bk-time-picker-cells-title", this.focusedColumn === 2 ? "active" : ""],
|
23286
|
+
"style": this.styles
|
23287
|
+
}, [createTextVNode("\u79D2")]), [[vShow, this.showSeconds]])]), createVNode("div", {
|
23288
|
+
"class": "bk-time-picker-cells-list",
|
23289
|
+
"ref": "hoursRef",
|
23290
|
+
"style": this.styles
|
23291
|
+
}, [createVNode("ul", {
|
23292
|
+
"class": "bk-time-picker-cells-ul"
|
23293
|
+
}, [this.hoursList.map((item) => withDirectives(createVNode("li", {
|
23294
|
+
"class": this.getCellCls(item),
|
23295
|
+
"onClick": () => this.handleClick("hours", item)
|
23296
|
+
}, [this.padTime(item.text)]), [[vShow, !item.hide]]))])]), createVNode("div", {
|
23297
|
+
"class": "bk-time-picker-cells-list",
|
23298
|
+
"ref": "minutesRef",
|
23299
|
+
"style": this.styles
|
23300
|
+
}, [createVNode("ul", {
|
23301
|
+
"class": "bk-time-picker-cells-ul"
|
23302
|
+
}, [this.minutesList.map((item) => withDirectives(createVNode("li", {
|
23303
|
+
"class": this.getCellCls(item),
|
23304
|
+
"onClick": () => this.handleClick("minutes", item)
|
23305
|
+
}, [this.padTime(item.text)]), [[vShow, !item.hide]]))])]), withDirectives(createVNode("div", {
|
23306
|
+
"class": "bk-time-picker-cells-list",
|
23307
|
+
"ref": "secondsRef",
|
23308
|
+
"style": this.styles
|
23309
|
+
}, [createVNode("ul", {
|
23310
|
+
"class": "bk-time-picker-cells-ul"
|
23311
|
+
}, [this.secondsList.map((item) => withDirectives(createVNode("li", {
|
23312
|
+
"class": this.getCellCls(item),
|
23313
|
+
"onClick": () => this.handleClick("seconds", item)
|
23314
|
+
}, [this.padTime(item.text)]), [[vShow, !item.hide]]))])]), [[vShow, this.showSeconds]])]);
|
23315
|
+
}
|
23316
|
+
});
|
23317
|
+
const timeProps = {
|
23318
|
+
disabledDate: {
|
23319
|
+
type: Function,
|
23320
|
+
default: () => false
|
23321
|
+
},
|
23322
|
+
steps: {
|
23323
|
+
type: Array,
|
23324
|
+
default: () => []
|
23325
|
+
},
|
23326
|
+
format: {
|
23327
|
+
type: String,
|
23328
|
+
default: "HH:mm:ss"
|
23329
|
+
},
|
23330
|
+
value: {
|
23331
|
+
type: Array,
|
23332
|
+
required: true
|
23333
|
+
},
|
23334
|
+
confirm: {
|
23335
|
+
type: Boolean,
|
23336
|
+
default: false
|
23337
|
+
}
|
23338
|
+
};
|
23339
|
+
var TimePanel = defineComponent({
|
23340
|
+
name: "TimePickerPanel",
|
23341
|
+
props: __spreadValues(__spreadValues(__spreadValues({}, datePickerProps), timePanelProps), timeProps),
|
23342
|
+
emits: ["pick", "pick-click"],
|
23343
|
+
setup(props2, {
|
23344
|
+
emit
|
23345
|
+
}) {
|
23346
|
+
const state = reactive({
|
23347
|
+
date: props2.value[0] || initTime(),
|
23348
|
+
showDate: false
|
23349
|
+
});
|
23350
|
+
const parentProvide = inject(timePickerKey);
|
23351
|
+
const timeSpinnerRef = ref(null);
|
23352
|
+
const showSeconds = computed(() => !(props2.format || "").match(/mm$/));
|
23353
|
+
const visibleDate = computed(() => fecha.format(parentProvide.panelDate, props2.format));
|
23354
|
+
const timeSlots = computed(() => {
|
23355
|
+
if (!props2.value[0]) {
|
23356
|
+
return [];
|
23357
|
+
}
|
23358
|
+
return ["getHours", "getMinutes", "getSeconds"].map((slot) => state.date[slot]());
|
23359
|
+
});
|
23360
|
+
const disabledHMS = computed(() => {
|
23361
|
+
const disabledTypes = ["disabledHours", "disabledMinutes", "disabledSeconds"];
|
23362
|
+
if (props2.disabledDate === (() => !props2.value[0])) {
|
23363
|
+
const disabled2 = disabledTypes.reduce((obj, type) => {
|
23364
|
+
obj[type] = this[type];
|
23365
|
+
return obj;
|
23366
|
+
}, {});
|
23367
|
+
return disabled2;
|
23368
|
+
}
|
23369
|
+
const slots = [24, 60, 60];
|
23370
|
+
const disabled = ["Hours", "Minutes", "Seconds"].map((type) => props2[`disabled${type}`]);
|
23371
|
+
const disabledHMS2 = disabled.map((preDisabled, j2) => {
|
23372
|
+
const slot = slots[j2];
|
23373
|
+
const toDisable = preDisabled;
|
23374
|
+
for (let i2 = 0; i2 < slot; i2 += props2.steps[j2] || 1) {
|
23375
|
+
const hms = timeSlots.value.map((slot2, x2) => x2 === j2 ? i2 : slot2);
|
23376
|
+
const testDateTime = mergeDateHMS(state.date, ...hms);
|
23377
|
+
if (props2.disabledDate(testDateTime, true)) {
|
23378
|
+
toDisable.push(i2);
|
23379
|
+
}
|
23380
|
+
}
|
23381
|
+
return toDisable.filter((el, i2, arr) => arr.indexOf(el) === i2);
|
23382
|
+
});
|
23383
|
+
return disabledTypes.reduce((obj, type, i2) => {
|
23384
|
+
obj[type] = disabledHMS2[i2];
|
23385
|
+
return obj;
|
23386
|
+
}, {});
|
23387
|
+
});
|
23388
|
+
watch(() => props2.value, (dates) => {
|
23389
|
+
let newVal = dates[0] || initTime();
|
23390
|
+
newVal = new Date(newVal);
|
23391
|
+
state.date = newVal;
|
23392
|
+
});
|
23393
|
+
onMounted(() => {
|
23394
|
+
if (parentProvide && parentProvide.parentName === "DatePanel") {
|
23395
|
+
state.showDate = true;
|
23396
|
+
}
|
23397
|
+
});
|
23398
|
+
function handleChange(date, isEmit = true) {
|
23399
|
+
const newDate = new Date(state.date);
|
23400
|
+
Object.keys(date).forEach((type) => newDate[`set${capitalize(type)}`](date[type]));
|
23401
|
+
if (isEmit) {
|
23402
|
+
emit("pick", newDate, true, "time");
|
23403
|
+
}
|
23404
|
+
}
|
23405
|
+
function handlePickClick() {
|
23406
|
+
emit("pick-click");
|
23407
|
+
}
|
23408
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
23409
|
+
visibleDate,
|
23410
|
+
showSeconds,
|
23411
|
+
timeSlots,
|
23412
|
+
disabledHMS,
|
23413
|
+
timeSpinnerRef,
|
23414
|
+
handlePickClick,
|
23415
|
+
handleChange
|
23416
|
+
});
|
23417
|
+
},
|
23418
|
+
render() {
|
23419
|
+
return createVNode("div", {
|
23420
|
+
"class": "bk-picker-panel-body-wrapper",
|
23421
|
+
"onMousedown": (e) => {
|
23422
|
+
e.preventDefault();
|
23423
|
+
}
|
23424
|
+
}, [createVNode("div", {
|
23425
|
+
"class": "bk-picker-panel-body",
|
23426
|
+
"style": {
|
23427
|
+
width: `${this.width}px`
|
23428
|
+
}
|
23429
|
+
}, [this.showDate ? createVNode("div", {
|
23430
|
+
"class": "bk-time-picker-header"
|
23431
|
+
}, [this.visibleDate]) : "", createVNode("div", {
|
23432
|
+
"class": "bk-picker-panel-content"
|
23433
|
+
}, [createVNode(TimeSpinner, {
|
23434
|
+
"ref": "timeSpinnerRef",
|
23435
|
+
"showSeconds": this.showSeconds,
|
23436
|
+
"steps": this.steps,
|
23437
|
+
"hours": this.timeSlots[0],
|
23438
|
+
"minutes": this.timeSlots[1],
|
23439
|
+
"seconds": this.timeSlots[2],
|
23440
|
+
"disabledHours": this.disabledHMS.disabledHours,
|
23441
|
+
"disabledMinutes": this.disabledHMS.disabledMinutes,
|
23442
|
+
"disabledSeconds": this.disabledHMS.disabledSeconds,
|
23443
|
+
"hideDisabledOptions": this.hideDisabledOptions,
|
23444
|
+
"onPick-click": this.handlePickClick,
|
23445
|
+
"onChange": this.handleChange
|
23446
|
+
}, null)])])]);
|
23447
|
+
}
|
23448
|
+
});
|
22765
23449
|
const datePanelProps = {
|
22766
23450
|
modelValue: {
|
22767
23451
|
type: [Date, String, Number, Array]
|
@@ -22808,11 +23492,20 @@ const datePanelProps = {
|
|
22808
23492
|
showTime: {
|
22809
23493
|
type: Boolean,
|
22810
23494
|
default: false
|
23495
|
+
},
|
23496
|
+
format: {
|
23497
|
+
type: String,
|
23498
|
+
default: "yyyy-MM-dd"
|
23499
|
+
},
|
23500
|
+
disabledDate: {
|
23501
|
+
type: Function,
|
23502
|
+
default: () => false
|
22811
23503
|
}
|
22812
23504
|
};
|
22813
23505
|
var DatePanel = defineComponent({
|
23506
|
+
name: "DatePanel",
|
22814
23507
|
props: datePanelProps,
|
22815
|
-
emits: ["pick", "pick-success", "pick-clear"],
|
23508
|
+
emits: ["pick", "pick-success", "pick-clear", "pick-click", "selection-mode-change"],
|
22816
23509
|
setup(props2, {
|
22817
23510
|
slots,
|
22818
23511
|
emit
|
@@ -22825,6 +23518,30 @@ var DatePanel = defineComponent({
|
|
22825
23518
|
dates,
|
22826
23519
|
panelDate: props2.startDate || dates[0] || new Date()
|
22827
23520
|
});
|
23521
|
+
const {
|
23522
|
+
proxy
|
23523
|
+
} = getCurrentInstance();
|
23524
|
+
provide(timePickerKey, {
|
23525
|
+
panelDate: state.panelDate,
|
23526
|
+
parentName: proxy.$options.name
|
23527
|
+
});
|
23528
|
+
const timePickerRef = ref(null);
|
23529
|
+
const timeSpinnerRef = ref(null);
|
23530
|
+
const timeSpinnerEndRef = ref(null);
|
23531
|
+
watch(() => state.currentView, (val) => {
|
23532
|
+
console.error(11111, val);
|
23533
|
+
emit("selection-mode-change", val);
|
23534
|
+
if (state.currentView === "time") {
|
23535
|
+
nextTick(() => {
|
23536
|
+
const spinner2 = timePickerRef.value.timeSpinnerRef;
|
23537
|
+
spinner2.updateScroll();
|
23538
|
+
});
|
23539
|
+
}
|
23540
|
+
});
|
23541
|
+
watch(() => props2.selectionMode, (type) => {
|
23542
|
+
state.currentView = type;
|
23543
|
+
state.pickerTable = getTableType(type);
|
23544
|
+
});
|
22828
23545
|
const resetView = () => {
|
22829
23546
|
setTimeout(() => {
|
22830
23547
|
state.currentView = props2.selectionMode;
|
@@ -22883,13 +23600,11 @@ var DatePanel = defineComponent({
|
|
22883
23600
|
const changeMonth = (dir) => {
|
22884
23601
|
state.panelDate = siblingMonth(state.panelDate, dir);
|
22885
23602
|
};
|
22886
|
-
const timeSpinner = ref(null);
|
22887
|
-
const timeSpinnerEnd = ref(null);
|
22888
23603
|
const onToggleVisibility = (open) => {
|
22889
23604
|
var _a, _b;
|
22890
23605
|
if (open) {
|
22891
|
-
(_a =
|
22892
|
-
(_b =
|
23606
|
+
(_a = timeSpinnerRef == null ? void 0 : timeSpinnerRef.value) == null ? void 0 : _a.updateScroll();
|
23607
|
+
(_b = timeSpinnerEndRef == null ? void 0 : timeSpinnerEndRef.value) == null ? void 0 : _b.updateScroll();
|
22893
23608
|
}
|
22894
23609
|
};
|
22895
23610
|
const panelPickerHandlers = computed(() => state.pickerTable === `${state.currentView}-table` ? handlePick : handlePreSelection);
|
@@ -22920,6 +23635,10 @@ var DatePanel = defineComponent({
|
|
22920
23635
|
state.currentView = state.currentView === "time" ? "date" : "time";
|
22921
23636
|
};
|
22922
23637
|
const hasShortcuts = computed(() => !!slots.shortcuts);
|
23638
|
+
const timeDisabled = computed(() => !state.dates[0]);
|
23639
|
+
function handlePickClick() {
|
23640
|
+
emit("pick-click");
|
23641
|
+
}
|
22923
23642
|
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
22924
23643
|
panelPickerHandlers,
|
22925
23644
|
datePanelLabel,
|
@@ -22931,10 +23650,14 @@ var DatePanel = defineComponent({
|
|
22931
23650
|
reset: reset2,
|
22932
23651
|
isTime,
|
22933
23652
|
hasShortcuts,
|
23653
|
+
timeDisabled,
|
22934
23654
|
onToggleVisibility,
|
22935
23655
|
handleToggleTime,
|
22936
23656
|
handlePickSuccess,
|
22937
|
-
handlePickClear
|
23657
|
+
handlePickClear,
|
23658
|
+
handlePick,
|
23659
|
+
handlePickClick,
|
23660
|
+
timePickerRef
|
22938
23661
|
});
|
22939
23662
|
},
|
22940
23663
|
render() {
|
@@ -23008,7 +23731,15 @@ var DatePanel = defineComponent({
|
|
23008
23731
|
default:
|
23009
23732
|
return null;
|
23010
23733
|
}
|
23011
|
-
})() :
|
23734
|
+
})() : createVNode(TimePanel, {
|
23735
|
+
"ref": "timePickerRef",
|
23736
|
+
"value": this.dates,
|
23737
|
+
"format": this.format,
|
23738
|
+
"disabledDate": this.disabledDate,
|
23739
|
+
"onPick": this.handlePick,
|
23740
|
+
"onPick-clear": this.handlePickClear,
|
23741
|
+
"onPick-success": this.handlePickSuccess
|
23742
|
+
}, null)]), this.confirm ? createVNode(Confirm, {
|
23012
23743
|
"clearable": this.clearable,
|
23013
23744
|
"showTime": this.showTime,
|
23014
23745
|
"isTime": this.isTime,
|
@@ -23430,153 +24161,6 @@ var DateRangePanel = defineComponent({
|
|
23430
24161
|
}, [(_c = (_b = (_a = this.$slots).shortcuts) == null ? void 0 : _b.call(_a)) != null ? _c : null]) : null]);
|
23431
24162
|
}
|
23432
24163
|
});
|
23433
|
-
const datePickerProps = {
|
23434
|
-
type: {
|
23435
|
-
type: String,
|
23436
|
-
default: "date",
|
23437
|
-
validator(value) {
|
23438
|
-
const validList = ["year", "month", "date", "daterange", "datetime", "datetimerange", "time", "timerange"];
|
23439
|
-
if (validList.indexOf(value) < 0) {
|
23440
|
-
console.error(`type property is not valid: '${value}'`);
|
23441
|
-
return false;
|
23442
|
-
}
|
23443
|
-
return true;
|
23444
|
-
}
|
23445
|
-
},
|
23446
|
-
extPopoverCls: {
|
23447
|
-
type: String,
|
23448
|
-
default: ""
|
23449
|
-
},
|
23450
|
-
format: String,
|
23451
|
-
readonly: {
|
23452
|
-
type: Boolean,
|
23453
|
-
default: false
|
23454
|
-
},
|
23455
|
-
disabled: {
|
23456
|
-
type: Boolean,
|
23457
|
-
default: false
|
23458
|
-
},
|
23459
|
-
editable: {
|
23460
|
-
type: Boolean,
|
23461
|
-
default: true
|
23462
|
-
},
|
23463
|
-
clearable: {
|
23464
|
-
type: Boolean,
|
23465
|
-
default: true
|
23466
|
-
},
|
23467
|
-
open: {
|
23468
|
-
type: Boolean,
|
23469
|
-
default: null
|
23470
|
-
},
|
23471
|
-
multiple: {
|
23472
|
-
type: Boolean,
|
23473
|
-
default: false
|
23474
|
-
},
|
23475
|
-
timePickerOptions: {
|
23476
|
-
type: Object,
|
23477
|
-
default: () => ({})
|
23478
|
-
},
|
23479
|
-
splitPanels: {
|
23480
|
-
type: Boolean,
|
23481
|
-
default: true
|
23482
|
-
},
|
23483
|
-
startDate: Date,
|
23484
|
-
placeholder: {
|
23485
|
-
type: String,
|
23486
|
-
default: ""
|
23487
|
-
},
|
23488
|
-
placement: {
|
23489
|
-
type: String,
|
23490
|
-
default: "bottom-start",
|
23491
|
-
validator: (value) => {
|
23492
|
-
const validList = [
|
23493
|
-
"top",
|
23494
|
-
"top-start",
|
23495
|
-
"top-end",
|
23496
|
-
"bottom",
|
23497
|
-
"bottom-start",
|
23498
|
-
"bottom-end",
|
23499
|
-
"left",
|
23500
|
-
"left-start",
|
23501
|
-
"left-end",
|
23502
|
-
"right",
|
23503
|
-
"right-start",
|
23504
|
-
"right-end"
|
23505
|
-
];
|
23506
|
-
if (validList.indexOf(value) < 0) {
|
23507
|
-
console.error(`placement property is not valid: '${value}'`);
|
23508
|
-
return false;
|
23509
|
-
}
|
23510
|
-
return true;
|
23511
|
-
}
|
23512
|
-
},
|
23513
|
-
transfer: {
|
23514
|
-
type: Boolean,
|
23515
|
-
default: false
|
23516
|
-
},
|
23517
|
-
appendToBody: {
|
23518
|
-
type: Boolean,
|
23519
|
-
default: false
|
23520
|
-
},
|
23521
|
-
shortcuts: {
|
23522
|
-
type: Array,
|
23523
|
-
default: () => []
|
23524
|
-
},
|
23525
|
-
shortcutClose: {
|
23526
|
-
type: Boolean,
|
23527
|
-
default: false
|
23528
|
-
},
|
23529
|
-
modelValue: {
|
23530
|
-
type: [Date, String, Number, Array]
|
23531
|
-
},
|
23532
|
-
value: {
|
23533
|
-
type: [Date, String, Number, Array]
|
23534
|
-
},
|
23535
|
-
options: {
|
23536
|
-
type: Object,
|
23537
|
-
default: () => ({})
|
23538
|
-
},
|
23539
|
-
fontSize: {
|
23540
|
-
type: String,
|
23541
|
-
default: "normal"
|
23542
|
-
},
|
23543
|
-
upToNow: {
|
23544
|
-
type: Boolean,
|
23545
|
-
default: false
|
23546
|
-
},
|
23547
|
-
useShortcutText: {
|
23548
|
-
type: Boolean,
|
23549
|
-
default: false
|
23550
|
-
},
|
23551
|
-
shortcutSelectedIndex: {
|
23552
|
-
type: Number,
|
23553
|
-
default: -1
|
23554
|
-
},
|
23555
|
-
headerSlotCls: {
|
23556
|
-
type: String,
|
23557
|
-
default: ""
|
23558
|
-
},
|
23559
|
-
footerSlotCls: {
|
23560
|
-
type: String,
|
23561
|
-
default: ""
|
23562
|
-
},
|
23563
|
-
allowCrossDay: {
|
23564
|
-
type: Boolean,
|
23565
|
-
default: false
|
23566
|
-
},
|
23567
|
-
behavior: {
|
23568
|
-
type: String,
|
23569
|
-
default: "normal",
|
23570
|
-
validator(v2) {
|
23571
|
-
return ["simplicity", "normal"].indexOf(v2) > -1;
|
23572
|
-
}
|
23573
|
-
},
|
23574
|
-
disableDate: Function,
|
23575
|
-
withValidate: {
|
23576
|
-
type: Boolean,
|
23577
|
-
default: true
|
23578
|
-
}
|
23579
|
-
};
|
23580
24164
|
var Component$9 = defineComponent({
|
23581
24165
|
name: "DatePicker",
|
23582
24166
|
directives: {
|
@@ -23691,6 +24275,7 @@ var Component$9 = defineComponent({
|
|
23691
24275
|
}
|
23692
24276
|
return !props2.editable || props2.readonly;
|
23693
24277
|
});
|
24278
|
+
const ownPickerProps = computed(() => props2.options);
|
23694
24279
|
const allowCrossDayProp = computed(() => panel.value === "RangeTimePickerPanel" ? props2.allowCrossDay : false);
|
23695
24280
|
const inputRef = ref(null);
|
23696
24281
|
const inputFocus = () => {
|
@@ -23893,11 +24478,6 @@ var Component$9 = defineComponent({
|
|
23893
24478
|
state.shortcut = null;
|
23894
24479
|
setTimeout(() => onSelectionModeChange(props2.type), 500);
|
23895
24480
|
};
|
23896
|
-
const handleTransferClick = () => {
|
23897
|
-
if (props2.appendToBody) {
|
23898
|
-
state.disableCloseUnderTransfer = true;
|
23899
|
-
}
|
23900
|
-
};
|
23901
24481
|
const onPickSuccess = () => {
|
23902
24482
|
var _a;
|
23903
24483
|
state.visible = false;
|
@@ -23953,6 +24533,7 @@ var Component$9 = defineComponent({
|
|
23953
24533
|
longWidthCls,
|
23954
24534
|
localReadonly,
|
23955
24535
|
allowCrossDayProp,
|
24536
|
+
ownPickerProps,
|
23956
24537
|
pickerDropdownRef,
|
23957
24538
|
inputRef,
|
23958
24539
|
triggerRef,
|
@@ -23966,7 +24547,6 @@ var Component$9 = defineComponent({
|
|
23966
24547
|
handleKeydown,
|
23967
24548
|
handleInputChange,
|
23968
24549
|
handleClear,
|
23969
|
-
handleTransferClick,
|
23970
24550
|
onPick,
|
23971
24551
|
onPickSuccess
|
23972
24552
|
});
|
@@ -24041,7 +24621,9 @@ var Component$9 = defineComponent({
|
|
24041
24621
|
const shortcutsSlot = this.hasShortcuts ? {
|
24042
24622
|
shortcuts: () => {
|
24043
24623
|
var _a2, _b2;
|
24044
|
-
return ((_b2 = (_a2 = this.$slots).shortcuts) == null ? void 0 : _b2.call(_a2
|
24624
|
+
return ((_b2 = (_a2 = this.$slots).shortcuts) == null ? void 0 : _b2.call(_a2, {
|
24625
|
+
change: this.onPick
|
24626
|
+
})) || null;
|
24045
24627
|
}
|
24046
24628
|
} : {};
|
24047
24629
|
return withDirectives(createVNode("div", {
|
@@ -24064,8 +24646,7 @@ var Component$9 = defineComponent({
|
|
24064
24646
|
"triggerRef": this.triggerRef,
|
24065
24647
|
"placement": this.placement,
|
24066
24648
|
"extPopoverCls": this.extPopoverCls,
|
24067
|
-
"appendToBody": this.appendToBody
|
24068
|
-
"onClick": this.handleTransferClick
|
24649
|
+
"appendToBody": this.appendToBody
|
24069
24650
|
}, {
|
24070
24651
|
default: () => {
|
24071
24652
|
var _a2, _b2, _c2, _d, _e, _f;
|
@@ -24082,7 +24663,8 @@ var Component$9 = defineComponent({
|
|
24082
24663
|
"disableDate": this.disableDate,
|
24083
24664
|
"focusedDate": this.focusedDate,
|
24084
24665
|
"onPick": this.onPick,
|
24085
|
-
"onPick-success": this.onPickSuccess
|
24666
|
+
"onPick-success": this.onPickSuccess,
|
24667
|
+
"onSelection-mode-change": this.onSelectionModeChange
|
24086
24668
|
}, shortcutsSlot) : createVNode(DatePanel, {
|
24087
24669
|
"ref": "pickerPanelRef",
|
24088
24670
|
"clearable": this.clearable,
|
@@ -24098,7 +24680,539 @@ var Component$9 = defineComponent({
|
|
24098
24680
|
"focusedDate": this.focusedDate,
|
24099
24681
|
"onPick": this.onPick,
|
24100
24682
|
"onPick-clear": this.handleClear,
|
24101
|
-
"onPick-success": this.onPickSuccess
|
24683
|
+
"onPick-success": this.onPickSuccess,
|
24684
|
+
"onSelection-mode-change": this.onSelectionModeChange
|
24685
|
+
}, shortcutsSlot), this.hasFooter ? createVNode("div", {
|
24686
|
+
"class": ["bk-date-picker-footer-wrapper", this.footerSlotCls]
|
24687
|
+
}, [(_f = (_e = (_d = this.$slots).footer) == null ? void 0 : _e.call(_d)) != null ? _f : null]) : null];
|
24688
|
+
}
|
24689
|
+
}), [[vShow, this.opened]])]
|
24690
|
+
})]
|
24691
|
+
})]), [[resolveDirective("clickoutside"), this.handleClose]]);
|
24692
|
+
}
|
24693
|
+
});
|
24694
|
+
var TimePicker = defineComponent({
|
24695
|
+
name: "TimePicker",
|
24696
|
+
directives: {
|
24697
|
+
clickoutside: ClickOutside
|
24698
|
+
},
|
24699
|
+
props: __spreadValues(__spreadValues(__spreadValues({}, datePickerProps), timePickerProps), timePanelProps),
|
24700
|
+
emits: ["open-change", "input", "change", "update:modelValue", "clear", "shortcut-change", "pick-success"],
|
24701
|
+
slots: ["header"],
|
24702
|
+
setup(props2, {
|
24703
|
+
slots,
|
24704
|
+
emit
|
24705
|
+
}) {
|
24706
|
+
const formItem = useFormItem();
|
24707
|
+
const isRange = props2.type.includes("range");
|
24708
|
+
const emptyArray = isRange ? [null, null] : [null];
|
24709
|
+
let initialValue = isAllEmptyArr((isRange ? props2.modelValue : [props2.modelValue]) || []) ? emptyArray : parseDate(props2.modelValue, props2.type, props2.multiple, props2.format);
|
24710
|
+
let shortcut = null;
|
24711
|
+
if (props2.shortcutSelectedIndex !== -1) {
|
24712
|
+
shortcut = props2.shortcuts[props2.shortcutSelectedIndex] || null;
|
24713
|
+
if (shortcut) {
|
24714
|
+
initialValue = shortcut.value();
|
24715
|
+
}
|
24716
|
+
}
|
24717
|
+
const state = reactive({
|
24718
|
+
showClose: false,
|
24719
|
+
visible: false,
|
24720
|
+
internalValue: initialValue,
|
24721
|
+
disableClickOutSide: false,
|
24722
|
+
disableCloseUnderTransfer: false,
|
24723
|
+
selectionMode: "date",
|
24724
|
+
forceInputRerender: 1,
|
24725
|
+
isFocused: false,
|
24726
|
+
focusedDate: initialValue[0] || props2.startDate || new Date(),
|
24727
|
+
focusedTime: {
|
24728
|
+
column: 0,
|
24729
|
+
picker: 0,
|
24730
|
+
time: initialValue.map(extractTime),
|
24731
|
+
active: false
|
24732
|
+
},
|
24733
|
+
internalFocus: false,
|
24734
|
+
timeEnterMode: true,
|
24735
|
+
shortcut,
|
24736
|
+
onSelectionModeChange
|
24737
|
+
});
|
24738
|
+
function onSelectionModeChange(_type) {
|
24739
|
+
let type = _type;
|
24740
|
+
if (_type.match(/^date/)) {
|
24741
|
+
type = "date";
|
24742
|
+
}
|
24743
|
+
state.selectionMode = ["year", "month", "date", "time"].indexOf(type) > -1 && type;
|
24744
|
+
return state.selectionMode;
|
24745
|
+
}
|
24746
|
+
const publicVModelValue = computed(() => {
|
24747
|
+
if (props2.multiple) {
|
24748
|
+
return state.internalValue.slice();
|
24749
|
+
}
|
24750
|
+
const isRange2 = props2.type.includes("range");
|
24751
|
+
let val = state.internalValue.map((date) => date instanceof Date ? new Date(date) : date || "");
|
24752
|
+
if (props2.type.match(/^time/)) {
|
24753
|
+
val = val.map((v2) => formatDate(v2, props2.type, props2.multiple, props2.format));
|
24754
|
+
}
|
24755
|
+
return isRange2 || props2.multiple ? val : val[0];
|
24756
|
+
});
|
24757
|
+
const publicStringValue = computed(() => {
|
24758
|
+
if (props2.type.match(/^time/)) {
|
24759
|
+
return publicVModelValue.value;
|
24760
|
+
}
|
24761
|
+
if (props2.multiple) {
|
24762
|
+
return formatDate(publicVModelValue.value, props2.type, props2.multiple, props2.format);
|
24763
|
+
}
|
24764
|
+
return Array.isArray(publicVModelValue.value) ? publicVModelValue.value.map((v2) => formatDate(v2, props2.type, props2.multiple, props2.format)) : formatDate(publicVModelValue.value, props2.type, props2.multiple, props2.format);
|
24765
|
+
});
|
24766
|
+
const panel = computed(() => {
|
24767
|
+
const isRange2 = props2.type === "timerange";
|
24768
|
+
return isRange2 ? "RangeTimePickerPanel" : "TimePickerPanel";
|
24769
|
+
});
|
24770
|
+
const opened = computed(() => props2.open === null ? state.visible : props2.open);
|
24771
|
+
const visualValue = computed(() => formatDate(state.internalValue, props2.type, props2.multiple, props2.format));
|
24772
|
+
const displayValue = computed(() => {
|
24773
|
+
var _a;
|
24774
|
+
if (((_a = state.shortcut) == null ? void 0 : _a.text) && props2.useShortcutText) {
|
24775
|
+
return state.shortcut.text;
|
24776
|
+
}
|
24777
|
+
return visualValue.value;
|
24778
|
+
});
|
24779
|
+
const isConfirm = computed(() => !!slots.trigger || props2.type === "datetime" || props2.type === "datetimerange" || props2.multiple);
|
24780
|
+
const hasHeader = computed(() => !!slots.header);
|
24781
|
+
const hasFooter = computed(() => !!slots.footer);
|
24782
|
+
const hasShortcuts = computed(() => !!slots.shortcuts);
|
24783
|
+
const fontSizeCls = computed(() => {
|
24784
|
+
let cls = "";
|
24785
|
+
if (props2.fontSize === "medium") {
|
24786
|
+
cls = "medium-font";
|
24787
|
+
} else if (props2.fontSize === "large") {
|
24788
|
+
cls = "large-font";
|
24789
|
+
}
|
24790
|
+
return cls;
|
24791
|
+
});
|
24792
|
+
const longWidthCls = computed(() => {
|
24793
|
+
let cls = "";
|
24794
|
+
if (props2.fontSize === "medium") {
|
24795
|
+
cls = "medium-width";
|
24796
|
+
} else if (props2.fontSize === "large") {
|
24797
|
+
cls = "large-width";
|
24798
|
+
}
|
24799
|
+
return cls;
|
24800
|
+
});
|
24801
|
+
const localReadonly = computed(() => {
|
24802
|
+
var _a;
|
24803
|
+
if (((_a = state.shortcut) == null ? void 0 : _a.text) && props2.useShortcutText) {
|
24804
|
+
return true;
|
24805
|
+
}
|
24806
|
+
return !props2.editable || props2.readonly;
|
24807
|
+
});
|
24808
|
+
const ownPickerProps = computed(() => ({
|
24809
|
+
disabledHours: props2.disabledHours,
|
24810
|
+
disabledMinutes: props2.disabledMinutes,
|
24811
|
+
disabledSeconds: props2.disabledSeconds,
|
24812
|
+
hideDisabledOptions: props2.hideDisabledOptions
|
24813
|
+
}));
|
24814
|
+
const allowCrossDayProp = computed(() => panel.value === "RangeTimePickerPanel" ? props2.allowCrossDay : false);
|
24815
|
+
const inputRef = ref(null);
|
24816
|
+
const inputFocus = () => {
|
24817
|
+
var _a;
|
24818
|
+
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.focus();
|
24819
|
+
};
|
24820
|
+
const {
|
24821
|
+
proxy
|
24822
|
+
} = getCurrentInstance();
|
24823
|
+
watch(() => state.visible, (visible) => {
|
24824
|
+
if (visible) {
|
24825
|
+
nextTick(() => {
|
24826
|
+
const spinners = findChildComponents(proxy, "TimeSpinner");
|
24827
|
+
spinners.forEach((instance) => instance.updateScroll());
|
24828
|
+
});
|
24829
|
+
}
|
24830
|
+
});
|
24831
|
+
const pickerDropdownRef = ref(null);
|
24832
|
+
watch(() => props2.modelValue, (modelValue) => {
|
24833
|
+
var _a;
|
24834
|
+
state.internalValue = parseDate(modelValue, props2.type, props2.multiple, props2.format);
|
24835
|
+
if (props2.withValidate) {
|
24836
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
|
24837
|
+
}
|
24838
|
+
});
|
24839
|
+
watch(() => props2.open, (open) => {
|
24840
|
+
state.visible = open === true;
|
24841
|
+
});
|
24842
|
+
watch(() => props2.type, (type) => {
|
24843
|
+
onSelectionModeChange(type);
|
24844
|
+
});
|
24845
|
+
watch(() => publicVModelValue, (now, before) => {
|
24846
|
+
const newValue = JSON.stringify(now);
|
24847
|
+
const oldValue = JSON.stringify(before);
|
24848
|
+
const shouldEmitInput = newValue !== oldValue || typeof now !== typeof before;
|
24849
|
+
if (shouldEmitInput) {
|
24850
|
+
emit("input", now);
|
24851
|
+
}
|
24852
|
+
});
|
24853
|
+
onMounted(() => {
|
24854
|
+
if (props2.type.indexOf("date") > -1) {
|
24855
|
+
state.timeEnterMode = true;
|
24856
|
+
} else {
|
24857
|
+
state.timeEnterMode = true;
|
24858
|
+
}
|
24859
|
+
const initialValue2 = props2.modelValue;
|
24860
|
+
const parsedValue = publicVModelValue.value;
|
24861
|
+
if (typeof initialValue2 !== typeof parsedValue || JSON.stringify(initialValue2) !== JSON.stringify(parsedValue)) {
|
24862
|
+
emit("input", publicVModelValue.value);
|
24863
|
+
}
|
24864
|
+
if (props2.open !== null) {
|
24865
|
+
state.visible = props2.open;
|
24866
|
+
}
|
24867
|
+
provide(datePickerKey, {
|
24868
|
+
props: props2,
|
24869
|
+
focus: () => inputFocus()
|
24870
|
+
});
|
24871
|
+
});
|
24872
|
+
const pickerPanelRef = ref(null);
|
24873
|
+
const handleClose = (e) => {
|
24874
|
+
var _a;
|
24875
|
+
if (state.disableCloseUnderTransfer) {
|
24876
|
+
state.disableCloseUnderTransfer = false;
|
24877
|
+
return false;
|
24878
|
+
}
|
24879
|
+
if (e && e.type === "mousedown" && state.visible) {
|
24880
|
+
e.preventDefault();
|
24881
|
+
e.stopPropagation();
|
24882
|
+
return;
|
24883
|
+
}
|
24884
|
+
if (state.visible) {
|
24885
|
+
const pickerPanel = (_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.$el;
|
24886
|
+
if (e && pickerPanel && pickerPanel.contains(e.target)) {
|
24887
|
+
return;
|
24888
|
+
}
|
24889
|
+
state.visible = false;
|
24890
|
+
e == null ? void 0 : e.preventDefault();
|
24891
|
+
e == null ? void 0 : e.stopPropagation();
|
24892
|
+
return;
|
24893
|
+
}
|
24894
|
+
state.isFocused = false;
|
24895
|
+
state.disableClickOutSide = false;
|
24896
|
+
};
|
24897
|
+
const handleIconClick = () => {
|
24898
|
+
var _a, _b;
|
24899
|
+
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.focus();
|
24900
|
+
(_b = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _b.click();
|
24901
|
+
};
|
24902
|
+
const handleInputMouseenter = () => {
|
24903
|
+
if (props2.readonly || props2.disabled) {
|
24904
|
+
return;
|
24905
|
+
}
|
24906
|
+
if (visualValue == null ? void 0 : visualValue.value) {
|
24907
|
+
state.showClose = true;
|
24908
|
+
}
|
24909
|
+
};
|
24910
|
+
const handleInputMouseleave = (_e) => {
|
24911
|
+
state.showClose = false;
|
24912
|
+
};
|
24913
|
+
const emitChange = (type) => {
|
24914
|
+
nextTick(() => {
|
24915
|
+
var _a;
|
24916
|
+
emit("change", publicStringValue.value, type);
|
24917
|
+
emit("update:modelValue", publicVModelValue.value);
|
24918
|
+
if (props2.type.indexOf("time") < 0) {
|
24919
|
+
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.blur();
|
24920
|
+
}
|
24921
|
+
});
|
24922
|
+
};
|
24923
|
+
const handleInputChange = (e) => {
|
24924
|
+
var _a;
|
24925
|
+
const isArrayValue = props2.type.includes("range") || props2.multiple;
|
24926
|
+
const oldValue = visualValue.value;
|
24927
|
+
const newValue = e.target.value;
|
24928
|
+
const newDate = parseDate(newValue, props2.type, props2.multiple, props2.format);
|
24929
|
+
const valueToTest = isArrayValue ? newDate : newDate[0];
|
24930
|
+
const isDisabled = (_a = props2.disableDate) == null ? void 0 : _a.call(props2, valueToTest);
|
24931
|
+
const isValidDate = newDate.reduce((valid, date) => valid && date instanceof Date, true);
|
24932
|
+
if (newValue !== oldValue && !isDisabled && isValidDate) {
|
24933
|
+
emitChange(props2.type);
|
24934
|
+
state.internalValue = newDate;
|
24935
|
+
} else {
|
24936
|
+
state.forceInputRerender = state.forceInputRerender + 1;
|
24937
|
+
}
|
24938
|
+
};
|
24939
|
+
const handleFocus = (e) => {
|
24940
|
+
if (props2.readonly) {
|
24941
|
+
return;
|
24942
|
+
}
|
24943
|
+
state.isFocused = true;
|
24944
|
+
if (e && e.type === "focus") {
|
24945
|
+
return;
|
24946
|
+
}
|
24947
|
+
if (!props2.disabled) {
|
24948
|
+
state.visible = true;
|
24949
|
+
}
|
24950
|
+
};
|
24951
|
+
const reset2 = () => {
|
24952
|
+
var _a;
|
24953
|
+
(_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.reset();
|
24954
|
+
};
|
24955
|
+
const handleBlur = (e) => {
|
24956
|
+
var _a, _b;
|
24957
|
+
if (state.internalFocus) {
|
24958
|
+
state.internalFocus = false;
|
24959
|
+
return;
|
24960
|
+
}
|
24961
|
+
if (state.visible) {
|
24962
|
+
e.preventDefault();
|
24963
|
+
return;
|
24964
|
+
}
|
24965
|
+
state.isFocused = false;
|
24966
|
+
onSelectionModeChange(props2.type);
|
24967
|
+
state.internalValue = state.internalValue.slice();
|
24968
|
+
reset2();
|
24969
|
+
(_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.onToggleVisibility(false);
|
24970
|
+
(_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur");
|
24971
|
+
};
|
24972
|
+
const handleKeydown = (e) => {
|
24973
|
+
const {
|
24974
|
+
keyCode
|
24975
|
+
} = e;
|
24976
|
+
if (keyCode === 9) {
|
24977
|
+
if (state.visible) {
|
24978
|
+
e.stopPropagation();
|
24979
|
+
e.preventDefault();
|
24980
|
+
if (isConfirm.value) {
|
24981
|
+
const selector = ".bk-picker-confirm > *";
|
24982
|
+
const tabbable = pickerDropdownRef.value.$el.querySelectorAll(selector);
|
24983
|
+
state.internalFocus = true;
|
24984
|
+
const element = [...tabbable][e.shiftKey ? "pop" : "shift"]();
|
24985
|
+
element.focus();
|
24986
|
+
} else {
|
24987
|
+
handleClose();
|
24988
|
+
}
|
24989
|
+
}
|
24990
|
+
}
|
24991
|
+
const arrows = [37, 38, 39, 40];
|
24992
|
+
if (!state.visible && arrows.includes(keyCode)) {
|
24993
|
+
state.visible = true;
|
24994
|
+
return;
|
24995
|
+
}
|
24996
|
+
if (keyCode === 27) {
|
24997
|
+
if (state.visible) {
|
24998
|
+
e.stopPropagation();
|
24999
|
+
handleClose();
|
25000
|
+
}
|
25001
|
+
}
|
25002
|
+
if (!arrows.includes(keyCode)) {
|
25003
|
+
return;
|
25004
|
+
}
|
25005
|
+
if (state.focusedTime.active) {
|
25006
|
+
e.preventDefault();
|
25007
|
+
}
|
25008
|
+
};
|
25009
|
+
const handleClear = () => {
|
25010
|
+
state.visible = false;
|
25011
|
+
state.internalValue = state.internalValue.map(() => null);
|
25012
|
+
emit("clear");
|
25013
|
+
emitChange(props2.type);
|
25014
|
+
reset2();
|
25015
|
+
state.showClose = false;
|
25016
|
+
state.shortcut = null;
|
25017
|
+
setTimeout(() => onSelectionModeChange(props2.type), 500);
|
25018
|
+
};
|
25019
|
+
const handleTransferClick = () => {
|
25020
|
+
if (props2.appendToBody) {
|
25021
|
+
state.disableCloseUnderTransfer = true;
|
25022
|
+
}
|
25023
|
+
};
|
25024
|
+
const onPickSuccess = () => {
|
25025
|
+
var _a;
|
25026
|
+
state.visible = false;
|
25027
|
+
nextTick(() => {
|
25028
|
+
emit("pick-success");
|
25029
|
+
});
|
25030
|
+
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.blur();
|
25031
|
+
reset2();
|
25032
|
+
};
|
25033
|
+
const onPick = (_dates, visible = false, type, shortcut2) => {
|
25034
|
+
let dates = _dates;
|
25035
|
+
if (props2.multiple) {
|
25036
|
+
const pickedTimeStamp = dates.getTime();
|
25037
|
+
const indexOfPickedDate = state.internalValue.findIndex((date) => date && date.getTime() === pickedTimeStamp);
|
25038
|
+
const allDates = [...state.internalValue, dates].filter(Boolean);
|
25039
|
+
const timeStamps = allDates.map((date) => date.getTime()).filter((ts, i2, arr) => arr.indexOf(ts) === i2 && i2 !== indexOfPickedDate);
|
25040
|
+
state.internalValue = timeStamps.map((ts) => new Date(ts));
|
25041
|
+
} else {
|
25042
|
+
dates = parseDate(_dates, props2.type, props2.multiple, props2.format);
|
25043
|
+
state.internalValue = Array.isArray(dates) ? dates : [dates];
|
25044
|
+
}
|
25045
|
+
if (state.internalValue[0]) {
|
25046
|
+
const [v2] = state.internalValue;
|
25047
|
+
state.focusedDate = v2;
|
25048
|
+
}
|
25049
|
+
state.focusedTime = __spreadProps(__spreadValues({}, state.focusedTime), {
|
25050
|
+
time: state.internalValue.map(extractTime)
|
25051
|
+
});
|
25052
|
+
if (!isConfirm.value) {
|
25053
|
+
onSelectionModeChange(props2.type);
|
25054
|
+
state.visible = visible;
|
25055
|
+
}
|
25056
|
+
if (type === "upToNow" && props2.type === "daterange") {
|
25057
|
+
onPickSuccess();
|
25058
|
+
}
|
25059
|
+
state.shortcut = shortcut2;
|
25060
|
+
emitChange(type);
|
25061
|
+
const shortcutIndex = props2.shortcuts.findIndex((item) => item === state.shortcut);
|
25062
|
+
emit("shortcut-change", state.shortcut, shortcutIndex);
|
25063
|
+
};
|
25064
|
+
const triggerRef = ref(null);
|
25065
|
+
console.error(panel);
|
25066
|
+
console.error(panel.value);
|
25067
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
25068
|
+
panel,
|
25069
|
+
publicStringValue,
|
25070
|
+
opened,
|
25071
|
+
visualValue,
|
25072
|
+
displayValue,
|
25073
|
+
isConfirm,
|
25074
|
+
hasHeader,
|
25075
|
+
hasFooter,
|
25076
|
+
hasShortcuts,
|
25077
|
+
fontSizeCls,
|
25078
|
+
longWidthCls,
|
25079
|
+
localReadonly,
|
25080
|
+
allowCrossDayProp,
|
25081
|
+
ownPickerProps,
|
25082
|
+
pickerDropdownRef,
|
25083
|
+
inputRef,
|
25084
|
+
triggerRef,
|
25085
|
+
pickerPanelRef,
|
25086
|
+
handleClose,
|
25087
|
+
handleIconClick,
|
25088
|
+
handleInputMouseenter,
|
25089
|
+
handleInputMouseleave,
|
25090
|
+
handleFocus,
|
25091
|
+
handleBlur,
|
25092
|
+
handleKeydown,
|
25093
|
+
handleInputChange,
|
25094
|
+
handleClear,
|
25095
|
+
handleTransferClick,
|
25096
|
+
onPick,
|
25097
|
+
onPickSuccess
|
25098
|
+
});
|
25099
|
+
},
|
25100
|
+
render() {
|
25101
|
+
var _a, _b, _c;
|
25102
|
+
const defaultTrigger = createVNode("div", null, [createVNode("span", {
|
25103
|
+
"class": ["icon-wrapper", this.disabled ? "disabled" : ""],
|
25104
|
+
"onClick": this.handleIconClick
|
25105
|
+
}, [this.type === "time" || this.type === "timerange" ? createVNode("svg", {
|
25106
|
+
"class": "picker-icon",
|
25107
|
+
"x": "0px",
|
25108
|
+
"y": "0px",
|
25109
|
+
"viewBox": "0 0 1024 1024"
|
25110
|
+
}, [createVNode("g", {
|
25111
|
+
"id": "time"
|
25112
|
+
}, [createVNode("path", {
|
25113
|
+
"fill": "#c4c6cc",
|
25114
|
+
"d": "M512,128c51.9,0,102.2,10.1,149.5,30.2c45.7,19.3,86.8,47,122.1,82.3s63,76.4,82.3,122.1c20,47.3,30.2,97.6,30.2,149.5S886,614.3,865.9,661.6c-19.3,45.7-47,86.8-82.3,122.1s-76.4,63-122.1,82.3c-47.3,20-97.6,30.2-149.5,30.2S409.8,886.1,362.5,866c-45.7-19.3-86.8-47-122.1-82.3s-63-76.4-82.3-122.1c-20-47.3-30.2-97.6-30.2-149.5s10.1-102.2,30.2-149.5c19.3-45.7,47-86.8,82.3-122.1s76.4-63,122.1-82.3C409.8,138.1,460.1,128,512,128 M512,64C264.6,64,64,264.6,64,512s200.6,448,448,448s448-200.6,448-448S759.4,64,512,64L512,64z"
|
25115
|
+
}, null), createVNode("polygon", {
|
25116
|
+
"fill": "#c4c6cc",
|
25117
|
+
"points": "512,512 512,256 448,256 448,512 448,576 512,576 768,576 768,512"
|
25118
|
+
}, null)])]) : createVNode("svg", {
|
25119
|
+
"class": "picker-icon",
|
25120
|
+
"x": "0px",
|
25121
|
+
"y": "0px",
|
25122
|
+
"viewBox": "0 0 1024 1024"
|
25123
|
+
}, [createVNode("g", {
|
25124
|
+
"id": "date"
|
25125
|
+
}, [createVNode("path", {
|
25126
|
+
"fill": "#c4c6cc",
|
25127
|
+
"d": "M896,128h-96v64h64v112H160V192h64v-64h-96c-17.7,0-32,14.3-32,32v736c0,17.7,14.3,32,32,32h768c17.7,0,32-14.3,32-32V160C928,142.3,913.7,128,896,128z M160,864V368h704v496H160z"
|
25128
|
+
}, null), createVNode("rect", {
|
25129
|
+
"x": "416",
|
25130
|
+
"y": "128",
|
25131
|
+
"fill": "#c4c6cc",
|
25132
|
+
"width": "192",
|
25133
|
+
"height": "64"
|
25134
|
+
}, null), createVNode("rect", {
|
25135
|
+
"x": "288",
|
25136
|
+
"y": "96",
|
25137
|
+
"fill": "#c4c6cc",
|
25138
|
+
"width": "64",
|
25139
|
+
"height": "128"
|
25140
|
+
}, null), createVNode("rect", {
|
25141
|
+
"x": "672",
|
25142
|
+
"y": "96",
|
25143
|
+
"fill": "#c4c6cc",
|
25144
|
+
"width": "64",
|
25145
|
+
"height": "128"
|
25146
|
+
}, null), createVNode("polygon", {
|
25147
|
+
"fill": "#c4c6cc",
|
25148
|
+
"points": "403.7,514.4 557.1,514.4 557.1,515.3 420.1,765.5 483.5,765.5 620.3,504.3 620.3,466.5 403.7,466.5"
|
25149
|
+
}, null)])])]), createVNode("input", {
|
25150
|
+
"type": "text",
|
25151
|
+
"class": ["bk-date-picker-editor", this.readonly ? "readonly" : "", this.fontSizeCls, this.behavior === "simplicity" ? "only-bottom-border" : ""],
|
25152
|
+
"ref": "inputRef",
|
25153
|
+
"key": this.forceInputRerender,
|
25154
|
+
"readonly": this.localReadonly,
|
25155
|
+
"disabled": this.disabled,
|
25156
|
+
"placeholder": this.placeholder,
|
25157
|
+
"value": this.displayValue,
|
25158
|
+
"onFocus": this.handleFocus,
|
25159
|
+
"onClick": this.handleFocus,
|
25160
|
+
"onBlur": this.handleBlur,
|
25161
|
+
"onKeydown": this.handleKeydown,
|
25162
|
+
"onChange": this.handleInputChange
|
25163
|
+
}, null), this.clearable && this.showClose ? createVNode(close$1, {
|
25164
|
+
"onClick": this.handleClear,
|
25165
|
+
"class": "clear-action"
|
25166
|
+
}, null) : ""]);
|
25167
|
+
const shortcutsSlot = this.hasShortcuts ? {
|
25168
|
+
shortcuts: () => {
|
25169
|
+
var _a2, _b2;
|
25170
|
+
return ((_b2 = (_a2 = this.$slots).shortcuts) == null ? void 0 : _b2.call(_a2)) || null;
|
25171
|
+
}
|
25172
|
+
} : {};
|
25173
|
+
return withDirectives(createVNode("div", {
|
25174
|
+
"class": ["bk-date-picker", this.type === "datetimerange" ? "long" : "", this.longWidthCls]
|
25175
|
+
}, [createVNode("div", {
|
25176
|
+
"ref": "triggerRef",
|
25177
|
+
"class": "bk-date-picker-rel",
|
25178
|
+
"onMouseenter": this.handleInputMouseenter,
|
25179
|
+
"onMouseleave": this.handleInputMouseleave
|
25180
|
+
}, [(_c = (_b = (_a = this.$slots).trigger) == null ? void 0 : _b.call(_a)) != null ? _c : defaultTrigger]), createVNode(Teleport, {
|
25181
|
+
"to": "body",
|
25182
|
+
"disabled": !this.appendToBody
|
25183
|
+
}, {
|
25184
|
+
default: () => [createVNode(Transition, {
|
25185
|
+
"name": "bk-fade-down-transition"
|
25186
|
+
}, {
|
25187
|
+
default: () => [withDirectives(createVNode(PickerDropdown, {
|
25188
|
+
"class": [this.appendToBody ? "bk-date-picker-transfer" : ""],
|
25189
|
+
"ref": "pickerDropdownRef",
|
25190
|
+
"triggerRef": this.triggerRef,
|
25191
|
+
"placement": this.placement,
|
25192
|
+
"extPopoverCls": this.extPopoverCls,
|
25193
|
+
"appendToBody": this.appendToBody,
|
25194
|
+
"onClick": this.handleTransferClick
|
25195
|
+
}, {
|
25196
|
+
default: () => {
|
25197
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
25198
|
+
return [this.hasHeader ? createVNode("div", {
|
25199
|
+
"class": ["bk-date-picker-top-wrapper", this.headerSlotCls]
|
25200
|
+
}, [(_c2 = (_b2 = (_a2 = this.$slots).header) == null ? void 0 : _b2.call(_a2)) != null ? _c2 : null]) : null, createVNode(TimePanel, {
|
25201
|
+
"ref": "pickerPanelRef",
|
25202
|
+
"clearable": this.clearable,
|
25203
|
+
"confirm": this.isConfirm,
|
25204
|
+
"shortcuts": this.shortcuts,
|
25205
|
+
"multiple": this.multiple,
|
25206
|
+
"shortcutClose": this.shortcutClose,
|
25207
|
+
"value": this.internalValue,
|
25208
|
+
"startDate": this.startDate,
|
25209
|
+
"disableDate": this.disableDate,
|
25210
|
+
"onPick": this.onPick,
|
25211
|
+
"onPick-clear": this.handleClear,
|
25212
|
+
"onPick-success": this.onPickSuccess,
|
25213
|
+
"disabledHours": this.ownPickerProps.disabledHours,
|
25214
|
+
"disabledMinutes": this.ownPickerProps.disabledMinutes,
|
25215
|
+
"disabledSeconds": this.ownPickerProps.disabledSeconds
|
24102
25216
|
}, shortcutsSlot), this.hasFooter ? createVNode("div", {
|
24103
25217
|
"class": ["bk-date-picker-footer-wrapper", this.footerSlotCls]
|
24104
25218
|
}, [(_f = (_e = (_d = this.$slots).footer) == null ? void 0 : _e.call(_d)) != null ? _f : null]) : null];
|
@@ -26234,7 +27348,7 @@ var CascaderPanel = defineComponent({
|
|
26234
27348
|
};
|
26235
27349
|
const nodeExpandHandler = (node) => {
|
26236
27350
|
var _a;
|
26237
|
-
if (node.isDisabled)
|
27351
|
+
if (!node || (node == null ? void 0 : node.isDisabled))
|
26238
27352
|
return;
|
26239
27353
|
menus.list = menus.list.slice(0, node.level);
|
26240
27354
|
activePath.value = activePath.value.slice(0, node.level - 1);
|
@@ -26301,6 +27415,9 @@ var CascaderPanel = defineComponent({
|
|
26301
27415
|
}, {
|
26302
27416
|
immediate: true
|
26303
27417
|
});
|
27418
|
+
watch(() => props2.store, (value) => {
|
27419
|
+
menus.list = [value.getNodes()];
|
27420
|
+
});
|
26304
27421
|
return {
|
26305
27422
|
menus,
|
26306
27423
|
activePath,
|
@@ -26431,7 +27548,7 @@ var Component$6 = defineComponent({
|
|
26431
27548
|
},
|
26432
27549
|
components: {
|
26433
27550
|
CascaderPanel,
|
26434
|
-
BkPopover
|
27551
|
+
BkPopover: BkPopover2
|
26435
27552
|
},
|
26436
27553
|
props: {
|
26437
27554
|
modelValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number).def([]), PropTypes.arrayOf(PropTypes.string).def([])]),
|
@@ -26466,7 +27583,7 @@ var Component$6 = defineComponent({
|
|
26466
27583
|
setHover,
|
26467
27584
|
cancelHover
|
26468
27585
|
} = useHover();
|
26469
|
-
const store =
|
27586
|
+
const store = ref(new Store(props2));
|
26470
27587
|
const panelShow = ref(false);
|
26471
27588
|
const selectedText = ref("");
|
26472
27589
|
const selectedTags = ref([]);
|
@@ -26482,57 +27599,61 @@ var Component$6 = defineComponent({
|
|
26482
27599
|
});
|
26483
27600
|
const popover3 = ref(null);
|
26484
27601
|
const updateValue = (val) => {
|
27602
|
+
var _a;
|
26485
27603
|
if (multiple) {
|
26486
|
-
selectedTags.value = store.getCheckedNodes().map((node) => ({
|
27604
|
+
selectedTags.value = store.value.getCheckedNodes().map((node) => ({
|
26487
27605
|
text: node.pathNames.join(separator2),
|
26488
27606
|
key: node.id
|
26489
27607
|
}));
|
26490
27608
|
return;
|
26491
27609
|
}
|
27610
|
+
(_a = popover3 == null ? void 0 : popover3.value) == null ? void 0 : _a.hide();
|
26492
27611
|
if (val.length === 0) {
|
26493
27612
|
selectedText.value = "";
|
26494
27613
|
} else {
|
26495
|
-
const node = store.getNodeByValue(val);
|
27614
|
+
const node = store.value.getNodeByValue(val);
|
27615
|
+
if (!node)
|
27616
|
+
return;
|
26496
27617
|
selectedText.value = node.pathNames.join(separator2);
|
26497
27618
|
}
|
26498
27619
|
};
|
26499
|
-
const hidePopover = () => {
|
26500
|
-
panelShow.value = false;
|
26501
|
-
};
|
26502
27620
|
const handleClear = (e) => {
|
26503
27621
|
e.stopPropagation();
|
26504
27622
|
updateValue([]);
|
26505
27623
|
emit("update:modelValue", []);
|
26506
27624
|
emit("clear", JSON.parse(JSON.stringify(props2.modelValue)));
|
26507
27625
|
};
|
26508
|
-
const inputClickHandler = (e) => {
|
26509
|
-
e.stopPropagation();
|
26510
|
-
panelShow.value = !panelShow.value;
|
26511
|
-
emit("toggle", panelShow.value);
|
26512
|
-
};
|
26513
27626
|
const removeTag = (value, index, e) => {
|
26514
27627
|
e.stopPropagation();
|
26515
27628
|
const current = JSON.parse(JSON.stringify(value));
|
26516
27629
|
current.splice(index, 1);
|
26517
27630
|
updateValue(current);
|
26518
27631
|
};
|
26519
|
-
|
26520
|
-
var _a;
|
27632
|
+
const modelValueChangeHandler = (value) => {
|
26521
27633
|
updateValue(value);
|
26522
|
-
(_a = popover3 == null ? void 0 : popover3.value) == null ? void 0 : _a.handlePopShow(false);
|
26523
27634
|
emit("update:modelValue", value);
|
26524
27635
|
emit("change", value);
|
26525
|
-
}
|
27636
|
+
};
|
27637
|
+
const listChangeHandler = () => {
|
27638
|
+
store.value = new Store(props2);
|
27639
|
+
updateValue(props2.modelValue);
|
27640
|
+
};
|
27641
|
+
const popoverChangeEmitter = (val) => {
|
27642
|
+
emit("toggle", val.isShow);
|
27643
|
+
};
|
27644
|
+
watch(() => props2.modelValue, modelValueChangeHandler, {
|
27645
|
+
immediate: true
|
27646
|
+
});
|
27647
|
+
watch(() => props2.list, listChangeHandler, {
|
27648
|
+
deep: true,
|
26526
27649
|
immediate: true
|
26527
27650
|
});
|
26528
27651
|
return {
|
26529
27652
|
store,
|
26530
27653
|
updateValue,
|
26531
|
-
|
26532
|
-
inputClickHandler,
|
27654
|
+
panelShow,
|
26533
27655
|
selectedText,
|
26534
27656
|
checkedValue,
|
26535
|
-
panelShow,
|
26536
27657
|
handleClear,
|
26537
27658
|
isHover,
|
26538
27659
|
setHover,
|
@@ -26540,7 +27661,8 @@ var Component$6 = defineComponent({
|
|
26540
27661
|
cancelHover,
|
26541
27662
|
selectedTags,
|
26542
27663
|
removeTag,
|
26543
|
-
cascaderPanel
|
27664
|
+
cascaderPanel,
|
27665
|
+
popoverChangeEmitter
|
26544
27666
|
};
|
26545
27667
|
},
|
26546
27668
|
render() {
|
@@ -26580,20 +27702,19 @@ var Component$6 = defineComponent({
|
|
26580
27702
|
"data-placeholder": this.placeholder,
|
26581
27703
|
"onMouseenter": this.setHover,
|
26582
27704
|
"onMouseleave": this.cancelHover
|
26583
|
-
}, [suffixIcon(), createVNode(
|
27705
|
+
}, [suffixIcon(), createVNode(BkPopover2, {
|
26584
27706
|
"placement": "bottom-start",
|
26585
27707
|
"theme": "light bk-cascader-popover",
|
26586
27708
|
"trigger": "click",
|
26587
27709
|
"arrow": false,
|
26588
27710
|
"class": "bk-cascader-popover-wrapper",
|
26589
|
-
"isShow": this.panelShow,
|
26590
|
-
"onUpdate:isShow": ($event) => this.panelShow = $event,
|
26591
27711
|
"ref": "popover",
|
27712
|
+
"onAfterHidden": this.popoverChangeEmitter,
|
27713
|
+
"onAfterShow": this.popoverChangeEmitter,
|
26592
27714
|
"boundary": "body"
|
26593
27715
|
}, {
|
26594
27716
|
default: () => createVNode("div", {
|
26595
|
-
"class": "bk-cascader-name"
|
26596
|
-
"onClick": this.inputClickHandler
|
27717
|
+
"class": "bk-cascader-name"
|
26597
27718
|
}, [this.multiple && renderTags(), this.filterable ? createVNode("input", {
|
26598
27719
|
"class": "bk-cascader-search-input",
|
26599
27720
|
"type": "text",
|
@@ -28969,7 +30090,7 @@ var useFileHandler = (props2, hooks) => {
|
|
28969
30090
|
var Component$1 = defineComponent({
|
28970
30091
|
name: "Upload",
|
28971
30092
|
props: uploadProps,
|
28972
|
-
emits: ["
|
30093
|
+
emits: ["exceed", "progress", "success", "error", "delete", "done"],
|
28973
30094
|
setup(props2, {
|
28974
30095
|
slots,
|
28975
30096
|
emit
|
@@ -28995,7 +30116,7 @@ var Component$1 = defineComponent({
|
|
28995
30116
|
};
|
28996
30117
|
function onRemove(file, fileList2) {
|
28997
30118
|
abort(file);
|
28998
|
-
emit("
|
30119
|
+
emit("delete", file, fileList2);
|
28999
30120
|
}
|
29000
30121
|
const {
|
29001
30122
|
fileList,
|
@@ -29012,7 +30133,7 @@ var Component$1 = defineComponent({
|
|
29012
30133
|
return;
|
29013
30134
|
}
|
29014
30135
|
if (props2.limit && fileList.value.length + files.length > props2.limit) {
|
29015
|
-
emit("
|
30136
|
+
emit("exceed", files, fileList.value);
|
29016
30137
|
return;
|
29017
30138
|
}
|
29018
30139
|
let sendFiles = files;
|
@@ -29023,7 +30144,7 @@ var Component$1 = defineComponent({
|
|
29023
30144
|
const rawFile = file;
|
29024
30145
|
const error2 = handlePreprocess(rawFile);
|
29025
30146
|
if (error2) {
|
29026
|
-
emit("
|
30147
|
+
emit("error", rawFile, fileList.value, error2);
|
29027
30148
|
return;
|
29028
30149
|
}
|
29029
30150
|
if (props2.autoUpload) {
|
@@ -29081,29 +30202,29 @@ var Component$1 = defineComponent({
|
|
29081
30202
|
chunkSize,
|
29082
30203
|
onProgress: (event) => {
|
29083
30204
|
handleProgress(event, file);
|
29084
|
-
emit("
|
30205
|
+
emit("progress", event, file, fileList.value);
|
29085
30206
|
},
|
29086
30207
|
onSuccess: (res) => {
|
29087
30208
|
var _a;
|
29088
30209
|
const result = res;
|
29089
30210
|
if ((_a = props2 == null ? void 0 : props2.handleResCode) == null ? void 0 : _a.call(props2, result)) {
|
29090
30211
|
handleSuccess(res, file);
|
29091
|
-
emit("
|
30212
|
+
emit("success", res, file, fileList.value);
|
29092
30213
|
} else {
|
29093
30214
|
const err = new Error((result == null ? void 0 : result.message) || "unknow error");
|
29094
30215
|
handleError(err, file);
|
29095
|
-
emit("
|
30216
|
+
emit("error", file, fileList.value, err);
|
29096
30217
|
}
|
29097
30218
|
delete requests.value[uid];
|
29098
30219
|
},
|
29099
30220
|
onError: (err) => {
|
29100
30221
|
handleError(err, file);
|
29101
|
-
emit("
|
30222
|
+
emit("error", file, fileList.value, err);
|
29102
30223
|
delete requests.value[uid];
|
29103
30224
|
},
|
29104
30225
|
onComplete: () => {
|
29105
30226
|
if (sendFiles.indexOf(file) === sendFiles.length - 1) {
|
29106
|
-
emit("
|
30227
|
+
emit("done", fileList.value);
|
29107
30228
|
}
|
29108
30229
|
}
|
29109
30230
|
};
|
@@ -33703,6 +34824,7 @@ var Component = defineComponent({
|
|
33703
34824
|
}
|
33704
34825
|
});
|
33705
34826
|
const BkColorPicker = withInstall(Component);
|
34827
|
+
const BkTimePicker = withInstall(TimePicker);
|
33706
34828
|
var components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
33707
34829
|
__proto__: null,
|
33708
34830
|
Alert: BkAlert,
|
@@ -33758,7 +34880,8 @@ var components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
33758
34880
|
Process: BkSteps,
|
33759
34881
|
Upload,
|
33760
34882
|
CodeDiff: BkCodeDiff,
|
33761
|
-
ColorPicker: BkColorPicker
|
34883
|
+
ColorPicker: BkColorPicker,
|
34884
|
+
TimePicker: BkTimePicker
|
33762
34885
|
}, Symbol.toStringTag, { value: "Module" }));
|
33763
34886
|
const createInstall = (prefix = "Bk") => (app) => {
|
33764
34887
|
const pre = app.config.globalProperties.bkUIPrefix || prefix;
|
@@ -33776,4 +34899,4 @@ var preset = {
|
|
33776
34899
|
install: createInstall(),
|
33777
34900
|
version: "0.0.1"
|
33778
34901
|
};
|
33779
|
-
export { BkAffix as Affix, BkAlert as Alert, BkAnimateNumber as AnimateNumber, BkBacktop as Backtop, BkBadge as Badge, BkBreadcrumb as Breadcrumb, BkButton as Button, BkCard as Card, BkCascader as Cascader, BkCheckbox as Checkbox, BkCodeDiff as CodeDiff, BkCollapse as Collapse, BkColorPicker as ColorPicker, BkContainer as Container, BkDatePicker as DatePicker, BkDialog as Dialog, BkDivider as Divider, BkDropdown as Dropdown, BkException as Exception, BkFixedNavbar as FixedNavbar, BkForm as Form, InfoBox, BkInput as Input, BkLink as Link, BkLoading as Loading, BkMenu as Menu, Message, BkModal as Modal, Navigation, Notify, BkPagination as Pagination, BkPopover as Popover, BkPopover2 as Popover2, BkSteps as Process, BkProgress as Progress, BkRadio as Radio, BkRate as Rate, BkResizeLayout as ResizeLayout, BkSelect as Select, BkSideslider as Sideslider, Slider, BkSteps$2 as Steps, BkSwiper as Swiper, BkSwitcher as Switcher, BkTab as Tab, BkTable as Table, BkTag as Tag, TagInput, BkSteps$1 as TimeLine, Transfer, BkTree as Tree, Upload, BkVirtualRender as VirtualRender, tooltips as bkTooltips, ClickOutside as clickoutside, BkContainer as containerProps, preset as default, mousewheel };
|
34902
|
+
export { BkAffix as Affix, BkAlert as Alert, BkAnimateNumber as AnimateNumber, BkBacktop as Backtop, BkBadge as Badge, BkBreadcrumb as Breadcrumb, BkButton as Button, BkCard as Card, BkCascader as Cascader, BkCheckbox as Checkbox, BkCodeDiff as CodeDiff, BkCollapse as Collapse, BkColorPicker as ColorPicker, BkContainer as Container, BkDatePicker as DatePicker, BkDialog as Dialog, BkDivider as Divider, BkDropdown as Dropdown, BkException as Exception, BkFixedNavbar as FixedNavbar, BkForm as Form, InfoBox, BkInput as Input, BkLink as Link, BkLoading as Loading, BkMenu as Menu, Message, BkModal as Modal, Navigation, Notify, BkPagination as Pagination, BkPopover as Popover, BkPopover2 as Popover2, BkSteps as Process, BkProgress as Progress, BkRadio as Radio, BkRate as Rate, BkResizeLayout as ResizeLayout, BkSelect as Select, BkSideslider as Sideslider, Slider, BkSteps$2 as Steps, BkSwiper as Swiper, BkSwitcher as Switcher, BkTab as Tab, BkTable as Table, BkTag as Tag, TagInput, BkSteps$1 as TimeLine, BkTimePicker as TimePicker, Transfer, BkTree as Tree, Upload, BkVirtualRender as VirtualRender, tooltips as bkTooltips, ClickOutside as clickoutside, BkContainer as containerProps, preset as default, mousewheel };
|