@cmstops/pro-compo 0.2.2 → 0.2.3

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.
@@ -43,11 +43,12 @@ const _sfc_main = defineComponent({
43
43
  const hasValue = computed(() => {
44
44
  return (key) => {
45
45
  var _a, _b;
46
- if (typeof form.value[key] === "object" && Object.prototype.hasOwnProperty.call(form.value[key], "range")) {
46
+ if (form.value[key] && typeof form.value[key] === "object" && Object.prototype.hasOwnProperty.call(form.value[key], "range")) {
47
47
  return ((_a = form.value[key].range) == null ? void 0 : _a.length) > 0;
48
48
  }
49
- const bool = form.value[key] !== ((_b = columnsMap.value[key]) == null ? void 0 : _b.defaultValue);
50
- if (bool) {
49
+ const diff = form.value[key] !== ((_b = columnsMap.value[key]) == null ? void 0 : _b.defaultValue);
50
+ console.log("hasValue", key, form.value[key], diff);
51
+ if (form.value[key] !== "" && diff) {
51
52
  return true;
52
53
  }
53
54
  return false;
@@ -73,6 +74,8 @@ const _sfc_main = defineComponent({
73
74
  }
74
75
  rangeTemp[column.range][column.key] = column.defaultValue || "";
75
76
  _form[column.range] = rangeTemp[column.range];
77
+ } else if (column.component === "select") {
78
+ _form[column.key] = column.defaultValue || null;
76
79
  } else {
77
80
  _form[column.key] = column.defaultValue || "";
78
81
  }
@@ -80,9 +83,14 @@ const _sfc_main = defineComponent({
80
83
  render.value = true;
81
84
  form.value = _form;
82
85
  };
86
+ const handleSelectChange = (value, item) => {
87
+ if (value === "") {
88
+ form.value[item.key] = null;
89
+ }
90
+ };
83
91
  const formMatte = (_form) => {
84
92
  Object.keys(_form).forEach((key) => {
85
- if (typeof _form[key] === "object" && Object.prototype.hasOwnProperty.call(_form[key], "range")) {
93
+ if (_form[key] && typeof _form[key] === "object" && Object.prototype.hasOwnProperty.call(_form[key], "range")) {
86
94
  Object.keys(_form[key]).forEach((k, index) => {
87
95
  var _a;
88
96
  const _time = ((_a = _form[key]) == null ? void 0 : _a.range) || {};
@@ -94,7 +102,10 @@ const _sfc_main = defineComponent({
94
102
  });
95
103
  const _parmas = { ..._form };
96
104
  Object.keys(_parmas).forEach((key) => {
97
- if (typeof _parmas[key] === "object" && Object.prototype.hasOwnProperty.call(_parmas[key], "range")) {
105
+ if (_parmas[key] && typeof _parmas[key] === "object" && Object.prototype.hasOwnProperty.call(_parmas[key], "range")) {
106
+ delete _parmas[key];
107
+ }
108
+ if (_parmas[key] === null || _parmas[key] === void 0) {
98
109
  delete _parmas[key];
99
110
  }
100
111
  });
@@ -157,8 +168,10 @@ const _sfc_main = defineComponent({
157
168
  "onUpdate:modelValue": ($event) => form.value[item.key] = $event,
158
169
  "popup-container": "#base-filter-popup-container",
159
170
  "allow-clear": "",
171
+ "default-active-first-option": false,
160
172
  style: normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
161
- placeholder: `\u8BF7\u9009\u62E9${item.label}`
173
+ placeholder: `\u8BF7\u9009\u62E9${item.label}`,
174
+ onChange: ($event) => handleSelectChange($event, item)
162
175
  }, {
163
176
  default: withCtx(() => [
164
177
  (openBlock(true), createElementBlock(Fragment, null, renderList(getOptions(item), (opt) => {
@@ -170,7 +183,7 @@ const _sfc_main = defineComponent({
170
183
  }), 128))
171
184
  ]),
172
185
  _: 2
173
- }, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : createCommentVNode("v-if", true),
186
+ }, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder", "onChange"])) : createCommentVNode("v-if", true),
174
187
  item.component === "range-picker" ? (openBlock(), createBlock(unref(RangePicker), {
175
188
  key: 2,
176
189
  modelValue: form.value[item.key].range,
@@ -44,11 +44,12 @@ const _sfc_main = vue.defineComponent({
44
44
  const hasValue = vue.computed(() => {
45
45
  return (key) => {
46
46
  var _a, _b;
47
- if (typeof form.value[key] === "object" && Object.prototype.hasOwnProperty.call(form.value[key], "range")) {
47
+ if (form.value[key] && typeof form.value[key] === "object" && Object.prototype.hasOwnProperty.call(form.value[key], "range")) {
48
48
  return ((_a = form.value[key].range) == null ? void 0 : _a.length) > 0;
49
49
  }
50
- const bool = form.value[key] !== ((_b = columnsMap.value[key]) == null ? void 0 : _b.defaultValue);
51
- if (bool) {
50
+ const diff = form.value[key] !== ((_b = columnsMap.value[key]) == null ? void 0 : _b.defaultValue);
51
+ console.log("hasValue", key, form.value[key], diff);
52
+ if (form.value[key] !== "" && diff) {
52
53
  return true;
53
54
  }
54
55
  return false;
@@ -74,6 +75,8 @@ const _sfc_main = vue.defineComponent({
74
75
  }
75
76
  rangeTemp[column.range][column.key] = column.defaultValue || "";
76
77
  _form[column.range] = rangeTemp[column.range];
78
+ } else if (column.component === "select") {
79
+ _form[column.key] = column.defaultValue || null;
77
80
  } else {
78
81
  _form[column.key] = column.defaultValue || "";
79
82
  }
@@ -81,9 +84,14 @@ const _sfc_main = vue.defineComponent({
81
84
  render.value = true;
82
85
  form.value = _form;
83
86
  };
87
+ const handleSelectChange = (value, item) => {
88
+ if (value === "") {
89
+ form.value[item.key] = null;
90
+ }
91
+ };
84
92
  const formMatte = (_form) => {
85
93
  Object.keys(_form).forEach((key) => {
86
- if (typeof _form[key] === "object" && Object.prototype.hasOwnProperty.call(_form[key], "range")) {
94
+ if (_form[key] && typeof _form[key] === "object" && Object.prototype.hasOwnProperty.call(_form[key], "range")) {
87
95
  Object.keys(_form[key]).forEach((k, index) => {
88
96
  var _a;
89
97
  const _time = ((_a = _form[key]) == null ? void 0 : _a.range) || {};
@@ -95,7 +103,10 @@ const _sfc_main = vue.defineComponent({
95
103
  });
96
104
  const _parmas = { ..._form };
97
105
  Object.keys(_parmas).forEach((key) => {
98
- if (typeof _parmas[key] === "object" && Object.prototype.hasOwnProperty.call(_parmas[key], "range")) {
106
+ if (_parmas[key] && typeof _parmas[key] === "object" && Object.prototype.hasOwnProperty.call(_parmas[key], "range")) {
107
+ delete _parmas[key];
108
+ }
109
+ if (_parmas[key] === null || _parmas[key] === void 0) {
99
110
  delete _parmas[key];
100
111
  }
101
112
  });
@@ -158,8 +169,10 @@ const _sfc_main = vue.defineComponent({
158
169
  "onUpdate:modelValue": ($event) => form.value[item.key] = $event,
159
170
  "popup-container": "#base-filter-popup-container",
160
171
  "allow-clear": "",
172
+ "default-active-first-option": false,
161
173
  style: vue.normalizeStyle({ width: styleWidth(columnsMap.value[item.key]) }),
162
- placeholder: `\u8BF7\u9009\u62E9${item.label}`
174
+ placeholder: `\u8BF7\u9009\u62E9${item.label}`,
175
+ onChange: ($event) => handleSelectChange($event, item)
163
176
  }, {
164
177
  default: vue.withCtx(() => [
165
178
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getOptions(item), (opt) => {
@@ -171,7 +184,7 @@ const _sfc_main = vue.defineComponent({
171
184
  }), 128))
172
185
  ]),
173
186
  _: 2
174
- }, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder"])) : vue.createCommentVNode("v-if", true),
187
+ }, 1032, ["modelValue", "onUpdate:modelValue", "style", "placeholder", "onChange"])) : vue.createCommentVNode("v-if", true),
175
188
  item.component === "range-picker" ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.RangePicker), {
176
189
  key: 2,
177
190
  modelValue: form.value[item.key].range,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",