@v2coding/ui 0.1.16 → 0.1.19

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/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # v2coding-ui
2
+ ## 发布新版本
3
+ - 修改 package.json 文件中版本字段
4
+ - `npm publish --access public`
5
+
2
6
  ## 使用须知
3
7
  - 提前在项目中安装以下依赖
4
8
  ```bash
@@ -4324,6 +4324,36 @@ var Upload = {
4324
4324
  };
4325
4325
  });
4326
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
+ });
4327
4357
  }
4328
4358
  };
4329
4359
 
@@ -4626,6 +4656,7 @@ var script$p = {
4626
4656
  type: Boolean,
4627
4657
  default: false
4628
4658
  },
4659
+ customUpload: Function,
4629
4660
  needCreateAttachment: {
4630
4661
  type: Boolean,
4631
4662
  default: false
@@ -4689,37 +4720,54 @@ var script$p = {
4689
4720
  }
4690
4721
 
4691
4722
  this.uploading = true;
4692
- const uploadServer = Upload[this.uploadType] || Upload.default;
4693
- uploadServer(this.url, {
4694
- filename: file.name
4695
- }, {
4696
- file,
4697
- filename: this.filename
4698
- }).then(result => {
4699
- var _result$data;
4700
4723
 
4701
- 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
+ };
4702
4729
 
4703
- if (!(result !== null && result !== void 0 && result.success)) {
4704
- this.$message.error(result.message || '上传失败');
4705
- return;
4706
- }
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;
4707
4744
 
4708
- this.$message.success('上传成功');
4709
- const url = result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.url;
4710
- this.onChange([...this.pickerValue, url].join(','));
4711
- this.$emit('afterUpload', result);
4745
+ this.uploading = false;
4712
4746
 
4713
- if (this.needCreateAttachment && typeof this.createAttachment === 'function') {
4714
- this.createAttachment(file, url).then(result => {
4715
- this.$emit('create-attachment', result);
4716
- }).catch(error => {
4717
- this.$emit('create-attachment', error);
4718
- });
4719
- }
4720
- }).catch(() => {
4721
- this.uploading = false;
4722
- });
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
+ }
4723
4771
  },
4724
4772
 
4725
4773
  remove(url) {
@@ -4739,7 +4787,7 @@ var script$p = {
4739
4787
  },
4740
4788
 
4741
4789
  getFileName(url) {
4742
- const pathname = new URL(url).pathname;
4790
+ const pathname = decodeURI(new URL(url).pathname);
4743
4791
  return pathname.substring(pathname.lastIndexOf('/') + 1);
4744
4792
  }
4745
4793
 
@@ -4792,7 +4840,8 @@ var __vue_render__$o = function () {
4792
4840
  }, [_vm._v(" ")]), _vm._v(" "), _c('a', {
4793
4841
  attrs: {
4794
4842
  "href": url,
4795
- "target": "_blank"
4843
+ "target": "_blank",
4844
+ "title": _vm.getFileName(url)
4796
4845
  }
4797
4846
  }, [_vm._v(_vm._s(_vm.getFileName(url)))]), _vm._v(" "), _vm.hasDeleteBtn ? _c('span', {
4798
4847
  staticClass: "close",
@@ -4812,8 +4861,8 @@ var __vue_staticRenderFns__$o = [];
4812
4861
 
4813
4862
  const __vue_inject_styles__$p = function (inject) {
4814
4863
  if (!inject) return;
4815
- inject("data-v-112cf62d_0", {
4816
- 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-adbfc424_0", {
4865
+ source: ".ui-file-upload-field[data-v-adbfc424]{width:100%}.ui-file-upload-field .uploader[data-v-adbfc424]{margin-bottom:5px}.ui-file-upload-field .uploader.disabled[data-v-adbfc424] .el-upload{cursor:not-allowed;pointer-events:none}.ui-file-upload-field .uploader.disabled[data-v-adbfc424] .el-upload .upload-btn{color:#888c94;background-color:#edeef0}.ui-file-upload-field .upload-btn[data-v-adbfc424]{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-adbfc424]:hover{background-color:#0d84ff}.ui-file-upload-field .files[data-v-adbfc424]{max-width:100%}.ui-file-upload-field .files .file[data-v-adbfc424]{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-adbfc424]{flex:1;color:#606266;transition:all .3s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-field .files .file .close[data-v-adbfc424]{color:transparent;width:28px;text-align:center;visibility:hidden;transition:color .3s;font-weight:700}.ui-file-upload-field .files .file[data-v-adbfc424]:hover{background-color:#f5f7fa}.ui-file-upload-field .files .file:hover a[data-v-adbfc424]{color:var(--color-primary)}.ui-file-upload-field .files .file:hover .close[data-v-adbfc424]{color:#409eff;visibility:visible}",
4817
4866
  map: undefined,
4818
4867
  media: undefined
4819
4868
  });
@@ -4821,7 +4870,7 @@ const __vue_inject_styles__$p = function (inject) {
4821
4870
  /* scoped */
4822
4871
 
4823
4872
 
4824
- const __vue_scope_id__$p = "data-v-112cf62d";
4873
+ const __vue_scope_id__$p = "data-v-adbfc424";
4825
4874
  /* module identifier */
4826
4875
 
4827
4876
  const __vue_module_identifier__$p = undefined;