@vunk/form 1.1.16 → 1.1.17

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.
@@ -2,3 +2,6 @@
2
2
  .vkf-van-cascader .el-select{
3
3
  --el-readonly-cursor: pointer;
4
4
  }
5
+ .vkf-van-cascader-input{
6
+ display: none;
7
+ }
@@ -1,10 +1,11 @@
1
1
  import { _VkfCascaderCtx, _VkfCascaderUse } from '@vunk/form/components/cascader';
2
- import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createVNode, normalizeClass } from 'vue';
2
+ import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createVNode } from 'vue';
3
3
  import { VkfFormItem, _VkfFormItemCtx } from '@vunk/form/components/form-item';
4
4
  import { Cascader, Popup } from 'vant';
5
5
  import { ElSelect } from 'element-plus';
6
6
  import 'vant/es/cascader/style';
7
7
  import 'vant/es/popup/style';
8
+ import { useComputedReadonly } from '@vunk/form/composables';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -49,6 +50,7 @@ const _sfc_main = defineComponent({
49
50
  const fieldValue = ref("");
50
51
  const cascaderValue = ref("");
51
52
  const options = _VkfCascaderUse.useOptions(props2, emit);
53
+ const readonly = useComputedReadonly(props2);
52
54
  watch(() => props2.modelValue, (val) => {
53
55
  if (Array.isArray(val) && val.length) {
54
56
  fieldValue.value = val.join("/");
@@ -64,13 +66,19 @@ const _sfc_main = defineComponent({
64
66
  popupShow.value = false;
65
67
  emit("update:modelValue", selectedOptions.map((item) => item.value));
66
68
  };
69
+ const preInput = () => {
70
+ if (readonly.value)
71
+ return;
72
+ popupShow.value = true;
73
+ };
67
74
  return {
68
75
  formItemBindProps,
69
76
  fieldValue,
70
77
  popupShow,
71
78
  handleFinish,
72
79
  cascaderValue,
73
- options
80
+ options,
81
+ preInput
74
82
  };
75
83
  }
76
84
  });
@@ -82,24 +90,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
82
90
  return openBlock(), createBlock(_component_VkfFormItem, mergeProps({ class: "vkf-van-cascader" }, _ctx.formItemBindProps), {
83
91
  default: withCtx(() => [
84
92
  createVNode(_component_ElSelect, {
85
- disabled: true,
86
- class: normalizeClass({
87
- "is-readonly": true
88
- }),
93
+ "popper-class": "vkf-van-cascader-input",
89
94
  "model-value": _ctx.fieldValue,
90
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.popupShow = true)
91
- }, null, 8, ["model-value"]),
95
+ onClick: _ctx.preInput
96
+ }, null, 8, ["model-value", "onClick"]),
92
97
  createVNode(_component_Popup, {
93
98
  show: _ctx.popupShow,
94
- "onUpdate:show": _cache[3] || (_cache[3] = ($event) => _ctx.popupShow = $event),
99
+ "onUpdate:show": _cache[2] || (_cache[2] = ($event) => _ctx.popupShow = $event),
95
100
  round: "",
96
101
  position: "bottom"
97
102
  }, {
98
103
  default: withCtx(() => [
99
104
  createVNode(_component_Cascader, {
100
105
  modelValue: _ctx.cascaderValue,
101
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.cascaderValue = $event),
102
- onClose: _cache[2] || (_cache[2] = ($event) => _ctx.popupShow = false),
106
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.cascaderValue = $event),
107
+ onClose: _cache[1] || (_cache[1] = ($event) => _ctx.popupShow = false),
103
108
  options: _ctx.options,
104
109
  "field-names": {
105
110
  text: "label",
@@ -131,6 +131,7 @@ declare const _default: import("vue").DefineComponent<{
131
131
  }) => void;
132
132
  cascaderValue: import("vue").Ref<string>;
133
133
  options: import("vue").ComputedRef<import("element-plus").CascaderOption[] | undefined>;
134
+ preInput: () => void;
134
135
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
135
136
  "update:modelValue": (val: import("element-plus").CascaderValue) => boolean;
136
137
  change: (val: import("element-plus").CascaderValue) => boolean;
package/index.css CHANGED
@@ -336,3 +336,6 @@
336
336
  .vkf-van-cascader .el-select{
337
337
  --el-readonly-cursor: pointer;
338
338
  }
339
+ .vkf-van-cascader-input{
340
+ display: none;
341
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "1.1.16",
3
+ "version": "1.1.17",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {