@opentiny/vue-renderless 3.9.3 → 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 +8 -16
- package/checkbox/vue.js +7 -9
- 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 +4 -11
- 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 +567 -283
- package/select/vue.js +141 -85
- 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/notify/vue.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
clearTimer,
|
|
4
|
+
startTimer,
|
|
5
|
+
close,
|
|
6
|
+
bindEvent,
|
|
7
|
+
unBindEvent,
|
|
8
|
+
click,
|
|
9
|
+
watchClosed,
|
|
10
|
+
getOffsetStyle,
|
|
11
|
+
getPositionSide,
|
|
12
|
+
getZindex
|
|
13
|
+
} from "./index";
|
|
3
14
|
const api = [
|
|
4
15
|
"state",
|
|
5
16
|
"clearTimer",
|
package/numeric/vue.js
CHANGED
|
@@ -52,8 +52,12 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
|
|
|
52
52
|
inputDisabled: computed(() => props.disabled || state.formDisabled),
|
|
53
53
|
displayValue: computed(() => api2.displayValue()),
|
|
54
54
|
numPrecision: computed(() => api2.getNumPecision()),
|
|
55
|
-
minDisabled: computed(
|
|
56
|
-
|
|
55
|
+
minDisabled: computed(
|
|
56
|
+
() => !props.circulate && state.currentValue <= props.min || state.formDisabled
|
|
57
|
+
),
|
|
58
|
+
maxDisabled: computed(
|
|
59
|
+
() => !props.circulate && state.currentValue >= props.max || state.formDisabled
|
|
60
|
+
),
|
|
57
61
|
controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
|
|
58
62
|
format: computed(() => getUnitPrecision({ service: $service, props })),
|
|
59
63
|
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
|
package/option/index.js
CHANGED
|
@@ -27,6 +27,8 @@ const hoverItem = ({ select, props, state, vm }) => () => {
|
|
|
27
27
|
};
|
|
28
28
|
const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
|
|
29
29
|
if (props.disabled !== true && state.groupDisabled !== true) {
|
|
30
|
+
if (select.multiple && props.required === true)
|
|
31
|
+
return;
|
|
30
32
|
select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
|
|
31
33
|
}
|
|
32
34
|
};
|
|
@@ -34,16 +36,22 @@ const queryChange = ({ select, props, state }) => (query) => {
|
|
|
34
36
|
state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
|
|
35
37
|
select.state.filteredOptionsCount += state.visible ? 1 : -1;
|
|
36
38
|
};
|
|
37
|
-
const toggleEvent = ({ props,
|
|
38
|
-
const optionEl = refs.option;
|
|
39
|
+
const toggleEvent = ({ props, vm, type }) => {
|
|
40
|
+
const optionEl = vm.$refs.option;
|
|
39
41
|
Object.keys(props.events).forEach((ev) => {
|
|
40
42
|
optionEl[type + "EventListener"](ev, props.events[ev]);
|
|
41
43
|
});
|
|
42
44
|
};
|
|
45
|
+
const initValue = ({ select, props, constants, vm }) => () => {
|
|
46
|
+
if (select.multiple && props.required) {
|
|
47
|
+
select.state.selectEmitter.emit(constants.EVENT_NAME.initValue, vm);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
43
50
|
export {
|
|
44
51
|
contains,
|
|
45
52
|
handleGroupDisabled,
|
|
46
53
|
hoverItem,
|
|
54
|
+
initValue,
|
|
47
55
|
isEqual,
|
|
48
56
|
queryChange,
|
|
49
57
|
selectOptionClick,
|
package/option/vue.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isEqual,
|
|
4
|
+
contains,
|
|
5
|
+
handleGroupDisabled,
|
|
6
|
+
hoverItem,
|
|
7
|
+
selectOptionClick,
|
|
8
|
+
queryChange,
|
|
9
|
+
toggleEvent,
|
|
10
|
+
initValue
|
|
11
|
+
} from "./index";
|
|
3
12
|
const api = ["state", "visible", "hoverItem", "selectOptionClick"];
|
|
4
13
|
const initState = ({ reactive, computed, props, api: api2, markRaw, select, parent }) => {
|
|
5
14
|
const state = reactive({
|
|
@@ -42,7 +51,8 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
|
|
|
42
51
|
hoverItem: hoverItem({ select, vm, props, state }),
|
|
43
52
|
queryChange: queryChange({ select, props, state }),
|
|
44
53
|
selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
|
|
45
|
-
handleGroupDisabled: handleGroupDisabled(state)
|
|
54
|
+
handleGroupDisabled: handleGroupDisabled(state),
|
|
55
|
+
initValue: initValue({ select, props, constants, vm })
|
|
46
56
|
});
|
|
47
57
|
};
|
|
48
58
|
const initWatch = ({ watch, props, state, select, constants }) => {
|
|
@@ -67,32 +77,33 @@ const initWatch = ({ watch, props, state, select, constants }) => {
|
|
|
67
77
|
}
|
|
68
78
|
);
|
|
69
79
|
};
|
|
70
|
-
const initOnMounted = ({ onMounted, props, api: api2, vm, state,
|
|
80
|
+
const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, select }) => {
|
|
71
81
|
onMounted(() => {
|
|
72
82
|
state.el = vm.$el;
|
|
73
|
-
toggleEvent({ props,
|
|
83
|
+
toggleEvent({ props, vm, type: "add" });
|
|
74
84
|
select.state.selectEmitter.on(constants.EVENT_NAME.queryChange, api2.queryChange);
|
|
85
|
+
api2.initValue();
|
|
75
86
|
});
|
|
76
87
|
};
|
|
77
|
-
const initOnBeforeUnmount = ({ onBeforeUnmount, props, select,
|
|
88
|
+
const initOnBeforeUnmount = ({ onBeforeUnmount, props, select, vm }) => {
|
|
78
89
|
onBeforeUnmount(() => {
|
|
79
90
|
const index = select.state.cachedOptions.indexOf(vm);
|
|
80
|
-
toggleEvent({ props,
|
|
91
|
+
toggleEvent({ props, vm, type: "remove" });
|
|
81
92
|
if (index === -1) {
|
|
82
93
|
select.state.cachedOptions.splice(index, 1);
|
|
83
94
|
}
|
|
84
95
|
select.onOptionDestroy(select.state.options.indexOf(vm));
|
|
85
96
|
});
|
|
86
97
|
};
|
|
87
|
-
const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm,
|
|
98
|
+
const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject, markRaw }, { vm, parent }) => {
|
|
88
99
|
const api2 = {};
|
|
89
100
|
const select = inject("select");
|
|
90
101
|
const constants = select._constants;
|
|
91
102
|
const state = initState({ reactive, computed, props, api: api2, markRaw, select, parent });
|
|
92
103
|
initApi({ api: api2, props, state, select, constants, vm });
|
|
93
104
|
initWatch({ watch, props, state, select, constants });
|
|
94
|
-
initOnMounted({ onMounted, props, api: api2, vm, state,
|
|
95
|
-
initOnBeforeUnmount({ onBeforeUnmount, props, select,
|
|
105
|
+
initOnMounted({ onMounted, props, api: api2, vm, state, constants, select });
|
|
106
|
+
initOnBeforeUnmount({ onBeforeUnmount, props, select, vm });
|
|
96
107
|
select.state.options.push(markRaw(vm));
|
|
97
108
|
select.state.cachedOptions.push(markRaw(vm));
|
|
98
109
|
select.state.optionsCount++;
|
package/option-group/index.js
CHANGED
|
@@ -2,7 +2,9 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
const queryChange = ({ select, state, vm }) => () => {
|
|
3
3
|
state.visible = true;
|
|
4
4
|
if (Array.isArray(select.state.options)) {
|
|
5
|
-
const groupOptions = select.state.options.filter(
|
|
5
|
+
const groupOptions = select.state.options.filter(
|
|
6
|
+
(option) => option.state.parent && vm && option.state.parent.label === vm.label
|
|
7
|
+
);
|
|
6
8
|
if (Array.isArray(groupOptions)) {
|
|
7
9
|
state.visible = groupOptions.some((option) => option.visible === true);
|
|
8
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/opentiny/tiny-vue/issues"
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
|
+
"type": "module",
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "tsup",
|
|
29
30
|
"build:fast": "npm run build && npm run release",
|
package/picker/index.js
CHANGED
|
@@ -10,11 +10,21 @@ import { formatDate, parseDate, isDateObject, getWeekNumber } from "../common/de
|
|
|
10
10
|
import { extend } from "../common/object";
|
|
11
11
|
import globalTimezone from "../picker/timezone";
|
|
12
12
|
const iso8601Reg = /^\d{4}-\d{2}-\d{2}(.)\d{2}:\d{2}:\d{2}(.+)$/;
|
|
13
|
-
const getPanel = ({
|
|
13
|
+
const getPanel = ({
|
|
14
|
+
DatePanel,
|
|
15
|
+
DateRangePanel,
|
|
16
|
+
MonthRangePanel,
|
|
17
|
+
YearRangePanel,
|
|
18
|
+
TimePanel,
|
|
19
|
+
TimeRangePanel,
|
|
20
|
+
TimeSelect
|
|
21
|
+
}) => (type) => {
|
|
14
22
|
if (type === DATEPICKER.DateRange || type === DATEPICKER.DateTimeRange) {
|
|
15
23
|
return DateRangePanel;
|
|
16
24
|
} else if (type === DATEPICKER.MonthRange) {
|
|
17
25
|
return MonthRangePanel;
|
|
26
|
+
} else if (type === DATEPICKER.YearRange) {
|
|
27
|
+
return YearRangePanel;
|
|
18
28
|
} else if (type === DATEPICKER.TimeRange) {
|
|
19
29
|
return TimeRangePanel;
|
|
20
30
|
} else if (type === DATEPICKER.Time) {
|
|
@@ -62,8 +72,8 @@ const getMode = ({ state }) => () => {
|
|
|
62
72
|
return DATEPICKER.Week;
|
|
63
73
|
} else if (state.type === DATEPICKER.Month) {
|
|
64
74
|
return DATEPICKER.Month;
|
|
65
|
-
} else if (
|
|
66
|
-
return
|
|
75
|
+
} else if ([DATEPICKER.Year, DATEPICKER.Years, DATEPICKER.YearRange].includes(state.type)) {
|
|
76
|
+
return state.type;
|
|
67
77
|
} else if (state.type === DATEPICKER.Dates) {
|
|
68
78
|
return DATEPICKER.Dates;
|
|
69
79
|
}
|
|
@@ -80,11 +90,14 @@ const formatAsFormatAndType = ({ api }) => (value, customFormat, type) => {
|
|
|
80
90
|
const displayValue = ({ api, props, state }) => () => {
|
|
81
91
|
const formattedValue = api.formatAsFormatAndType(state.parsedValue, state.format, state.type, props.rangeSeparator);
|
|
82
92
|
if (Array.isArray(state.userInput)) {
|
|
83
|
-
return [
|
|
93
|
+
return [
|
|
94
|
+
state.userInput[0] || formattedValue && formattedValue[0] || "",
|
|
95
|
+
state.userInput[1] || formattedValue && formattedValue[1] || ""
|
|
96
|
+
];
|
|
84
97
|
} else if (state.userInput !== null) {
|
|
85
98
|
return state.userInput;
|
|
86
99
|
} else if (formattedValue) {
|
|
87
|
-
return
|
|
100
|
+
return [DATEPICKER.Dates, DATEPICKER.Years].includes(state.type) ? formattedValue.join(", ") : formattedValue;
|
|
88
101
|
}
|
|
89
102
|
return "";
|
|
90
103
|
};
|
|
@@ -253,7 +266,9 @@ const getDatesOfTypeValueResolveMap = (api) => ({
|
|
|
253
266
|
return value.map((date) => api.dateFormatter(date, format));
|
|
254
267
|
},
|
|
255
268
|
parser(value, format) {
|
|
256
|
-
return (typeof value === "string" ? value.split(", ") : value).map(
|
|
269
|
+
return (typeof value === "string" ? value.split(", ") : value).map(
|
|
270
|
+
(date) => date instanceof Date ? date : api.dateParser(date, format)
|
|
271
|
+
);
|
|
257
272
|
}
|
|
258
273
|
});
|
|
259
274
|
const typeValueResolveMap = ({ api, t }) => () => ({
|
|
@@ -268,6 +283,8 @@ const typeValueResolveMap = ({ api, t }) => () => ({
|
|
|
268
283
|
time: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
269
284
|
month: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
270
285
|
year: { formatter: api.dateFormatter, parser: api.dateParser },
|
|
286
|
+
years: getDatesOfTypeValueResolveMap(api),
|
|
287
|
+
yearrange: getDatesOfTypeValueResolveMap(api),
|
|
271
288
|
number: getNumberOfTypeValueResolveMap(),
|
|
272
289
|
dates: getDatesOfTypeValueResolveMap(api)
|
|
273
290
|
});
|
|
@@ -295,7 +312,7 @@ const secondInputId = ({ props, state }) => () => {
|
|
|
295
312
|
}
|
|
296
313
|
return obj;
|
|
297
314
|
};
|
|
298
|
-
const focus = ({ api, props,
|
|
315
|
+
const focus = ({ api, props, vm }) => () => !props.ranged ? vm.$refs.reference.focus() : api.handleFocus();
|
|
299
316
|
const blur = (state) => () => state.refInput.forEach((input) => input.blur());
|
|
300
317
|
const parseValue = ({ api, props, state }) => (value) => {
|
|
301
318
|
const isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);
|
|
@@ -365,20 +382,31 @@ const handleStartChange = ({ api, state }) => () => {
|
|
|
365
382
|
if (state.displayValue[1]) {
|
|
366
383
|
state.userInput = [api.formatToString(value), state.displayValue[1]];
|
|
367
384
|
newValue = [value, state.picker.state.value && state.picker.state.value[1]];
|
|
385
|
+
state.startStatus = true;
|
|
368
386
|
} else {
|
|
369
|
-
let now =
|
|
387
|
+
let now = new Date();
|
|
370
388
|
if (now.getTime() < value.getTime()) {
|
|
371
389
|
state.userInput = [api.formatToString(value), api.formatToString(value)];
|
|
372
390
|
newValue = [value, value];
|
|
373
391
|
} else {
|
|
374
|
-
state.userInput = [api.formatToString(value),
|
|
375
|
-
newValue = [value,
|
|
392
|
+
state.userInput = [api.formatToString(value), ""];
|
|
393
|
+
newValue = [value, ""];
|
|
376
394
|
}
|
|
377
395
|
}
|
|
378
|
-
state.picker.state.value = newValue;
|
|
379
396
|
if (api.isValidValue(newValue)) {
|
|
397
|
+
state.picker.state.value = newValue;
|
|
398
|
+
state.historyUserInput = [value, state.picker.state.value && state.picker.state.value[1]];
|
|
399
|
+
state.historyUserValue = newValue;
|
|
380
400
|
api.emitInput(newValue);
|
|
381
401
|
state.userInput = null;
|
|
402
|
+
} else {
|
|
403
|
+
if (state.startStatus) {
|
|
404
|
+
state.picker.state.value = state.historyUserValue ? state.historyUserValue : state.historyValue;
|
|
405
|
+
api.emitInput(state.historyUserValue ? state.historyUserValue : state.historyValue);
|
|
406
|
+
state.userInput = state.historyUserInput ? state.historyUserInput : state.historyInput;
|
|
407
|
+
} else {
|
|
408
|
+
state.picker.state.value = newValue;
|
|
409
|
+
}
|
|
382
410
|
}
|
|
383
411
|
}
|
|
384
412
|
};
|
|
@@ -389,8 +417,9 @@ const handleEndChange = ({ api, state }) => () => {
|
|
|
389
417
|
if (state.displayValue[0]) {
|
|
390
418
|
state.userInput = [state.displayValue[0], api.formatToString(value)];
|
|
391
419
|
newValue = [state.picker.state.value && state.picker.state.value[0], value];
|
|
420
|
+
state.endStatus = true;
|
|
392
421
|
} else {
|
|
393
|
-
let now =
|
|
422
|
+
let now = new Date();
|
|
394
423
|
if (now.getTime() < value.getTime()) {
|
|
395
424
|
state.userInput = [api.formatToString(now), api.formatToString(value)];
|
|
396
425
|
newValue = [now, value];
|
|
@@ -399,10 +428,21 @@ const handleEndChange = ({ api, state }) => () => {
|
|
|
399
428
|
newValue = [value, value];
|
|
400
429
|
}
|
|
401
430
|
}
|
|
402
|
-
state.picker.state.value = newValue;
|
|
403
431
|
if (api.isValidValue(newValue)) {
|
|
432
|
+
state.historyValue = newValue;
|
|
433
|
+
state.historyInput = [state.displayValue[0], api.formatToString(value)];
|
|
434
|
+
state.picker.state.value = newValue;
|
|
404
435
|
api.emitInput(newValue);
|
|
405
436
|
state.userInput = null;
|
|
437
|
+
} else {
|
|
438
|
+
if (state.endStatus) {
|
|
439
|
+
state.picker.state.value = state.historyValue;
|
|
440
|
+
api.emitInput(state.historyValue);
|
|
441
|
+
state.userInput = state.historyInput;
|
|
442
|
+
} else {
|
|
443
|
+
state.picker.state.value = state.historyValue;
|
|
444
|
+
state.userInput = state.historyInput;
|
|
445
|
+
}
|
|
406
446
|
}
|
|
407
447
|
}
|
|
408
448
|
};
|
|
@@ -433,12 +473,12 @@ const handleClose = ({ api, props, state }) => () => {
|
|
|
433
473
|
api.emitInput(oldValue);
|
|
434
474
|
}
|
|
435
475
|
};
|
|
436
|
-
const handleFocus = ({ emit,
|
|
476
|
+
const handleFocus = ({ emit, vm, state }) => () => {
|
|
437
477
|
const type = state.type;
|
|
438
478
|
if (DATEPICKER.TriggerTypes.includes(type) && !state.pickerVisible) {
|
|
439
479
|
state.pickerVisible = true;
|
|
440
480
|
}
|
|
441
|
-
emit("focus", refs.reference);
|
|
481
|
+
emit("focus", vm.$refs.reference);
|
|
442
482
|
};
|
|
443
483
|
const handleKeydown = ({ api, state }) => (event) => {
|
|
444
484
|
const keyCode = event.keyCode;
|
|
@@ -662,6 +702,13 @@ const getType = ({ props }) => () => {
|
|
|
662
702
|
return DATEPICKER.TimeSelect;
|
|
663
703
|
};
|
|
664
704
|
const watchModelValue = ({ api, props, state, dispatch }) => (value, oldValue) => {
|
|
705
|
+
state.historyInput = state.displayValue;
|
|
706
|
+
if (state.picker) {
|
|
707
|
+
state.historyValue = [
|
|
708
|
+
state.picker.state.value && state.picker.state.value[0],
|
|
709
|
+
api.parseString(state.historyInput && state.historyInput[1])
|
|
710
|
+
];
|
|
711
|
+
}
|
|
665
712
|
api.emitChange(props.modelValue);
|
|
666
713
|
if (!valueEquals(value, oldValue) && !state.pickerVisible && props.validateEvent) {
|
|
667
714
|
dispatch("FormItem", "form.change", value);
|
|
@@ -682,7 +729,7 @@ const computedFormat = ({ props, utils }) => () => {
|
|
|
682
729
|
};
|
|
683
730
|
const computedTriggerClass = ({ props, state }) => () => props.suffixIcon || props.prefixIcon || (state.type.includes(DATEPICKER.Time) ? DATEPICKER.IconTime : DATEPICKER.IconDate);
|
|
684
731
|
const computedHaveTrigger = ({ props }) => () => typeof props.showTrigger !== "undefined" ? props.showTrigger : DATEPICKER.TriggerTypes.includes(props.type);
|
|
685
|
-
const
|
|
732
|
+
const initPopper = ({ props, hooks, vnode }) => {
|
|
686
733
|
const { reactive, watch, toRefs, onBeforeUnmount, onDeactivated } = hooks;
|
|
687
734
|
const { emit, refs, slots, nextTick } = vnode;
|
|
688
735
|
const placementMap = DATEPICKER.PlacementMap;
|
|
@@ -734,6 +781,27 @@ const initGlobalTimezone = ({ api, state, props }) => () => {
|
|
|
734
781
|
}
|
|
735
782
|
api.emitDbTime(props.value);
|
|
736
783
|
};
|
|
784
|
+
const handleEnterDisplayOnlyContent = ({ state, t }) => ($event) => {
|
|
785
|
+
const target = $event.target;
|
|
786
|
+
if (target && target.scrollWidth > target.offsetWidth) {
|
|
787
|
+
state.displayOnlyTooltip = state.displayValue.join(` ${t("ui.datepicker.to")} `);
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
const handleEnterPickerlabel = ({ state, props }) => ($event) => {
|
|
791
|
+
const target = $event.target;
|
|
792
|
+
if (target && target.scrollWidth > target.offsetWidth) {
|
|
793
|
+
state.labelTooltip = props.label;
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
const setInputPaddingLeft = ({ props, state, vm, nextTick }) => () => {
|
|
797
|
+
const ml = 12;
|
|
798
|
+
const mr = 8;
|
|
799
|
+
if (props.label && !state.ranged && vm.$refs.label && vm.$refs.reference) {
|
|
800
|
+
nextTick(() => {
|
|
801
|
+
vm.$refs.reference.querySelector("input").style.paddingLeft = vm.$refs.label.offsetWidth + ml + mr + "px";
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
};
|
|
737
805
|
export {
|
|
738
806
|
blur,
|
|
739
807
|
computedFormat,
|
|
@@ -762,6 +830,8 @@ export {
|
|
|
762
830
|
handleClose,
|
|
763
831
|
handleEndChange,
|
|
764
832
|
handleEndInput,
|
|
833
|
+
handleEnterDisplayOnlyContent,
|
|
834
|
+
handleEnterPickerlabel,
|
|
765
835
|
handleFocus,
|
|
766
836
|
handleKeydown,
|
|
767
837
|
handleMouseEnter,
|
|
@@ -771,7 +841,7 @@ export {
|
|
|
771
841
|
handleStartInput,
|
|
772
842
|
hidePicker,
|
|
773
843
|
initGlobalTimezone,
|
|
774
|
-
|
|
844
|
+
initPopper,
|
|
775
845
|
isValidValue,
|
|
776
846
|
mountPicker,
|
|
777
847
|
parseAsFormatAndType,
|
|
@@ -781,6 +851,7 @@ export {
|
|
|
781
851
|
rangeFormatter,
|
|
782
852
|
rangeParser,
|
|
783
853
|
secondInputId,
|
|
854
|
+
setInputPaddingLeft,
|
|
784
855
|
showPicker,
|
|
785
856
|
typeValueResolveMap,
|
|
786
857
|
updateOptions,
|
package/picker/vue.js
CHANGED
|
@@ -48,9 +48,12 @@ import {
|
|
|
48
48
|
computedFormat,
|
|
49
49
|
computedTriggerClass,
|
|
50
50
|
computedHaveTrigger,
|
|
51
|
-
|
|
51
|
+
initPopper,
|
|
52
52
|
initGlobalTimezone,
|
|
53
|
-
emitDbTime
|
|
53
|
+
emitDbTime,
|
|
54
|
+
handleEnterDisplayOnlyContent,
|
|
55
|
+
handleEnterPickerlabel,
|
|
56
|
+
setInputPaddingLeft
|
|
54
57
|
} from "./index";
|
|
55
58
|
import { DATEPICKER } from "../common";
|
|
56
59
|
const api = [
|
|
@@ -71,10 +74,18 @@ const api = [
|
|
|
71
74
|
"handlePick",
|
|
72
75
|
"handleSelectRange",
|
|
73
76
|
"handleSelectChange",
|
|
74
|
-
"popperElm"
|
|
77
|
+
"popperElm",
|
|
78
|
+
"handleEnterDisplayOnlyContent",
|
|
79
|
+
"handleEnterPickerlabel"
|
|
75
80
|
];
|
|
76
|
-
const initState = ({ api: api2, reactive,
|
|
81
|
+
const initState = ({ api: api2, reactive, vm, computed, props, utils, parent }) => {
|
|
77
82
|
const state = reactive({
|
|
83
|
+
historyValue: [],
|
|
84
|
+
historyInput: [],
|
|
85
|
+
historyUserInput: [],
|
|
86
|
+
historyUserValue: [],
|
|
87
|
+
startStatus: false,
|
|
88
|
+
endStatus: false,
|
|
78
89
|
date: null,
|
|
79
90
|
pickerVisible: false,
|
|
80
91
|
showClose: false,
|
|
@@ -83,7 +94,7 @@ const initState = ({ api: api2, reactive, refs, computed, props, utils }) => {
|
|
|
83
94
|
popperElm: null,
|
|
84
95
|
unwatchPickerOptions: null,
|
|
85
96
|
ranged: computed(() => state.type.includes(DATEPICKER.Range)),
|
|
86
|
-
reference: computed(() => refs.reference.$el || refs.reference),
|
|
97
|
+
reference: computed(() => vm.$refs.reference.$el || vm.$refs.reference),
|
|
87
98
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
88
99
|
refInput: computed(() => state.reference ? [].slice.call(state.reference.querySelectorAll("input")) : []),
|
|
89
100
|
valueIsEmpty: computed(() => api2.getValueEmpty()),
|
|
@@ -93,13 +104,16 @@ const initState = ({ api: api2, reactive, refs, computed, props, utils }) => {
|
|
|
93
104
|
displayValue: computed(() => api2.displayValue()),
|
|
94
105
|
parsedValue: computed(() => api2.parsedValue()),
|
|
95
106
|
pickerSize: computed(() => props.size),
|
|
96
|
-
pickerDisabled: computed(() => props.disabled || state.formDisabled),
|
|
107
|
+
pickerDisabled: computed(() => props.disabled || state.formDisabled || state.isDisplayOnly),
|
|
97
108
|
firstInputId: computed(() => api2.firstInputId()),
|
|
98
109
|
secondInputId: computed(() => api2.secondInputId()),
|
|
99
110
|
type: computed(() => api2.getType()),
|
|
100
111
|
timezone: computed(() => api2.getTimezone()),
|
|
101
112
|
valueFormat: computed(() => getValueFormat({ props, utils })),
|
|
102
|
-
format: computed(() => api2.computedFormat())
|
|
113
|
+
format: computed(() => api2.computedFormat()),
|
|
114
|
+
labelTooltip: "",
|
|
115
|
+
displayOnlyTooltip: "",
|
|
116
|
+
isDisplayOnly: computed(() => props.displayOnly || (parent.auiForm || {}).displayOnly)
|
|
103
117
|
});
|
|
104
118
|
return state;
|
|
105
119
|
};
|
|
@@ -122,13 +136,15 @@ const initApi2 = ({ api: api2, props, state, t }) => {
|
|
|
122
136
|
handleMouseEnter: handleMouseEnter({ props, state }),
|
|
123
137
|
initGlobalTimezone: initGlobalTimezone({ api: api2, state, props }),
|
|
124
138
|
parseValue: parseValue({ api: api2, props, state }),
|
|
125
|
-
handleSelectRange: handleSelectRange(state)
|
|
139
|
+
handleSelectRange: handleSelectRange(state),
|
|
140
|
+
handleEnterPickerlabel: handleEnterPickerlabel({ state, props }),
|
|
141
|
+
handleEnterDisplayOnlyContent: handleEnterDisplayOnlyContent({ state, props, t })
|
|
126
142
|
});
|
|
127
143
|
};
|
|
128
144
|
const initApi = ({ api: api2, props, hooks, state, vnode, others, utils }) => {
|
|
129
|
-
const { t, emit,
|
|
145
|
+
const { t, emit, dispatch, nextTick, vm } = vnode;
|
|
130
146
|
const { TimePanel, TimeRangePanel } = others;
|
|
131
|
-
const { destroyPopper, popperElm, updatePopper } =
|
|
147
|
+
const { destroyPopper, popperElm, updatePopper } = initPopper({ props, hooks, vnode });
|
|
132
148
|
state.popperElm = popperElm;
|
|
133
149
|
state.picker = null;
|
|
134
150
|
Object.assign(api2, {
|
|
@@ -137,14 +153,14 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils }) => {
|
|
|
137
153
|
hidePicker: hidePicker({ destroyPopper, state }),
|
|
138
154
|
handleSelectChange: ({ tz, date }) => emit("select-change", { tz, date }),
|
|
139
155
|
getPanel: getPanel(others),
|
|
140
|
-
handleFocus: handleFocus({ emit,
|
|
156
|
+
handleFocus: handleFocus({ emit, vm, state }),
|
|
141
157
|
getTimezone: getTimezone({ props, utils }),
|
|
142
158
|
emitChange: emitChange({ api: api2, dispatch, emit, props, state }),
|
|
143
159
|
parsedValue: parsedValue({ api: api2, props, state, t }),
|
|
144
160
|
parseAsFormatAndType: parseAsFormatAndType({ api: api2 }),
|
|
145
161
|
typeValueResolveMap: typeValueResolveMap({ api: api2, t }),
|
|
146
162
|
updateOptions: updateOptions({ api: api2, props, state }),
|
|
147
|
-
focus: focus({ api: api2, props,
|
|
163
|
+
focus: focus({ api: api2, props, vm }),
|
|
148
164
|
handleChange: handleChange({ api: api2, state }),
|
|
149
165
|
isValidValue: isValidValue({ api: api2, state }),
|
|
150
166
|
emitInput: emitInput({ api: api2, emit, props, state }),
|
|
@@ -166,7 +182,8 @@ const initApi = ({ api: api2, props, hooks, state, vnode, others, utils }) => {
|
|
|
166
182
|
watchModelValue: watchModelValue({ api: api2, props, state, dispatch }),
|
|
167
183
|
computedFormat: computedFormat({ props, utils }),
|
|
168
184
|
computedTriggerClass: computedTriggerClass({ props, state }),
|
|
169
|
-
computedHaveTrigger: computedHaveTrigger({ props })
|
|
185
|
+
computedHaveTrigger: computedHaveTrigger({ props }),
|
|
186
|
+
setInputPaddingLeft: setInputPaddingLeft({ props, state, vm, nextTick })
|
|
170
187
|
});
|
|
171
188
|
initApi2({ api: api2, props, state, t });
|
|
172
189
|
};
|
|
@@ -189,17 +206,25 @@ const initWatch = ({ api: api2, state, props, watch, markRaw }) => {
|
|
|
189
206
|
watch(() => props.isRange, api2.watchIsRange);
|
|
190
207
|
watch(() => props.modelValue, api2.watchModelValue);
|
|
191
208
|
watch(() => props.pickerOptions, api2.updateOptions, { deep: true });
|
|
209
|
+
watch(() => props.label, api2.setInputPaddingLeft);
|
|
192
210
|
};
|
|
193
211
|
const renderless = (props, hooks, vnode, others) => {
|
|
194
212
|
const api2 = {};
|
|
195
|
-
const { reactive, computed, watch, onBeforeUnmount, inject, markRaw } = hooks;
|
|
196
|
-
const {
|
|
213
|
+
const { reactive, computed, watch, onBeforeUnmount, inject, markRaw, onMounted } = hooks;
|
|
214
|
+
const { vm, service, parent } = vnode;
|
|
197
215
|
const { utils = {} } = service || {};
|
|
198
|
-
const state = initState({ api: api2, reactive,
|
|
199
|
-
|
|
216
|
+
const state = initState({ api: api2, reactive, vm, computed, props, utils, parent });
|
|
217
|
+
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
200
218
|
initApi({ api: api2, props, hooks, state, vnode, others, utils });
|
|
201
219
|
initWatch({ api: api2, state, props, watch, markRaw });
|
|
202
220
|
api2.initGlobalTimezone();
|
|
221
|
+
onMounted(() => {
|
|
222
|
+
api2.setInputPaddingLeft();
|
|
223
|
+
});
|
|
224
|
+
vm.$on("handle-clear", (event) => {
|
|
225
|
+
state.showClose = true;
|
|
226
|
+
api2.handleClickIcon(event);
|
|
227
|
+
});
|
|
203
228
|
onBeforeUnmount(() => {
|
|
204
229
|
api2.destroyPopper("remove");
|
|
205
230
|
state.popperElm = null;
|
package/picker-column/index.js
CHANGED
|
@@ -49,7 +49,7 @@ const adjustIndex = (state) => (index) => {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
const onTouchstart = ({
|
|
52
|
+
const onTouchstart = ({ vm, state }) => (event) => {
|
|
53
53
|
state.direction = "";
|
|
54
54
|
state.deltaX = 0;
|
|
55
55
|
state.deltaY = 0;
|
|
@@ -58,7 +58,7 @@ const onTouchstart = ({ refs, state }) => (event) => {
|
|
|
58
58
|
state.startX = event.touches[0].clientX;
|
|
59
59
|
state.startY = event.touches[0].clientY;
|
|
60
60
|
if (state.moving) {
|
|
61
|
-
const style = window.getComputedStyle(refs.track);
|
|
61
|
+
const style = window.getComputedStyle(vm.$refs.track);
|
|
62
62
|
const transform = style.transform || style.webkitTransform;
|
|
63
63
|
const translateY = Number(transform.slice(7, transform.length - 1).split(", ")[5]);
|
|
64
64
|
state.offset = Math.min(0, translateY - state.baseOffset);
|
|
@@ -113,8 +113,8 @@ const onTouchend = ({ api, state }) => () => {
|
|
|
113
113
|
state.moving = false;
|
|
114
114
|
}, 0);
|
|
115
115
|
};
|
|
116
|
-
const mountedHandler = ({ api,
|
|
117
|
-
const track = refs.track;
|
|
116
|
+
const mountedHandler = ({ api, vm, state }) => () => {
|
|
117
|
+
const track = vm.$refs.track;
|
|
118
118
|
on(track, "touchstart", api.onTouchstart);
|
|
119
119
|
on(track, "touchmove", api.onTouchmove);
|
|
120
120
|
on(track, "touchend", api.onTouchend);
|
|
@@ -123,8 +123,8 @@ const mountedHandler = ({ api, refs, state }) => () => {
|
|
|
123
123
|
backgroundSize: `100% ${(state.clumnsWrapHeight - state.itemHeight) / 2}px`
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
|
-
const beforeUnmountHandler = ({ api,
|
|
127
|
-
const track = refs.track;
|
|
126
|
+
const beforeUnmountHandler = ({ api, vm }) => () => {
|
|
127
|
+
const track = vm.$refs.track;
|
|
128
128
|
off(track, "touchstart", api.onTouchstart);
|
|
129
129
|
off(track, "touchmove", api.onTouchmove);
|
|
130
130
|
off(track, "touchend", api.onTouchend);
|
package/picker-column/vue.js
CHANGED
|
@@ -49,7 +49,7 @@ const initState = ({ reactive, computed, props, api: api2 }) => {
|
|
|
49
49
|
});
|
|
50
50
|
return state;
|
|
51
51
|
};
|
|
52
|
-
const initApi = ({ api: api2, props, state,
|
|
52
|
+
const initApi = ({ api: api2, props, state, vm, emit }) => {
|
|
53
53
|
Object.assign(api2, {
|
|
54
54
|
state,
|
|
55
55
|
getValue: getValue(state),
|
|
@@ -66,8 +66,8 @@ const initApi = ({ api: api2, props, state, refs, emit }) => {
|
|
|
66
66
|
momentum: momentum({ api: api2, state, props }),
|
|
67
67
|
setIndex: setIndex({ api: api2, state, emit }),
|
|
68
68
|
onClickItem: onClickItem({ api: api2, state }),
|
|
69
|
-
mountedHandler: mountedHandler({ api: api2, state,
|
|
70
|
-
beforeUnmountHandler: beforeUnmountHandler({ api: api2,
|
|
69
|
+
mountedHandler: mountedHandler({ api: api2, state, vm }),
|
|
70
|
+
beforeUnmountHandler: beforeUnmountHandler({ api: api2, vm })
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
const initWatch = ({ watch, props, state, api: api2 }) => {
|
|
@@ -87,10 +87,10 @@ const initWatch = ({ watch, props, state, api: api2 }) => {
|
|
|
87
87
|
{ immediate: true }
|
|
88
88
|
);
|
|
89
89
|
};
|
|
90
|
-
const renderless = (props, { computed, onMounted, reactive, watch, onBeforeUnmount }, { emit,
|
|
90
|
+
const renderless = (props, { computed, onMounted, reactive, watch, onBeforeUnmount }, { emit, vm }) => {
|
|
91
91
|
const api2 = {};
|
|
92
92
|
const state = initState({ reactive, computed, props, api: api2 });
|
|
93
|
-
initApi({ api: api2, props, state,
|
|
93
|
+
initApi({ api: api2, props, state, vm, emit });
|
|
94
94
|
api2.setIndex(state.currentIndex);
|
|
95
95
|
state.columnsItem = deepClone(props.columnsItem);
|
|
96
96
|
initWatch({ watch, props, state, api: api2 });
|
package/popconfirm/vue.js
CHANGED
|
@@ -8,7 +8,9 @@ const renderless = (props, { computed, reactive }, { emit, constants, designConf
|
|
|
8
8
|
const state = reactive({
|
|
9
9
|
isLock: false,
|
|
10
10
|
showPopover: false,
|
|
11
|
-
getIcon: computed(
|
|
11
|
+
getIcon: computed(
|
|
12
|
+
() => typeof props.type === "object" ? props.type : designIcon || constants.ICON_MAP[props.type]
|
|
13
|
+
)
|
|
12
14
|
});
|
|
13
15
|
Object.assign(api2, {
|
|
14
16
|
state,
|