@v2coding/ui 0.1.16 → 0.1.17

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.
@@ -1016,132 +1016,132 @@ var script$F = {
1016
1016
  }
1017
1017
  };
1018
1018
 
1019
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
1020
- if (typeof shadowMode !== 'boolean') {
1021
- createInjectorSSR = createInjector;
1022
- createInjector = shadowMode;
1023
- shadowMode = false;
1024
- }
1025
- // Vue.extend constructor export interop.
1026
- const options = typeof script === 'function' ? script.options : script;
1027
- // render functions
1028
- if (template && template.render) {
1029
- options.render = template.render;
1030
- options.staticRenderFns = template.staticRenderFns;
1031
- options._compiled = true;
1032
- // functional template
1033
- if (isFunctionalTemplate) {
1034
- options.functional = true;
1035
- }
1036
- }
1037
- // scopedId
1038
- if (scopeId) {
1039
- options._scopeId = scopeId;
1040
- }
1041
- let hook;
1042
- if (moduleIdentifier) {
1043
- // server build
1044
- hook = function (context) {
1045
- // 2.3 injection
1046
- context =
1047
- context || // cached call
1048
- (this.$vnode && this.$vnode.ssrContext) || // stateful
1049
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
1050
- // 2.2 with runInNewContext: true
1051
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1052
- context = __VUE_SSR_CONTEXT__;
1053
- }
1054
- // inject component styles
1055
- if (style) {
1056
- style.call(this, createInjectorSSR(context));
1057
- }
1058
- // register component module identifier for async chunk inference
1059
- if (context && context._registeredComponents) {
1060
- context._registeredComponents.add(moduleIdentifier);
1061
- }
1062
- };
1063
- // used by ssr in case component is cached and beforeCreate
1064
- // never gets called
1065
- options._ssrRegister = hook;
1066
- }
1067
- else if (style) {
1068
- hook = shadowMode
1069
- ? function (context) {
1070
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
1071
- }
1072
- : function (context) {
1073
- style.call(this, createInjector(context));
1074
- };
1075
- }
1076
- if (hook) {
1077
- if (options.functional) {
1078
- // register for functional component in vue file
1079
- const originalRender = options.render;
1080
- options.render = function renderWithStyleInjection(h, context) {
1081
- hook.call(context);
1082
- return originalRender(h, context);
1083
- };
1084
- }
1085
- else {
1086
- // inject component registration as beforeCreate hook
1087
- const existing = options.beforeCreate;
1088
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
1089
- }
1090
- }
1091
- return script;
1019
+ function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
1020
+ if (typeof shadowMode !== 'boolean') {
1021
+ createInjectorSSR = createInjector;
1022
+ createInjector = shadowMode;
1023
+ shadowMode = false;
1024
+ }
1025
+ // Vue.extend constructor export interop.
1026
+ const options = typeof script === 'function' ? script.options : script;
1027
+ // render functions
1028
+ if (template && template.render) {
1029
+ options.render = template.render;
1030
+ options.staticRenderFns = template.staticRenderFns;
1031
+ options._compiled = true;
1032
+ // functional template
1033
+ if (isFunctionalTemplate) {
1034
+ options.functional = true;
1035
+ }
1036
+ }
1037
+ // scopedId
1038
+ if (scopeId) {
1039
+ options._scopeId = scopeId;
1040
+ }
1041
+ let hook;
1042
+ if (moduleIdentifier) {
1043
+ // server build
1044
+ hook = function (context) {
1045
+ // 2.3 injection
1046
+ context =
1047
+ context || // cached call
1048
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
1049
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
1050
+ // 2.2 with runInNewContext: true
1051
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1052
+ context = __VUE_SSR_CONTEXT__;
1053
+ }
1054
+ // inject component styles
1055
+ if (style) {
1056
+ style.call(this, createInjectorSSR(context));
1057
+ }
1058
+ // register component module identifier for async chunk inference
1059
+ if (context && context._registeredComponents) {
1060
+ context._registeredComponents.add(moduleIdentifier);
1061
+ }
1062
+ };
1063
+ // used by ssr in case component is cached and beforeCreate
1064
+ // never gets called
1065
+ options._ssrRegister = hook;
1066
+ }
1067
+ else if (style) {
1068
+ hook = shadowMode
1069
+ ? function (context) {
1070
+ style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
1071
+ }
1072
+ : function (context) {
1073
+ style.call(this, createInjector(context));
1074
+ };
1075
+ }
1076
+ if (hook) {
1077
+ if (options.functional) {
1078
+ // register for functional component in vue file
1079
+ const originalRender = options.render;
1080
+ options.render = function renderWithStyleInjection(h, context) {
1081
+ hook.call(context);
1082
+ return originalRender(h, context);
1083
+ };
1084
+ }
1085
+ else {
1086
+ // inject component registration as beforeCreate hook
1087
+ const existing = options.beforeCreate;
1088
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
1089
+ }
1090
+ }
1091
+ return script;
1092
1092
  }
