@v2coding/ui 0.1.28 → 0.1.29

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.
@@ -3111,6 +3111,19 @@ var script$y = {
3111
3111
 
3112
3112
  expandMap() {
3113
3113
  return this.getExpandMap(this.realData);
3114
+ },
3115
+
3116
+ realAllValue(_ref2) {
3117
+ let {
3118
+ realProps,
3119
+ allValue
3120
+ } = _ref2;
3121
+
3122
+ if (realProps.multiple) {
3123
+ return false;
3124
+ }
3125
+
3126
+ return allValue;
3114
3127
  }
3115
3128
 
3116
3129
  },
@@ -3183,16 +3196,35 @@ var script$y = {
3183
3196
  },
3184
3197
 
3185
3198
  matchValue(data, value) {
3199
+ if (this.realProps.multiple) {
3200
+ return this.matchMultipleValue(data, value);
3201
+ }
3202
+
3203
+ return this.matchSingleValue(data, value);
3204
+ },
3205
+
3206
+ matchSingleValue(data, value) {
3186
3207
  if (!value) {
3187
3208
  return [];
3188
3209
  }
3189
3210
 
3190
- if (!this.allValue) {
3211
+ if (!this.realAllValue) {
3191
3212
  const fullValues = this.expandMap[value] || [];
3192
3213
  return [...fullValues].reverse();
3193
3214
  }
3194
3215
 
3195
- return value.split(',');
3216
+ return String(value).split(',');
3217
+ },
3218
+
3219
+ matchMultipleValue(data, values) {
3220
+ if (!values) {
3221
+ return [];
3222
+ }
3223
+
3224
+ return values.split(',').map(value => {
3225
+ const fullValues = this.expandMap[value] || [];
3226
+ return [...fullValues].reverse();
3227
+ });
3196
3228
  },
3197
3229
 
3198
3230
  /**
@@ -3248,6 +3280,15 @@ var script$y = {
3248
3280
  },
3249
3281
 
3250
3282
  onChange(value) {
3283
+ if (this.realProps.multiple) {
3284
+ this.onMultipleChange(value);
3285
+ return;
3286
+ }
3287
+
3288
+ this.onSingleChange(value);
3289
+ },
3290
+
3291
+ onSingleChange(value) {
3251
3292
  const lastVal = value.length ? value[value.length - 1] : '';
3252
3293
 
3253
3294
  if (!lastVal) {
@@ -3255,7 +3296,7 @@ var script$y = {
3255
3296
  return;
3256
3297
  }
3257
3298
 
3258
- if (!this.allValue) {
3299
+ if (!this.realAllValue) {
3259
3300
  this.emitChange(lastVal);
3260
3301
  return;
3261
3302
  }
@@ -3265,6 +3306,20 @@ var script$y = {
3265
3306
  this.emitChange(_value);
3266
3307
  },
3267
3308
 
3309
+ onMultipleChange(list) {
3310
+ if (!Array.isArray(list) || list.length <= 0) {
3311
+ this.emitChange(undefined);
3312
+ return;
3313
+ }
3314
+
3315
+ const _value = list.map(item => {
3316
+ const lastVal = item.length ? item[item.length - 1] : '';
3317
+ return lastVal;
3318
+ }).filter(Boolean).join(',');
3319
+
3320
+ this.emitChange(_value);
3321
+ },
3322
+
3268
3323
  resetValue() {
3269
3324
  this.onChange([]);
3270
3325
  }
@@ -3345,8 +3400,8 @@ var __vue_staticRenderFns__$y = [];
3345
3400
 
3346
3401
  const __vue_inject_styles__$z = function (inject) {
3347
3402
  if (!inject) return;
3348
- inject("data-v-682ee118_0", {
3349
- source: ".ui-cascade-field[data-v-682ee118]{width:100%}.ui-cascade-field-popper[data-v-682ee118]{z-index:99999!important}.ui-cascade-field-popper .el-cascader-menu__item[data-v-682ee118]{padding-right:30px}[data-v-682ee118] .el-loading-mask .el-loading-spinner{margin-top:-14px}",
3403
+ inject("data-v-e8617b10_0", {
3404
+ source: ".ui-cascade-field[data-v-e8617b10]{width:100%}.ui-cascade-field-popper[data-v-e8617b10]{z-index:99999!important}.ui-cascade-field-popper .el-cascader-menu__item[data-v-e8617b10]{padding-right:30px}[data-v-e8617b10] .el-loading-mask .el-loading-spinner{margin-top:-14px}",
3350
3405
  map: undefined,
3351
3406
  media: undefined
3352
3407
  });
@@ -3354,7 +3409,7 @@ const __vue_inject_styles__$z = function (inject) {
3354
3409
  /* scoped */
3355
3410
 
3356
3411
 
3357
- const __vue_scope_id__$z = "data-v-682ee118";
3412
+ const __vue_scope_id__$z = "data-v-e8617b10";
3358
3413
  /* module identifier */
3359
3414
 
3360
3415
  const __vue_module_identifier__$z = undefined;