@opentiny/vue-renderless 3.9.3 → 3.10.1
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 +1 -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/action-sheet/vue.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
setSheetStyle,
|
|
4
|
+
initScrollMenu,
|
|
5
|
+
visibleHandle,
|
|
6
|
+
watchVisible,
|
|
7
|
+
menuHandle,
|
|
8
|
+
close,
|
|
9
|
+
selectOption,
|
|
10
|
+
confirm,
|
|
11
|
+
actionSelectOption,
|
|
12
|
+
hide
|
|
13
|
+
} from "./index";
|
|
14
|
+
const api = [
|
|
15
|
+
"state",
|
|
16
|
+
"setSheetStyle",
|
|
17
|
+
"initScrollMenu",
|
|
18
|
+
"visibleHandle",
|
|
19
|
+
"watchVisible",
|
|
20
|
+
"menuHandle",
|
|
21
|
+
"close",
|
|
22
|
+
"selectOption",
|
|
23
|
+
"confirm",
|
|
24
|
+
"actionSelectOption",
|
|
25
|
+
"hide"
|
|
26
|
+
];
|
|
4
27
|
const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, { BScroll }) => {
|
|
5
28
|
const api2 = {};
|
|
6
29
|
const state = reactive({
|
package/anchor/index.js
CHANGED
|
@@ -40,10 +40,10 @@ const updateSkidPosition = ({ vm, state, emit }) => {
|
|
|
40
40
|
const offsetTop = linkTitleClientTop - anchorClientTop;
|
|
41
41
|
const offsetLeft = linkTitleClientLeft - anchorClientLeft;
|
|
42
42
|
addClass(skidRef, "tiny-anchor-orbit-skid--active");
|
|
43
|
-
skidRef.style.
|
|
43
|
+
skidRef.style.transform = `translateY(${offsetTop}px)`;
|
|
44
44
|
skidRef.style.height = `${offsetHeight}px`;
|
|
45
45
|
if (maskRef) {
|
|
46
|
-
maskRef.style.
|
|
46
|
+
maskRef.style.transform = `translateY(${offsetTop}px)`;
|
|
47
47
|
maskRef.style.height = `${offsetHeight}px`;
|
|
48
48
|
maskRef.style.maxWidth = `${offsetWidth + offsetLeft}px`;
|
|
49
49
|
}
|
|
@@ -83,7 +83,7 @@ const handleScroll = (state) => {
|
|
|
83
83
|
state.scrollTimer = setTimeout(() => {
|
|
84
84
|
state.isScroll = false;
|
|
85
85
|
clearTimeout(state.scrollTimer);
|
|
86
|
-
},
|
|
86
|
+
}, 2e3);
|
|
87
87
|
};
|
|
88
88
|
const setChildOffsetTop = ({ state, props }) => {
|
|
89
89
|
var _a;
|
package/anchor/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { mounted, updated, unmounted, getContainer, linkClick, onItersectionObserver } from "./index";
|
|
3
3
|
const api = ["state", "getContainer", "linkClick", "onItersectionObserver"];
|
|
4
|
-
const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive }, { vm, emit }) => {
|
|
4
|
+
const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive, watch }, { vm, emit }) => {
|
|
5
5
|
const api2 = {};
|
|
6
6
|
const state = reactive({
|
|
7
7
|
currentLink: "",
|
|
@@ -26,6 +26,12 @@ const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive }, { vm
|
|
|
26
26
|
onMounted(api2.mounted);
|
|
27
27
|
onUpdated(api2.updated);
|
|
28
28
|
onUnmounted(api2.unmounted);
|
|
29
|
+
watch(
|
|
30
|
+
() => props.links,
|
|
31
|
+
() => {
|
|
32
|
+
api2.mounted();
|
|
33
|
+
}
|
|
34
|
+
);
|
|
29
35
|
return api2;
|
|
30
36
|
};
|
|
31
37
|
export {
|
package/area/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const fetchDefaultData = ({ emit, fetchArea, nextTick, props, refs, state }) =>
|
|
|
9
9
|
promise = props.fetchJcr();
|
|
10
10
|
} else {
|
|
11
11
|
if (typeof fetchArea !== "function") {
|
|
12
|
-
throw new TypeError("[TINY Error][Area] Prop fetchJcr is not
|
|
12
|
+
throw new TypeError("[TINY Error][Area] Prop fetchJcr is mandatory when the framework service is not used");
|
|
13
13
|
}
|
|
14
14
|
promise = fetchArea({ label: "JCR", parent });
|
|
15
15
|
}
|
|
@@ -30,7 +30,7 @@ const getRegion = ({ emit, fetchArea, nextTick, props, refs, state }) => (value)
|
|
|
30
30
|
promise = props.fetchRegion();
|
|
31
31
|
} else {
|
|
32
32
|
if (typeof fetchArea !== "function") {
|
|
33
|
-
throw new TypeError("[TINY Error][Area] Prop fetchRegion is not
|
|
33
|
+
throw new TypeError("[TINY Error][Area] Prop fetchRegion is mandatory when the framework service is not used");
|
|
34
34
|
}
|
|
35
35
|
promise = fetchArea({ label: "Region", parent: value });
|
|
36
36
|
}
|
|
@@ -50,7 +50,7 @@ const getRep = ({ emit, fetchArea, nextTick, props, refs, state }) => (value) =>
|
|
|
50
50
|
promise = props.fetchRep();
|
|
51
51
|
} else {
|
|
52
52
|
if (typeof fetchArea !== "function") {
|
|
53
|
-
throw new TypeError("[TINY Error][Area] Prop fetchRep is not
|
|
53
|
+
throw new TypeError("[TINY Error][Area] Prop fetchRep is mandatory when the framework service is not used");
|
|
54
54
|
}
|
|
55
55
|
promise = fetchArea({ label: "Rep. Office", parent: value });
|
|
56
56
|
}
|
|
@@ -69,7 +69,7 @@ const getOffice = ({ emit, fetchArea, nextTick, props, refs, state }) => (value)
|
|
|
69
69
|
promise = props.fetchOffice();
|
|
70
70
|
} else {
|
|
71
71
|
if (typeof fetchArea !== "function") {
|
|
72
|
-
throw new TypeError("[TINY Error][Area] Prop fetchOffice is not
|
|
72
|
+
throw new TypeError("[TINY Error][Area] Prop fetchOffice is mandatory when the framework service is not used");
|
|
73
73
|
}
|
|
74
74
|
promise = fetchArea({ label: "Office", parent: value });
|
|
75
75
|
}
|
package/button/vue.js
CHANGED
|
@@ -4,11 +4,13 @@ const api = ["state", "handleClick"];
|
|
|
4
4
|
const renderless = (props, { computed, onBeforeUnmount, reactive, watch, inject }, { emit, parent }) => {
|
|
5
5
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
6
6
|
const state = reactive({
|
|
7
|
-
timer:
|
|
7
|
+
timer: void 0,
|
|
8
8
|
disabled: props.disabled,
|
|
9
9
|
plain: computed(() => props.plain || (parent.buttonGroup || {}).plain),
|
|
10
10
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
11
|
-
buttonDisabled: computed(
|
|
11
|
+
buttonDisabled: computed(
|
|
12
|
+
() => props.disabled || state.disabled || (parent.buttonGroup || {}).disabled || state.formDisabled
|
|
13
|
+
)
|
|
12
14
|
});
|
|
13
15
|
watch(
|
|
14
16
|
() => props.disabled,
|
package/button-group/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const handleChange = ({ emit, state }) => () => {
|
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
7
|
const handleClick = ({ emit, props, state }) => (node) => {
|
|
8
|
-
if (!state.disabled) {
|
|
8
|
+
if (!state.disabled && !node.disabled) {
|
|
9
9
|
state.value = node[props.valueField];
|
|
10
10
|
emit("update:modelValue", state.value);
|
|
11
11
|
}
|
|
@@ -19,7 +19,14 @@ const moreNodeClick = ({ emit, props, state }) => (node) => {
|
|
|
19
19
|
emit("update:modelValue", state.value);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
const getItemClass = ({ props, state }) => (node) => {
|
|
23
|
+
if (state.disabled || node.disabled) {
|
|
24
|
+
return { disabled: true };
|
|
25
|
+
}
|
|
26
|
+
return props.plain ? { plain: props.plain } : "";
|
|
27
|
+
};
|
|
22
28
|
export {
|
|
29
|
+
getItemClass,
|
|
23
30
|
handleChange,
|
|
24
31
|
handleClick,
|
|
25
32
|
moreNodeClick
|
package/button-group/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import { handleClick, moreNodeClick, handleChange } from "./index";
|
|
3
|
-
const api = ["state", "handleClick", "moreNodeClick", "handleChange"];
|
|
2
|
+
import { handleClick, moreNodeClick, handleChange, getItemClass } from "./index";
|
|
3
|
+
const api = ["state", "handleClick", "moreNodeClick", "handleChange", "getItemClass"];
|
|
4
4
|
const renderless = (props, { computed, reactive, watch, inject }, { emit, parent }) => {
|
|
5
5
|
var _a, _b;
|
|
6
6
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
@@ -9,13 +9,7 @@ const renderless = (props, { computed, reactive, watch, inject }, { emit, parent
|
|
|
9
9
|
buttonData: ((_a = props.data) == null ? void 0 : _a.slice(0, props.showMore)) || [],
|
|
10
10
|
moreData: ((_b = props.data) == null ? void 0 : _b.slice(props.showMore, props.data.length)) || [],
|
|
11
11
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
12
|
-
disabled: computed(() => props.disabled || state.formDisabled)
|
|
13
|
-
attributeValue: computed(() => {
|
|
14
|
-
if (state.disabled) {
|
|
15
|
-
return { disabled: state.disabled };
|
|
16
|
-
}
|
|
17
|
-
return props.plain ? { plain: props.plain } : "";
|
|
18
|
-
})
|
|
12
|
+
disabled: computed(() => props.disabled || state.formDisabled)
|
|
19
13
|
});
|
|
20
14
|
watch(
|
|
21
15
|
() => props.modelValue,
|
|
@@ -34,7 +28,8 @@ const renderless = (props, { computed, reactive, watch, inject }, { emit, parent
|
|
|
34
28
|
state,
|
|
35
29
|
handleClick: handleClick({ emit, props, state }),
|
|
36
30
|
moreNodeClick: moreNodeClick({ emit, props, state }),
|
|
37
|
-
handleChange: handleChange({ emit, state })
|
|
31
|
+
handleChange: handleChange({ emit, state }),
|
|
32
|
+
getItemClass: getItemClass({ props, state })
|
|
38
33
|
};
|
|
39
34
|
return api2;
|
|
40
35
|
};
|
package/calendar/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "../chunk-PKUHTIDK.js";
|
|
|
2
2
|
import { isLeapYear } from "../common/date";
|
|
3
3
|
import { copyArray } from "../common/object";
|
|
4
4
|
const getDays = (year, month) => [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
|
|
5
|
-
const getWeek = (year, month, day) =>
|
|
5
|
+
const getWeek = (year, month, day) => new Date(`${year}/${month}/${day}`).getDay();
|
|
6
6
|
const lastMonth = (year, month) => {
|
|
7
7
|
year = Number(year);
|
|
8
8
|
month = Number(month);
|
|
@@ -133,7 +133,7 @@ const selectDay = (state) => (day) => {
|
|
|
133
133
|
state.activeYear = year;
|
|
134
134
|
}
|
|
135
135
|
state.selectedTip = `You selected date: ${state.activeYear}-${state.activeMonth}-${day.value}`;
|
|
136
|
-
state.selectedDate = Number(
|
|
136
|
+
state.selectedDate = Number(new Date(`${state.activeYear}/${state.activeMonth}/${day.value}`));
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
const getEventByDay = (state) => (day) => {
|
|
@@ -162,9 +162,9 @@ const getEventByMonth = ({ props, state }) => (month) => {
|
|
|
162
162
|
}
|
|
163
163
|
return events;
|
|
164
164
|
};
|
|
165
|
-
const getTime = (state) => (day) => Number(
|
|
165
|
+
const getTime = (state) => (day) => Number(new Date(`${state.activeYear}/${state.activeMonth}/${day}`));
|
|
166
166
|
const getYearList = () => () => {
|
|
167
|
-
const date =
|
|
167
|
+
const date = new Date();
|
|
168
168
|
const year = date.getFullYear();
|
|
169
169
|
const yesrs = [];
|
|
170
170
|
for (let i = year - 10; i < year + 10; i++) {
|
|
@@ -173,7 +173,7 @@ const getYearList = () => () => {
|
|
|
173
173
|
return yesrs;
|
|
174
174
|
};
|
|
175
175
|
const isToday = (state) => (day) => {
|
|
176
|
-
const date =
|
|
176
|
+
const date = new Date();
|
|
177
177
|
let year = Number(state.activeYear);
|
|
178
178
|
let month = Number(state.activeMonth);
|
|
179
179
|
if (day.isLast) {
|
|
@@ -189,7 +189,7 @@ const isToday = (state) => (day) => {
|
|
|
189
189
|
return date.getDate() === day.value && date.getFullYear() === year && date.getMonth() + 1 === month;
|
|
190
190
|
};
|
|
191
191
|
const isThisMonth = (state) => (month) => {
|
|
192
|
-
const date =
|
|
192
|
+
const date = new Date();
|
|
193
193
|
const year = Number(state.activeYear);
|
|
194
194
|
return date.getMonth() + 1 === month && date.getFullYear() === year;
|
|
195
195
|
};
|
|
@@ -205,19 +205,19 @@ const genMonths = () => {
|
|
|
205
205
|
return result;
|
|
206
206
|
};
|
|
207
207
|
const toToday = (state) => () => {
|
|
208
|
-
const year =
|
|
209
|
-
const month =
|
|
210
|
-
const day =
|
|
208
|
+
const year = new Date().getFullYear();
|
|
209
|
+
const month = new Date().getMonth() + 1;
|
|
210
|
+
const day = new Date().getDate();
|
|
211
211
|
state.activeMonth = month;
|
|
212
212
|
state.activeYear = year;
|
|
213
213
|
state.selectedTip = `You selected date: ${year}-${month}-${day}`;
|
|
214
|
-
state.selectedDate = Number(
|
|
214
|
+
state.selectedDate = Number(new Date(`${year}/${month}/${day}`));
|
|
215
215
|
};
|
|
216
216
|
const getCurrentDate = () => {
|
|
217
|
-
const day =
|
|
218
|
-
const month =
|
|
219
|
-
const year =
|
|
220
|
-
return Number(
|
|
217
|
+
const day = new Date().getDate();
|
|
218
|
+
const month = new Date().getMonth() + 1;
|
|
219
|
+
const year = new Date().getFullYear();
|
|
220
|
+
return Number(new Date(`${year}/${month}/${day}`));
|
|
221
221
|
};
|
|
222
222
|
export {
|
|
223
223
|
computedCalendar,
|
package/calendar-bar/index.js
CHANGED
|
@@ -11,12 +11,12 @@ const normalConfig = (config, state) => {
|
|
|
11
11
|
return { weekFirst, disabled, holiday, workday, mark };
|
|
12
12
|
};
|
|
13
13
|
const normalDate = (date) => {
|
|
14
|
-
date = !date ?
|
|
15
|
-
date = date.toString() === "Invalid Date" ?
|
|
14
|
+
date = !date ? new Date() : !(date instanceof Date) ? new Date(date) : date;
|
|
15
|
+
date = date.toString() === "Invalid Date" ? new Date() : date;
|
|
16
16
|
return date;
|
|
17
17
|
};
|
|
18
18
|
const splitDate = (date) => {
|
|
19
|
-
const today =
|
|
19
|
+
const today = new Date();
|
|
20
20
|
const todayFullYear = today.getFullYear();
|
|
21
21
|
const todayMonth = today.getMonth() + 1;
|
|
22
22
|
const todayDate = today.getDate();
|
package/carousel-item/index.js
CHANGED
|
@@ -28,7 +28,7 @@ const translateItem = ({ api, CARD_SCALE, parent, state }) => ({ activeIndex, in
|
|
|
28
28
|
if (vnode.type !== TYPE_CARD && oldIndex !== void 0) {
|
|
29
29
|
state.animating = index === activeIndex || index === oldIndex;
|
|
30
30
|
}
|
|
31
|
-
state.animatingMf = [activeIndex, oldIndex].
|
|
31
|
+
state.animatingMf = ![activeIndex, oldIndex].includes(index);
|
|
32
32
|
if (index !== activeIndex && length > 2 && vnode.loop) {
|
|
33
33
|
index = api.processIndex({ index, activeIndex, length });
|
|
34
34
|
}
|
package/cascader/vue.js
CHANGED
|
@@ -78,7 +78,7 @@ const initState = ({ reactive, props, computed, parent, api: api2, t, constants,
|
|
|
78
78
|
disabled: computed(() => props.disabled || state.isDisplayOnly || state.formDisabled),
|
|
79
79
|
tagSize: computed(() => ~["small", "mini"].indexOf(state.realSize) ? "mini" : "small"),
|
|
80
80
|
isDisabled: computed(() => state.disabled),
|
|
81
|
-
isDisplayOnly: computed(() => state.displayOnly || (parent.
|
|
81
|
+
isDisplayOnly: computed(() => state.displayOnly || (parent.tinyForm || {}).displayOnly),
|
|
82
82
|
config: computed(() => api2.getConfig()),
|
|
83
83
|
multiple: computed(() => state.config.multiple),
|
|
84
84
|
leafOnly: computed(() => !state.config.checkStrictly),
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
import TreeStore from "../common/deps/tree-model/tree-store";
|
|
3
|
+
const close = ({ state, emit }) => () => {
|
|
4
|
+
state.search.show = false;
|
|
5
|
+
emit("update:visible", false);
|
|
6
|
+
emit("close", false);
|
|
7
|
+
};
|
|
8
|
+
const syncCheckStatus = ({ state, props, api }) => (value) => {
|
|
9
|
+
const { valueField, textField, modelValue: propsModelValue, visible } = props;
|
|
10
|
+
const { lazy, isLeaf: leafField } = api.getNodeConfig();
|
|
11
|
+
let currentData, navList = [], modelValue = value || propsModelValue || [], len = modelValue.length, isLeaf;
|
|
12
|
+
if (!visible) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (let i = 0; i < len; i++) {
|
|
16
|
+
const id = modelValue[i];
|
|
17
|
+
currentData = state.store.getNode(id);
|
|
18
|
+
if (currentData) {
|
|
19
|
+
navList.push(currentData);
|
|
20
|
+
} else {
|
|
21
|
+
isLeaf = i === len - 1;
|
|
22
|
+
navList.push({
|
|
23
|
+
data: { [valueField]: id, [textField]: id, [leafField]: isLeaf },
|
|
24
|
+
loaded: false,
|
|
25
|
+
isLeaf,
|
|
26
|
+
childNodes: [],
|
|
27
|
+
level: i,
|
|
28
|
+
loading: false,
|
|
29
|
+
selfWaitLoad: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
state.isLeaf = !hasChildren(navList[len - 1]);
|
|
34
|
+
state.navList = navList;
|
|
35
|
+
state.level = lazy && state.waitLoadList.length ? 0 : Math.max(len - 1, 0);
|
|
36
|
+
};
|
|
37
|
+
const watchVisible = ({ emit, state, props, api }) => (visible) => {
|
|
38
|
+
const { modelValue } = props;
|
|
39
|
+
if (visible) {
|
|
40
|
+
api.watchModelValue(modelValue);
|
|
41
|
+
api.initTreeStore();
|
|
42
|
+
}
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
state.toggle = visible;
|
|
45
|
+
}, 0);
|
|
46
|
+
emit("update:visible", visible);
|
|
47
|
+
};
|
|
48
|
+
const watchModelValue = ({ props, state, emit }) => () => {
|
|
49
|
+
const { textSplit } = props;
|
|
50
|
+
emit("update:text", state.checkLabels.join(textSplit));
|
|
51
|
+
};
|
|
52
|
+
const hasChildren = (option) => option && !option.isLeaf;
|
|
53
|
+
const selectOption = ({ emit, state, props, api }) => (option) => {
|
|
54
|
+
const { valueField } = props;
|
|
55
|
+
const { lazy, load } = api.getNodeConfig();
|
|
56
|
+
const { navList, level, waitLoadList } = state;
|
|
57
|
+
const len = navList.length;
|
|
58
|
+
const appendNavList = () => {
|
|
59
|
+
const isSame = level < len && navList[level] === option;
|
|
60
|
+
if (!isSame) {
|
|
61
|
+
state.navList = [...navList.slice(0, level), option];
|
|
62
|
+
}
|
|
63
|
+
if (hasChildren(option)) {
|
|
64
|
+
state.level += 1;
|
|
65
|
+
}
|
|
66
|
+
state.isLeaf = !hasChildren(state.navList[state.navList.length - 1]);
|
|
67
|
+
emit("node-expand", option);
|
|
68
|
+
};
|
|
69
|
+
if (lazy && load && (option.selfWaitLoad || !option.loaded && !option.isLeaf)) {
|
|
70
|
+
option.loading = true;
|
|
71
|
+
state.loading = true;
|
|
72
|
+
load(option, (nodes) => {
|
|
73
|
+
let index, node;
|
|
74
|
+
option.loading = false;
|
|
75
|
+
state.loading = false;
|
|
76
|
+
option.loaded = true;
|
|
77
|
+
nodes.map((data) => {
|
|
78
|
+
state.store.append(data, option.data);
|
|
79
|
+
index = waitLoadList.indexOf(data[valueField]);
|
|
80
|
+
if (index !== -1) {
|
|
81
|
+
node = state.store.getNode(data);
|
|
82
|
+
state.navList = state.navList.map((option2) => {
|
|
83
|
+
if (node && option2.data[valueField] === data[valueField]) {
|
|
84
|
+
option2 = node;
|
|
85
|
+
}
|
|
86
|
+
return option2;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
appendNavList();
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
appendNavList();
|
|
94
|
+
}
|
|
95
|
+
emit("click", option);
|
|
96
|
+
};
|
|
97
|
+
const confirm = ({ emit, state, api }) => () => {
|
|
98
|
+
if (state.search.show) {
|
|
99
|
+
api.searchBoxToggle(false);
|
|
100
|
+
} else {
|
|
101
|
+
emit("confirm", state);
|
|
102
|
+
emit("update:visible", false);
|
|
103
|
+
emit("update:modelValue", state.checkIds);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const loopSearchOption = ({
|
|
107
|
+
options,
|
|
108
|
+
input,
|
|
109
|
+
childrenField,
|
|
110
|
+
valueField,
|
|
111
|
+
textField,
|
|
112
|
+
prefixValue,
|
|
113
|
+
prefixText,
|
|
114
|
+
textSplit = "/"
|
|
115
|
+
}) => {
|
|
116
|
+
const list = [];
|
|
117
|
+
options.forEach((item) => {
|
|
118
|
+
const text = item[textField];
|
|
119
|
+
const textNavStr = prefixText ? prefixText + textSplit + text : text;
|
|
120
|
+
const value = [...prefixValue, item[valueField]];
|
|
121
|
+
const children = item[childrenField];
|
|
122
|
+
if (text.includes(input)) {
|
|
123
|
+
list.push({
|
|
124
|
+
[valueField]: value,
|
|
125
|
+
[textField]: textNavStr
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (children && children.length) {
|
|
129
|
+
const arr = loopSearchOption({
|
|
130
|
+
options: children,
|
|
131
|
+
input,
|
|
132
|
+
childrenField,
|
|
133
|
+
valueField,
|
|
134
|
+
textField,
|
|
135
|
+
prefixValue: value,
|
|
136
|
+
prefixText: textNavStr,
|
|
137
|
+
textSplit
|
|
138
|
+
});
|
|
139
|
+
list.push(...arr);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return list;
|
|
143
|
+
};
|
|
144
|
+
const searchMethod = ({ state, props, api }) => () => {
|
|
145
|
+
const { searchConfig, valueField, textField } = props;
|
|
146
|
+
const { children: childrenField } = api.getNodeConfig();
|
|
147
|
+
const { input, options } = state.search;
|
|
148
|
+
let list = [];
|
|
149
|
+
if (searchConfig && searchConfig.searchMethod) {
|
|
150
|
+
list = searchConfig.searchMethod({ input, options, state }) || [];
|
|
151
|
+
} else if (input) {
|
|
152
|
+
list = loopSearchOption({
|
|
153
|
+
options,
|
|
154
|
+
input,
|
|
155
|
+
childrenField,
|
|
156
|
+
valueField,
|
|
157
|
+
textField,
|
|
158
|
+
prefixValue: [],
|
|
159
|
+
prefixText: ""
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (typeof list.then === "function") {
|
|
163
|
+
list.then((data) => state.search.filterOptions = data);
|
|
164
|
+
} else {
|
|
165
|
+
state.search.filterOptions = list;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const searchBoxToggle = ({ state, props, api }) => (bool) => {
|
|
169
|
+
const { searchConfig = {} } = props;
|
|
170
|
+
const { lazy } = api.getNodeConfig();
|
|
171
|
+
state.search.show = bool;
|
|
172
|
+
state.search.input = "";
|
|
173
|
+
if (bool) {
|
|
174
|
+
state.search.options = !lazy && searchConfig.options && searchConfig.options.length ? searchConfig.options : state.store.getAllData();
|
|
175
|
+
api.searchMethod();
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const searchSelectHandler = ({ emit, api, props }) => (option) => {
|
|
179
|
+
const { valueField } = props;
|
|
180
|
+
api.searchBoxToggle(false);
|
|
181
|
+
api.syncCheckStatus(option[valueField]);
|
|
182
|
+
emit("search-click", option);
|
|
183
|
+
};
|
|
184
|
+
const isSelected = ({ state }) => (option) => {
|
|
185
|
+
const { navList } = state;
|
|
186
|
+
return navList.includes(option);
|
|
187
|
+
};
|
|
188
|
+
const setLevel = ({ state, api }) => (level, option) => {
|
|
189
|
+
if (!api.disabledNavOption(level, option)) {
|
|
190
|
+
state.level = level;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
const created = ({ api }) => () => {
|
|
194
|
+
api.initTreeStore();
|
|
195
|
+
};
|
|
196
|
+
const loadData = ({ props, state }) => (data) => {
|
|
197
|
+
const { visible } = props;
|
|
198
|
+
if (!visible) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
state.store.setData(data);
|
|
202
|
+
};
|
|
203
|
+
const renderSearchOption = ({ state }) => (text) => {
|
|
204
|
+
return (text || "").split(state.search.input);
|
|
205
|
+
};
|
|
206
|
+
const computedNavListHandler = ({ state, props }) => () => {
|
|
207
|
+
const { textField, placeholder } = props;
|
|
208
|
+
const { isLeaf, navList } = state;
|
|
209
|
+
const placeholderArr = [];
|
|
210
|
+
const len = navList.length;
|
|
211
|
+
if (!Array.isArray(placeholder)) {
|
|
212
|
+
placeholderArr.push({ data: { [textField]: placeholder }, selfWaitLoad: true });
|
|
213
|
+
} else if (len < placeholder.length) {
|
|
214
|
+
for (let i = len; i < placeholder.length; i++) {
|
|
215
|
+
placeholderArr.push({ data: { [textField]: placeholder[i] }, selfWaitLoad: true });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return isLeaf && len ? state.navList : [...state.navList, ...placeholderArr];
|
|
219
|
+
};
|
|
220
|
+
const disabledNavOption = ({ state }) => (level, option) => {
|
|
221
|
+
const node = state.navList[level - 1];
|
|
222
|
+
return option.selfWaitLoad && (!node || !node.childNodes.length);
|
|
223
|
+
};
|
|
224
|
+
const getNodeConfig = ({ constants, props }) => () => {
|
|
225
|
+
const { nodeConfig, valueField } = props;
|
|
226
|
+
return Object.assign({ nodeKey: valueField }, constants.defaultNodeConfig, nodeConfig);
|
|
227
|
+
};
|
|
228
|
+
const initTreeStore = ({ props, state, api }) => () => {
|
|
229
|
+
const { data, textField, visible } = props;
|
|
230
|
+
const {
|
|
231
|
+
nodeKey,
|
|
232
|
+
lazy,
|
|
233
|
+
load,
|
|
234
|
+
afterLoad,
|
|
235
|
+
children,
|
|
236
|
+
isLeaf,
|
|
237
|
+
checkStrictly,
|
|
238
|
+
currentNodeKey,
|
|
239
|
+
checkDescendants,
|
|
240
|
+
defaultCheckedKeys,
|
|
241
|
+
defaultExpandedKeys,
|
|
242
|
+
autoExpandParent,
|
|
243
|
+
defaultExpandAll,
|
|
244
|
+
filterNodeMethod
|
|
245
|
+
} = api.getNodeConfig();
|
|
246
|
+
if (!visible || state.store) {
|
|
247
|
+
api.syncCheckStatus();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
state.store = new TreeStore({
|
|
251
|
+
key: nodeKey,
|
|
252
|
+
data,
|
|
253
|
+
lazy,
|
|
254
|
+
props: {
|
|
255
|
+
children,
|
|
256
|
+
label: textField,
|
|
257
|
+
isLeaf
|
|
258
|
+
},
|
|
259
|
+
load,
|
|
260
|
+
afterLoad: () => {
|
|
261
|
+
state.rootData = state.root.childNodes || [];
|
|
262
|
+
api.syncCheckStatus();
|
|
263
|
+
afterLoad && afterLoad();
|
|
264
|
+
},
|
|
265
|
+
currentNodeKey,
|
|
266
|
+
checkStrictly,
|
|
267
|
+
checkDescendants,
|
|
268
|
+
defaultCheckedKeys,
|
|
269
|
+
defaultExpandedKeys,
|
|
270
|
+
autoExpandParent,
|
|
271
|
+
defaultExpandAll,
|
|
272
|
+
filterNodeMethod
|
|
273
|
+
});
|
|
274
|
+
state.root = state.store.root;
|
|
275
|
+
if (!lazy) {
|
|
276
|
+
state.rootData = state.root.childNodes || [];
|
|
277
|
+
api.syncCheckStatus();
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
export {
|
|
281
|
+
close,
|
|
282
|
+
computedNavListHandler,
|
|
283
|
+
confirm,
|
|
284
|
+
created,
|
|
285
|
+
disabledNavOption,
|
|
286
|
+
getNodeConfig,
|
|
287
|
+
initTreeStore,
|
|
288
|
+
isSelected,
|
|
289
|
+
loadData,
|
|
290
|
+
renderSearchOption,
|
|
291
|
+
searchBoxToggle,
|
|
292
|
+
searchMethod,
|
|
293
|
+
searchSelectHandler,
|
|
294
|
+
selectOption,
|
|
295
|
+
setLevel,
|
|
296
|
+
syncCheckStatus,
|
|
297
|
+
watchModelValue,
|
|
298
|
+
watchVisible
|
|
299
|
+
};
|