vue-element-ui-x 0.1.7-beta → 0.1.9-beta

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.
@@ -50,11 +50,9 @@
50
50
  ref="imgRef"
51
51
  class="el-x-filescard-img"
52
52
  :src="_previewImgUrl"
53
- :preview-src-list="imgPreview ? [_previewImgUrl] : []"
53
+ :preview-src-list="_previewImgUrl ? [_previewImgUrl] : []"
54
54
  fit="cover"
55
- :show-progress="false"
56
- hide-on-click-modal
57
- @show="handlePreviewAction('self')"
55
+ @click="handlePreviewAction('self')"
58
56
  />
59
57
 
60
58
  <!-- 无预览地址时显示默认图标 -->
@@ -164,9 +162,9 @@
164
162
  </template>
165
163
 
166
164
  <script>
165
+ import { getFileType, getSize, previewImage } from '../../../utils/index.js';
167
166
  import svgIconMap from './fileSvg/index.js';
168
167
  import { colorMap } from './options.js';
169
- import { previewImage, getFileType, getSize } from '../../../utils/index.js';
170
168
 
171
169
  export default {
172
170
  name: 'ElXFilesCard',
@@ -371,12 +369,10 @@
371
369
  },
372
370
  handlePreviewAction(type) {
373
371
  if (this.imgPreview && this.$refs.imgRef && this._previewImgUrl && type === 'mask') {
374
- console.log(this.$refs.imgRef);
375
372
  this.$refs.imgRef.clickHandler();
376
- // this.$refs.imgRef.showPreview()
377
373
  }
378
374
  if (type === 'self') {
379
- this.$emit('imagePreview', {
375
+ this.$emit('image-preview', {
380
376
  ...this.propsData,
381
377
  });
382
378
  }
@@ -174,9 +174,10 @@
174
174
  name="trigger-popover"
175
175
  :trigger-string="triggerString"
176
176
  :readonly="readOnly"
177
- >当前触发的字符为:{{ `${triggerString}` }} 在这里定义的内容,但注意这里的回车事件将会被
178
- 输入框 覆盖</slot
179
177
  >
178
+ 当前触发的字符为:{{ `${triggerString}` }} 在这里定义的内容,但注意这里的回车事件将会被
179
+ 输入框 覆盖
180
+ </slot>
180
181
  </template>
181
182
  </el-popover>
182
183
  </div>
@@ -553,7 +554,7 @@
553
554
 
554
555
  if (this.hasOnRecordingChangeListener) {
555
556
  this.speechLoading = true;
556
- this.$emit('recordingChange', true);
557
+ this.$emit('recording-change', true);
557
558
  return;
558
559
  }
559
560
 
@@ -1,195 +1,195 @@
1
- <template>
2
- <div
3
- class="el-x-thinking"
4
- :style="{
5
- '--el-x-thinking-button-width': buttonWidth,
6
- '--el-x-thinking-animation-duration': duration,
7
- '--el-x-thinking-content-wrapper-width': maxWidth,
8
- '--el-x-thinking-content-wrapper-background-color': backgroundColor,
9
- '--el-x-thinking-content-wrapper-color': color,
10
- }"
11
- >
12
- <button
13
- class="trigger"
14
- :class="[localStatus, { disabled: !disabled }]"
15
- :disabled="disabled"
16
- @click="changeExpand"
17
- >
18
- <span class="status-icon">
19
- <slot
20
- name="status-icon"
21
- :status="localStatus"
22
- >
23
- <i
24
- v-if="localStatus === 'thinking'"
25
- class="is-loading el-icon-center el-icon-loading"
26
- ></i>
27
- <i
28
- v-if="localStatus === 'start'"
29
- class="el-icon-center start-color el-icon-opportunity"
30
- ></i>
31
- <i
32
- v-if="localStatus === 'end'"
33
- class="el-icon-center end-color el-icon-success"
34
- ></i>
35
- <i
36
- v-if="localStatus === 'error'"
37
- class="el-icon-center error-color el-icon-circle-close"
38
- ></i>
39
- </slot>
40
- </span>
41
-
42
- <span class="label">
43
- <slot
44
- name="label"
45
- :status="localStatus"
46
- >
47
- {{
48
- localStatus === 'thinking'
49
- ? '思考中...'
50
- : localStatus === 'error'
51
- ? '思考遇到问题'
52
- : localStatus === 'end'
53
- ? '思考完成'
54
- : '开始思考'
55
- }}
56
- </slot>
57
- </span>
58
-
59
- <transition name="rotate">
60
- <span
61
- v-if="!disabled"
62
- class="arrow el-icon-center"
63
- :class="{ expanded: isExpanded }"
64
- >
65
- <slot name="arrow">
66
- <i class="el-icon-center el-icon-arrow-up"></i>
67
- </slot>
68
- </span>
69
- </transition>
70
- </button>
71
-
72
- <Transition name="slide">
73
- <div
74
- v-show="isExpanded"
75
- v-if="displayedContent"
76
- class="content-wrapper"
77
- :class="{ 'error-state': localStatus === 'error' }"
78
- >
79
- <div class="content">
80
- <slot
81
- v-if="localStatus !== 'error'"
82
- name="content"
83
- :content="displayedContent"
84
- >
85
- <pre>{{ displayedContent }}</pre>
86
- </slot>
87
-
88
- <slot
89
- v-else
90
- name="error"
91
- :error-content="displayedContent"
92
- >
93
- <div class="error-message">{{ displayedContent }}</div>
94
- </slot>
95
- </div>
96
- </div>
97
- </Transition>
98
- </div>
99
- </template>
100
-
101
- <script>
102
- export default {
103
- name: 'ElXThinking',
104
- props: {
105
- content: {
106
- type: String,
107
- default: '',
108
- },
109
- modelValue: {
110
- type: Boolean,
111
- default: true,
112
- },
113
- status: {
114
- type: String,
115
- default: 'start',
116
- validator: function (value) {
117
- return ['start', 'thinking', 'end', 'error'].indexOf(value) !== -1;
118
- },
119
- },
120
- disabled: {
121
- type: Boolean,
122
- default: false,
123
- },
124
- autoCollapse: {
125
- type: Boolean,
126
- default: false,
127
- },
128
- buttonWidth: {
129
- type: String,
130
- default: '160px',
131
- },
132
- duration: {
133
- type: String,
134
- default: '0.2s',
135
- },
136
- maxWidth: {
137
- type: String,
138
- default: '500px',
139
- },
140
- backgroundColor: {
141
- type: String,
142
- default: '#fcfcfc',
143
- },
144
- color: {
145
- type: String,
146
- default: '#909399',
147
- },
148
- },
149
- data() {
150
- return {
151
- isExpanded: this.modelValue,
152
- localStatus: this.status,
153
- };
154
- },
155
- computed: {
156
- displayedContent() {
157
- return this.localStatus === 'error' ? '思考过程中出现错误' : this.content;
158
- },
159
- },
160
- watch: {
161
- modelValue(newVal) {
162
- this.isExpanded = newVal;
163
- },
164
- status(newVal) {
165
- this.localStatus = newVal;
166
- if (newVal === 'end' && this.autoCollapse) {
167
- this.isExpanded = false;
168
- }
169
- },
170
- $attrs: {
171
- handler(newVal) {
172
- if (newVal['onUpdate:status']) {
173
- this.$emit('update:status', this.localStatus);
174
- }
175
- },
176
- immediate: true,
177
- },
178
- },
179
- methods: {
180
- changeExpand() {
181
- if (this.disabled) return;
182
- this.isExpanded = !this.isExpanded;
183
- this.$emit('change', {
184
- value: this.isExpanded,
185
- status: this.localStatus,
186
- });
187
- this.$emit('update:expanded', this.isExpanded);
188
- },
189
- },
190
- };
191
- </script>
192
-
193
- <style lang="scss" scoped>
194
- @import '../../../styles/Thinking.scss';
195
- </style>
1
+ <template>
2
+ <div
3
+ class="el-x-thinking"
4
+ :style="{
5
+ '--el-x-thinking-button-width': buttonWidth,
6
+ '--el-x-thinking-animation-duration': duration,
7
+ '--el-x-thinking-content-wrapper-width': maxWidth,
8
+ '--el-x-thinking-content-wrapper-background-color': backgroundColor,
9
+ '--el-x-thinking-content-wrapper-color': color,
10
+ }"
11
+ >
12
+ <button
13
+ class="trigger"
14
+ :class="[localStatus, { disabled: !disabled }]"
15
+ :disabled="disabled"
16
+ @click="changeExpand"
17
+ >
18
+ <span class="status-icon">
19
+ <slot
20
+ name="status-icon"
21
+ :status="localStatus"
22
+ >
23
+ <i
24
+ v-if="localStatus === 'thinking'"
25
+ class="is-loading el-icon-center el-icon-loading"
26
+ ></i>
27
+ <i
28
+ v-if="localStatus === 'start'"
29
+ class="el-icon-center start-color el-icon-opportunity"
30
+ ></i>
31
+ <i
32
+ v-if="localStatus === 'end'"
33
+ class="el-icon-center end-color el-icon-success"
34
+ ></i>
35
+ <i
36
+ v-if="localStatus === 'error'"
37
+ class="el-icon-center error-color el-icon-circle-close"
38
+ ></i>
39
+ </slot>
40
+ </span>
41
+
42
+ <span class="label">
43
+ <slot
44
+ name="label"
45
+ :status="localStatus"
46
+ >
47
+ {{
48
+ localStatus === 'thinking'
49
+ ? '思考中...'
50
+ : localStatus === 'error'
51
+ ? '思考遇到问题'
52
+ : localStatus === 'end'
53
+ ? '思考完成'
54
+ : '开始思考'
55
+ }}
56
+ </slot>
57
+ </span>
58
+
59
+ <transition name="rotate">
60
+ <span
61
+ v-if="!disabled"
62
+ class="thinking-arrow el-icon-center"
63
+ :class="{ expanded: isExpanded }"
64
+ >
65
+ <slot name="arrow">
66
+ <i class="el-icon-center el-icon-arrow-up"></i>
67
+ </slot>
68
+ </span>
69
+ </transition>
70
+ </button>
71
+
72
+ <Transition name="slide">
73
+ <div
74
+ v-show="isExpanded"
75
+ v-if="displayedContent"
76
+ class="content-wrapper"
77
+ :class="{ 'error-state': localStatus === 'error' }"
78
+ >
79
+ <div class="content">
80
+ <slot
81
+ v-if="localStatus !== 'error'"
82
+ name="content"
83
+ :content="displayedContent"
84
+ >
85
+ <pre>{{ displayedContent }}</pre>
86
+ </slot>
87
+
88
+ <slot
89
+ v-else
90
+ name="error"
91
+ :error-content="displayedContent"
92
+ >
93
+ <div class="error-message">{{ displayedContent }}</div>
94
+ </slot>
95
+ </div>
96
+ </div>
97
+ </Transition>
98
+ </div>
99
+ </template>
100
+
101
+ <script>
102
+ export default {
103
+ name: 'ElXThinking',
104
+ props: {
105
+ content: {
106
+ type: String,
107
+ default: '',
108
+ },
109
+ modelValue: {
110
+ type: Boolean,
111
+ default: true,
112
+ },
113
+ status: {
114
+ type: String,
115
+ default: 'start',
116
+ validator: function (value) {
117
+ return ['start', 'thinking', 'end', 'error'].indexOf(value) !== -1;
118
+ },
119
+ },
120
+ disabled: {
121
+ type: Boolean,
122
+ default: false,
123
+ },
124
+ autoCollapse: {
125
+ type: Boolean,
126
+ default: false,
127
+ },
128
+ buttonWidth: {
129
+ type: String,
130
+ default: '160px',
131
+ },
132
+ duration: {
133
+ type: String,
134
+ default: '0.2s',
135
+ },
136
+ maxWidth: {
137
+ type: String,
138
+ default: '500px',
139
+ },
140
+ backgroundColor: {
141
+ type: String,
142
+ default: '#fcfcfc',
143
+ },
144
+ color: {
145
+ type: String,
146
+ default: '#909399',
147
+ },
148
+ },
149
+ data() {
150
+ return {
151
+ isExpanded: this.modelValue,
152
+ localStatus: this.status,
153
+ };
154
+ },
155
+ computed: {
156
+ displayedContent() {
157
+ return this.localStatus === 'error' ? '思考过程中出现错误' : this.content;
158
+ },
159
+ },
160
+ watch: {
161
+ modelValue(newVal) {
162
+ this.isExpanded = newVal;
163
+ },
164
+ status(newVal) {
165
+ this.localStatus = newVal;
166
+ if (newVal === 'end' && this.autoCollapse) {
167
+ this.isExpanded = false;
168
+ }
169
+ },
170
+ $attrs: {
171
+ handler(newVal) {
172
+ if (newVal['onUpdate:status']) {
173
+ this.$emit('update:status', this.localStatus);
174
+ }
175
+ },
176
+ immediate: true,
177
+ },
178
+ },
179
+ methods: {
180
+ changeExpand() {
181
+ if (this.disabled) return;
182
+ this.isExpanded = !this.isExpanded;
183
+ this.$emit('change', {
184
+ value: this.isExpanded,
185
+ status: this.localStatus,
186
+ });
187
+ this.$emit('update:expanded', this.isExpanded);
188
+ },
189
+ },
190
+ };
191
+ </script>
192
+
193
+ <style lang="scss" scoped>
194
+ @import '../../../styles/Thinking.scss';
195
+ </style>