@opentiny/vue-renderless 3.9.2 → 3.10.0
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/action-sheet/vue.js +25 -2
- package/anchor/index.js +3 -3
- package/anchor/vue.js +7 -1
- package/area/index.js +4 -4
- package/button/vue.js +4 -2
- package/button-group/index.js +8 -1
- package/button-group/vue.js +5 -10
- package/calendar/index.js +14 -14
- package/calendar-bar/index.js +3 -3
- package/carousel-item/index.js +1 -1
- package/cascader/vue.js +1 -1
- package/cascader-mobile/index.js +299 -0
- package/cascader-mobile/vue.js +102 -0
- package/cascader-panel/store.js +3 -1
- package/chart-boxplot/index.js +0 -1
- package/chart-core/deps/constants.js +20 -2
- package/chart-core/index.js +9 -1
- package/chart-core/modules/extend.js +14 -1
- package/chart-gauge/index.js +3 -1
- package/chart-graph/index.js +3 -1
- package/chart-map/index.js +11 -1
- package/chart-scatter/index.js +10 -2
- package/chart-waterfall/index.js +4 -1
- package/checkbox/index.js +16 -14
- package/checkbox/vue.js +14 -10
- package/checkbox-button/vue.js +7 -3
- package/column-list-item/vue.js +10 -1
- package/common/bigInt.js +4 -11
- package/common/date.js +2 -2
- package/common/deps/ResizeObserver.js +3 -1
- package/common/deps/date-util.js +9 -1
- package/common/deps/date.js +18 -5
- package/common/deps/fastdom/async.js +41 -0
- package/common/deps/fastdom/index.js +9 -0
- package/common/deps/fastdom/sandbox.js +53 -0
- package/common/deps/fastdom/singleton.js +80 -0
- package/common/deps/fullscreen/screenfull.js +16 -2
- package/common/deps/memorize.js +3 -3
- package/common/deps/popup-manager.js +0 -1
- package/common/deps/requestAnimationFrame.js +1 -1
- package/common/deps/throttle.js +2 -2
- package/common/deps/tree-model/node.js +23 -11
- package/common/deps/tree-model/tree-store.js +28 -7
- package/common/deps/vue-popper.js +14 -2
- package/common/deps/vue-popup.js +16 -23
- package/common/index.js +7 -35
- package/common/runtime.js +1 -1
- package/common/validate/rules/type.js +3 -1
- package/credit-card-form/vue.js +2 -2
- package/date-panel/index.js +35 -31
- package/date-panel/vue.js +12 -12
- package/date-picker/index.js +9 -5
- package/date-picker/vue.js +20 -8
- package/date-picker-mobile/index.js +3 -3
- package/date-range/index.js +91 -19
- package/date-range/vue.js +19 -11
- package/date-table/index.js +39 -6
- package/date-table/vue.js +2 -2
- package/dept/index.js +1 -1
- package/detail-page/vue.js +9 -1
- package/dialog-box/index.js +11 -2
- package/dialog-box/vue.js +30 -6
- package/dialog-select/index.js +27 -5
- package/dialog-select/vue.js +11 -4
- package/drop-roles/index.js +3 -1
- package/dropdown/index.js +28 -7
- package/dropdown/vue.js +12 -7
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +3 -3
- package/dropdown-item/vue.js +12 -10
- package/dropdown-menu/index.js +13 -14
- package/dropdown-menu/vue.js +8 -7
- package/espace/vue.js +9 -1
- package/fall-menu/vue.js +12 -1
- package/file-upload/index.js +137 -89
- package/file-upload/vue.js +24 -14
- package/filter/index.js +1 -1
- package/filter/vue.js +1 -3
- package/floating-button/index.js +73 -0
- package/floating-button/vue.js +35 -0
- package/form/index.js +13 -4
- package/form/vue.js +7 -2
- package/form-item/index.js +4 -1
- package/form-item/vue.js +6 -3
- package/fullscreen/vue.js +24 -3
- package/grid/plugins/exportExcel.js +54 -8
- package/grid/static/base/helperGetHGSKeys.js +1 -4
- package/grid/utils/common.js +15 -11
- package/grid/utils/dom.js +5 -1
- package/guide/index.js +2 -3
- package/hrapprover/index.js +3 -1
- package/index-bar/vue.js +8 -1
- package/input/index.js +1 -11
- package/input/vue.js +6 -12
- package/ip-address/index.js +66 -33
- package/ip-address/vue.js +8 -1
- package/link-menu/vue.js +22 -2
- package/locales/index.js +4 -2
- package/logon-user/index.js +3 -1
- package/logout/index.js +6 -2
- package/milestone/vue.js +1 -1
- package/mini-picker/index.js +12 -10
- package/mini-picker/vue.js +10 -10
- package/modal/index.js +5 -3
- package/modal/vue.js +4 -2
- package/month-range/index.js +18 -18
- package/month-range/vue.js +16 -4
- package/month-table/index.js +7 -3
- package/multi-select/vue.js +1 -9
- package/nav-menu/index.js +33 -4
- package/nav-menu/vue.js +9 -1
- package/notify/vue.js +12 -1
- package/numeric/vue.js +6 -2
- package/option/index.js +10 -2
- package/option/vue.js +20 -9
- package/option-group/index.js +3 -1
- package/package.json +2 -1
- package/picker/index.js +88 -17
- package/picker/vue.js +42 -17
- package/picker-column/index.js +6 -6
- package/picker-column/vue.js +5 -5
- package/popconfirm/vue.js +3 -1
- package/popeditor/index.js +55 -13
- package/popeditor/vue.js +23 -7
- package/popover/vue.js +1 -2
- package/popup/vue.js +15 -2
- package/progress/index.js +9 -7
- package/progress/vue.js +12 -4
- package/pull-refresh/vue.js +10 -1
- package/query-builder/index.js +9 -0
- package/query-builder/vue.js +18 -0
- package/radio/vue.js +3 -1
- package/radio-button/vue.js +1 -1
- package/rate/index.js +8 -2
- package/rate/vue.js +27 -4
- package/recycle-scroller/index.js +0 -1
- package/scrollbar/vue-bar.js +18 -2
- package/search/index.js +12 -5
- package/search/vue.js +7 -5
- package/select/index.js +596 -304
- package/select/vue.js +167 -101
- package/select-dropdown/vue.js +8 -6
- package/select-mobile/index.js +26 -13
- package/select-mobile/vue.js +14 -5
- package/select-view/index.js +5 -21
- package/select-view/vue.js +0 -3
- package/selected-box/index.js +3 -1
- package/slider/index.js +5 -5
- package/slider/vue.js +16 -0
- package/slider-button/index.js +41 -0
- package/slider-button/vue.js +36 -0
- package/slider-button-group/slide-button.js +142 -0
- package/slider-button-group/vue.js +52 -0
- package/steps/slide-bar.js +0 -1
- package/switch/index.js +1 -1
- package/switch/vue.js +1 -1
- package/tab-bar/index.js +8 -6
- package/tab-nav/index.js +19 -13
- package/tab-nav/vue.js +10 -9
- package/tabs/index.js +21 -17
- package/tabs/vue.js +1 -4
- package/tag/vue.js +2 -1
- package/tag-group/index.js +23 -10
- package/tag-group/vue.js +5 -4
- package/time/index.js +8 -8
- package/time/vue.js +9 -9
- package/time-line/index.js +24 -2
- package/time-line/vue.js +30 -4
- package/time-panel/index.js +2 -2
- package/time-panel/vue.js +2 -2
- package/time-range/index.js +24 -21
- package/time-range/vue.js +26 -16
- package/time-spinner/index.js +32 -21
- package/time-spinner/vue.js +37 -12
- package/timeline-item/index.js +77 -0
- package/timeline-item/vue.js +44 -0
- package/toggle-menu/vue.js +0 -1
- package/tooltip/index.js +11 -12
- package/tooltip/vue.js +11 -1
- package/top-box/vue.js +13 -1
- package/tree/index.js +228 -15
- package/tree/vue.js +119 -15
- package/tree-menu/index.js +35 -0
- package/tree-menu/vue.js +27 -5
- package/tree-node/index.js +75 -10
- package/tree-node/vue.js +45 -23
- package/upload/index.js +90 -49
- package/upload/vue.js +22 -10
- package/upload-dragger/index.js +4 -3
- package/upload-list/index.js +67 -16
- package/upload-list/vue.js +26 -9
- package/user/index.js +7 -4
- package/user-link/index.js +2 -1
- package/wizard/index.js +4 -1
- package/wizard/vue.js +19 -2
- package/year-range/index.js +1 -1
- package/year-range/vue.js +3 -3
- package/year-table/index.js +2 -2
package/tag-group/index.js
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../chunk-PKUHTIDK.js";
|
|
4
|
+
const handelItemClick = ({ emit }) => (item, index, $event) => {
|
|
5
|
+
emit("item-click", item, index, $event);
|
|
6
|
+
};
|
|
2
7
|
const getHiddenTags = ({ props, vm, state }) => () => {
|
|
3
8
|
if (!props.data.length)
|
|
4
9
|
return;
|
|
5
10
|
const tagGroup = vm.$refs.tagGroup || {};
|
|
6
11
|
const tags = tagGroup.children;
|
|
7
12
|
const moreDom = vm.$refs.more || {};
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const extrasHeightMap = {
|
|
14
|
+
mini: 4,
|
|
15
|
+
small: 2,
|
|
16
|
+
medium: 0
|
|
17
|
+
};
|
|
18
|
+
const height = tags[0] && tags[0].getBoundingClientRect().height + extrasHeightMap[props.size] + "px";
|
|
19
|
+
if (tagGroup.style) {
|
|
20
|
+
tagGroup.style.height = height;
|
|
21
|
+
}
|
|
22
|
+
if (moreDom.style) {
|
|
23
|
+
moreDom.style.height = height;
|
|
24
|
+
}
|
|
11
25
|
state.hiddenTags = [];
|
|
12
26
|
Array.from(tags).forEach((el, index) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type: props.data[index] && props.data[index].type
|
|
17
|
-
});
|
|
27
|
+
const item = props.data[index];
|
|
28
|
+
if (el.offsetTop >= el.offsetHeight && item) {
|
|
29
|
+
state.hiddenTags.push(__spreadValues({}, item));
|
|
18
30
|
}
|
|
19
31
|
});
|
|
20
32
|
state.showMore = !!state.hiddenTags.length;
|
|
21
33
|
};
|
|
22
34
|
export {
|
|
23
|
-
getHiddenTags
|
|
35
|
+
getHiddenTags,
|
|
36
|
+
handelItemClick
|
|
24
37
|
};
|
package/tag-group/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
|
|
3
3
|
import debounce from "../common/deps/debounce";
|
|
4
|
-
import { getHiddenTags } from "./index";
|
|
5
|
-
const api = ["state"];
|
|
6
|
-
const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm }) => {
|
|
4
|
+
import { getHiddenTags, handelItemClick } from "./index";
|
|
5
|
+
const api = ["state", "handelItemClick"];
|
|
6
|
+
const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm, emit }) => {
|
|
7
7
|
const delay = 100;
|
|
8
8
|
const state = reactive({
|
|
9
9
|
showMore: false,
|
|
@@ -11,7 +11,8 @@ const renderless = (props, { onMounted, onBeforeUnmount, reactive }, { vm }) =>
|
|
|
11
11
|
});
|
|
12
12
|
const api2 = {
|
|
13
13
|
state,
|
|
14
|
-
getHiddenTags: getHiddenTags({ props, vm, state })
|
|
14
|
+
getHiddenTags: getHiddenTags({ props, vm, state }),
|
|
15
|
+
handelItemClick: handelItemClick({ emit })
|
|
15
16
|
};
|
|
16
17
|
onMounted(() => {
|
|
17
18
|
api2.getHiddenTags();
|
package/time/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const watchValue = ({ api, nextTick, state }) => (value) => {
|
|
|
5
5
|
if (value instanceof Date) {
|
|
6
6
|
date = limitTimeRange(value, state.selectableRange, state.format);
|
|
7
7
|
} else if (!value) {
|
|
8
|
-
date = state.defaultValue ? new Date(state.defaultValue) :
|
|
8
|
+
date = state.defaultValue ? new Date(state.defaultValue) : new Date();
|
|
9
9
|
}
|
|
10
10
|
state.date = date;
|
|
11
11
|
if (state.visible && state.needInitAdjust) {
|
|
@@ -13,10 +13,10 @@ const watchValue = ({ api, nextTick, state }) => (value) => {
|
|
|
13
13
|
state.needInitAdjust = false;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
const watchVisible = ({ nextTick,
|
|
16
|
+
const watchVisible = ({ nextTick, vm, state }) => (value) => {
|
|
17
17
|
if (value) {
|
|
18
18
|
state.oldValue = state.value;
|
|
19
|
-
nextTick(() => refs.spinner.emitSelectRange("hours"));
|
|
19
|
+
nextTick(() => vm.$refs.spinner.emitSelectRange("hours"));
|
|
20
20
|
} else {
|
|
21
21
|
state.needInitAdjust = true;
|
|
22
22
|
}
|
|
@@ -43,7 +43,7 @@ const handleConfirm = ({ state, emit }) => (visible = false, first = null) => {
|
|
|
43
43
|
const date = clearMilliseconds(limitTimeRange(state.date, state.selectableRange, state.format));
|
|
44
44
|
emit("pick", date, visible, first);
|
|
45
45
|
};
|
|
46
|
-
const handleKeydown = ({ api,
|
|
46
|
+
const handleKeydown = ({ api, vm }) => (event) => {
|
|
47
47
|
const mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
|
|
48
48
|
const keyCode = event.keyCode;
|
|
49
49
|
if (keyCode === 37 || keyCode === 39) {
|
|
@@ -54,18 +54,18 @@ const handleKeydown = ({ api, refs }) => (event) => {
|
|
|
54
54
|
}
|
|
55
55
|
if (keyCode === 38 || keyCode === 40) {
|
|
56
56
|
const key = mapping[keyCode];
|
|
57
|
-
refs.spinner.scrollDown(key);
|
|
57
|
+
vm.$refs.spinner.scrollDown(key);
|
|
58
58
|
event.preventDefault();
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
const isValidValue = ({ state }) => (date) => timeWithinRange(date, state.selectableRange, state.format);
|
|
62
|
-
const adjustSpinners = (
|
|
63
|
-
const changeSelectionRange = ({
|
|
62
|
+
const adjustSpinners = (vm) => () => vm.$refs.spinner.adjustSpinners();
|
|
63
|
+
const changeSelectionRange = ({ vm, state }) => (step) => {
|
|
64
64
|
const list = [0, 3].concat(state.showSeconds ? [6] : []);
|
|
65
65
|
const mapping = ["hours", "minutes"].concat(state.showSeconds ? ["seconds"] : []);
|
|
66
66
|
const index = list.indexOf(state.selectionRange[0]);
|
|
67
67
|
const next = (index + step + list.length) % list.length;
|
|
68
|
-
refs.spinner.emitSelectRange(mapping[next]);
|
|
68
|
+
vm.$refs.spinner.emitSelectRange(mapping[next]);
|
|
69
69
|
};
|
|
70
70
|
export {
|
|
71
71
|
adjustSpinners,
|
package/time/vue.js
CHANGED
|
@@ -20,8 +20,8 @@ const initState = ({ reactive, props, computed, api: api2 }) => {
|
|
|
20
20
|
format: "HH:mm:ss",
|
|
21
21
|
value: "",
|
|
22
22
|
defaultValue: null,
|
|
23
|
-
date: props.value ||
|
|
24
|
-
oldValue:
|
|
23
|
+
date: props.value || new Date(),
|
|
24
|
+
oldValue: new Date(),
|
|
25
25
|
selectableRange: [],
|
|
26
26
|
selectionRange: [0, 2],
|
|
27
27
|
disabled: false,
|
|
@@ -34,7 +34,7 @@ const initState = ({ reactive, props, computed, api: api2 }) => {
|
|
|
34
34
|
});
|
|
35
35
|
return state;
|
|
36
36
|
};
|
|
37
|
-
const renderless = (props, { computed, onMounted, reactive, watch, nextTick }, { t, emit: $emit,
|
|
37
|
+
const renderless = (props, { computed, onMounted, reactive, watch, nextTick }, { t, emit: $emit, vm }) => {
|
|
38
38
|
const api2 = {};
|
|
39
39
|
const emit = props.emitter ? props.emitter.emit : $emit;
|
|
40
40
|
const state = initState({ reactive, props, computed, api: api2 });
|
|
@@ -42,14 +42,14 @@ const renderless = (props, { computed, onMounted, reactive, watch, nextTick }, {
|
|
|
42
42
|
t,
|
|
43
43
|
state,
|
|
44
44
|
compuAmPmMode: compuAmPmMode(state),
|
|
45
|
-
adjustSpinners: adjustSpinners(
|
|
45
|
+
adjustSpinners: adjustSpinners(vm),
|
|
46
46
|
handleCancel: handleCancel({ state, emit }),
|
|
47
47
|
setSelectionRange: setSelectionRange({ state, emit }),
|
|
48
|
-
watchVisible: watchVisible({ nextTick,
|
|
48
|
+
watchVisible: watchVisible({ nextTick, vm, state }),
|
|
49
49
|
isValidValue: isValidValue({ state }),
|
|
50
|
-
changeSelectionRange: changeSelectionRange({
|
|
50
|
+
changeSelectionRange: changeSelectionRange({ vm, state }),
|
|
51
51
|
handleConfirm: handleConfirm({ state, emit }),
|
|
52
|
-
handleKeydown: handleKeydown({ api: api2,
|
|
52
|
+
handleKeydown: handleKeydown({ api: api2, vm }),
|
|
53
53
|
handleChange: handleChange({ api: api2, emit, state }),
|
|
54
54
|
watchValue: watchValue({ api: api2, emit, nextTick, state })
|
|
55
55
|
});
|
|
@@ -63,11 +63,11 @@ const renderless = (props, { computed, onMounted, reactive, watch, nextTick }, {
|
|
|
63
63
|
);
|
|
64
64
|
watch(
|
|
65
65
|
() => state.selectableRange,
|
|
66
|
-
(value) => refs.spinner.state.selectableRange = value
|
|
66
|
+
(value) => vm.$refs.spinner.state.selectableRange = value
|
|
67
67
|
);
|
|
68
68
|
watch(
|
|
69
69
|
() => state.defaultValue,
|
|
70
|
-
(value) => !isDate(state.value) && (state.date = value ? new Date(value) :
|
|
70
|
+
(value) => !isDate(state.value) && (state.date = value ? new Date(value) : new Date())
|
|
71
71
|
);
|
|
72
72
|
onMounted(() => {
|
|
73
73
|
api2.handleConfirm(true, true);
|
package/time-line/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-PKUHTIDK.js";
|
|
2
5
|
import { format } from "../common/date";
|
|
3
6
|
const getDate = (dateTime) => ({
|
|
4
7
|
date: format(dateTime, "yyyy-MM-dd"),
|
|
@@ -35,7 +38,12 @@ const getStatusCls = ({ constants, state }) => (index, node) => {
|
|
|
35
38
|
}
|
|
36
39
|
return cls;
|
|
37
40
|
};
|
|
38
|
-
const computedData = ({ props, state }) => () =>
|
|
41
|
+
const computedData = ({ props, state }) => () => {
|
|
42
|
+
if (props.data) {
|
|
43
|
+
return state.isReverse ? props.data.map((item, i) => __spreadProps(__spreadValues({}, props.data[props.data.length - 1 - i]), { index: i })) : props.data.map((item, i) => __spreadProps(__spreadValues({}, item), { index: i }));
|
|
44
|
+
}
|
|
45
|
+
return state.timelineItems;
|
|
46
|
+
};
|
|
39
47
|
const computedCurrent = ({ props, state }) => () => state.isReverse ? state.nodes.length - props.active - 1 : props.active;
|
|
40
48
|
const computedIsReverse = (props) => () => props.reverse && props.vertical;
|
|
41
49
|
const computedStackNodes = ({ state, constants }) => () => {
|
|
@@ -49,6 +57,19 @@ const changeStatus = ({ state }) => () => {
|
|
|
49
57
|
state.showAll = !state.showAll;
|
|
50
58
|
return state.showAll;
|
|
51
59
|
};
|
|
60
|
+
const computedWrapperClass = ({ props }) => () => {
|
|
61
|
+
const { vertical, reverse, textPosition, showDivider } = props;
|
|
62
|
+
const wrapperClass = [];
|
|
63
|
+
if (vertical) {
|
|
64
|
+
wrapperClass.push("tiny-steps-timeline", { reverse });
|
|
65
|
+
} else {
|
|
66
|
+
wrapperClass.push("tiny-steps-normal", textPosition === "right" ? "text-right" : "text-bottom");
|
|
67
|
+
}
|
|
68
|
+
if (showDivider && textPosition === "right") {
|
|
69
|
+
wrapperClass.push("show-divider");
|
|
70
|
+
}
|
|
71
|
+
return wrapperClass;
|
|
72
|
+
};
|
|
52
73
|
export {
|
|
53
74
|
changeStatus,
|
|
54
75
|
computedCurrent,
|
|
@@ -56,6 +77,7 @@ export {
|
|
|
56
77
|
computedIsReverse,
|
|
57
78
|
computedSpace,
|
|
58
79
|
computedStackNodes,
|
|
80
|
+
computedWrapperClass,
|
|
59
81
|
getDate,
|
|
60
82
|
getStatus,
|
|
61
83
|
getStatusCls,
|
package/time-line/vue.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
handleClick,
|
|
4
|
+
getStatusCls,
|
|
5
|
+
getStatus,
|
|
6
|
+
computedData,
|
|
7
|
+
getDate,
|
|
8
|
+
computedCurrent,
|
|
9
|
+
computedIsReverse,
|
|
10
|
+
changeStatus,
|
|
11
|
+
computedStackNodes,
|
|
12
|
+
computedSpace,
|
|
13
|
+
computedWrapperClass
|
|
14
|
+
} from "./index";
|
|
3
15
|
const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus"];
|
|
4
|
-
const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
|
|
16
|
+
const renderless = (props, { computed, reactive, provide, watch }, { t, emit, constants }) => {
|
|
5
17
|
const api2 = {};
|
|
6
18
|
const state = reactive({
|
|
7
19
|
nodes: computed(() => api2.computedData()),
|
|
20
|
+
timelineItems: [],
|
|
8
21
|
current: computed(() => api2.computedCurrent()),
|
|
9
22
|
isReverse: computed(() => api2.computedIsReverse()),
|
|
10
23
|
stackNodes: computed(() => state.showAll ? state.nodes : api2.computedStackNodes()),
|
|
11
24
|
computedSpace: computed(() => computedSpace({ props })),
|
|
12
25
|
showData: false,
|
|
13
|
-
showAll: false
|
|
26
|
+
showAll: false,
|
|
27
|
+
computedWrapperClass: computed(() => api2.computedWrapperClass())
|
|
14
28
|
});
|
|
15
29
|
Object.assign(api2, {
|
|
16
30
|
state,
|
|
@@ -22,8 +36,20 @@ const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
|
|
|
22
36
|
handleClick: handleClick({ emit, state, api: api2 }),
|
|
23
37
|
getStatusCls: getStatusCls({ constants, props, state }),
|
|
24
38
|
computedStackNodes: computedStackNodes({ state, constants }),
|
|
25
|
-
changeStatus: changeStatus({ state })
|
|
39
|
+
changeStatus: changeStatus({ state }),
|
|
40
|
+
computedWrapperClass: computedWrapperClass({ props })
|
|
26
41
|
});
|
|
42
|
+
provide("nodesInject", { timelineItems: state.timelineItems, nodes: state.nodes, props });
|
|
43
|
+
watch(
|
|
44
|
+
() => state.timelineItems,
|
|
45
|
+
(newVal) => {
|
|
46
|
+
newVal.forEach((item, i) => item.index = i);
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
immediate: true,
|
|
50
|
+
deep: true
|
|
51
|
+
}
|
|
52
|
+
);
|
|
27
53
|
return api2;
|
|
28
54
|
};
|
|
29
55
|
export {
|
package/time-panel/index.js
CHANGED
|
@@ -74,8 +74,8 @@ const handleClear = ({ api, state }) => () => {
|
|
|
74
74
|
state.defaultTime = "";
|
|
75
75
|
api.emitPick();
|
|
76
76
|
};
|
|
77
|
-
const scrollToOption = ({
|
|
78
|
-
const menu = refs.popper.querySelector(DATEPICKER.queryClass);
|
|
77
|
+
const scrollToOption = ({ vm }) => (selector = DATEPICKER.selClass) => {
|
|
78
|
+
const menu = vm.$refs.popper.querySelector(DATEPICKER.queryClass);
|
|
79
79
|
scrollIntoView(menu, menu.querySelector(selector));
|
|
80
80
|
};
|
|
81
81
|
const handleMenuEnter = ({ api, nextTick, state }) => () => {
|
package/time-panel/vue.js
CHANGED
|
@@ -45,7 +45,7 @@ const initState = ({ reactive, computed, api: api2 }) => {
|
|
|
45
45
|
});
|
|
46
46
|
return state;
|
|
47
47
|
};
|
|
48
|
-
const renderless = (props, { computed, reactive, watch, nextTick }, {
|
|
48
|
+
const renderless = (props, { computed, reactive, watch, nextTick }, { vm, emit: $emit }) => {
|
|
49
49
|
const api2 = {};
|
|
50
50
|
const emit = props.emitter ? props.emitter.emit : $emit;
|
|
51
51
|
const state = initState({ reactive, computed, api: api2 });
|
|
@@ -54,7 +54,7 @@ const renderless = (props, { computed, reactive, watch, nextTick }, { refs, emit
|
|
|
54
54
|
parseTime: parseTime(),
|
|
55
55
|
formatTime: formatTime(),
|
|
56
56
|
isValidValue: isValidValue(state),
|
|
57
|
-
scrollToOption: scrollToOption({
|
|
57
|
+
scrollToOption: scrollToOption({ vm }),
|
|
58
58
|
emitPick: emitPick({ emit, state }),
|
|
59
59
|
emitDestroy: emitDestroy(emit),
|
|
60
60
|
nextTime: nextTime(api2),
|
package/time-range/index.js
CHANGED
|
@@ -17,12 +17,12 @@ const watchValue = ({ api, state }) => (value) => {
|
|
|
17
17
|
if (value[0]) {
|
|
18
18
|
state.minDate = new Date(value[0]);
|
|
19
19
|
} else {
|
|
20
|
-
state.minDate = value[1] ? new Date(api.minTimeOfDay(new Date(value[1])).getTime()) :
|
|
20
|
+
state.minDate = value[1] ? new Date(api.minTimeOfDay(new Date(value[1])).getTime()) : new Date();
|
|
21
21
|
}
|
|
22
22
|
if (value[1]) {
|
|
23
23
|
state.maxDate = new Date(value[1]);
|
|
24
24
|
} else {
|
|
25
|
-
state.maxDate = value[0] ? api.advanceTime(new Date(value[0]), 60 * 60 * 1e3) : api.advanceTime(
|
|
25
|
+
state.maxDate = value[0] ? api.advanceTime(new Date(value[0]), 60 * 60 * 1e3) : api.advanceTime(new Date(), 60 * 60 * 1e3);
|
|
26
26
|
}
|
|
27
27
|
} else {
|
|
28
28
|
if (Array.isArray(state.defaultValue)) {
|
|
@@ -32,14 +32,16 @@ const watchValue = ({ api, state }) => (value) => {
|
|
|
32
32
|
state.minDate = new Date(state.defaultValue);
|
|
33
33
|
state.maxDate = api.advanceTime(new Date(state.defaultValue), 60 * 60 * 1e3);
|
|
34
34
|
} else {
|
|
35
|
-
state.minDate =
|
|
36
|
-
state.maxDate = api.advanceTime(
|
|
35
|
+
state.minDate = new Date();
|
|
36
|
+
state.maxDate = api.advanceTime(new Date(), 60 * 60 * 1e3);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
const adjustSpinners = (
|
|
41
|
-
refs.minSpinner
|
|
42
|
-
|
|
40
|
+
const adjustSpinners = ({ vm }) => () => {
|
|
41
|
+
if (vm.$refs.minSpinner) {
|
|
42
|
+
vm.$refs.minSpinner.adjustSpinners();
|
|
43
|
+
vm.$refs.maxSpinner.adjustSpinners();
|
|
44
|
+
}
|
|
43
45
|
};
|
|
44
46
|
const setMaxMinData = (state) => {
|
|
45
47
|
if (Array.isArray(state.oldValue)) {
|
|
@@ -47,21 +49,21 @@ const setMaxMinData = (state) => {
|
|
|
47
49
|
state.oldValue[1] && (state.maxDate = clearMilliseconds(state.oldValue[1]));
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
|
-
const watchVisible = ({ nextTick,
|
|
52
|
+
const watchVisible = ({ nextTick, api, state }) => (value) => {
|
|
51
53
|
if (value) {
|
|
52
54
|
state.oldValue = state.value;
|
|
53
55
|
nextTick(() => {
|
|
54
56
|
setMaxMinData(state);
|
|
55
|
-
adjustSpinners(
|
|
57
|
+
api.adjustSpinners();
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
const handleClear = (emit) => () => emit("pick", null);
|
|
60
|
-
const handleCancel = ({ emit,
|
|
62
|
+
const handleCancel = ({ emit, api, state }) => () => {
|
|
61
63
|
state.visible = false;
|
|
62
64
|
emit("pick", state.oldValue);
|
|
63
65
|
setMaxMinData(state);
|
|
64
|
-
adjustSpinners(
|
|
66
|
+
api.adjustSpinners();
|
|
65
67
|
};
|
|
66
68
|
const handleMinChange = ({ api, state }) => (date) => {
|
|
67
69
|
state.minDate = clearMilliseconds(date);
|
|
@@ -71,10 +73,10 @@ const handleMaxChange = ({ api, state }) => (date) => {
|
|
|
71
73
|
state.maxDate = clearMilliseconds(date);
|
|
72
74
|
api.handleChange();
|
|
73
75
|
};
|
|
74
|
-
const handleChange = ({ api, emit,
|
|
76
|
+
const handleChange = ({ api, emit, vm, state }) => () => {
|
|
75
77
|
if (api.isValidValue([state.minDate, state.maxDate])) {
|
|
76
|
-
refs.minSpinner.state.selectableRange = [[api.minTimeOfDay(state.minDate), state.maxDate]];
|
|
77
|
-
refs.maxSpinner.state.selectableRange = [[state.minDate, api.maxTimeOfDay(state.maxDate)]];
|
|
78
|
+
vm.$refs.minSpinner.state.selectableRange = [[api.minTimeOfDay(state.minDate), state.maxDate]];
|
|
79
|
+
vm.$refs.maxSpinner.state.selectableRange = [[state.minDate, api.maxTimeOfDay(state.maxDate)]];
|
|
78
80
|
emit("pick", [state.minDate, state.maxDate], state.visible);
|
|
79
81
|
}
|
|
80
82
|
};
|
|
@@ -86,26 +88,26 @@ const setMaxSelectionRange = ({ emit, state }) => (start, end) => {
|
|
|
86
88
|
emit("select-range", start, end, "max");
|
|
87
89
|
state.selectionRange = [start + state.offset, end + state.offset];
|
|
88
90
|
};
|
|
89
|
-
const handleConfirm = ({ emit,
|
|
90
|
-
const minSelectableRange = refs.minSpinner.state.selectableRange;
|
|
91
|
-
const maxSelectableRange = refs.maxSpinner.state.selectableRange;
|
|
91
|
+
const handleConfirm = ({ emit, vm, state }) => (visible = false) => {
|
|
92
|
+
const minSelectableRange = vm.$refs.minSpinner.state.selectableRange;
|
|
93
|
+
const maxSelectableRange = vm.$refs.maxSpinner.state.selectableRange;
|
|
92
94
|
state.minDate = limitTimeRange(state.minDate, minSelectableRange, state.format);
|
|
93
95
|
state.maxDate = limitTimeRange(state.maxDate, maxSelectableRange, state.format);
|
|
94
96
|
emit("pick", [state.minDate, state.maxDate], visible);
|
|
95
97
|
};
|
|
96
|
-
const changeSelectionRange = ({
|
|
98
|
+
const changeSelectionRange = ({ vm, state }) => (step) => {
|
|
97
99
|
const list = state.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
|
|
98
100
|
const mapping = ["hours", "minutes"].concat(state.showSeconds ? ["seconds"] : []);
|
|
99
101
|
const index = list.indexOf(state.selectionRange[0]);
|
|
100
102
|
const next = (index + step + list.length) % list.length;
|
|
101
103
|
const half = list.length / 2;
|
|
102
104
|
if (next < half) {
|
|
103
|
-
refs.minSpinner.emitSelectRange(mapping[next]);
|
|
105
|
+
vm.$refs.minSpinner.emitSelectRange(mapping[next]);
|
|
104
106
|
} else {
|
|
105
|
-
refs.maxSpinner.emitSelectRange(mapping[next - half]);
|
|
107
|
+
vm.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
|
|
106
108
|
}
|
|
107
109
|
};
|
|
108
|
-
const isValidValue = ({
|
|
110
|
+
const isValidValue = ({ vm, state }) => (date) => Array.isArray(date) && timeWithinRange(state.minDate, vm.$refs.minSpinner.state.selectableRange) && timeWithinRange(state.maxDate, vm.$refs.maxSpinner.state.selectableRange);
|
|
109
111
|
const handleKeydown = ({ api, state }) => (event) => {
|
|
110
112
|
const keyCode = event.keyCode;
|
|
111
113
|
const mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
|
|
@@ -122,6 +124,7 @@ const handleKeydown = ({ api, state }) => (event) => {
|
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
126
|
export {
|
|
127
|
+
adjustSpinners,
|
|
125
128
|
advanceTime,
|
|
126
129
|
changeSelectionRange,
|
|
127
130
|
compuAmPmMode,
|
package/time-range/vue.js
CHANGED
|
@@ -16,36 +16,45 @@ import {
|
|
|
16
16
|
minTimeOfDay,
|
|
17
17
|
maxTimeOfDay,
|
|
18
18
|
advanceTime,
|
|
19
|
-
compuAmPmMode
|
|
19
|
+
compuAmPmMode,
|
|
20
|
+
adjustSpinners
|
|
20
21
|
} from "./index";
|
|
21
22
|
import { parseDate } from "../common/deps/date-util";
|
|
22
|
-
const api = [
|
|
23
|
-
|
|
23
|
+
const api = [
|
|
24
|
+
"state",
|
|
25
|
+
"handleMinChange",
|
|
26
|
+
"handleConfirm",
|
|
27
|
+
"setMinSelectionRange",
|
|
28
|
+
"handleCancel",
|
|
29
|
+
"setMaxSelectionRange",
|
|
30
|
+
"handleMaxChange"
|
|
31
|
+
];
|
|
32
|
+
const initState = ({ reactive, computed, vm, api: api2 }) => {
|
|
24
33
|
const state = reactive({
|
|
25
34
|
popperClass: "",
|
|
26
35
|
defaultValue: null,
|
|
27
36
|
format: "HH:mm:ss",
|
|
28
37
|
visible: false,
|
|
29
38
|
value: [],
|
|
30
|
-
oldValue: [
|
|
39
|
+
oldValue: [new Date(), new Date()],
|
|
31
40
|
selectionRange: [0, 2],
|
|
32
41
|
arrowControl: false,
|
|
33
|
-
maxDate:
|
|
34
|
-
minDate:
|
|
42
|
+
maxDate: new Date(),
|
|
43
|
+
minDate: new Date(),
|
|
35
44
|
showSeconds: computed(() => (state.format || "").includes("ss")),
|
|
36
45
|
offset: computed(() => state.showSeconds ? 11 : 8),
|
|
37
|
-
spinner: computed(() => state.selectionRange[0] < state.offset ? refs.minSpinner : refs.maxSpinner),
|
|
46
|
+
spinner: computed(() => state.selectionRange[0] < state.offset ? vm.$refs.minSpinner : vm.$refs.maxSpinner),
|
|
38
47
|
btnDisabled: computed(() => state.minDate.getTime() > state.maxDate.getTime()),
|
|
39
48
|
amPmMode: computed(() => api2.compuAmPmMode())
|
|
40
49
|
});
|
|
41
50
|
return state;
|
|
42
51
|
};
|
|
43
|
-
const renderless = (props, { computed, reactive, watch, nextTick }, { t,
|
|
52
|
+
const renderless = (props, { computed, reactive, watch, nextTick }, { t, vm, emit: $emit }) => {
|
|
44
53
|
const api2 = {};
|
|
45
54
|
const emit = props.emitter ? props.emitter.emit : $emit;
|
|
46
55
|
const MIN_TIME = parseDate("00:00:00", "HH:mm:ss", t);
|
|
47
56
|
const MAX_TIME = parseDate("23:59:59", "HH:mm:ss", t);
|
|
48
|
-
const state = initState({ reactive, computed,
|
|
57
|
+
const state = initState({ reactive, computed, vm, api: api2 });
|
|
49
58
|
Object.assign(api2, {
|
|
50
59
|
t,
|
|
51
60
|
state,
|
|
@@ -53,19 +62,20 @@ const renderless = (props, { computed, reactive, watch, nextTick }, { t, refs, e
|
|
|
53
62
|
compuAmPmMode: compuAmPmMode(state),
|
|
54
63
|
maxTimeOfDay: maxTimeOfDay({ MAX_TIME }),
|
|
55
64
|
minTimeOfDay: minTimeOfDay({ MIN_TIME }),
|
|
56
|
-
changeSelectionRange: changeSelectionRange({
|
|
65
|
+
changeSelectionRange: changeSelectionRange({ vm, state }),
|
|
57
66
|
setMaxSelectionRange: setMaxSelectionRange({ emit, state }),
|
|
58
67
|
setMinSelectionRange: setMinSelectionRange({ emit, state }),
|
|
59
|
-
isValidValue: isValidValue({
|
|
60
|
-
handleConfirm: handleConfirm({ emit,
|
|
61
|
-
handleCancel: handleCancel({ emit,
|
|
62
|
-
watchVisible: watchVisible({ nextTick,
|
|
68
|
+
isValidValue: isValidValue({ vm, state }),
|
|
69
|
+
handleConfirm: handleConfirm({ emit, vm, state }),
|
|
70
|
+
handleCancel: handleCancel({ emit, api: api2, state }),
|
|
71
|
+
watchVisible: watchVisible({ nextTick, api: api2, state }),
|
|
63
72
|
advanceTime: advanceTime(api2),
|
|
64
73
|
watchValue: watchValue({ api: api2, state }),
|
|
65
74
|
handleKeydown: handleKeydown({ api: api2, state }),
|
|
66
|
-
handleChange: handleChange({ api: api2, emit,
|
|
75
|
+
handleChange: handleChange({ api: api2, emit, vm, state }),
|
|
67
76
|
handleMinChange: handleMinChange({ api: api2, state }),
|
|
68
|
-
handleMaxChange: handleMaxChange({ api: api2, state })
|
|
77
|
+
handleMaxChange: handleMaxChange({ api: api2, state }),
|
|
78
|
+
adjustSpinners: adjustSpinners({ vm })
|
|
69
79
|
});
|
|
70
80
|
watch(() => state.value, api2.watchValue);
|
|
71
81
|
watch(() => state.visible, api2.watchVisible);
|
package/time-spinner/index.js
CHANGED
|
@@ -3,18 +3,21 @@ import { modifyTime } from "../common/deps/date-util";
|
|
|
3
3
|
import { DATEPICKER } from "../common";
|
|
4
4
|
const getArrowHourList = (state) => () => {
|
|
5
5
|
const hours = state.hours;
|
|
6
|
-
|
|
6
|
+
const step = state.step.hours;
|
|
7
|
+
return [hours - step >= 0 ? hours - step : void 0, hours, hours + step <= 23 ? hours + step : void 0];
|
|
7
8
|
};
|
|
8
9
|
const getArrowMinuteList = (state) => () => {
|
|
9
10
|
const minutes = state.minutes;
|
|
10
|
-
|
|
11
|
+
const step = state.step.minutes;
|
|
12
|
+
return [minutes - step >= 0 ? minutes - step : void 0, minutes, minutes + step <= 59 ? minutes + step : void 0];
|
|
11
13
|
};
|
|
12
14
|
const getArrowSecondList = (state) => () => {
|
|
13
15
|
const seconds = state.seconds;
|
|
14
|
-
|
|
16
|
+
const step = state.step.seconds;
|
|
17
|
+
return [seconds - step >= 0 ? seconds - step : void 0, seconds, seconds + step <= 59 ? seconds + step : void 0];
|
|
15
18
|
};
|
|
16
|
-
const increase = (api) => () => api.scrollDown(
|
|
17
|
-
const decrease = (api) => () => api.scrollDown(-
|
|
19
|
+
const increase = ({ api, state }) => () => api.scrollDown(state.step[state.currentScrollbar]);
|
|
20
|
+
const decrease = ({ api, state }) => () => api.scrollDown(-state.step[state.currentScrollbar]);
|
|
18
21
|
const modifyDateField = ({ emit, props, state }) => (type, value) => {
|
|
19
22
|
if (state[type] === value) {
|
|
20
23
|
return;
|
|
@@ -50,9 +53,9 @@ const emitSelectRange = ({ emit, state }) => (type) => {
|
|
|
50
53
|
}
|
|
51
54
|
state.currentScrollbar = type;
|
|
52
55
|
};
|
|
53
|
-
const bindScrollEvent = ({ api,
|
|
56
|
+
const bindScrollEvent = ({ api, vm }) => () => {
|
|
54
57
|
const bindFuntion = (type) => {
|
|
55
|
-
refs[type].$refs.wrap.onscroll = (e) => {
|
|
58
|
+
vm.$refs[type].$refs.wrap.onscroll = (e) => {
|
|
56
59
|
api.handleScroll(type, e);
|
|
57
60
|
};
|
|
58
61
|
};
|
|
@@ -60,11 +63,14 @@ const bindScrollEvent = ({ api, refs }) => () => {
|
|
|
60
63
|
bindFuntion("minutes");
|
|
61
64
|
bindFuntion("seconds");
|
|
62
65
|
};
|
|
63
|
-
const handleScroll = ({ api,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
type === "hours" ? 23 : 59
|
|
66
|
+
const handleScroll = ({ api, vm, state }) => (type) => {
|
|
67
|
+
let value = Math.round(
|
|
68
|
+
(vm.$refs[type].$refs.wrap.scrollTop - (api.scrollBarHeight(type) * 0.5 - 10) / api.typeItemHeight(type) + 3) / api.typeItemHeight(type)
|
|
67
69
|
);
|
|
70
|
+
const step = state.step[type];
|
|
71
|
+
const limitVal = { hours: 23, minutes: 59, seconds: 59 };
|
|
72
|
+
Object.keys(limitVal).forEach((key) => limitVal[key] = Math.floor(limitVal[key] / step) * step);
|
|
73
|
+
value = Math.min(value * step, limitVal[type]);
|
|
68
74
|
api.modifyDateField(type, value);
|
|
69
75
|
};
|
|
70
76
|
const adjustSpinners = ({ api, state }) => () => {
|
|
@@ -75,13 +81,13 @@ const adjustSpinners = ({ api, state }) => () => {
|
|
|
75
81
|
const adjustCurrentSpinner = ({ api, state }) => (type) => {
|
|
76
82
|
api.adjustSpinner(type, state[type]);
|
|
77
83
|
};
|
|
78
|
-
const adjustSpinner = ({ api, props,
|
|
84
|
+
const adjustSpinner = ({ api, props, vm, state }) => (type, value) => {
|
|
79
85
|
if (props.arrowControl) {
|
|
80
86
|
return;
|
|
81
87
|
}
|
|
82
|
-
const el = refs[type].$refs.wrap;
|
|
88
|
+
const el = vm.$refs[type].$refs.wrap;
|
|
83
89
|
if (el) {
|
|
84
|
-
el.scrollTop = Math.max(0, value * api.typeItemHeight(type));
|
|
90
|
+
el.scrollTop = Math.max(0, value / state.step[type] * api.typeItemHeight(type));
|
|
85
91
|
}
|
|
86
92
|
};
|
|
87
93
|
const scrollDown = ({ api, state }) => (step) => {
|
|
@@ -91,22 +97,27 @@ const scrollDown = ({ api, state }) => (step) => {
|
|
|
91
97
|
const label = state.currentScrollbar;
|
|
92
98
|
const hoursArr = state.hoursList;
|
|
93
99
|
let now = state[label];
|
|
100
|
+
let diabledHour;
|
|
101
|
+
const find = (arr, value, key) => arr.find((item) => item[key] === value);
|
|
94
102
|
if (state.currentScrollbar === "hours") {
|
|
95
103
|
let total = Math.abs(step);
|
|
96
|
-
step = step > 0 ? 1 : -1;
|
|
97
104
|
let length = hoursArr.length;
|
|
98
105
|
while (length-- && total) {
|
|
99
|
-
now = (now + step + hoursArr.length) % hoursArr.length;
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
now = (now + step + hoursArr.length * total) % (hoursArr.length * total);
|
|
107
|
+
diabledHour = find(hoursArr, now, "hour");
|
|
108
|
+
if (diabledHour && diabledHour.disabled) {
|
|
109
|
+
continue;
|
|
102
110
|
}
|
|
111
|
+
60;
|
|
112
|
+
total -= total;
|
|
103
113
|
}
|
|
104
|
-
if (
|
|
114
|
+
if (diabledHour && diabledHour.disabled) {
|
|
105
115
|
return;
|
|
106
116
|
}
|
|
107
117
|
} else {
|
|
108
118
|
now = (now + step + 60) % 60;
|
|
109
119
|
}
|
|
120
|
+
now = Math.round(now / state.step[label]) * state.step[label];
|
|
110
121
|
api.modifyDateField(label, now);
|
|
111
122
|
api.adjustSpinner(label, now);
|
|
112
123
|
};
|
|
@@ -122,8 +133,8 @@ const amPm = (props) => (hour) => {
|
|
|
122
133
|
}
|
|
123
134
|
return content;
|
|
124
135
|
};
|
|
125
|
-
const typeItemHeight = ({
|
|
126
|
-
const scrollBarHeight = (
|
|
136
|
+
const typeItemHeight = ({ vm }) => (type) => vm.$refs[type].$el.querySelector(DATEPICKER.Qurtyli).offsetHeight;
|
|
137
|
+
const scrollBarHeight = (vm) => (type) => vm.$refs[type].$el.offsetHeight;
|
|
127
138
|
export {
|
|
128
139
|
adjustCurrentSpinner,
|
|
129
140
|
adjustSpinner,
|