hzzt-plus 2.0.7 → 2.0.9
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.css +1 -1
- package/dist/index.full.js +55 -8
- package/dist/index.full.min.js +14 -14
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +15 -15
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +55 -8
- 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/src/cascader.d.ts +1 -0
- package/es/components/cascader/src/cascader.mjs +4 -0
- package/es/components/cascader/src/cascader.mjs.map +1 -1
- package/es/components/cascader/src/cascader.vue.d.ts +7 -0
- package/es/components/cascader/src/cascader2.mjs +37 -3
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/click-input/index.mjs +2 -2
- package/es/components/click-input/src/click-input.mjs +21 -84
- package/es/components/click-input/src/click-input.mjs.map +1 -1
- package/es/components/click-input/src/click-input2.mjs +84 -21
- package/es/components/click-input/src/click-input2.mjs.map +1 -1
- package/es/components/collapse/index.d.ts +6 -0
- package/es/components/collapse/src/collapse.vue.d.ts +6 -0
- package/es/components/collapse/src/collapse2.mjs +4 -0
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/icon/index.d.ts +6 -0
- package/es/components/icon/src/index.mjs +9 -4
- package/es/components/icon/src/index.mjs.map +1 -1
- package/es/components/icon/src/index.vue.d.ts +6 -0
- package/es/components/index.mjs +2 -2
- package/es/components/lazy-list/index.mjs +2 -2
- package/es/components/lazy-list/src/lazy-list.mjs +80 -22
- package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
- package/es/components/lazy-list/src/lazy-list2.mjs +22 -80
- package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
- package/es/components/page-size/index.d.ts +6 -0
- package/es/components/page-size/src/index.vue.d.ts +6 -0
- package/es/components/pagination/index.d.ts +6 -0
- package/es/components/pagination/src/index.vue.d.ts +6 -0
- package/es/components/quarter-picker/index.d.ts +6 -0
- package/es/components/quarter-picker/src/index.vue.d.ts +6 -0
- package/es/components/scroll/src/scroll.vue.d.ts +6 -0
- package/es/components/select/src/select.vue.d.ts +6 -0
- package/es/components/tab/index.d.ts +6 -0
- package/es/components/tab/src/index.vue.d.ts +6 -0
- package/es/index.mjs +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/src/cascader.d.ts +1 -0
- package/lib/components/cascader/src/cascader.js +4 -0
- package/lib/components/cascader/src/cascader.js.map +1 -1
- package/lib/components/cascader/src/cascader.vue.d.ts +7 -0
- package/lib/components/cascader/src/cascader2.js +37 -3
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/click-input/index.js +2 -2
- package/lib/components/click-input/src/click-input.js +22 -84
- package/lib/components/click-input/src/click-input.js.map +1 -1
- package/lib/components/click-input/src/click-input2.js +84 -22
- package/lib/components/click-input/src/click-input2.js.map +1 -1
- package/lib/components/collapse/index.d.ts +6 -0
- package/lib/components/collapse/src/collapse.vue.d.ts +6 -0
- package/lib/components/collapse/src/collapse2.js +4 -0
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/icon/index.d.ts +6 -0
- package/lib/components/icon/src/index.js +8 -3
- package/lib/components/icon/src/index.js.map +1 -1
- package/lib/components/icon/src/index.vue.d.ts +6 -0
- package/lib/components/index.js +2 -2
- package/lib/components/lazy-list/index.js +2 -2
- package/lib/components/lazy-list/src/lazy-list.js +80 -23
- package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
- package/lib/components/lazy-list/src/lazy-list2.js +23 -80
- package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
- package/lib/components/page-size/index.d.ts +6 -0
- package/lib/components/page-size/src/index.vue.d.ts +6 -0
- package/lib/components/pagination/index.d.ts +6 -0
- package/lib/components/pagination/src/index.vue.d.ts +6 -0
- package/lib/components/quarter-picker/index.d.ts +6 -0
- package/lib/components/quarter-picker/src/index.vue.d.ts +6 -0
- package/lib/components/scroll/src/scroll.vue.d.ts +6 -0
- package/lib/components/select/src/select.vue.d.ts +6 -0
- package/lib/components/tab/index.d.ts +6 -0
- package/lib/components/tab/src/index.vue.d.ts +6 -0
- package/lib/index.js +2 -2
- 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/theme/hzzt-cascader.css +1 -1
- package/theme/index.css +1 -1
- package/theme/src/cascader.scss +3 -0
- 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.8 */
|
|
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.8";
|
|
12965
12965
|
|
|
12966
12966
|
const makeInstaller = (components = []) => {
|
|
12967
12967
|
const install = (app, options) => {
|
|
@@ -25881,19 +25881,24 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
25881
25881
|
type: {
|
|
25882
25882
|
type: String,
|
|
25883
25883
|
default: "el"
|
|
25884
|
-
}
|
|
25884
|
+
},
|
|
25885
|
+
size: [String, Number],
|
|
25886
|
+
color: String
|
|
25885
25887
|
},
|
|
25886
25888
|
setup(__props) {
|
|
25887
25889
|
const props = __props;
|
|
25888
25890
|
const attrs = useAttrs$1();
|
|
25889
25891
|
const componentName = computed(() => `hzzt-${props.type}-${props.name}`);
|
|
25890
25892
|
return (_ctx, _cache) => {
|
|
25891
|
-
return openBlock(), createBlock(unref(ElIcon),
|
|
25893
|
+
return openBlock(), createBlock(unref(ElIcon), mergeProps(unref(attrs), {
|
|
25894
|
+
size: __props.size,
|
|
25895
|
+
color: __props.color
|
|
25896
|
+
}), {
|
|
25892
25897
|
default: withCtx(() => [
|
|
25893
25898
|
(openBlock(), createBlock(resolveDynamicComponent(unref(componentName))))
|
|
25894
25899
|
]),
|
|
25895
25900
|
_: 1
|
|
25896
|
-
}, 16);
|
|
25901
|
+
}, 16, ["size", "color"]);
|
|
25897
25902
|
};
|
|
25898
25903
|
}
|
|
25899
25904
|
});
|
|
@@ -25939,6 +25944,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
25939
25944
|
emit("update:modelValue", false);
|
|
25940
25945
|
expand.value = false;
|
|
25941
25946
|
}
|
|
25947
|
+
watch(() => props.defaultActive, (v) => {
|
|
25948
|
+
emit("update:modelValue", v);
|
|
25949
|
+
expand.value = v;
|
|
25950
|
+
});
|
|
25942
25951
|
watch(() => props.modelValue, (v) => {
|
|
25943
25952
|
expand.value = v;
|
|
25944
25953
|
});
|
|
@@ -27636,6 +27645,10 @@ const cascaderProps = buildProps$1({
|
|
|
27636
27645
|
type: String,
|
|
27637
27646
|
default: ""
|
|
27638
27647
|
},
|
|
27648
|
+
joinSeparator: {
|
|
27649
|
+
type: String,
|
|
27650
|
+
default: ","
|
|
27651
|
+
},
|
|
27639
27652
|
modelValue: {
|
|
27640
27653
|
type: definePropType$1([
|
|
27641
27654
|
String
|
|
@@ -27709,7 +27722,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
27709
27722
|
clearable: props.clearable,
|
|
27710
27723
|
placeholder: props.placeholder,
|
|
27711
27724
|
readonly: props.readonly,
|
|
27712
|
-
...attrs
|
|
27725
|
+
...attrs,
|
|
27726
|
+
class: "",
|
|
27727
|
+
style: ""
|
|
27713
27728
|
}));
|
|
27714
27729
|
const _cascaderProps = computed(() => ({
|
|
27715
27730
|
options: props.options,
|
|
@@ -27723,6 +27738,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
27723
27738
|
showAllLevels: true,
|
|
27724
27739
|
...props.cascaderProps
|
|
27725
27740
|
}));
|
|
27741
|
+
const isMultiple = computed(() => {
|
|
27742
|
+
var _a;
|
|
27743
|
+
return !!((_a = _cascaderProps.value.props) == null ? void 0 : _a.multiple);
|
|
27744
|
+
});
|
|
27726
27745
|
watch(() => props.modelValue, (v) => {
|
|
27727
27746
|
inputVal.value = v;
|
|
27728
27747
|
getCascaderVal();
|
|
@@ -27746,14 +27765,42 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
27746
27765
|
target.focus();
|
|
27747
27766
|
}
|
|
27748
27767
|
function cascaderChange(val) {
|
|
27768
|
+
var _a;
|
|
27749
27769
|
const separator = _cascaderProps.value.separator || "/";
|
|
27750
|
-
|
|
27770
|
+
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
27771
|
+
if (isMultiple.value) {
|
|
27772
|
+
const list = isArray$1(val) ? val : [];
|
|
27773
|
+
const items = list.map((item) => {
|
|
27774
|
+
var _a2;
|
|
27775
|
+
if (isArray$1(item)) {
|
|
27776
|
+
return _cascaderProps.value.showAllLevels === false ? String((_a2 = item[item.length - 1]) != null ? _a2 : "") : item.join(separator);
|
|
27777
|
+
}
|
|
27778
|
+
return String(item != null ? item : "");
|
|
27779
|
+
});
|
|
27780
|
+
inputVal.value = items.join(joinSeparator);
|
|
27781
|
+
} else {
|
|
27782
|
+
inputVal.value = val ? isArray$1(val) ? _cascaderProps.value.showAllLevels === false ? val[val.length - 1] : val.join(separator) : [val].join(separator) : "";
|
|
27783
|
+
}
|
|
27751
27784
|
input(inputVal.value);
|
|
27752
27785
|
change(inputVal.value);
|
|
27753
27786
|
}
|
|
27754
27787
|
function getCascaderVal() {
|
|
27788
|
+
var _a;
|
|
27755
27789
|
const separator = _cascaderProps.value.separator || "/";
|
|
27756
|
-
|
|
27790
|
+
const joinSeparator = (_a = props.joinSeparator) != null ? _a : ",";
|
|
27791
|
+
if (isMultiple.value) {
|
|
27792
|
+
const raw = props.modelValue || "";
|
|
27793
|
+
if (!raw) {
|
|
27794
|
+
cascaderVal.value = [];
|
|
27795
|
+
return;
|
|
27796
|
+
}
|
|
27797
|
+
const parts = raw.split(joinSeparator).filter((s) => s !== "");
|
|
27798
|
+
if (_cascaderProps.value.showAllLevels === false) {
|
|
27799
|
+
cascaderVal.value = parts.map((id) => getCascaderId(id, props.options));
|
|
27800
|
+
} else {
|
|
27801
|
+
cascaderVal.value = parts.map((p) => p.split(separator));
|
|
27802
|
+
}
|
|
27803
|
+
} else if (_cascaderProps.value.showAllLevels === false) {
|
|
27757
27804
|
const list = getCascaderId(props.modelValue, props.options);
|
|
27758
27805
|
cascaderVal.value = list.join(separator);
|
|
27759
27806
|
} else {
|
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.8 */(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.8 */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.8 */(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.8 */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
|
@@ -23,6 +23,7 @@ export declare const cascaderProps: {
|
|
|
23
23
|
};
|
|
24
24
|
options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => CascaderOption[]) | (() => CascaderOption[]) | ((new (...args: any[]) => CascaderOption[]) | (() => CascaderOption[]))[], unknown, unknown, () => CascaderOption[], boolean>;
|
|
25
25
|
placeholder: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
26
|
+
joinSeparator: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
26
27
|
modelValue: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string & {}) | (() => string | undefined) | ((new (...args: any[]) => string & {}) | (() => string | undefined))[], unknown, unknown, string, boolean>;
|
|
27
28
|
};
|
|
28
29
|
export declare type CascaderProps = ExtractPropTypes<typeof cascaderProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cascader.mjs","sources":["../../../../../../packages/components/cascader/src/cascader.ts"],"sourcesContent":["import {buildProps, definePropType, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\nimport type {ExtractPropTypes} from 'vue'\nimport type Cascader from './cascader.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport type CascaderNodeValue = string | number\n\nexport interface CascaderOption extends Record<string, unknown> {\n label?: string\n value?: CascaderNodeValue\n children?: CascaderOption[]\n disabled?: boolean\n leaf?: boolean\n}\n\nexport const cascaderProps = buildProps({\n cascaderProps: {\n type: Object,\n default: () => ({\n showAllLevels: true,\n }),\n },\n disabled: Boolean,\n readonly: Boolean,\n clearable: Boolean,\n size: useSizeProp,\n options: {\n type: definePropType<CascaderOption[]>(Array),\n default: () => [] as CascaderOption[],\n },\n placeholder: {\n type: String,\n default: '',\n },\n modelValue: {\n type: definePropType<string | undefined>([\n String,\n ]),\n default: '',\n },\n})\n\nexport type CascaderProps = ExtractPropTypes<typeof cascaderProps>\n\nexport const cascaderEmits = {\n [UPDATE_MODEL_EVENT]: (value: string | undefined) => isString(value),\n input: (value: string | undefined) => isString(value),\n change: (value: string | undefined) => isString(value),\n}\nexport type CascaderEmits = typeof cascaderEmits\n\n\nexport type CascaderInstance = InstanceType<typeof Cascader>\n"],"names":[],"mappings":";;;;;;;;AAGY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,MAAM,aAAa,EAAE,IAAI;AACzB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC;AACzB,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC;;;;"}
|
|
1
|
+
{"version":3,"file":"cascader.mjs","sources":["../../../../../../packages/components/cascader/src/cascader.ts"],"sourcesContent":["import {buildProps, definePropType, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\nimport type {ExtractPropTypes} from 'vue'\nimport type Cascader from './cascader.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport type CascaderNodeValue = string | number\n\nexport interface CascaderOption extends Record<string, unknown> {\n label?: string\n value?: CascaderNodeValue\n children?: CascaderOption[]\n disabled?: boolean\n leaf?: boolean\n}\n\nexport const cascaderProps = buildProps({\n cascaderProps: {\n type: Object,\n default: () => ({\n showAllLevels: true,\n }),\n },\n disabled: Boolean,\n readonly: Boolean,\n clearable: Boolean,\n size: useSizeProp,\n options: {\n type: definePropType<CascaderOption[]>(Array),\n default: () => [] as CascaderOption[],\n },\n placeholder: {\n type: String,\n default: '',\n },\n joinSeparator: {\n type: String,\n default: ',',\n },\n modelValue: {\n type: definePropType<string | undefined>([\n String,\n ]),\n default: '',\n },\n})\n\nexport type CascaderProps = ExtractPropTypes<typeof cascaderProps>\n\nexport const cascaderEmits = {\n [UPDATE_MODEL_EVENT]: (value: string | undefined) => isString(value),\n input: (value: string | undefined) => isString(value),\n change: (value: string | undefined) => isString(value),\n}\nexport type CascaderEmits = typeof cascaderEmits\n\n\nexport type CascaderInstance = InstanceType<typeof Cascader>\n"],"names":[],"mappings":";;;;;;;;AAGY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,MAAM,aAAa,EAAE,IAAI;AACzB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC;AACzB,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC;;;;"}
|
|
@@ -14,6 +14,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
};
|
|
15
15
|
options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]) | ((new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]))[], unknown, unknown, () => import("./cascader").CascaderOption[], boolean>;
|
|
16
16
|
placeholder: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
17
|
+
joinSeparator: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
17
18
|
modelValue: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string & {}) | (() => string | undefined) | ((new (...args: any[]) => string & {}) | (() => string | undefined))[], unknown, unknown, string, boolean>;
|
|
18
19
|
}, {
|
|
19
20
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -31,6 +32,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
31
32
|
};
|
|
32
33
|
options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]) | ((new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]))[], unknown, unknown, () => import("./cascader").CascaderOption[], boolean>;
|
|
33
34
|
placeholder: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
35
|
+
joinSeparator: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
34
36
|
modelValue: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string & {}) | (() => string | undefined) | ((new (...args: any[]) => string & {}) | (() => string | undefined))[], unknown, unknown, string, boolean>;
|
|
35
37
|
}>> & {
|
|
36
38
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
@@ -71,6 +73,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
73
|
inputCls: import("vue").ComputedRef<string[]>;
|
|
72
74
|
cascaderCls: import("vue").ComputedRef<string[]>;
|
|
73
75
|
_inputProps: import("vue").ComputedRef<{
|
|
76
|
+
class: string;
|
|
77
|
+
style: string;
|
|
74
78
|
disabled: boolean;
|
|
75
79
|
size: "" | "default" | "small" | "large";
|
|
76
80
|
clearable: boolean;
|
|
@@ -88,6 +92,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
92
|
separator: string;
|
|
89
93
|
showAllLevels: boolean;
|
|
90
94
|
}>;
|
|
95
|
+
isMultiple: import("vue").ComputedRef<boolean>;
|
|
91
96
|
input: (str: string) => void;
|
|
92
97
|
change: (str: string) => void;
|
|
93
98
|
click: (e: MouseEvent) => void;
|
|
@@ -2276,6 +2281,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2276
2281
|
};
|
|
2277
2282
|
options: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]) | ((new (...args: any[]) => import("./cascader").CascaderOption[]) | (() => import("./cascader").CascaderOption[]))[], unknown, unknown, () => import("./cascader").CascaderOption[], boolean>;
|
|
2278
2283
|
placeholder: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
2284
|
+
joinSeparator: import("hzzt-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
2279
2285
|
modelValue: import("hzzt-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string & {}) | (() => string | undefined) | ((new (...args: any[]) => string & {}) | (() => string | undefined))[], unknown, unknown, string, boolean>;
|
|
2280
2286
|
}>> & {
|
|
2281
2287
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
@@ -2288,6 +2294,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2288
2294
|
clearable: boolean;
|
|
2289
2295
|
options: import("./cascader").CascaderOption[];
|
|
2290
2296
|
placeholder: string;
|
|
2297
|
+
joinSeparator: string;
|
|
2291
2298
|
modelValue: import("hzzt-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string & {}) | (() => string | undefined) | ((new (...args: any[]) => string & {}) | (() => string | undefined))[], unknown, unknown>;
|
|
2292
2299
|
}>;
|
|
2293
2300
|
export default _default;
|
|
@@ -45,7 +45,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
45
|
clearable: props.clearable,
|
|
46
46
|
placeholder: props.placeholder,
|
|
47
47
|
readonly: props.readonly,
|
|
48
|
-
...attrs
|
|
48
|
+
...attrs,
|
|
49
|
+
class: "",
|
|
50
|
+
style: ""
|
|
49
51
|
}));
|
|
50
52
|
const _cascaderProps = computed(() => ({
|
|
51
53
|
options: props.options,
|
|
@@ -59,6 +61,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
59
61
|
showAllLevels: true,
|
|
60
62
|
...props.cascaderProps
|
|
61
63
|
}));
|
|
64
|
+
const isMultiple = computed(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
return !!((_a = _cascaderProps.value.props) == null ? void 0 : _a.multiple);
|
|
67
|
+
});
|
|
62
68
|
watch(() => props.modelValue, (v) => {
|
|
63
69
|
inputVal.value = v;
|
|
64
70
|
getCascaderVal();
|
|
@@ -82,14 +88,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
82
88
|
target.focus();
|
|
83
89
|
}
|
|
84
90
|
function cascaderChange(val) {
|
|
91
|
+
var _a;
|
|
85
92
|
const separator = _cascaderProps.value.separator || "/";
|
|
86
|
-
|
|
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
|
+
}
|
|
87
107
|
input(inputVal.value);
|
|
88
108
|
change(inputVal.value);
|
|
89
109
|
}
|
|
90
110
|
function getCascaderVal() {
|
|
111
|
+
var _a;
|
|
91
112
|
const separator = _cascaderProps.value.separator || "/";
|
|
92
|
-
|
|
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) {
|
|
93
127
|
const list = getCascaderId(props.modelValue, props.options);
|
|
94
128
|
cascaderVal.value = list.join(separator);
|
|
95
129
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cascader2.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} 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 }))\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 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 inputVal.value = val ? isArray(val) ? val.join(separator) : [val].join(separator) : '';\n input(inputVal.value);\n change(inputVal.value);\n }\n\n function getCascaderVal() {\n const separator = _cascaderProps.value.separator || '/';\n 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":[
|
|
1
|
+
{"version":3,"file":"cascader2.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,E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AAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import ClickInput from './src/click-
|
|
3
|
-
export { clickInputEmits, clickInputProps } from './src/click-
|
|
2
|
+
import ClickInput from './src/click-input2.mjs';
|
|
3
|
+
export { clickInputEmits, clickInputProps } from './src/click-input.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const HzztClickInput = withInstall(ClickInput);
|
|
@@ -1,89 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { clickInputProps, clickInputEmits } from './click-input2.mjs';
|
|
1
|
+
import '../../../utils/index.mjs';
|
|
3
2
|
import '../../../hooks/index.mjs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import '../../../constants/index.mjs';
|
|
4
|
+
import { buildProps } 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';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const clickInputProps = buildProps({
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: ""
|
|
13
|
+
},
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
readonly: Boolean,
|
|
16
|
+
inputProps: Object,
|
|
17
|
+
size: useSizeProp
|
|
11
18
|
});
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const props = __props;
|
|
18
|
-
const _inputVal = ref(props.modelValue || "");
|
|
19
|
-
const inputVal = ref(props.modelValue || "");
|
|
20
|
-
const inputRef = ref();
|
|
21
|
-
const editable = ref(false);
|
|
22
|
-
const nsInput = useNamespace("click-input");
|
|
23
|
-
const formSize = useFormSize();
|
|
24
|
-
const formDisabled = useFormDisabled();
|
|
25
|
-
const trueSize = computed(() => props.size || formSize.value || useGlobalSize().value);
|
|
26
|
-
const trueDisabled = computed(() => props.disabled || formDisabled.value);
|
|
27
|
-
const trueReadonly = computed(() => trueDisabled.value || props.readonly || !editable.value);
|
|
28
|
-
const containerCls = computed(() => [
|
|
29
|
-
nsInput.b(),
|
|
30
|
-
nsInput.m(trueSize.value),
|
|
31
|
-
"flex width-100% align-items-center"
|
|
32
|
-
]);
|
|
33
|
-
const spanClass = computed(() => [
|
|
34
|
-
nsInput.e("span"),
|
|
35
|
-
"flex width-100% align-items-center"
|
|
36
|
-
]);
|
|
37
|
-
watch(() => props.modelValue, (v) => {
|
|
38
|
-
inputVal.value = v || "";
|
|
39
|
-
_inputVal.value = v || "";
|
|
40
|
-
});
|
|
41
|
-
function input(val) {
|
|
42
|
-
emit("update:modelValue", val);
|
|
43
|
-
emit("input", val);
|
|
44
|
-
}
|
|
45
|
-
function change() {
|
|
46
|
-
editable.value = false;
|
|
47
|
-
if (_inputVal.value === inputVal.value) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
input(inputVal.value);
|
|
51
|
-
emit("change", inputVal.value);
|
|
52
|
-
}
|
|
53
|
-
function edit() {
|
|
54
|
-
if (trueDisabled.value || props.readonly) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
editable.value = true;
|
|
58
|
-
nextTick(() => {
|
|
59
|
-
inputRef.value.focus();
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return (_ctx, _cache) => {
|
|
63
|
-
return openBlock(), createElementBlock("div", {
|
|
64
|
-
class: normalizeClass(unref(containerCls))
|
|
65
|
-
}, [
|
|
66
|
-
!unref(trueReadonly) ? (openBlock(), createBlock(unref(ElInput), mergeProps({
|
|
67
|
-
key: 0,
|
|
68
|
-
ref_key: "inputRef",
|
|
69
|
-
ref: inputRef,
|
|
70
|
-
modelValue: inputVal.value,
|
|
71
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event)
|
|
72
|
-
}, _ctx.inputProps, {
|
|
73
|
-
clearable: "",
|
|
74
|
-
size: unref(trueSize),
|
|
75
|
-
onKeyup: withKeys(change, ["enter"]),
|
|
76
|
-
onBlur: change
|
|
77
|
-
}), null, 16, ["modelValue", "size", "onKeyup"])) : (openBlock(), createElementBlock("div", {
|
|
78
|
-
key: 1,
|
|
79
|
-
class: normalizeClass(["width-100%", unref(spanClass)]),
|
|
80
|
-
onClick: edit
|
|
81
|
-
}, toDisplayString(inputVal.value || " "), 3))
|
|
82
|
-
], 2);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
var ClickInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "click-input.vue"]]);
|
|
19
|
+
const clickInputEmits = {
|
|
20
|
+
[UPDATE_MODEL_EVENT]: (value) => isString(value),
|
|
21
|
+
input: (value) => isString(value),
|
|
22
|
+
change: (value) => isString(value)
|
|
23
|
+
};
|
|
87
24
|
|
|
88
|
-
export {
|
|
25
|
+
export { clickInputEmits, clickInputProps };
|
|
89
26
|
//# sourceMappingURL=click-input.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-input.mjs","sources":["../../../../../../packages/components/click-input/src/click-input.
|
|
1
|
+
{"version":3,"file":"click-input.mjs","sources":["../../../../../../packages/components/click-input/src/click-input.ts"],"sourcesContent":["import {buildProps, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type ClickInput from './click-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const clickInputProps = buildProps({\n modelValue: {\n type: String,\n default: '',\n },\n disabled: Boolean,\n readonly: Boolean,\n inputProps: Object,\n size: useSizeProp,\n})\n\nexport type ClickInputProps = ExtractPropTypes<typeof clickInputProps>\n\nexport const clickInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n input: (value: string) => isString(value),\n change: (value: string) => isString(value),\n}\nexport type ClickInputEmits = typeof clickInputEmits\n\nexport type ClickInputInstance = InstanceType<typeof ClickInput>\n"],"names":[],"mappings":";;;;;;;;AAGY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,IAAI,EAAE,WAAW;AACnB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC;;;;"}
|