1093
1093
 
1094
- const isOldIE = typeof navigator !== 'undefined' &&
1095
- /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
1096
- function createInjector(context) {
1097
- return (id, style) => addStyle(id, style);
1098
- }
1099
- let HEAD;
1100
- const styles = {};
1101
- function addStyle(id, css) {
1102
- const group = isOldIE ? css.media || 'default' : id;
1103
- const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
1104
- if (!style.ids.has(id)) {
1105
- style.ids.add(id);
1106
- let code = css.source;
1107
- if (css.map) {
1108
- // https://developer.chrome.com/devtools/docs/javascript-debugging
1109
- // this makes source maps inside style tags work properly in Chrome
1110
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
1111
- // http://stackoverflow.com/a/26603875
1112
- code +=
1113
- '\n/*# sourceMappingURL=data:application/json;base64,' +
1114
- btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
1115
- ' */';
1116
- }
1117
- if (!style.element) {
1118
- style.element = document.createElement('style');
1119
- style.element.type = 'text/css';
1120
- if (css.media)
1121
- style.element.setAttribute('media', css.media);
1122
- if (HEAD === undefined) {
1123
- HEAD = document.head || document.getElementsByTagName('head')[0];
1124
- }
1125
- HEAD.appendChild(style.element);
1126
- }
1127
- if ('styleSheet' in style.element) {
1128
- style.styles.push(code);
1129
- style.element.styleSheet.cssText = style.styles
1130
- .filter(Boolean)
1131
- .join('\n');
1132
- }
1133
- else {
1134
- const index = style.ids.size - 1;
1135
- const textNode = document.createTextNode(code);
1136
- const nodes = style.element.childNodes;
1137
- if (nodes[index])
1138
- style.element.removeChild(nodes[index]);
1139
- if (nodes.length)
1140
- style.element.insertBefore(textNode, nodes[index]);
1141
- else
1142
- style.element.appendChild(textNode);
1143
- }
1144
- }
1094
+ const isOldIE = typeof navigator !== 'undefined' &&
1095
+ /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
1096
+ function createInjector(context) {
1097
+ return (id, style) => addStyle(id, style);
1098
+ }
1099
+ let HEAD;
1100
+ const styles = {};
1101
+ function addStyle(id, css) {
1102
+ const group = isOldIE ? css.media || 'default' : id;
1103
+ const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
1104
+ if (!style.ids.has(id)) {
1105
+ style.ids.add(id);
1106
+ let code = css.source;
1107
+ if (css.map) {
1108
+ // https://developer.chrome.com/devtools/docs/javascript-debugging
1109
+ // this makes source maps inside style tags work properly in Chrome
1110
+ code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
1111
+ // http://stackoverflow.com/a/26603875
1112
+ code +=
1113
+ '\n/*# sourceMappingURL=data:application/json;base64,' +
1114
+ btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
1115
+ ' */';
1116
+ }
1117
+ if (!style.element) {
1118
+ style.element = document.createElement('style');
1119
+ style.element.type = 'text/css';
1120
+ if (css.media)
1121
+ style.element.setAttribute('media', css.media);
1122
+ if (HEAD === undefined) {
1123
+ HEAD = document.head || document.getElementsByTagName('head')[0];
1124
+ }
1125
+ HEAD.appendChild(style.element);
1126
+ }
1127
+ if ('styleSheet' in style.element) {
1128
+ style.styles.push(code);
1129
+ style.element.styleSheet.cssText = style.styles
1130
+ .filter(Boolean)
1131
+ .join('\n');
1132
+ }
1133
+ else {
1134
+ const index = style.ids.size - 1;
1135
+ const textNode = document.createTextNode(code);
1136
+ const nodes = style.element.childNodes;
1137
+ if (nodes[index])
1138
+ style.element.removeChild(nodes[index]);
1139
+ if (nodes.length)
1140
+ style.element.insertBefore(textNode, nodes[index]);
1141
+ else
1142
+ style.element.appendChild(textNode);
1143
+ }
1144
+ }
1145
1145
  }
1146
1146
 
1147
1147
  /* script */
@@ -4324,6 +4324,37 @@ var Upload = {
4324
4324
  };
4325
4325
  });
4326
4326
  });
