@v2coding/ui 0.1.15 → 0.1.18

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.
@@ -2768,8 +2768,16 @@ var script$A = {
2768
2768
  this.query = query;
2769
2769
  },
2770
2770
 
2771
- onBlur() {
2772
- this.query = '';
2771
+ async delay() {
2772
+ let ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2773
+ return new Promise(resolve => setTimeout(resolve, ms));
2774
+ },
2775
+
2776
+ async onVisibleChange(visible) {
2777
+ if (!visible) {
2778
+ await this.delay(300);
2779
+ this.query = '';
2780
+ }
2773
2781
  }
2774
2782
 
2775
2783
  }
@@ -2806,7 +2814,7 @@ var __vue_render__$A = function () {
2806
2814
  },
2807
2815
  on: {
2808
2816
  "input": _vm.onChange,
2809
- "blur": _vm.onBlur
2817
+ "visible-change": _vm.onVisibleChange
2810
2818
  }
2811
2819
  }, 'el-select', _vm.$attrs, false), _vm._listeners), [_vm._l(_vm.displayOptions, function (item) {
2812
2820
  return _c('el-option', _vm._b({
@@ -2859,7 +2867,7 @@ var __vue_render__$A = function () {
2859
2867
  },
2860
2868
  on: {
2861
2869
  "input": _vm.onChange,
2862
- "blur": _vm.onBlur
2870
+ "visible-change": _vm.onVisibleChange
2863
2871
  }
2864
2872
  }, 'el-select', _vm.$attrs, false), _vm._listeners), [_vm._l(_vm.displayOptions, function (item) {
2865
2873
  return _c('el-option', _vm._b({
@@ -2909,7 +2917,7 @@ var __vue_staticRenderFns__$A = [];
2909
2917
 
2910
2918
  const __vue_inject_styles__$B = function (inject) {
2911
2919
  if (!inject) return;
2912
- inject("data-v-525e6b24_0", {
2920
+ inject("data-v-5ed62eec_0", {
2913
2921
  source: ".ui-field-select .el-select{width:100%}.ui-field-select .el-input-group--append .el-select .el-input.is-focus .el-input__inner{border-color:var(--color-primary)}.ui-field-select .empty{font-size:12px;color:#909399;display:flex;align-items:center}.ui-field-select .el-loading-mask .el-loading-spinner{margin-top:-14px}",
2914
2922
  map: undefined,
2915
2923
  media: undefined
@@ -4316,6 +4324,36 @@ var Upload = {
4316
4324
  };
4317
4325
  });
4318
4326
  });
4327
+ },
4328
+ aws: (url, params, file) => {
4329
+ const getSignature = params => {
4330
+ return Axios.getInstance().get(url, {
4331
+ params
4332
+ });
4333
+ };
4334
+
4335
+ return getSignature(params).then(result => {
4336
+ if (!result.success) {
4337
+ return result;
4338
+ }
4339
+
4340
+ const {
4341
+ url,
4342
+ putUrl
4343
+ } = result.data;
4344
+ return Axios.getInstance().put(putUrl, file.file, {
4345
+ headers: {
4346
+ 'Content-Type': 'multipart/form-data'
4347
+ }
4348
+ }).then(() => {
4349
+ return {
4350
+ success: true,
4351
+ data: {
4352
+ url: url
4353
+ }
4354
+ };
4355
+ });
4356
+ });
4319
4357
  }
4320
4358
  };
4321
4359
 
@@ -4618,6 +4656,7 @@ var script$p = {
4618
4656
  type: Boolean,
4619
4657
  default: false
4620
4658
  },
4659
+ customUpload: Function,
4621
4660
  needCreateAttachment: {
4622
4661
  type: Boolean,
4623
4662
  default: false
@@ -4681,37 +4720,54 @@ var script$p = {
4681
4720
  }
4682
4721
 
4683
4722
  this.uploading = true;
4684
- const uploadServer = Upload[this.uploadType] || Upload.default;
4685
- uploadServer(this.url, {
4686
- filename: file.name
4687
- }, {
4688
- file,
4689
- filename: this.filename
4690
- }).then(result => {
4691
- var _result$data;
4692
4723
 
4693
- this.uploading = false;
4724
+ if (typeof this.customUpload === 'function') {
4725
+ const done = url => {
4726
+ this.onChange([...this.pickerValue, url].join(','));
4727
+ this.handleAttachment(file, url);
4728
+ };
4694
4729
 
4695
- if (!(result !== null && result !== void 0 && result.success)) {
4696
- this.$message.error(result.message || '上传失败');
4697
- return;
4698
- }
4730
+ this.customUpload({
4731
+ file: file,
4732
+ filename: this.filename,
4733
+ done: done
4734
+ });
4735
+ } else {
4736
+ const uploadServer = Upload[this.uploadType] || Upload.default;
4737
+ uploadServer(this.url, {
4738
+ filename: file.name
4739
+ }, {
4740
+ file,
4741
+ filename: this.filename
4742
+ }).then(result => {
4743
+ var _result$data;
4699
4744
 
4700
- this.$message.success('上传成功');
4701
- const url = result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.url;
4702
- this.onChange([...this.pickerValue, url].join(','));
4703
- this.$emit('afterUpload', result);
4745
+ this.uploading = false;
4704
4746
 
4705
- if (this.needCreateAttachment && typeof this.createAttachment === 'function') {
4706
- this.createAttachment(file, url).then(result => {
4707
- this.$emit('create-attachment', result);
4708
- }).catch(error => {
4709
- this.$emit('create-attachment', error);
4710
- });
4711
- }
4712
- }).catch(() => {
4713
- this.uploading = false;
4714
- });
4747
+ if (!(result !== null && result !== void 0 && result.success)) {
4748
+ this.$message.error(result.message || '上传失败');
4749
+ return;
4750
+ }
4751
+
4752
+ this.$message.success('上传成功');
4753
+ const url = result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.url;
4754
+ this.onChange([...this.pickerValue, url].join(','));
4755
+ this.$emit('afterUpload', result);
4756
+ this.handleAttachment(file, url);
4757
+ }).catch(() => {
4758
+ this.uploading = false;
4759
+ });
4760
+ }
4761
+ },
4762
+
4763
+ handleAttachment(file, url) {
4764
+ if (this.needCreateAttachment && typeof this.createAttachment === 'function') {
4765
+ this.createAttachment(file, url).then(result => {
4766
+ this.$emit('create-attachment', result);
4767
+ }).catch(error => {
4768
+ this.$emit('create-attachment', error);
4769
+ });
4770
+ }
4715
4771
  },
4716
4772
 
4717
4773
  remove(url) {
@@ -4784,7 +4840,8 @@ var __vue_render__$o = function () {
4784
4840
  }, [_vm._v(" ")]), _vm._v(" "), _c('a', {
4785
4841
  attrs: {
4786
4842
  "href": url,
4787
- "target": "_blank"
4843
+ "target": "_blank",
4844
+ "title": _vm.getFileName(url)
4788
4845
  }
4789
4846
  }, [_vm._v(_vm._s(_vm.getFileName(url)))]), _vm._v(" "), _vm.hasDeleteBtn ? _c('span', {
4790
4847
  staticClass: "close",
@@ -4804,8 +4861,8 @@ var __vue_staticRenderFns__$o = [];
4804
4861
 
4805
4862
  const __vue_inject_styles__$p = function (inject) {
4806
4863
  if (!inject) return;
4807
- inject("data-v-112cf62d_0", {
4808
- source: ".ui-file-upload-field[data-v-112cf62d]{width:100%}.ui-file-upload-field .uploader[data-v-112cf62d]{margin-bottom:5px}.ui-file-upload-field .uploader.disabled[data-v-112cf62d] .el-upload{cursor:not-allowed;pointer-events:none}.ui-file-upload-field .uploader.disabled[data-v-112cf62d] .el-upload .upload-btn{color:#888c94;background-color:#edeef0}.ui-file-upload-field .upload-btn[data-v-112cf62d]{padding:5px 10px;line-height:1;background-color:#409eff;color:#fff;font-size:12px;transition:background-color .3s}.ui-file-upload-field .upload-btn[data-v-112cf62d]:hover{background-color:#0d84ff}.ui-file-upload-field .files .file[data-v-112cf62d]{color:#606266;font-size:14px;transition:all .3s;cursor:pointer;line-height:28px;display:flex;align-items:center}.ui-file-upload-field .files .file a[data-v-112cf62d]{flex:1;color:#606266;transition:all .3s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-field .files .file .close[data-v-112cf62d]{color:transparent;width:28px;text-align:center;visibility:hidden;transition:color .3s;font-weight:700}.ui-file-upload-field .files .file[data-v-112cf62d]:hover{background-color:#f5f7fa}.ui-file-upload-field .files .file:hover a[data-v-112cf62d]{color:#409eff}.ui-file-upload-field .files .file:hover .close[data-v-112cf62d]{color:#409eff;visibility:visible}",
4864
+ inject("data-v-2e4cb775_0", {
4865
+ source: ".ui-file-upload-field[data-v-2e4cb775]{width:100%}.ui-file-upload-field .uploader[data-v-2e4cb775]{margin-bottom:5px}.ui-file-upload-field .uploader.disabled[data-v-2e4cb775] .el-upload{cursor:not-allowed;pointer-events:none}.ui-file-upload-field .uploader.disabled[data-v-2e4cb775] .el-upload .upload-btn{color:#888c94;background-color:#edeef0}.ui-file-upload-field .upload-btn[data-v-2e4cb775]{padding:5px 10px;line-height:1;background-color:#409eff;color:#fff;font-size:12px;transition:background-color .3s}.ui-file-upload-field .upload-btn[data-v-2e4cb775]:hover{background-color:#0d84ff}.ui-file-upload-field .files[data-v-2e4cb775]{max-width:100%}.ui-file-upload-field .files .file[data-v-2e4cb775]{color:#606266;font-size:14px;transition:all .3s;cursor:pointer;display:flex;align-items:center;max-width:100%}.ui-file-upload-field .files .file a[data-v-2e4cb775]{flex:1;color:#606266;transition:all .3s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-field .files .file .close[data-v-2e4cb775]{color:transparent;width:28px;text-align:center;visibility:hidden;transition:color .3s;font-weight:700}.ui-file-upload-field .files .file[data-v-2e4cb775]:hover{background-color:#f5f7fa}.ui-file-upload-field .files .file:hover a[data-v-2e4cb775]{color:var(--color-primary)}.ui-file-upload-field .files .file:hover .close[data-v-2e4cb775]{color:#409eff;visibility:visible}",
4809
4866
  map: undefined,
4810
4867
  media: undefined
4811
4868
  });
@@ -4813,7 +4870,7 @@ const __vue_inject_styles__$p = function (inject) {
4813
4870
  /* scoped */
4814
4871
 
4815
4872
 
4816
- const __vue_scope_id__$p = "data-v-112cf62d";
4873
+ const __vue_scope_id__$p = "data-v-2e4cb775";
4817
4874
  /* module identifier */
4818
4875
 
4819
4876
  const __vue_module_identifier__$p = undefined;