hzzt-plus 2.0.9 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.js +45 -25
- package/dist/index.full.min.js +6 -6
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +5 -5
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +45 -25
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/es/components/cascader/index.mjs +2 -2
- package/es/components/cascader/src/cascader.mjs +156 -40
- package/es/components/cascader/src/cascader.mjs.map +1 -1
- package/es/components/cascader/src/cascader2.mjs +40 -156
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/index.mjs +3 -3
- package/es/components/lazy-list/index.mjs +2 -2
- package/es/components/lazy-list/src/lazy-list.mjs +22 -80
- package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
- package/es/components/lazy-list/src/lazy-list2.mjs +80 -22
- package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
- package/es/components/select/index.mjs +2 -2
- package/es/components/select/src/select.mjs +213 -42
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select2.mjs +42 -193
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/index.mjs +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/index.js +2 -2
- package/lib/components/cascader/src/cascader.js +155 -40
- package/lib/components/cascader/src/cascader.js.map +1 -1
- package/lib/components/cascader/src/cascader2.js +40 -155
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/index.js +3 -3
- package/lib/components/lazy-list/index.js +2 -2
- package/lib/components/lazy-list/src/lazy-list.js +23 -80
- package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
- package/lib/components/lazy-list/src/lazy-list2.js +80 -23
- package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
- package/lib/components/select/index.js +2 -2
- package/lib/components/select/src/select.js +213 -43
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select2.js +43 -193
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/web-types.json +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.9 */
|
|
2
2
|
|
|
3
3
|
import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, readonly, shallowRef, watchEffect, watch, ref, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isRef, inject, provide, renderSlot, mergeProps, toRef, onUnmounted, useAttrs as useAttrs$1, useSlots, normalizeClass, normalizeStyle, createCommentVNode, Fragment, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, onBeforeUnmount, Transition, withDirectives, vShow, reactive, onActivated, onUpdated, cloneVNode, Text, Comment, Teleport as Teleport$1, onBeforeMount, onDeactivated, toRaw, vModelCheckbox, createTextVNode, toRefs, vModelRadio, h, resolveComponent, renderList, onBeforeUpdate, withKeys, vModelText, createSlots, resolveDirective, toHandlerKey, normalizeProps, guardReactiveProps } from 'vue';
|
|
4
4
|
|
|
@@ -12961,7 +12961,7 @@ var ConfigProvider$1 = ConfigProvider;
|
|
|
12961
12961
|
|
|
12962
12962
|
const HzztConfigProvider = withInstall$1(ConfigProvider$1);
|
|
12963
12963
|
|
|
12964
|
-
const version$1 = "2.0.
|
|
12964
|
+
const version$1 = "2.0.9";
|
|
12965
12965
|
|
|
12966
12966
|
const makeInstaller = (components = []) => {
|
|
12967
12967
|
const install = (app, options) => {
|
|
@@ -27904,14 +27904,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
27904
27904
|
nsSelect.m(trueSize.value)
|
|
27905
27905
|
]);
|
|
27906
27906
|
const containerStyle = computed(() => attrs.style);
|
|
27907
|
-
const inputCls = computed(() => [
|
|
27908
|
-
|
|
27909
|
-
"width-100%"
|
|
27910
|
-
]);
|
|
27911
|
-
const selectCls = computed(() => [
|
|
27912
|
-
nsSelect.e("select"),
|
|
27913
|
-
"width-100%"
|
|
27914
|
-
]);
|
|
27907
|
+
const inputCls = computed(() => [nsSelect.e("input"), "width-100%"]);
|
|
27908
|
+
const selectCls = computed(() => [nsSelect.e("select"), "width-100%"]);
|
|
27915
27909
|
const _inputProps = computed(() => ({
|
|
27916
27910
|
disabled: trueDisabled.value,
|
|
27917
27911
|
size: trueSize.value,
|
|
@@ -27942,10 +27936,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
27942
27936
|
selectVal.value = v;
|
|
27943
27937
|
});
|
|
27944
27938
|
function input(str) {
|
|
27945
|
-
var _a;
|
|
27939
|
+
var _a, _b;
|
|
27946
27940
|
if ((_a = selectRef.value) == null ? void 0 : _a.dropdownMenuVisible) {
|
|
27947
|
-
selectRef.value.states.inputValue = inputVal.value;
|
|
27941
|
+
selectRef.value.states.inputValue = (_b = inputVal.value) != null ? _b : "";
|
|
27948
27942
|
selectRef.value.debouncedOnInputChange();
|
|
27943
|
+
} else if (selectRef.value) {
|
|
27944
|
+
selectRef.value.dropdownMenuVisible = true;
|
|
27945
|
+
setTimeout(() => {
|
|
27946
|
+
var _a2;
|
|
27947
|
+
if (selectRef.value) {
|
|
27948
|
+
selectRef.value.states.inputValue = (_a2 = inputVal.value) != null ? _a2 : "";
|
|
27949
|
+
selectRef.value.debouncedOnInputChange();
|
|
27950
|
+
}
|
|
27951
|
+
}, 200);
|
|
27949
27952
|
}
|
|
27950
27953
|
emit("update:modelValue", str);
|
|
27951
27954
|
emit("input", str);
|
|
@@ -27956,34 +27959,49 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
27956
27959
|
function focus() {
|
|
27957
27960
|
if (selectRef.value && props.autoPullDown) {
|
|
27958
27961
|
setTimeout(() => {
|
|
27959
|
-
selectRef.value
|
|
27962
|
+
if (selectRef.value) {
|
|
27963
|
+
selectRef.value.dropdownMenuVisible = true;
|
|
27964
|
+
}
|
|
27960
27965
|
}, 200);
|
|
27961
27966
|
}
|
|
27962
27967
|
}
|
|
27963
27968
|
function keydown(e) {
|
|
27964
|
-
var _a, _b;
|
|
27969
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
27965
27970
|
const key = "key" in e && e.key;
|
|
27966
|
-
|
|
27967
|
-
|
|
27968
|
-
|
|
27969
|
-
|
|
27970
|
-
|
|
27971
|
-
|
|
27972
|
-
|
|
27971
|
+
const dropdownVisible = (_a = selectRef.value) == null ? void 0 : _a.dropdownMenuVisible;
|
|
27972
|
+
if (dropdownVisible && (key === "ArrowDown" || key === "ArrowUp" || key === "Enter")) {
|
|
27973
|
+
(_b = e.preventDefault) == null ? void 0 : _b.call(e);
|
|
27974
|
+
if (key === "ArrowDown") {
|
|
27975
|
+
(_c = selectRef.value) == null ? void 0 : _c.onKeyboardNavigate("forward");
|
|
27976
|
+
} else if (key === "ArrowUp") {
|
|
27977
|
+
(_d = selectRef.value) == null ? void 0 : _d.onKeyboardNavigate("backward");
|
|
27978
|
+
} else if (key === "Enter") {
|
|
27979
|
+
(_e = selectRef.value) == null ? void 0 : _e.onKeyboardSelect();
|
|
27980
|
+
}
|
|
27981
|
+
return;
|
|
27982
|
+
}
|
|
27983
|
+
if (!dropdownVisible) {
|
|
27984
|
+
if (key === "ArrowDown") {
|
|
27985
|
+
emit("arrow-down", e);
|
|
27986
|
+
} else if (key === "ArrowUp") {
|
|
27987
|
+
emit("arrow-up", e);
|
|
27988
|
+
}
|
|
27989
|
+
}
|
|
27990
|
+
if (key === "ArrowLeft") {
|
|
27973
27991
|
const index = inputRef.value.input.selectionStart;
|
|
27974
|
-
if (index === 0) {
|
|
27992
|
+
if (index === 0 && selectRef.value) {
|
|
27975
27993
|
emit("arrow-left", e);
|
|
27976
27994
|
selectRef.value.dropdownMenuVisible = false;
|
|
27977
27995
|
}
|
|
27978
27996
|
} else if (key === "ArrowRight") {
|
|
27979
27997
|
const index = inputRef.value.input.selectionStart;
|
|
27980
|
-
if (((
|
|
27998
|
+
if (((_g = (_f = inputVal.value) == null ? void 0 : _f.length) != null ? _g : 0) === index && selectRef.value) {
|
|
27981
27999
|
emit("arrow-right", e);
|
|
27982
28000
|
selectRef.value.dropdownMenuVisible = false;
|
|
27983
28001
|
}
|
|
27984
28002
|
} else if (key === "Enter") {
|
|
27985
28003
|
emit("enter", e);
|
|
27986
|
-
selectRef.value.dropdownMenuVisible = false;
|
|
28004
|
+
selectRef.value && (selectRef.value.dropdownMenuVisible = false);
|
|
27987
28005
|
}
|
|
27988
28006
|
}
|
|
27989
28007
|
function showSelect() {
|
|
@@ -28004,7 +28022,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
28004
28022
|
setTimeout(() => {
|
|
28005
28023
|
inputRef.value.focus();
|
|
28006
28024
|
setTimeout(() => {
|
|
28007
|
-
selectRef.value
|
|
28025
|
+
if (selectRef.value) {
|
|
28026
|
+
selectRef.value.dropdownMenuVisible = false;
|
|
28027
|
+
}
|
|
28008
28028
|
}, 250);
|
|
28009
28029
|
emit("change", str);
|
|
28010
28030
|
});
|
package/dist/locale/en.js
CHANGED
package/dist/locale/en.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.9 */(function(e,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis!="undefined"?globalThis:e||self,e.HzztPlusLocaleEn=r())})(this,function(){"use strict";var e={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};return e});
|
|
2
2
|
//# sourceMappingURL=en.min.js.map
|
package/dist/locale/en.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.9 */var r={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};export{r as default};
|
|
2
2
|
//# sourceMappingURL=en.min.mjs.map
|
package/dist/locale/en.mjs
CHANGED
package/dist/locale/zh-cn.js
CHANGED
package/dist/locale/zh-cn.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.9 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.HzztPlusLocaleZhCn=e())})(this,function(){"use strict";var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};return u});
|
|
2
2
|
//# sourceMappingURL=zh-cn.min.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Hzzt Plus v2.0.
|
|
1
|
+
/*! Hzzt Plus v2.0.9 */var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};export{u as default};
|
|
2
2
|
//# sourceMappingURL=zh-cn.min.mjs.map
|
package/dist/locale/zh-cn.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Cascader from './src/
|
|
3
|
-
export { cascaderEmits, cascaderProps } from './src/
|
|
2
|
+
import Cascader from './src/cascader.mjs';
|
|
3
|
+
export { cascaderEmits, cascaderProps } from './src/cascader2.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const HzztCascader = withInstall(Cascader);
|
|
@@ -1,46 +1,162 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { defineComponent, useAttrs, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createVNode, mergeProps } from 'vue';
|
|
2
|
+
import { cascaderProps, cascaderEmits } from './cascader2.mjs';
|
|
3
|
+
import { useFormSize, useFormDisabled, ElInput, ElCascader } from 'element-plus';
|
|
2
4
|
import '../../../hooks/index.mjs';
|
|
3
|
-
import '../../../
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import '../../../utils/index.mjs';
|
|
6
|
+
import { getCascaderId } from './hooks/utils.mjs';
|
|
7
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
9
|
+
import { useGlobalSize } from '../../../hooks/use-size/index.mjs';
|
|
10
|
+
import { isArray } from '@vue/shared';
|
|
8
11
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
])
|
|
36
|
-
|
|
12
|
+
const __default__ = defineComponent({
|
|
13
|
+
name: "HzztCascader"
|
|
14
|
+
});
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
16
|
+
...__default__,
|
|
17
|
+
props: cascaderProps,
|
|
18
|
+
emits: cascaderEmits,
|
|
19
|
+
setup(__props, { emit }) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const attrs = useAttrs();
|
|
22
|
+
const inputVal = ref(props.modelValue);
|
|
23
|
+
const cascaderVal = ref();
|
|
24
|
+
const inputRef = ref();
|
|
25
|
+
const cascaderRef = ref();
|
|
26
|
+
const nsCascader = useNamespace("cascader");
|
|
27
|
+
const formSize = useFormSize();
|
|
28
|
+
const formDisabled = useFormDisabled();
|
|
29
|
+
const trueSize = computed(() => props.size || formSize.value || useGlobalSize().value);
|
|
30
|
+
const trueDisabled = computed(() => props.disabled || formDisabled.value);
|
|
31
|
+
const containerCls = computed(() => [
|
|
32
|
+
"relative",
|
|
33
|
+
nsCascader.b(),
|
|
34
|
+
nsCascader.m(trueSize.value)
|
|
35
|
+
]);
|
|
36
|
+
const inputCls = computed(() => [
|
|
37
|
+
nsCascader.e("input")
|
|
38
|
+
]);
|
|
39
|
+
const cascaderCls = computed(() => [
|
|
40
|
+
nsCascader.e("cascader")
|
|
41
|
+
]);
|
|
42
|
+
const _inputProps = computed(() => ({
|
|
43
|
+
disabled: trueDisabled.value,
|
|
44
|
+
size: trueSize.value,
|
|
45
|
+
clearable: props.clearable,
|
|
46
|
+
placeholder: props.placeholder,
|
|
47
|
+
readonly: props.readonly,
|
|
48
|
+
...attrs,
|
|
49
|
+
class: "",
|
|
50
|
+
style: ""
|
|
51
|
+
}));
|
|
52
|
+
const _cascaderProps = computed(() => ({
|
|
53
|
+
options: props.options,
|
|
54
|
+
disabled: trueDisabled.value,
|
|
55
|
+
size: trueSize.value,
|
|
56
|
+
clearable: props.clearable,
|
|
57
|
+
placeholder: props.placeholder,
|
|
58
|
+
props: { checkStrictly: true, expandTrigger: "hover" },
|
|
59
|
+
filterable: true,
|
|
60
|
+
separator: "/",
|
|
61
|
+
showAllLevels: true,
|
|
62
|
+
...props.cascaderProps
|
|
63
|
+
}));
|
|
64
|
+
const isMultiple = computed(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
return !!((_a = _cascaderProps.value.props) == null ? void 0 : _a.multiple);
|
|
67
|
+
});
|
|
68
|
+
watch(() => props.modelValue, (v) => {
|
|
69
|
+
inputVal.value = v;
|
|
70
|
+
getCascaderVal();
|
|
71
|
+
});
|
|
72
|
+
watch(() => props.options, (v) => {
|
|
73
|
+
if (!v)
|
|
74
|
+
return;
|
|
75
|
+
getCascaderVal();
|
|
76
|
+
});
|
|
77
|
+
getCascaderVal();
|
|
78
|
+
function input(str) {
|
|
79
|
+
emit("update:modelValue", str);
|
|
80
|
+
emit("input", str);
|
|
81
|
+
}
|
|
82
|
+
function change(str) {
|
|
83
|
+
emit("change", str);
|
|
84
|
+
}
|
|
85
|
+
function click(e) {
|
|
86
|
+
cascaderRef.value.togglePopperVisible();
|
|
87
|
+
const target = e.target;
|
|
88
|
+
target.focus();
|
|
89
|
+
}
|
|
90
|
+
function cascaderChange(val) {
|
|
91
|
+
var _a;
|
|
92
|
+
const separator = _cascaderProps.value.separator || "/";
|
|
93
|
+
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
94
|
+
if (isMultiple.value) {
|
|
95
|
+
const list = isArray(val) ? val : [];
|
|
96
|
+
const items = list.map((item) => {
|
|
97
|
+
var _a2;
|
|
98
|
+
if (isArray(item)) {
|
|
99
|
+
return _cascaderProps.value.showAllLevels === false ? String((_a2 = item[item.length - 1]) != null ? _a2 : "") : item.join(separator);
|
|
100
|
+
}
|
|
101
|
+
return String(item != null ? item : "");
|
|
102
|
+
});
|
|
103
|
+
inputVal.value = items.join(joinSeparator);
|
|
104
|
+
} else {
|
|
105
|
+
inputVal.value = val ? isArray(val) ? _cascaderProps.value.showAllLevels === false ? val[val.length - 1] : val.join(separator) : [val].join(separator) : "";
|
|
106
|
+
}
|
|
107
|
+
input(inputVal.value);
|
|
108
|
+
change(inputVal.value);
|
|
109
|
+
}
|
|
110
|
+
function getCascaderVal() {
|
|
111
|
+
var _a;
|
|
112
|
+
const separator = _cascaderProps.value.separator || "/";
|
|
113
|
+
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
114
|
+
if (isMultiple.value) {
|
|
115
|
+
const raw = props.modelValue || "";
|
|
116
|
+
if (!raw) {
|
|
117
|
+
cascaderVal.value = [];
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const parts = raw.split(joinSeparator).filter((s) => s !== "");
|
|
121
|
+
if (_cascaderProps.value.showAllLevels === false) {
|
|
122
|
+
cascaderVal.value = parts.map((id) => getCascaderId(id, props.options));
|
|
123
|
+
} else {
|
|
124
|
+
cascaderVal.value = parts.map((p) => p.split(separator));
|
|
125
|
+
}
|
|
126
|
+
} else if (_cascaderProps.value.showAllLevels === false) {
|
|
127
|
+
const list = getCascaderId(props.modelValue, props.options);
|
|
128
|
+
cascaderVal.value = list.join(separator);
|
|
129
|
+
} else {
|
|
130
|
+
cascaderVal.value = (props.modelValue || "").split(separator);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return (_ctx, _cache) => {
|
|
134
|
+
return openBlock(), createElementBlock("div", {
|
|
135
|
+
class: normalizeClass(unref(containerCls))
|
|
136
|
+
}, [
|
|
137
|
+
createVNode(unref(ElInput), mergeProps({
|
|
138
|
+
class: unref(inputCls),
|
|
139
|
+
modelValue: inputVal.value,
|
|
140
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event),
|
|
141
|
+
ref_key: "inputRef",
|
|
142
|
+
ref: inputRef
|
|
143
|
+
}, unref(_inputProps), {
|
|
144
|
+
onInput: input,
|
|
145
|
+
onClick: click,
|
|
146
|
+
onChange: change
|
|
147
|
+
}), null, 16, ["class", "modelValue"]),
|
|
148
|
+
createVNode(unref(ElCascader), mergeProps({
|
|
149
|
+
class: unref(cascaderCls),
|
|
150
|
+
modelValue: cascaderVal.value,
|
|
151
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => cascaderVal.value = $event),
|
|
152
|
+
ref_key: "cascaderRef",
|
|
153
|
+
ref: cascaderRef
|
|
154
|
+
}, unref(_cascaderProps), { onChange: cascaderChange }), null, 16, ["class", "modelValue"])
|
|
155
|
+
], 2);
|
|
156
|
+
};
|
|
37
157
|
}
|
|
38
158
|
});
|
|
39
|
-
|
|
40
|
-
[UPDATE_MODEL_EVENT]: (value) => isString(value),
|
|
41
|
-
input: (value) => isString(value),
|
|
42
|
-
change: (value) => isString(value)
|
|
43
|
-
};
|
|
159
|
+
var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "cascader.vue"]]);
|
|
44
160
|
|
|
45
|
-
export {
|
|
161
|
+
export { Cascader as default };
|
|
46
162
|
//# sourceMappingURL=cascader.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cascader.mjs","sources":["../../../../../../packages/components/cascader/src/cascader.
|
|
1
|
+
{"version":3,"file":"cascader.mjs","sources":["../../../../../../packages/components/cascader/src/cascader.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\">\n <el-input\n :class=\"inputCls\"\n v-model=\"inputVal\"\n ref=\"inputRef\"\n v-bind=\"_inputProps\"\n @input=\"input\"\n @click=\"click\"\n @change=\"change\"\n >\n </el-input>\n <el-cascader :class=\"cascaderCls\" v-model=\"cascaderVal\" ref=\"cascaderRef\" v-bind=\"_cascaderProps\"\n @change=\"cascaderChange\">\n </el-cascader>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {cascaderEmits, cascaderProps, CascaderNodeValue} from './cascader'\n import {computed, ref, useAttrs, watch} from \"vue\";\n import {CascaderProps, useFormDisabled, useFormSize, CascaderValue} from \"element-plus\";\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n import {isArray} from '@hzzt-plus/utils'\n import {ElInput, ElCascader} from 'element-plus'\n import {getCascaderId} from \"./hooks/utils\";\n\n defineOptions({\n name: 'HzztCascader',\n })\n\n const props = defineProps(cascaderProps)\n const emit = defineEmits(cascaderEmits)\n\n const attrs = useAttrs();\n\n const inputVal = ref(props.modelValue);\n const cascaderVal = ref();\n const inputRef = ref();\n const cascaderRef = ref();\n\n const nsCascader = useNamespace('cascader');\n\n const formSize = useFormSize()\n const formDisabled = useFormDisabled()\n\n const trueSize = computed(\n () => props.size || formSize.value || useGlobalSize().value\n )\n\n const trueDisabled = computed(() => props.disabled || formDisabled.value)\n\n const containerCls = computed(() => [\n 'relative',\n nsCascader.b(),\n nsCascader.m(trueSize.value),\n ])\n\n const inputCls = computed(() => [\n nsCascader.e('input'),\n ])\n\n const cascaderCls = computed(() => [\n nsCascader.e('cascader'),\n ])\n\n const _inputProps = computed(() => ({\n disabled: trueDisabled.value,\n size: trueSize.value,\n clearable: props.clearable,\n placeholder: props.placeholder,\n readonly: props.readonly,\n ...attrs,\n class: '',\n style: ''\n }))\n\n const _cascaderProps = computed(() => ({\n options: props.options,\n disabled: trueDisabled.value,\n size: trueSize.value,\n clearable: props.clearable,\n placeholder: props.placeholder,\n props: {checkStrictly: true, expandTrigger: 'hover'} as CascaderProps,\n filterable: true,\n separator: '/',\n showAllLevels: true,\n ...props.cascaderProps,\n }))\n\n const isMultiple = computed(() => !!_cascaderProps.value.props?.multiple)\n\n watch(() => props.modelValue, (v) => {\n inputVal.value = v;\n getCascaderVal();\n })\n\n watch(() => props.options, (v) => {\n if (!v) return;\n getCascaderVal();\n })\n\n getCascaderVal();\n\n function input(str: string) {\n emit('update:modelValue', str)\n emit('input', str)\n }\n\n function change(str: string) {\n emit('change', str)\n }\n\n function click(e: MouseEvent) {\n cascaderRef.value.togglePopperVisible();\n const target = e.target as HTMLInputElement;\n target.focus();\n }\n\n function cascaderChange(val: CascaderValue) {\n const separator = _cascaderProps.value.separator || '/';\n const joinSeparator = props.joinSeparator ?? ',';\n if (isMultiple.value) {\n const list = (isArray(val) ? val : []) as Array<CascaderNodeValue | CascaderNodeValue[]>;\n const items = list.map((item) => {\n if (isArray(item)) {\n return _cascaderProps.value.showAllLevels === false\n ? String(item[item.length - 1] ?? '')\n : item.join(separator);\n }\n return String(item ?? '');\n });\n inputVal.value = items.join(joinSeparator);\n } else {\n inputVal.value = val ? isArray(val) ? _cascaderProps.value.showAllLevels === false ? (val[val.length - 1] as string) : val.join(separator) : [val].join(separator) : '';\n }\n input(inputVal.value);\n change(inputVal.value);\n }\n\n function getCascaderVal() {\n const separator = _cascaderProps.value.separator || '/';\n const joinSeparator = props.joinSeparator ?? ',';\n if (isMultiple.value) {\n const raw = props.modelValue || '';\n if (!raw) {\n cascaderVal.value = [];\n return;\n }\n const parts = raw.split(joinSeparator).filter((s) => s !== '');\n if (_cascaderProps.value.showAllLevels === false) {\n cascaderVal.value = parts.map((id) => getCascaderId(id, props.options));\n } else {\n cascaderVal.value = parts.map((p) => p.split(separator));\n }\n } else if (_cascaderProps.value.showAllLevels === false) {\n const list = getCascaderId(props.modelValue, props.options);\n cascaderVal.value = list.join(separator);\n } else {\n cascaderVal.value = (props.modelValue || '').split(separator);\n }\n }\n\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;mCA2BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,QAAA,GAAW,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACrC,IAAA,MAAM,cAAc,GAAI,EAAA,CAAA;AACxB,IAAA,MAAM,WAAW,GAAI,EAAA,CAAA;AACrB,IAAA,MAAM,cAAc,GAAI,EAAA,CAAA;AAExB,IAAM,MAAA,UAAA,GAAa,aAAa,UAAU,CAAA,CAAA;AAE1C,IAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,IAAA,MAAM,eAAe,eAAgB,EAAA,CAAA;AAErC,IAAA,MAAM,QAAW,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,IAAA,IAAA,QAAA,CAAA,KAAA,IAAA,aAAA,EAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IAAA,kBACH,GAAA,QAAiB,CAAA,MAAA,kBAAuB,YAAE,CAAA,KAAA,CAAA,CAAA;AAAA,IACxD,MAAA,YAAA,GAAA,QAAA,CAAA,MAAA;AAEA,MAAA;AAEA,MAAM,UAAA,CAAA,CAAA,EAAA;AAA8B,MAClC,UAAA,CAAA,CAAA,CAAA,QAAA,CAAA,KAAA,CAAA;AAAA,KAAA,CACA;AAAa,IACb,MAAA,QAAa,GAAA,QAAc,CAAA,MAAA;AAAA,MAC5B,UAAA,CAAA,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CAAA;AACvB,UAAY,OAAA;AAA0D,SACjE;AACL,QAAY,MAAA,KAAA,GAAA,GAAA,CAAA,qBAAyB,MAAE,CAAA,CAAM,YAAU,EAAA,CAAA,CAAA;AAAA,QACzD,IAAA,cAAA,CAAA,KAAA,CAAA,aAAA,KAAA,KAAA,EAAA;AAAA,UACS,WAAA,CAAA,KAAA,GAAA,KAAqB,CAAA,GAAA,CAAA,CAAA,EAAA,KAAA,aAAyB,CAAA,EAAA,EAAA,KAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AACvD,SAAA,MAAa;AACb,UAAY,WAAA,CAAA,KAAA,GAAa,KAAA,CAAA,GAAc,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,KAAA,CAAA,SAAA,CAAA,CAAA,CAAA;AAAA,SAClC;AACL,OAAA,MAAA,IAAA,cAAqB,CAAA,KAAoB,CAAA,aAAA,UAAmB,EAAA;AAAA,QAC9D,MAAA,IAAA,GAAA,aAAA,CAAA,KAAA,CAAA,UAAA,EAAA,KAAA,CAAA,OAAA,CAAA,CAAA;AAAA,QACF,WAAA,CAAA,KAAA,GAAA,IAAA,CAAA,IAAA,CAAA,SAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,162 +1,46 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createVNode, mergeProps } from 'vue';
|
|
2
|
-
import { cascaderProps, cascaderEmits } from './cascader.mjs';
|
|
3
|
-
import { useFormSize, useFormDisabled, ElInput, ElCascader } from 'element-plus';
|
|
4
|
-
import '../../../hooks/index.mjs';
|
|
5
1
|
import '../../../utils/index.mjs';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import '../../../hooks/index.mjs';
|
|
3
|
+
import '../../../constants/index.mjs';
|
|
4
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
5
|
+
import { useSizeProp } from '../../../hooks/use-size/index.mjs';
|
|
6
|
+
import { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
|
|
7
|
+
import { isString } from '@vue/shared';
|
|
11
8
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
])
|
|
39
|
-
|
|
40
|
-
nsCascader.e("cascader")
|
|
41
|
-
]);
|
|
42
|
-
const _inputProps = computed(() => ({
|
|
43
|
-
disabled: trueDisabled.value,
|
|
44
|
-
size: trueSize.value,
|
|
45
|
-
clearable: props.clearable,
|
|
46
|
-
placeholder: props.placeholder,
|
|
47
|
-
readonly: props.readonly,
|
|
48
|
-
...attrs,
|
|
49
|
-
class: "",
|
|
50
|
-
style: ""
|
|
51
|
-
}));
|
|
52
|
-
const _cascaderProps = computed(() => ({
|
|
53
|
-
options: props.options,
|
|
54
|
-
disabled: trueDisabled.value,
|
|
55
|
-
size: trueSize.value,
|
|
56
|
-
clearable: props.clearable,
|
|
57
|
-
placeholder: props.placeholder,
|
|
58
|
-
props: { checkStrictly: true, expandTrigger: "hover" },
|
|
59
|
-
filterable: true,
|
|
60
|
-
separator: "/",
|
|
61
|
-
showAllLevels: true,
|
|
62
|
-
...props.cascaderProps
|
|
63
|
-
}));
|
|
64
|
-
const isMultiple = computed(() => {
|
|
65
|
-
var _a;
|
|
66
|
-
return !!((_a = _cascaderProps.value.props) == null ? void 0 : _a.multiple);
|
|
67
|
-
});
|
|
68
|
-
watch(() => props.modelValue, (v) => {
|
|
69
|
-
inputVal.value = v;
|
|
70
|
-
getCascaderVal();
|
|
71
|
-
});
|
|
72
|
-
watch(() => props.options, (v) => {
|
|
73
|
-
if (!v)
|
|
74
|
-
return;
|
|
75
|
-
getCascaderVal();
|
|
76
|
-
});
|
|
77
|
-
getCascaderVal();
|
|
78
|
-
function input(str) {
|
|
79
|
-
emit("update:modelValue", str);
|
|
80
|
-
emit("input", str);
|
|
81
|
-
}
|
|
82
|
-
function change(str) {
|
|
83
|
-
emit("change", str);
|
|
84
|
-
}
|
|
85
|
-
function click(e) {
|
|
86
|
-
cascaderRef.value.togglePopperVisible();
|
|
87
|
-
const target = e.target;
|
|
88
|
-
target.focus();
|
|
89
|
-
}
|
|
90
|
-
function cascaderChange(val) {
|
|
91
|
-
var _a;
|
|
92
|
-
const separator = _cascaderProps.value.separator || "/";
|
|
93
|
-
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
94
|
-
if (isMultiple.value) {
|
|
95
|
-
const list = isArray(val) ? val : [];
|
|
96
|
-
const items = list.map((item) => {
|
|
97
|
-
var _a2;
|
|
98
|
-
if (isArray(item)) {
|
|
99
|
-
return _cascaderProps.value.showAllLevels === false ? String((_a2 = item[item.length - 1]) != null ? _a2 : "") : item.join(separator);
|
|
100
|
-
}
|
|
101
|
-
return String(item != null ? item : "");
|
|
102
|
-
});
|
|
103
|
-
inputVal.value = items.join(joinSeparator);
|
|
104
|
-
} else {
|
|
105
|
-
inputVal.value = val ? isArray(val) ? _cascaderProps.value.showAllLevels === false ? val[val.length - 1] : val.join(separator) : [val].join(separator) : "";
|
|
106
|
-
}
|
|
107
|
-
input(inputVal.value);
|
|
108
|
-
change(inputVal.value);
|
|
109
|
-
}
|
|
110
|
-
function getCascaderVal() {
|
|
111
|
-
var _a;
|
|
112
|
-
const separator = _cascaderProps.value.separator || "/";
|
|
113
|
-
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
114
|
-
if (isMultiple.value) {
|
|
115
|
-
const raw = props.modelValue || "";
|
|
116
|
-
if (!raw) {
|
|
117
|
-
cascaderVal.value = [];
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const parts = raw.split(joinSeparator).filter((s) => s !== "");
|
|
121
|
-
if (_cascaderProps.value.showAllLevels === false) {
|
|
122
|
-
cascaderVal.value = parts.map((id) => getCascaderId(id, props.options));
|
|
123
|
-
} else {
|
|
124
|
-
cascaderVal.value = parts.map((p) => p.split(separator));
|
|
125
|
-
}
|
|
126
|
-
} else if (_cascaderProps.value.showAllLevels === false) {
|
|
127
|
-
const list = getCascaderId(props.modelValue, props.options);
|
|
128
|
-
cascaderVal.value = list.join(separator);
|
|
129
|
-
} else {
|
|
130
|
-
cascaderVal.value = (props.modelValue || "").split(separator);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return (_ctx, _cache) => {
|
|
134
|
-
return openBlock(), createElementBlock("div", {
|
|
135
|
-
class: normalizeClass(unref(containerCls))
|
|
136
|
-
}, [
|
|
137
|
-
createVNode(unref(ElInput), mergeProps({
|
|
138
|
-
class: unref(inputCls),
|
|
139
|
-
modelValue: inputVal.value,
|
|
140
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event),
|
|
141
|
-
ref_key: "inputRef",
|
|
142
|
-
ref: inputRef
|
|
143
|
-
}, unref(_inputProps), {
|
|
144
|
-
onInput: input,
|
|
145
|
-
onClick: click,
|
|
146
|
-
onChange: change
|
|
147
|
-
}), null, 16, ["class", "modelValue"]),
|
|
148
|
-
createVNode(unref(ElCascader), mergeProps({
|
|
149
|
-
class: unref(cascaderCls),
|
|
150
|
-
modelValue: cascaderVal.value,
|
|
151
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => cascaderVal.value = $event),
|
|
152
|
-
ref_key: "cascaderRef",
|
|
153
|
-
ref: cascaderRef
|
|
154
|
-
}, unref(_cascaderProps), { onChange: cascaderChange }), null, 16, ["class", "modelValue"])
|
|
155
|
-
], 2);
|
|
156
|
-
};
|
|
9
|
+
const cascaderProps = buildProps({
|
|
10
|
+
cascaderProps: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: () => ({
|
|
13
|
+
showAllLevels: true
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
disabled: Boolean,
|
|
17
|
+
readonly: Boolean,
|
|
18
|
+
clearable: Boolean,
|
|
19
|
+
size: useSizeProp,
|
|
20
|
+
options: {
|
|
21
|
+
type: definePropType(Array),
|
|
22
|
+
default: () => []
|
|
23
|
+
},
|
|
24
|
+
placeholder: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
joinSeparator: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ","
|
|
31
|
+
},
|
|
32
|
+
modelValue: {
|
|
33
|
+
type: definePropType([
|
|
34
|
+
String
|
|
35
|
+
]),
|
|
36
|
+
default: ""
|
|
157
37
|
}
|
|
158
38
|
});
|
|
159
|
-
|
|
39
|
+
const cascaderEmits = {
|
|
40
|
+
[UPDATE_MODEL_EVENT]: (value) => isString(value),
|
|
41
|
+
input: (value) => isString(value),
|
|
42
|
+
change: (value) => isString(value)
|
|
43
|
+
};
|
|
160
44
|
|
|
161
|
-
export {
|
|
45
|
+
export { cascaderEmits, cascaderProps };
|
|
162
46
|
//# sourceMappingURL=cascader2.mjs.map
|