tianheng-ui 0.0.57 → 0.0.58

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.
@@ -161,6 +161,7 @@ export default {
161
161
  });
162
162
  },
163
163
  generateRules(item) {
164
+ if (!item.rules) item.rules = [];
164
165
  item.rules.forEach(rule => {
165
166
  if (rule.pattern) {
166
167
  rule.pattern = new RegExp(rule.pattern);
@@ -260,6 +260,7 @@ export default {
260
260
  },
261
261
  elementSave() {
262
262
  console.log(this.xmlString);
263
+ this.$emit("element-save", this.xmlString);
263
264
  // saveModel({ modelXml: this.xmlString }).then(res => {});
264
265
  }
265
266
  }
@@ -6,7 +6,7 @@ import ElProgress from 'element-ui/packages/progress';
6
6
  function noop() {}
7
7
 
8
8
  export default {
9
- name: 'ElUpload',
9
+ name: 'ThUpload',
10
10
  components: {
11
11
  ElProgress,
12
12
  UploadList,
@@ -13,7 +13,7 @@
13
13
  </template>
14
14
  <script>
15
15
  export default {
16
- name: 'ElUploadDrag',
16
+ name: 'ThUploadDrag',
17
17
  props: {
18
18
  disabled: Boolean
19
19
  },
@@ -10,7 +10,11 @@
10
10
  >
11
11
  <li
12
12
  v-for="file in files"
13
- :class="['el-upload-list__item', 'is-' + file.status, focusing ? 'focusing' : '']"
13
+ :class="[
14
+ 'el-upload-list__item',
15
+ 'is-' + file.status,
16
+ focusing ? 'focusing' : ''
17
+ ]"
14
18
  :key="file.uid"
15
19
  tabindex="0"
16
20
  @keydown.delete="!disabled && $emit('remove', file)"
@@ -21,28 +25,46 @@
21
25
  <slot :file="file">
22
26
  <img
23
27
  class="el-upload-list__item-thumbnail"
24
- v-if="file.status !== 'uploading' && ['picture-card', 'picture'].indexOf(listType) > -1"
25
- :src="file.url" alt=""
26
- >
28
+ v-if="
29
+ file.status !== 'uploading' &&
30
+ ['picture-card', 'picture'].indexOf(listType) > -1
31
+ "
32
+ :src="file.url"
33
+ alt=""
34
+ />
27
35
  <a class="el-upload-list__item-name" @click="handleClick(file)">
28
- <i class="el-icon-document"></i>{{file.name}}
36
+ <i class="el-icon-document"></i>{{ file.name }}
29
37
  </a>
30
38
  <label class="el-upload-list__item-status-label">
31
- <i :class="{
32
- 'el-icon-upload-success': true,
33
- 'el-icon-circle-check': listType === 'text',
34
- 'el-icon-check': ['picture-card', 'picture'].indexOf(listType) > -1
35
- }"></i>
39
+ <i
40
+ :class="{
41
+ 'el-icon-upload-success': true,
42
+ 'el-icon-circle-check': listType === 'text',
43
+ 'el-icon-check':
44
+ ['picture-card', 'picture'].indexOf(listType) > -1
45
+ }"
46
+ ></i>
36
47
  </label>
37
- <i class="el-icon-close" v-if="!disabled" @click="$emit('remove', file)"></i>
38
- <i class="el-icon-close-tip" v-if="!disabled">{{ t('el.upload.deleteTip') }}</i> <!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上-->
48
+ <i
49
+ class="el-icon-close"
50
+ v-if="!disabled"
51
+ @click="$emit('remove', file)"
52
+ ></i>
53
+ <i class="el-icon-close-tip" v-if="!disabled">{{
54
+ t("el.upload.deleteTip")
55
+ }}</i>
56
+ <!--因为close按钮只在li:focus的时候 display, li blur后就不存在了,所以键盘导航时永远无法 focus到 close按钮上-->
39
57
  <el-progress
40
58
  v-if="file.status === 'uploading'"
41
59
  :type="listType === 'picture-card' ? 'circle' : 'line'"
42
60
  :stroke-width="listType === 'picture-card' ? 6 : 2"
43
- :percentage="parsePercentage(file.percentage)">
61
+ :percentage="parsePercentage(file.percentage)"
62
+ >
44
63
  </el-progress>
45
- <span class="el-upload-list__item-actions" v-if="listType === 'picture-card'">
64
+ <span
65
+ class="el-upload-list__item-actions"
66
+ v-if="listType === 'picture-card'"
67
+ >
46
68
  <span
47
69
  class="el-upload-list__item-preview"
48
70
  v-if="handlePreview && listType === 'picture-card'"
@@ -63,39 +85,39 @@
63
85
  </transition-group>
64
86
  </template>
65
87
  <script>
66
- import Locale from 'element-ui/src/mixins/locale';
67
- import ElProgress from 'element-ui/packages/progress';
68
- export default {
69
- name: 'ElUploadList',
70
- mixins: [Locale],
71
- data() {
72
- return {
73
- focusing: false
74
- };
75
- },
76
- components: { ElProgress },
88
+ import Locale from "element-ui/src/mixins/locale";
89
+ import ElProgress from "element-ui/packages/progress";
90
+ export default {
91
+ name: "ThUploadList",
92
+ mixins: [Locale],
93
+ data() {
94
+ return {
95
+ focusing: false
96
+ };
97
+ },
98
+ components: { ElProgress },
77
99
 
78
- props: {
79
- files: {
80
- type: Array,
81
- default() {
82
- return [];
83
- }
84
- },
85
- disabled: {
86
- type: Boolean,
87
- default: false
88
- },
89
- handlePreview: Function,
90
- listType: String
91
- },
92
- methods: {
93
- parsePercentage(val) {
94
- return parseInt(val, 10);
95
- },
96
- handleClick(file) {
97
- this.handlePreview && this.handlePreview(file);
100
+ props: {
101
+ files: {
102
+ type: Array,
103
+ default() {
104
+ return [];
98
105
  }
106
+ },
107
+ disabled: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ handlePreview: Function,
112
+ listType: String
113
+ },
114
+ methods: {
115
+ parsePercentage(val) {
116
+ return parseInt(val, 10);
117
+ },
118
+ handleClick(file) {
119
+ this.handlePreview && this.handlePreview(file);
99
120
  }
100
- };
121
+ }
122
+ };
101
123
  </script>