cy-element-ui 1.0.15 → 1.0.16

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": "cy-element-ui",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "基于ElementUI开发的组件",
5
5
  "main": "lib/element-ui.common.js",
6
6
  "browser": {
@@ -12,7 +12,8 @@
12
12
  <label-wrap
13
13
  :is-auto-width="labelStyle && labelStyle.width === 'auto'"
14
14
  :update-all="form.labelWidth === 'auto'">
15
- <label :for="labelFor" class="el-form-item__label" :style="labelStyle" v-if="!!label || $slots.label">
15
+ {{ label +'----'+ $slots.label }}
16
+ <label :for="labelFor" class="el-form-item__label" :style="labelStyle" v-if="label || $slots.label">
16
17
  <slot name="label">{{ label + form.labelSuffix }}</slot>
17
18
  </label>
18
19
  </label-wrap>
@@ -10,6 +10,7 @@
10
10
  'hover': hover
11
11
  }">
12
12
  <slot>
13
+ {{ this.label +'----'+ this.isObject +'----'+ this.value }}
13
14
  <span>{{ currentLabel }}</span>
14
15
  </slot>
15
16
  </li>
@@ -41,7 +41,7 @@
41
41
  <span class="el-select__tags-text">{{ item.currentLabel }}</span>
42
42
  </el-tag>
43
43
  </transition-group>
44
-
44
+
45
45
  <input
46
46
  type="text"
47
47
  class="el-select__input"
@@ -99,7 +99,8 @@
99
99
  </template>
100
100
  <template slot="suffix">
101
101
  <i v-show="!showClose" :class="['el-select__caret', 'el-input__icon', 'el-icon-' + iconClass]"></i>
102
- <i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close" @click="handleClearClick"></i>
102
+ <i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close"
103
+ @click="handleClearClick"></i>
103
104
  </template>
104
105
  </el-input>
105
106
  <transition
@@ -154,55 +155,55 @@ import { isKorean } from 'element-ui/src/utils/shared';
154
155
 
