@tripup-company/element-ui-extended 0.0.66 → 0.0.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tripup-company/element-ui-extended",
3
- "version": "0.0.66",
3
+ "version": "0.0.69",
4
4
  "main": "./dist/element-ui-extended.umd.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve && tsc --emitDeclarationOnly",
@@ -51,6 +51,7 @@
51
51
  :remote="remote"
52
52
  :remote-method="remoteMethodHandler"
53
53
  :loading="loading"
54
+ :value-key="objectValueKey"
54
55
  clearable
55
56
  @change="updateSearch"
56
57
  >
@@ -58,7 +59,7 @@
58
59
  v-for="item in selectListLocal"
59
60
  :key="item[selectKey]"
60
61
  :label="item[selectLabel]"
61
- :value="item[selectValue]"
62
+ :value="selectJson ? item : item[selectValue]"
62
63
  />
63
64
  </el-select>
64
65
  </el-col>
@@ -66,7 +67,7 @@
66
67
  </el-row>
67
68
  </template>
68
69
  <script>
69
- import { upperFirst } from 'lodash'
70
+ import { upperFirst } from "lodash";
70
71
  import Vue from "vue";
71
72
  export default {
72
73
  props: {
@@ -84,7 +85,7 @@ export default {
84
85
  },
85
86
  name: {
86
87
  type: String,
87
- default: '',
88
+ default: "",
88
89
  },
89
90
  },
90
91
  data() {
@@ -93,6 +94,16 @@ export default {
93
94
  { value: true, name: "true" },
94
95
  { value: false, name: "false" },
95
96
  ];
97
+ let selectValues = [];
98
+ if (this.column.selectList && this.column.selectList.length) {
99
+ selectValues = this.column.selectList;
100
+ } else if (this.search.selectList && this.search.selectList.length) {
101
+ selectValues = this.search.selectList;
102
+ } else if (this.column.type === "enum") {
103
+ selectValues = this.column.values;
104
+ } else {
105
+ selectValues = boolValues;
106
+ }
96
107
  return {
97
108
  searchLocal: this.search,
98
109
  loading: false,
@@ -100,13 +111,10 @@ export default {
100
111
  selectLabel: this.column.selectLabel ?? "name",
101
112
  selectValue: this.column.selectValue ?? "value",
102
113
  filterable: this.column.filterable ?? false,
114
+ objectValueKey: this.column.objectValueKey ?? "value",
115
+ selectJson: this.column.selectJson ?? false,
103
116
  remote: this.column.remote ?? false,
104
117
  remoteMethod: this.column.remoteMethod ?? null,
105
- selectListLocal: this.column.selectList
106
- ? this.column.selectList
107
- : this.column.type === "enum"
108
- ? this.column.values
109
- : boolValues,
110
118
  showFilter: this.search.operator !== "",
111
119
  stringOperators: [
112
120
  { value: "equal", label: "is equal" },
@@ -124,6 +132,8 @@ export default {
124
132
  enumOperatorsInObject: [{ value: "in_object", label: "in_object" }],
125
133
  dateOperators: [{ value: "between", label: "between" }],
126
134
  boolOperators: [{ value: "equal", label: "is" }],
135
+ selectListLocal: selectValues,
136
+
127
137
  };
128
138
  },
129
139
  computed: {
@@ -135,7 +145,12 @@ export default {
135
145
  break;
136
146
  case ("enum", "select"):
137
147
  if (this.column.operator) {
138
- operators = [{ value: this.column.operator, label: upperFirst(this.column.operator.replace('_', ' ')) }];
148
+ operators = [
149
+ {
150
+ value: this.column.operator,
151
+ label: upperFirst(this.column.operator.replace("_", " ")),
152
+ },
153
+ ];
139
154
  } else if (this.column.selectMultiple) {
140
155
  operators = this.enumOperatorsMultiple;
141
156
  } else {
@@ -168,12 +183,15 @@ export default {
168
183
  if (this.showFilter === false) {
169
184
  this.searchLocal.operator = "";
170
185
  this.searchLocal.value = "";
171
- } else if (this.searchLocal.operator === "" && this.operators.length === 1) {
186
+ } else if (
187
+ this.searchLocal.operator === "" &&
188
+ this.operators.length === 1
189
+ ) {
172
190
  this.searchLocal.operator = this.operators[0].value;
173
191
  }
174
192
  },
175
- search (newValue ) {
176
- console.log('seach updated');
193
+ search(newValue) {
194
+ console.log("seach updated");
177
195
  if (newValue !== this.search) {
178
196
  this.searchLocal = Object.assign({}, this.search);
179
197
  }
@@ -183,13 +201,16 @@ export default {
183
201
  searchLocal: {
184
202
  deep: true,
185
203
  handler() {
186
- console.log('searchLocal updated');
187
- this.$emit("update:search", { name: this.name, value: this.searchLocal});
204
+ console.log("searchLocal updated");
205
+ this.$emit("update:search", {
206
+ name: this.name,
207
+ value: this.searchLocal,
208
+ });
188
209
  console.log(this.searchLocal);
189
- if (this.searchLocal.operator == '') {
210
+ if (this.searchLocal.operator == "") {
190
211
  this.showFilter = false;
191
212
  }
192
- }
213
+ },
193
214
  },
194
215
  },
195
216
  methods: {