4327
+ },
4328
+ aws: (url, params, file) => {
4329
+ const getSignature = params => {
4330
+ console.log('aws getSignature', params)
4331
+ return Axios.getInstance().get(url, {
4332
+ params
4333
+ });
4334
+ };
4335
+
4336
+ return getSignature(params).then(result => {
4337
+ if (!result.success) {
4338
+ return result;
4339
+ }
4340
+
4341
+ const {
4342
+ url,
4343
+ putUrl
4344
+ } = result.data;
4345
+ return Axios.getInstance().put(putUrl, file.file, {
4346
+ headers: {
4347
+ 'Content-Type': 'multipart/form-data'
4348
+ }
4349
+ }).then(() => {
4350
+ return {
4351
+ success: true,
4352
+ data: {
4353
+ url: url
4354
+ }
4355
+ };
4356
+ });
4357
+ });
4327
4358
  }
4328
4359
  };
4329
4360
 
@@ -4626,6 +4657,7 @@ var script$p = {
4626
4657
  type: Boolean,
4627
4658
  default: false
4628
4659
  },
4660
+ customUpload: Function,
4629
4661
  needCreateAttachment: {
4630
4662
  type: Boolean,
4631
4663
  default: false
@@ -4689,37 +4721,54 @@ var script$p = {
4689
4721
  }
4690
4722
 
4691
4723
  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
4724
 
4701
- this.uploading = false;
4725
+ if (typeof this.customUpload === 'function') {
4726
+ const done = url => {
4727
+ this.onChange([...this.pickerValue, url].join(','));
4728
+ this.handleAttachment(file, url);
4729
+ };
4702
4730
 
4703
- if (!(result !== null && result !== void 0 && result.success)) {
4704
- this.$message.error(result.message || '上传失败');
4705
- return;
4706
- }
4731
+ this.customUpload({
4732
+ file: file,
4733
+ filename: this.filename,
4734
+ done: done
4735
+ });
4736
+ } else {
4737
+ const uploadServer = Upload[this.uploadType] || Upload.default;
4738
+ uploadServer(this.url, {
4739
+ filename: file.name
4740
+ }, {
4741
+ file,
4742
+ filename: this.filename
4743
+ }).then(result => {
4744
+ var _result$data;
4707
4745
 
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);
4746
+ this.uploading = false;
4712
4747
 
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
- });
4748
+ if (!(result !== null && result !== void 0 && result.success)) {
4749
+ this.$message.error(result.message || '上传失败');
4750
+ return;
4751
+ }
4752
+
4753
+ this.$message.success('上传成功');
4754
+ const url = result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.url;
4755
+ this.onChange([...this.pickerValue, url].join(','));
4756
+ this.$emit('afterUpload', result);
4757
+ this.handleAttachment(file, url);
4758
+ }).catch(() => {
4759
+ this.uploading = false;
4760
+ });
4761
+ }
4762
+ },
4763
+
4764
+ handleAttachment(file, url) {
4765
+ if (this.needCreateAttachment && typeof this.createAttachment === 'function') {
4766
+ this.createAttachment(file, url).then(result => {
4767
+ this.$emit('create-attachment', result);
4768
+ }).catch(error => {
4769
+ this.$emit('create-attachment', error);
4770
+ });
4771
+ }
4723
4772
  },
4724
4773
 
4725
4774
  remove(url) {
@@ -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-3f613baa_0", {
4865
+ source: ".ui-file-upload-field[data-v-3f613baa]{width:100%}.ui-file-upload-field .uploader[data-v-3f613baa]{margin-bottom:5px}.ui-file-upload-field .uploader.disabled[data-v-3f613baa] .el-upload{cursor:not-allowed;pointer-events:none}.ui-file-upload-field .uploader.disabled[data-v-3f613baa] .el-upload .upload-btn{color:#888c94;background-color:#edeef0}.ui-file-upload-field .upload-btn[data-v-3f613baa]{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-3f613baa]:hover{background-color:#0d84ff}.ui-file-upload-field .files .file[data-v-3f613baa]{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-3f613baa]{flex:1;color:#606266;transition:all .3s;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-file-upload-field .files .file .close[data-v-3f613baa]{color:transparent;width:28px;text-align:center;visibility:hidden;transition:color .3s;font-weight:700}.ui-file-upload-field .files .file[data-v-3f613baa]:hover{background-color:#f5f7fa}.ui-file-upload-field .files .file:hover a[data-v-3f613baa]{color:#409eff}.ui-file-upload-field .files .file:hover .close[data-v-3f613baa]{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-3f613baa";
4825
4874
  /* module identifier */
4826
4875
 
4827
4876
  const __vue_module_identifier__$p = undefined;