155
156
  export default {
156
157
  mixins: [Emitter, Locale, Focus('reference'), NavigationMixin],
157
-
158
+
158
159
  name: 'ElSelect',
159
-
160
+
160
161
  componentName: 'ElSelect',
161
-
162
+
162
163
  inject: {
163
164
  elForm: {
164
165
  default: ''
165
166
  },
166
-
167
+
167
168
  elFormItem: {
168
169
  default: ''
169
170
  }
170
171
  },
171
-
172
+
172
173
  provide() {
173
174
  return {
174
175
  'select': this
175
176
  };
176
177
  },
177
-
178
+
178
179
  computed: {
179
180
  _elFormItemSize() {
180
181
  return (this.elFormItem || {}).elFormItemSize;
181
182
  },
182
-
183
+
183
184
  readonly() {
184
185
  return !this.filterable || this.multiple || (!isIE() && !isEdge() && !this.visible);
185
186
  },
186
-
187
+
187
188
  showClose() {
188
189
  let hasValue = this.multiple
189
190
  ? Array.isArray(this.value) && this.value.length > 0
190
191
  : this.value !== undefined && this.value !== null && this.value !== '';
191
192
  let criteria = this.clearable &&
192
- !this.selectDisabled &&
193
- this.inputHovering &&
194
- hasValue;
193
+ !this.selectDisabled &&
194
+ this.inputHovering &&
195
+ hasValue;
195
196
  return criteria;
196
197
  },
197
-
198
+
198
199
  iconClass() {
199
200
  return this.remote && this.filterable ? '' : (this.visible ? 'arrow-up is-reverse' : 'arrow-up');
200
201
  },
201
-
202
+
202
203
  debounce() {
203
204
  return this.remote ? 300 : 0;
204
205
  },
205
-
206
+
206
207
  emptyText() {
207
208
  if (this.loading) {
208
209
  return this.loadingText || this.t('el.select.loading');
@@ -217,21 +218,21 @@ export default {
217
218
  }
218
219
  return null;
219
220
  },
220
-
221
+
221
222
  showNewOption() {
222
223
  let hasExistingOption = this.options.filter(option => !option.created)
223
224
  .some(option => option.currentLabel === this.query);
224
225
  return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
225
226
  },
226
-
227
+
227
228
  selectSize() {
228
229
  return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
229
230
  },
230
-
231
+
231
232
  selectDisabled() {
232
233
  return this.disabled || (this.elForm || {}).disabled;
233
234
  },
234
-
235
+
235
236
  collapseTagSize() {
236
237
  return ['small', 'mini'].indexOf(this.selectSize) > -1
237
238
  ? 'mini'
@@ -241,7 +242,7 @@ export default {
241
242
  return typeof this.placeholder !== 'undefined' ? this.placeholder : this.t('el.select.placeholder');
242
243
  }
243
244
  },
244
-
245
+
245
246
  components: {
246
247
  ElInput,
247
248
  ElSelectMenu,
@@ -249,9 +250,9 @@ export default {
249
250
  ElTag,
250
251
  ElScrollbar
251
252
  },
252
-
253
+
253
254
  directives: { Clickoutside },
254
-
255
+
255
256
  props: {
256
257
  name: String,
257
258
  id: String,
@@ -267,7 +268,7 @@ export default {
267
268
  type: String,
268
269
  validator(val) {
269
270
  process.env.NODE_ENV !== 'production' &&
270
- console.warn('[Element Warn][Select]\'auto-complete\' property will be deprecated in next major version. please use \'autocomplete\' instead.');
271
+ console.warn('[Element Warn][Select]\'auto-complete\' property will be deprecated in next major version. please use \'autocomplete\' instead.');
271
272
  return true;
272
273
  }
273
274
  },
@@ -306,7 +307,7 @@ export default {
306
307
  default: true
307
308
  }
308
309
  },
309
-
310
+
310
311
  data() {
311
312
  return {
312
313
  options: [],
@@ -333,18 +334,18 @@ export default {
333
334
  isSilentBlur: false
334
335
  };
335
336
  },
336
-
337
+
337
338
  watch: {
338
339
  selectDisabled() {
339
340
  this.$nextTick(() => {
340
341
  this.resetInputHeight();
341
342
  });
342
343
  },
343
-
344
+
344
345
  propPlaceholder(val) {
345
346
  this.cachedPlaceHolder = this.currentPlaceholder = val;
346
347
  },
347
-
348
+
348
349
  value(val, oldVal) {
349
350
  if (this.multiple) {
350
351
  this.resetInputHeight();
@@ -366,7 +367,7 @@ export default {
366
367
  this.dispatch('ElFormItem', 'el.form.change', val);
367
368
  }
368
369
  },
369
-
370
+
370
371
  visible(val) {
371
372
  if (!val) {
372
373
  this.broadcast('ElSelectDropdown', 'destroyPopper');
@@ -381,22 +382,22 @@ export default {
381
382
  this.resetHoverIndex();
382
383
  this.$nextTick(() => {
383
384
  if (this.$refs.input &&
384
- this.$refs.input.value === '' &&
385
- this.selected.length === 0) {
385
+ this.$refs.input.value === '' &&
386
+ this.selected.length === 0) {
386
387
  this.currentPlaceholder = this.cachedPlaceHolder;
387
388
  }
388
389
  });
389
390
  if (!this.multiple) {
390
391
  if (this.selected) {
391
392
  if (this.filterable && this.allowCreate &&
392
- this.createdSelected && this.createdLabel) {
393
+ this.createdSelected && this.createdLabel) {
393
394
  this.selectedLabel = this.createdLabel;
394
395
  } else {
395
396
  this.selectedLabel = this.selected.currentLabel;
396
397
  }
397
398
  if (this.filterable) this.query = this.selectedLabel;
398
399
  }
399
-
400
+
400
401
  if (this.filterable) {
401
402
  this.currentPlaceholder = this.cachedPlaceHolder;
402
403
  }
@@ -413,7 +414,7 @@ export default {
413
414
  this.broadcast('ElOption', 'queryChange', '');
414
415
  this.broadcast('ElOptionGroup', 'queryChange');
415
416
  }
416
-
417
+
417
418
  if (this.selectedLabel) {
418
419
  this.currentPlaceholder = this.selectedLabel;
419
420
  this.selectedLabel = '';
@@ -423,7 +424,7 @@ export default {
423
424
  }
424
425
  this.$emit('visible-change', val);
425
426
  },
426
-
427
+
427
428
  options() {
428
429
  if (this.$isServer) return;
429
430
  this.$nextTick(() => {
@@ -441,11 +442,11 @@ export default {
441
442
  }
442
443
  }
443
444
  },
444
-
445
+
445
446
  methods: {
446
447
  handleNavigate(direction) {
447
448
  if (this.isOnComposition) return;
448
-
449
+
449
450
  this.navigateOptions(direction);
450
451
  },
451
452
  handleComposition(event) {
@@ -462,7 +463,7 @@ export default {
462
463
  if (this.previousQuery === val || this.isOnComposition) return;
463
464
  if (
464
465
  this.previousQuery === null &&
465
- (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')
466
+ (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')
466
467
  ) {
467
468
  this.previousQuery = val;
468
469
  return;
@@ -495,7 +496,7 @@ export default {
495
496
  this.checkDefaultFirstOption();
496
497
  }
497
498
  },
498
-
499
+
499
500
  scrollToOption(option) {
500
501
  const target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
501
502
  if (this.$refs.popper && target) {
@@ -504,23 +505,23 @@ export default {
504
505
  }
505
506
  this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
506
507
  },
507
-
508
+
508
509
  handleMenuEnter() {
509
510
  this.$nextTick(() => this.scrollToOption(this.selected));
510
511
  },
511
-
512
+
512
513
  emitChange(val) {
513
514
  if (!valueEquals(this.value, val)) {
514
515
  this.$emit('change', val);
515
516
  }
516
517
  },
517
-
518
+
518
519
  getOption(value) {
519
520
  let option;
520
521
  const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
521
522
  const isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
522
523
  const isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
523
-
524
+
524
525
  for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
525
526
  const cachedOption = this.cachedOptions[i];
526
527
  const isEqual = isObject
@@ -543,7 +544,7 @@ export default {
543
544
  }
544
545
  return newOption;
545
546
  },
546
-
547
+
547
548
  setSelected() {
548
549
  if (!this.multiple) {
549
550
  let option = this.getOption(this.value);
@@ -569,7 +570,7 @@ export default {
569
570
  this.resetInputHeight();
570
571
  });
571
572
  },
572
-
573
+
573
574
  handleFocus(event) {
574
575
  if (!this.softFocus) {
575
576
  if (this.automaticDropdown || this.filterable) {
@@ -583,12 +584,12 @@ export default {
583
584
  this.softFocus = false;
584
585
  }
585
586
  },
586
-
587
+
587
588
  blur() {
588
589
  this.visible = false;
589
590
  this.$refs.reference.blur();
590
591
  },
591
-
592
+
592
593
  handleBlur(event) {
593
594
  setTimeout(() => {
594
595
  if (this.isSilentBlur) {
@@ -599,33 +600,33 @@ export default {
599
600
  }, 50);
600
601
  this.softFocus = false;
601
602
  },
602
-
603
+
603
604
  handleClearClick(event) {
604
605
  this.deleteSelected(event);
605
606
  },
606
-
607
+
607
608
  doDestroy() {
608
609
  this.$refs.popper && this.$refs.popper.doDestroy();
609
610
  },
610
-
611
+
611
612
  handleClose() {
612
613
  this.visible = false;
613
614
  },
614
-
615
+
615
616
  toggleLastOptionHitState(hit) {
616
617
  if (!Array.isArray(this.selected)) return;
617
618
  const option = this.selected[this.selected.length - 1];
618
619
  if (!option) return;
619
-
620
+
620
621
  if (hit === true || hit === false) {
621
622
  option.hitState = hit;
622
623
  return hit;
623
624
  }
624
-
625
+
625
626
  option.hitState = !option.hitState;
626
627
  return option.hitState;
627
628
  },
628
-
629
+
629
630
  deletePrevTag(e) {
630
631
  if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
631
632
  const value = this.value.slice();
@@ -634,19 +635,19 @@ export default {
634
635
  this.emitChange(value);
635
636
  }
636
637
  },
637
-
638
+
638
639
  managePlaceholder() {
639
640
  if (this.currentPlaceholder !== '') {
640
641
  this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
641
642
  }
642
643
  },
643
-
644
+
644
645
  resetInputState(e) {
645
646
  if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
646
647
  this.inputLength = this.$refs.input.value.length * 15 + 20;
647
648
  this.resetInputHeight();
648
649
  },
649
-
650
+
650
651
  resetInputHeight() {
651
652
  if (this.collapseTags && !this.filterable) return;
652
653
  this.$nextTick(() => {
@@ -659,15 +660,15 @@ export default {
659
660
  input.style.height = this.selected.length === 0
660
661
  ? sizeInMap + 'px'
661
662
  : Math.max(
662
- tags ? (tagsHeight + (tagsHeight > sizeInMap ? 6 : 0)) : 0,
663
- sizeInMap
664
- ) + 'px';
663
+ tags ? (tagsHeight + (tagsHeight > sizeInMap ? 6 : 0)) : 0,
664
+ sizeInMap
665
+ ) + 'px';
665
666
  if (this.visible && this.emptyText !== false) {
666
667
  this.broadcast('ElSelectDropdown', 'updatePopper');
667
668
  }
668
669
  });
669
670
  },
670
-
671
+
671
672
  resetHoverIndex() {
672
673
  setTimeout(() => {
673
674
  if (!this.multiple) {
@@ -681,7 +682,7 @@ export default {
681
682
  }
682
683
  }, 300);
683
684
  },
684
-
685
+
685
686
  handleOptionSelect(option, byClick) {
686
687
  if (this.multiple) {
687
688
  const value = (this.value || []).slice();
@@ -711,7 +712,7 @@ export default {
711
712
  this.scrollToOption(option);
712
713
  });
713
714
  },
714
-
715
+
715
716
  setSoftFocus() {
716
717
  this.softFocus = true;
717
718
  const input = this.$refs.input || this.$refs.reference;
@@ -719,7 +720,7 @@ export default {
719
720
  input.focus();
720
721
  }
721
722
  },
722
-
723
+
723
724
  getValueIndex(arr = [], value) {
724
725
  const isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
725
726
  if (!isObject) {
@@ -737,7 +738,7 @@ export default {
737
738
  return index;
738
739
  }
739
740
  },
740
-
741
+
741
742
  toggleMenu() {
742
743
  if (!this.selectDisabled) {
743
744
  if (this.menuVisibleOnFocus) {
@@ -750,7 +751,7 @@ export default {
750
751
  }
751
752
  }
752
753
  },
753
-
754
+
754
755
  selectOption() {
755
756
  if (!this.visible) {
756
757
  this.toggleMenu();
@@ -760,7 +761,7 @@ export default {
760
761
  }
761
762
  }
762
763
  },
763
-
764
+
764
765
  deleteSelected(event) {
765
766
  event.stopPropagation();
766
767
  const value = this.multiple ? [] : '';
@@ -769,7 +770,7 @@ export default {
769
770
  this.visible = false;
770
771
  this.$emit('clear');
771
772
  },
772
-
773
+
773
774
  deleteTag(event, tag) {
774
775
  let index = this.selected.indexOf(tag);
775
776
  if (index > -1 && !this.selectDisabled) {
@@ -781,14 +782,14 @@ export default {
781
782
  }
782
783
  event.stopPropagation();
783
784
  },
784
-
785
+
785
786
  onInputChange() {
786
787
  if (this.filterable && this.query !== this.selectedLabel) {
787
788
  this.query = this.selectedLabel;
788
789
  this.handleQueryChange(this.query);
789
790
  }
790
791
  },
791
-
792
+
792
793
  onOptionDestroy(index) {
793
794
  if (index > -1) {
794
795
  this.optionsCount--;
@@ -796,16 +797,16 @@ export default {
796
797
  this.options.splice(index, 1);
797
798
  }
798
799
  },
799
-
800
+
800
801
  resetInputWidth() {
801
802
  this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
802
803
  },
803
-
804
+
804
805
  handleResize() {
805
806
  this.resetInputWidth();
806
807
  if (this.multiple) this.resetInputHeight();
807
808
  },
808
-
809
+
809
810
  checkDefaultFirstOption() {
810
811
  this.hoverIndex = -1;
811
812
  // highlight the created option
@@ -835,7 +836,7 @@ export default {
835
836
  }
836
837
  }
837
838
  },
838
-
839
+
839
840
  getValueKey(item) {
840
841
  if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
841
842
  return item.value;
@@ -844,7 +845,7 @@ export default {
844
845
  }
845
846
  }
846
847
  },
847
-
848
+
848
849
  created() {
849
850
  this.cachedPlaceHolder = this.currentPlaceholder = this.propPlaceholder;
850
851
  if (this.multiple && !Array.isArray(this.value)) {
@@ -853,25 +854,25 @@ export default {
853
854
  if (!this.multiple && Array.isArray(this.value)) {
854
855
  this.$emit('input', '');
855
856
  }
856
-
857
+
857
858
  this.debouncedOnInputChange = debounce(this.debounce, () => {
858
859
  this.onInputChange();
859
860
  });
860
-
861
+
861
862
  this.debouncedQueryChange = debounce(this.debounce, (e) => {
862
863
  this.handleQueryChange(e.target.value);
863
864
  });
864
-
865
+
865
866
  this.$on('handleOptionClick', this.handleOptionSelect);
866
867
  this.$on('setSelected', this.setSelected);
867
868
  },
868
-
869
+
869
870
  mounted() {
870
871
  if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
871
872
  this.currentPlaceholder = '';
872
873
  }
873
874
  addResizeListener(this.$el, this.handleResize);
874
-
875
+
875
876
  const reference = this.$refs.reference;
876
877
  if (reference && reference.$el) {
877
878
  const sizeMap = {
@@ -892,7 +893,7 @@ export default {
892
893
  });
893
894
  this.setSelected();
894
895
  },
895
-
896
+
896
897
  beforeDestroy() {
897
898
  if (this.$el && this.handleResize) removeResizeListener(this.$el, this.handleResize);
898
899
  }