yks-element 2.0.4-private.3 → 2.0.6

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.
Files changed (3) hide show
  1. package/README.md +409 -496
  2. package/lib/yks.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,547 +1,460 @@
1
- # yks-element
2
1
 
3
- Vue 2 component library for the YKS exam platform. It wraps [Element UI](https://element.eleme.io/) 2.15 and adds media, editor, recording, and table components used by the exam apps.
2
+ # yks公共库
4
3
 
5
- Current version: `2.0.4-english.1`.
4
+ ## Quick Start
6
5
 
7
- ## Requirements
8
-
9
- | Item | Version |
10
- | --- | --- |
11
- | Vue | `2.6.11` (peer dependency) |
12
- | Element UI | `2.15.x` (bundled) |
13
- | Node | `>= 8.9` |
14
- | npm | `>= 3.0.0` |
15
-
16
- This package targets Vue 2 only. Do not install it in a Vue 3 app.
17
-
18
- ## Install
19
-
20
- ```bash
21
- yarn add yks-element
22
- # or
23
- npm install yks-element -S
24
- ```
25
-
26
- Upgrade an existing app:
27
-
28
- ```bash
29
- yarn add yks-element@latest -S
30
- # or
31
- npm install yks-element@latest -S
32
- ```
33
-
34
- Install a beta build:
35
-
36
- ```bash
37
- npm install yks-element@beta
38
- ```
39
-
40
- ## Quick start
41
-
42
- Register the whole library. This also registers Element UI, loading, infinite scroll, and the global message helpers.
43
-
44
- ```javascript
45
- import Vue from 'vue'
6
+ ``` javascript
46
7
  import YksElement from 'yks-element'
47
- import 'yks-element/lib/theme-chalk/index.css'
48
-
49
- Vue.use(YksElement, {
50
- size: 'medium',
51
- zIndex: 2000,
52
- i18n: (key, value) => i18n.t(key, value)
53
- })
54
- ```
55
-
56
- `main` points to `lib/yks.js`. `style` points to `lib/theme-chalk/index.css`. Import the stylesheet once at the app entry. Without it, component layout has no theme.
57
-
58
- ### Install options
59
-
60
- | Option | Default | Description |
61
- | --- | --- | --- |
62
- | `size` | `''` | Element UI component size (`medium`, `small`, `mini`) |
63
- | `zIndex` | `1000` | Popup base z-index |
64
- | `locale` | English (`element-ui/lib/locale/lang/en`) | Element UI language pack. Omit it to keep English |
65
- | `i18n` | none | vue-i18n lookup. Called before the locale pack |
66
-
67
- ```javascript
68
- locale.use(opts.locale || enLocale)
69
- ```
70
-
71
- Do not pass a Chinese locale object unless that screen must stay in Chinese. A caller-supplied `locale` replaces the English default.
72
-
73
- `i18n` does not replace that default. Element UI asks vue-i18n first. If the key exists, that translation is shown. The English pack is the fallback when vue-i18n has no value.
74
-
75
- Recommended app setup:
8
+ import '~yks-element/lib/theme-chalk/index.css';
76
9
 
77
- - Default vue-i18n locale is `en`.
78
- - Merge `element-ui/lib/locale/lang/en` into the `en` message catalog.
79
- - Keep `zh-CN`, `es`, `ja`, and `ko` packs on their own locale keys.
80
- - Pass only `size` and `i18n` into `Vue.use`. Leave `locale` unset.
10
+ Vue.use(YksElement)
81
11
 
82
- ```javascript
83
- import elementEnLocale from 'element-ui/lib/locale/lang/en'
84
- import enLocale from './en'
85
-
86
- const messages = {
87
- en: {
88
- ...enLocale,
89
- ...elementEnLocale
90
- }
91
- }
92
-
93
- Vue.use(YksElement, {
94
- size: 'medium',
95
- i18n: (key, value) => i18n.t(key, value)
96
- })
97
- ```
98
-
99
- ### On-demand components
100
-
101
- `Vue.use` is what applies the English locale. Importing a single component does not.
102
-
103
- ```javascript
104
- import Vue from 'vue'
105
- import { Button, YksDialog } from 'yks-element'
106
- import 'yks-element/lib/theme-chalk/index.css'
12
+ // or
13
+ import {
14
+ Button
15
+ // ...
16
+ } from 'yks-element'
107
17
 
108
18
  Vue.component(Button.name, Button)
109
- Vue.component(YksDialog.name, YksDialog)
110
19
  ```
111
20
 
112
- If you register components one by one, call the locale helper yourself:
113
-
114
- ```javascript
115
- import YksElement from 'yks-element'
116
- import enLocale from 'element-ui/lib/locale/lang/en'
117
-
118
- YksElement.locale(enLocale)
119
- ```
120
-
121
- ### Global services
122
-
123
- After `Vue.use(YksElement)` these are available on the Vue prototype:
124
-
125
- | Helper | Role |
126
- | --- | --- |
127
- | `$loading` | Full-screen or element loading |
128
- | `$message` | Toast message |
129
- | `$notify` | Notification |
130
- | `$msgbox` | Message box |
131
- | `$alert` | Alert dialog |
132
- | `$confirm` | Confirm dialog |
133
- | `$prompt` | Prompt dialog |
21
+ ### YKS-ELEMENT 文档
134
22
 
135
- ## Components
23
+ #### 2.0.6 更新文档
136
24
 
137
- Template tags use the component `name`. `YksDialog` is `<yks-dialog>`.
25
+ 2.0.5 的 `yks-tinymce` 有图片宽高 bug:上传图片只有 `width`、`height` 属性,权重太低,容易被样式覆盖。请使用 2.0.6。
138
26
 
139
- | Export | Tag | Role |
140
- | --- | --- | --- |
141
- | `YksDialog` | `yks-dialog` | Dialog with confirm and cancel |
142
- | `YksPagination` | `yks-pagination` | Pagination bound to a page object |
143
- | `YksSelect` | `yks-select` | Virtualized select |
144
- | `YksScrollbar` | `yks-scrollbar` | Scroll container |
145
- | `YksTable` | `yks-table` | Table driven by a column array |
146
- | `YksUploadfile` | `yks-uploadfile` | Upload dialog |
147
- | `YksTinymce` | `yks-tinymce` | Rich text editor |
148
- | `YksAcebuilds` | `yks-acebuilds` | Code editor |
149
- | `YksMultimedia` | `yks-multimedia` | Image, audio, video, or document preview |
150
- | `YksAudio` | `yks-audio` | Audio bar player |
151
- | `YksVideo` | `yks-video` | Lightweight video or audio player |
152
- | `YksVideoPlayer` | `yks-video-player` | video.js player |
153
- | `YksWaveview` | `yks-waveview` | Audio waveform |
154
- | `YksRecorders` | `yks-recorders` | Recorder with waveform |
155
- | `YksOption` | `yks-option` | Select option used by `YksSelect` |
27
+ #### 2.0.0 更新文档
156
28
 
157
- Element UI components (`Button`, `Input`, `Table`, `DatePicker`, and the rest of the public export list) are re-exported from this package.
29
+ 新增 `YksAudio` 音频条播放器;`YksMultimedia` 在 `isAudioPlay` 且音频后缀时走 `yks-audio`(mp3/wav/aac),外层可加 `is-audio-play-bar` 全宽条;`playLimitEnabled` 开启后点击播放抛 `play-request`(需外部调用 `play()`),并禁止拖进度。
158
30
 
159
- ### yks-dialog
31
+ #### 1.7.0 更新文档()
160
32
 
161
- Extends `el-dialog`. Unlisted props and events are passed through.
33
+ 新增YksVideoPlayer组件,支持视频播放功能;在App.vue中添加示例用法;优化Multimedia组件的样式和功能;更新依赖项以支持新特性。
162
34
 
163
- | Prop | Default | Description |
164
- | --- | --- | --- |
165
- | `show` | `false` | Visibility. Use `.sync` |
166
- | `height` | `390px` | Scrollable body height |
167
- | `loading` | `false` | Confirm button loading state |
168
- | `disabledSure` | `false` | Disables the confirm button |
169
- | `footer` | `true` | Shows the footer |
170
- | `title`, `width`, `top`, `modal`, `append-to-body` | Element defaults | Inherited from `el-dialog` |
35
+ #### 1.6.3 更新文档
171
36
 
172
- Slots: `title`, default (wrapped in `yks-scrollbar`), `footer`.
173
-
174
- The default footer buttons are **Confirm** and **Cancel**.
175
-
176
- Events: `sure` (confirm), `close` (cancel or close), plus `el-dialog` events such as `open`, `opened`, and `closed`.
177
-
178
- ### yks-pagination
179
-
180
- | Prop | Default | Description |
181
- | --- | --- | --- |
182
- | `pageOption` | required | `{ total, page, pageSize }` |
183
- | `pageSizes` | `[10, 20, 50, 100]` | Page-size options |
184
- | `layout` | `sizes, total, prev, pager, next, jumper` | Element pagination layout |
185
- | `background` | `false` | Background on pager buttons |
186
- | `hidden` | `false` | Hides the pager |
187
-
188
- Event `pagination` receives the updated `pageOption`.
189
-
190
- ### yks-select
191
-
192
- Extends `el-select`.
193
-
194
- | Prop | Default | Description |
195
- | --- | --- | --- |
196
- | `data` | `[]` | Option list |
197
- | `domNum` | `10` | DOM nodes rendered at a time |
198
- | `domLimit` | `true` | Internal list rendering. `false` uses the default slot |
199
- | `optionMap` | — | Field map, for example `{ value: 'id', label: 'name', disabled: 'dis' }` |
200
- | `valueKey` | — | Unique key when the value is an object |
201
- | `clearable` | `false` | Shows the clear icon |
202
- | `allowBottom` | `false` | Shows the footer slot |
203
- | `filterableInline` | `false` | Puts the search box inside the dropdown |
204
-
205
- Slots: default (when `domLimit` is `false`), `options` (`{ item }`), `footer` (requires `allow-bottom`).
206
-
207
- Events: `input` for `v-model`, `scrollBottom` when a remote list hits the end, plus `el-select` events.
208
-
209
- Ref methods: `focus()`, `blur()`.
210
-
211
- ### yks-scrollbar
212
-
213
- | Prop | Default | Description |
214
- | --- | --- | --- |
215
- | `height` | `auto` | Container height, such as `390px` or `100%` |
216
-
217
- The default slot is the scrolled content.
218
-
219
- ### yks-table
220
-
221
- Extends `el-table`. Column objects accept the same props as `el-table-column`.
222
-
223
- | Prop | Default | Description |
224
- | --- | --- | --- |
225
- | `columns` | — | Column definitions |
226
- | `dom` | `true` | Renders columns from `columns`. `false` uses the default slot |
227
- | `emptyMsg` | `No data` | Empty-state text |
228
- | `data`, `height`, `stripe`, `border`, `row-key` | Element defaults | Inherited from `el-table` |
229
-
230
- Slots:
231
-
232
- | Slot | Scope | When |
233
- | --- | --- | --- |
234
- | default | — | `dom` is `false`. Place `el-table-column` here |
235
- | `[col.prop]` | `row`, `$index`, `column`, `columnIndex` | Cell content |
236
- | `header[col.prop]` | `column`, `$index` | Header content |
237
- | `expand` | `row`, `scope`, `$index` | Expand row |
238
- | `append` | — | Content after the last row |
239
- | `empty` | — | Custom empty state |
240
-
241
- Native `el-table` events are forwarded (`selection-change`, `row-click`, `sort-change`, and others).
242
-
243
- ### yks-uploadfile
244
-
245
- | Prop | Default | Description |
246
- | --- | --- | --- |
247
- | `show` | `false` | Dialog visibility. Use `.sync` |
248
- | `title` | — | Dialog title |
249
- | `uploadFileFunction` | — | `({ file, fileData, fileSrc }) => Promise` |
250
- | `fileData` | — | `{ fileType, typeList, fileSize, types }` |
251
- | `excludeList` | `[]` | File extensions to reject |
252
-
253
- The `footer` slot receives `{ row }`.
254
-
255
- Events: `sure` with the upload result, and `update:show` when the dialog closes.
256
-
257
- ### yks-tinymce
258
-
259
- Rich text editor. `language` defaults to `en`. English does not load a remote `language_url`, because the TinyMCE CDN has no `en.js`. Any other language loads `https://obs-ogt.obs.cn-east-3.myhuaweicloud.com/hyt-present-common/assets/tinymce/langs/${language}.js`.
260
-
261
- | Prop | Default | Description |
262
- | --- | --- | --- |
263
- | `value` | required | HTML. Use `v-model` |
264
- | `language` | `en` | TinyMCE language id |
265
- | `toolbar` | `[]` | Extra toolbar items, string or array |
266
- | `plugins` | `[]` | Extra plugins |
267
- | `menubar` | `file edit insert view format table` | Menu bar |
268
- | `height` | `660px` | Editor height |
269
- | `width` | `auto` | Editor width |
270
- | `charLimit` | `5000` | Character limit |
271
- | `fontsizeFormats` | — | Font-size list |
272
- | `inline` | `false` | Inline mode |
273
- | `autosize` | `false` | Drag handle for height |
274
- | `effect` | `default` | Theme id |
275
- | `videoWidth` | `160` | Attachment video width in px |
276
- | `videoHeight` | `90` | Attachment video height in px |
277
- | `fileParams` | — | Attachment list, same shape as `yks-multimedia` |
278
- | `fileParamsAttributes` | — | Custom file-param mode |
279
- | `uploadFileToHwCloud` | — | `(blobInfo) => imageUrl` |
280
- | `uploadFileFunction` | — | Audio, video, or file upload |
281
- | `externalPlugins` | — | Extra TinyMCE plugins |
282
- | `accept` | `[]` | Allowed image extensions |
283
- | `moreParameters` | — | Extra TinyMCE `init` options |
284
-
285
- Events:
286
-
287
- | Event | Payload | When |
288
- | --- | --- | --- |
289
- | `input` | HTML string | Content changes (`v-model`) |
290
- | `blur` | `true` on blur, `false` on focus | Focus changes |
291
- | `delte` | `{ row, index }` | An attachment is removed. The event name is `delte` |
292
- | `change` | `{ value, itemAttr: { type, content } }` | An audio, video, or file upload is confirmed |
293
- | `selectVideo` | — | The toolbar **Select video** button is clicked |
294
-
295
- Toolbar item for the video picker:
296
-
297
- ```javascript
37
+ ``` javascript
298
38
  {
299
- toolbar: ['selectVideo']
39
+ toolbar : ['selectVideo']
300
40
  }
301
41
  ```
302
42
 
303
- Emphasis mark plugin:
43
+ ```text
44
+ selectVideo 新增选择视频
45
+ 点击抛出 selectVideo 事件
46
+ ```
304
47
 
305
- ```javascript
48
+ #### 1.6.2 新增着重号 emphasis
49
+
50
+ ``` javascript
306
51
  {
307
- plugins: ['emphasis'],
308
- toolbar: ['emphasis']
52
+ plugins : ['emphasis'],
53
+ toolbar : ['emphasis']
309
54
  }
310
55
  ```
311
56
 
312
- Ref methods: `handleInsertContent(value)` inserts HTML at the cursor. `deleFillItem(index)` removes a fill-in blank and renumbers the rest.
313
-
314
- ### yks-acebuilds
315
-
316
- | Prop | Default | Description |
317
- | --- | --- | --- |
318
- | `value` | required | Source text. Use `v-model` |
319
- | `theme` | `tomorrow_night` | `tomorrow_night`, `monokai`, or `chrome` |
320
- | `language` | `javascript` | Ace mode |
321
- | `disabled` | `false` | Read-only |
322
- | `noCopy` | `false` | Blocks Ctrl+C / V / X |
323
- | `autosize` | `false` | Shows a height drag handle |
324
- | `height` | `400` | Height in px |
325
- | `fontSize` | `16` | Font size in px |
326
- | `tabSize` | `4` | Tab width |
327
- | `lockedLines` | `[]` | 1-based line numbers that stay read-only |
328
-
329
- Built-in language values:
330
-
331
- | Label | Value |
332
- | --- | --- |
333
- | JavaScript | `javascript` |
334
- | Objective-C | `objectivec` |
335
- | C++ | `c_cpp` |
336
- | Java | `java` |
337
- | C# | `csharp` |
338
- | Go | `golang` |
339
- | Python | `python` |
340
- | PHP | `php` |
341
- | SQL | `sql` |
342
-
343
- Event `input` emits the new value. Ref methods `setValue()`, `setTheme()`, `setTabSize()`, and `setFontSize()` push the current props back into the Ace instance.
344
-
345
- ### yks-multimedia
346
-
347
- Preview for an image, audio file, video, or document.
348
-
349
- | Prop | Default | Description |
350
- | --- | --- | --- |
351
- | `data` | — | `{ content, fileName }` |
352
- | `visibleDel` | `false` | Shows the delete button |
353
- | `width` | `160` | Width in px. Ignored when the audio bar is full width |
354
- | `height` | `90` | Height in px |
355
- | `customize` | `true` | Custom video enlarge. Forced on in the client, off on mobile |
356
- | `visibleFileName` | `true` | Shows the file name |
357
- | `client` | `false` | Client mode. Forced on for Android |
358
- | `isAudioPlay` | `false` | Uses `yks-audio` for `mp3`, `wav`, and `aac` |
359
- | `playLimitEnabled` | `false` | Passed through to the audio or video player |
360
- | `allowPause` | `true` | Allows pause while play limit is on |
361
-
362
- Add the class `is-audio-play-bar` on the outer node when the audio bar should stretch to full width.
363
-
364
- Events: `delete` emits `data`. `play-request` fires when play is limited; call `play()` on the inner player before playback starts.
365
-
366
- Ref methods: `play()` starts the inner `yks-video`. `forcePause()` pauses it. For the audio bar, call `this.$refs.innerAudio.play()`.
367
-
368
- ### yks-audio
369
-
370
- Native `<audio>` with a custom control bar. Accepts `mp3`, `wav`, and `aac`.
371
-
372
- | Prop | Default | Description |
373
- | --- | --- | --- |
374
- | `src` | required | Audio URL |
375
- | `width` | `160` | Reserved width in px. The bar itself is `100%` of the parent |
376
- | `height` | `90` | Reserved height in px |
377
- | `playLimitEnabled` | `false` | Clicking play emits `play-request` and seeking is disabled |
378
- | `allowPause` | `true` | Allows pause while the limit is on |
379
-
380
- When duration is known, the bar shows current / total (`0:00 / 3:43`). When duration is unknown, it shows the current time only and the bar cannot be dragged.
381
-
382
- Event `play-request` fires when the limit is on and playback has not started. Call `play()` from the parent to start.
383
-
384
- Ref methods: `play()` returns a Promise, `forcePause()`, `getMediaEl()` returns the `HTMLAudioElement`.
385
-
386
- ### yks-video
387
-
388
- | Prop | Default | Description |
389
- | --- | --- | --- |
390
- | `src` | required | Video or audio URL |
391
- | `width` | `160` | Width in px |
392
- | `height` | `90` | Height in px |
393
- | `customize` | `false` | Replaces native fullscreen with the `customize` event |
394
- | `fullScreen` | `true` | Fullscreen button. `mp4` only |
395
- | `playLimitEnabled` | `false` | Clicking play emits `play-request` |
396
- | `allowPause` | `true` | Allows pause and seeking while the limit is on |
397
-
398
- Events: `customize` emits the video element and `{ src, musicDuration, id }`. `play-request` matches `yks-audio`.
399
-
400
- Ref methods: `play()` returns a Promise. `forcePause()` pauses playback.
401
-
402
- ### yks-video-player
403
-
404
- Based on `vue-video-player@5` and `video.js@6`. The player UI language is `en`.
405
-
406
- Import the video.js stylesheet before using the component:
407
-
408
- ```javascript
409
- import 'video.js/dist/video-js.css'
57
+ #### 新增ace-builds 编辑器
58
+
59
+ ``` javascript
60
+ [
61
+ { label: 'JavaScript', value: 'javascript' },
62
+ { label: 'Objective-C', value: 'objectivec' },
63
+ { label: 'C++', value: 'c_cpp' },
64
+ { label: 'Java', value: 'java' },
65
+ { label: 'C#', value: 'csharp' },
66
+ { label: 'Go', value: 'golang' },
67
+ { label: 'Python', value: 'python' },
68
+ { label: 'PHP', value: 'php' },
69
+ { label: 'SQL', value: 'sql' },
70
+ ]
410
71
  ```
411
72
 
412
- | Prop | Default | Description |
413
- | --- | --- | --- |
414
- | `src` | — | Media URL |
415
- | `width` | `640` | Width in px |
416
- | `height` | `360` | Height in px |
417
- | `poster` | — | Poster URL. Empty uses the first video frame |
418
- | `autoplay` | `false` | Starts playback on load |
419
- | `loop` | `false` | Loops |
420
- | `muted` | `false` | Starts muted |
421
- | `fluid` | `false` | Fills the parent. Ignores `width` and `height` |
422
- | `sources` | — | `[{ src, type, label }]`. Overrides `src` |
423
- | `playbackRates` | `[0.5, 1, 1.5, 2]` | Playback speeds |
424
- | `options` | — | Extra video.js options |
425
-
426
- Events: `ready`, `play`, and `pause` receive the player. `ended` receives the player. `timeupdate` receives `{ currentTime, duration }`. `error` receives the error.
427
-
428
- ### yks-waveview
429
-
430
- | Prop | Default | Description |
431
- | --- | --- | --- |
432
- | `processSlotClass` | `IctrlProcessWave` | Class of the node that mounts the waveform |
433
- | `url` | — | Audio file URL |
434
- | `styleWave` | — | Style object for the waveform container |
435
- | `loop` | — | Loops playback |
436
-
437
- Ref methods: `onStart()`, `onPause()`, `onResume()`, `onStop()`, `setRealtimeOn()`, `setRealtimeOff()`, `receiveAudioChunk(arrayBuffer)`.
438
-
439
- `setRealtimeOn` drops buffered data to lower latency. `setRealtimeOff` plays every chunk in order.
440
-
441
- ### yks-recorders
442
-
443
- | Prop | Default | Description |
444
- | --- | --- | --- |
445
- | `fileSize` | `600` | Max duration in seconds. `0` means no limit |
446
- | `sampleRate` | `16000` | Sample rate |
447
- | `bitRate` | `16` | Bit rate |
448
- | `type` | `mp3` | Output format |
449
- | `disabled` | `false` | Blocks recording |
450
- | `processSlotClass` | — | Mount class for the `process` slot |
451
- | `title` | — | Status title |
452
- | `showProcess` | `false` | Shows the live waveform |
453
-
454
- Slots: default scoped slot `{ onRecord, timestamp, resetData }`, and `process` (requires `processSlotClass`).
455
-
456
- Events:
457
-
458
- | Event | Payload | When |
459
- | --- | --- | --- |
460
- | `change` | `{ blob, duration, timestamp, powerLevel, fileSrc }` | Recording finishes |
461
- | `succress` | `true` | A record action succeeds. The event name is `succress` |
462
- | `error` | error | Recording fails |
463
- | `buffers` | `{ buffers, powerLevel, sampleRate }` | Live buffers while `showProcess` is true |
464
-
465
- Ref methods: `onRecord()` toggles recording. `resetData()` clears recorder state.
466
-
467
- ## Icons
468
-
469
- Use the class on an `<i>` or the icon component:
470
-
471
- ```html
472
- <i class="yks-icon-camera"></i>
73
+ ```text
74
+ * yks-video-player 播放器(基于 vue-video-player@5 + video.js@6)
75
+ - 使用前需在项目入口引入 video.js 样式:
76
+ import 'video.js/dist/video-js.css'
77
+ - Attribute
78
+ - src 视频/音频 URL
79
+ - width 播放器宽度(px),默认 640
80
+ - height 播放器高度(px),默认 360
81
+ - poster 封面图片 URL,为空时自动截取视频第一帧
82
+ - autoplay 是否自动播放,默认 false
83
+ - loop 是否循环播放,默认 false
84
+ - muted 是否静音,默认 false
85
+ - fluid 是否响应式撑满父容器,默认 false(开启后 width/height 失效)
86
+ - sources 多清晰度源数组 [{ src, type, label }],优先级高于 src
87
+ - playbackRates 倍速选项数组,默认 [0.5, 1, 1.5, 2]
88
+ - options video.js 原生 options 对象透传(高级配置)
89
+ - Methods(Events)
90
+ - ready 播放器实例就绪,参数:player(video.js 实例)
91
+ - play 开始播放,参数:player
92
+ - pause 暂停,参数:player
93
+ - ended 播放结束,参数:player
94
+ - timeupdate 进度更新,参数:{ currentTime, duration }
95
+ - error 播放错误,参数:err
96
+
97
+ * yks-acebuilds 代码编辑器
98
+ - Attribute
99
+ - value(v-model) 编辑器绑定值(代码字符串),必填
100
+ - theme 主题,默认 tomorrow_night(可选 monokai、chrome)
101
+ - language 编程语言,默认 javascript(可选 java、python、sql 等)
102
+ - disabled 是否只读,默认 false
103
+ - noCopy 是否禁用 Ctrl+C/V/X,默认 false
104
+ - autosize 是否显示拖拽调高手柄,默认 false
105
+ - height 编辑器高度(px),默认 400
106
+ - fontSize 字体大小(px),默认 16
107
+ - tabSize Tab 缩进空格数,默认 4
108
+ - lockedLines 锁定只读的行号数组(1-based),默认 []
109
+ - Methods(Events)
110
+ - input 内容变更,参数:value(用于 v-model)
111
+ - Ref Methods(通过 $refs 调用)
112
+ - setValue() 将当前 value prop 重新同步到编辑器
113
+ - setTheme() 将当前 theme prop 应用到编辑器
114
+ - setTabSize() 将当前 tabSize prop 应用到编辑器
115
+ - setFontSize() 将当前 fontSize prop 应用到编辑器
116
+
117
+ * yks-waveview 播放音频并显示波形轨迹
118
+ - Attribute
119
+ - processSlotClass WaveView 视图挂载目标的 class 名,默认 IctrlProcessWave
120
+ - url 要播放的音频文件 URL
121
+ - styleWave 波形容器自定义样式对象
122
+ - loop 是否循环播放
123
+ - Ref Methods(通过 $refs 调用)
124
+ - onStart() 开始加载并播放音频
125
+ - onPause() 暂停播放
126
+ - onResume() 恢复播放
127
+ - onStop() 停止播放并重置状态
128
+ - setRealtimeOn() 切换为实时模式(降低延迟,丢弃积压数据)
129
+ - setRealtimeOff() 切换为非实时模式(顺序完整播放所有数据)
130
+ - receiveAudioChunk(arrayBuffer) 接收外部实时音频片段数据(ArrayBuffer)
131
+
132
+ * yks-recorders 录音并显示音频轨迹
133
+ - Attribute
134
+ - fileSize 录音最大时长(单位 s),0 表示不限制,默认 600
135
+ - sampleRate 录音采样率,默认 16000
136
+ - bitRate 录音比特率,默认 16
137
+ - type 录制输出格式,默认 mp3
138
+ - disabled 是否禁止录制,默认 false
139
+ - processSlotClass 使用 process slot 时 WaveView 挂载目标的 class 名
140
+ - title 自定义状态标题文字
141
+ - showProcess 是否显示录制波形轨迹,默认 false
142
+ - Slot
143
+ - default(作用域插槽) 自定义录音控件 UI,作用域变量:onRecord、timestamp、resetData
144
+ - process 自定义波形显示区域(需配合 processSlotClass 使用)
145
+ - Methods(Events)
146
+ - change 录音完成后触发,参数:{ blob, duration, timestamp, powerLevel, fileSrc }
147
+ - succress 每次录音操作成功后触发,参数:true
148
+ - error 录音出错时触发,参数:error 对象
149
+ - buffers showProcess=true 时实时推送录音缓冲数据,参数:{ buffers, powerLevel, sampleRate }
150
+ - Ref Methods(通过 $refs 调用)
151
+ - onRecord() 开始/停止录音(toggle)
152
+ - resetData() 重置所有录音状态数据
153
+
154
+ * yks-dialog 弹窗(继承 el-dialog 全部属性与事件)
155
+ - Attribute
156
+ - show 是否显示 Dialog,支持 .sync 修饰符,默认 false
157
+ - height 内容区滚动高度,默认 390px
158
+ - loading 确定按钮 loading 状态,默认 false
159
+ - disabledSure 是否禁用确定按钮,默认 false
160
+ - footer 是否显示底部操作区,默认 true
161
+ - (其余属性完全继承 el-dialog,如 title、width、top、modal、append-to-body 等)
162
+ - Slot
163
+ - title 自定义 Dialog 标题区域
164
+ - default 内容区(被 yks-scrollbar 包裹)
165
+ - footer 自定义底部操作区(默认渲染"确定/取消"按钮)
166
+ - Methods(Events)
167
+ - close 点击取消或关闭时触发
168
+ - sure 点击确定时触发
169
+ - (其余事件完全继承 el-dialog,如 open、opened、closed)
170
+
171
+ * yks-audio 音频条播放器(原生 audio + 自定义控制条)
172
+ - Attribute
173
+ - src 音频 URL,必填(mp3 / wav / aac)
174
+ - width 预留宽度(px),默认 160(条形样式以 100% 撑满父级为准)
175
+ - height 预留高度(px),默认 90
176
+ - playLimitEnabled 是否开启播放限制,默认 false(true:点击播放抛 play-request,禁止拖进度)
177
+ - allowPause 限制开启时是否允许暂停,默认 true
178
+ - 展示
179
+ - 有总时长:右侧显示 当前 / 总时长(如 0:00 / 3:43)
180
+ - 拿不到总时长:只显示当前播放时间,进度条不可拖
181
+ - Methods(Events)
182
+ - play-request playLimitEnabled=true 且未在播放时,用户点击播放按钮触发;需外部再调用 play()
183
+ - Ref Methods(通过 $refs 调用)
184
+ - play() 外部触发播放,返回 Promise
185
+ - forcePause() 外部强制暂停(超次等)
186
+ - getMediaEl() 返回内部 HTMLAudioElement
187
+
188
+ * yks-multimedia 媒体文件显示(图片/音频/视频/文档)
189
+ - Attribute
190
+ - data 文件信息对象,含 content(文件 URL)、fileName(文件名)
191
+ - visibleDel 是否显示删除按钮,默认 false
192
+ - width 宽度(px),默认 160(音频条模式下由 is-audio-play-bar 撑满)
193
+ - height 高度(px),默认 90
194
+ - customize 是否自定义视频放大(客户端模式自动为 true,移动端自动为 false),默认 true
195
+ - visibleFileName 是否显示文件名称,默认 true
196
+ - client 是否为客户端模式(android 下自动设置为 true),默认 false
197
+ - isAudioPlay 是否使用音频条 yks-audio,默认 false(需同时为 mp3/wav/aac)
198
+ - playLimitEnabled 是否开启播放限制(透传 yks-audio / yks-video),默认 false
199
+ - allowPause 限制开启时是否允许暂停,默认 true
200
+ - Methods(Events)
201
+ - delete 点击删除图标时触发,参数:data(当前文件信息对象),与 visibleDel 联动
202
+ - play-request 限制模式下用户点击播放时触发,需外部调用内部播放器 play()
203
+ - Ref Methods(通过 $refs 调用)
204
+ - play() 触发内部 yks-video 播放(音频条请 $refs.innerAudio.play())
205
+ - forcePause() 强制暂停内部 yks-video
206
+
207
+ * yks-pagination 分页
208
+ - Attribute
209
+ - pageOption 分页状态对象(必填),含 total(总条数)、page(当前页)、pageSize(每页条数)
210
+ - pageSizes 每页条数可选列表,默认 [10, 20, 50, 100]
211
+ - layout 分页布局,默认 sizes, total, prev, pager, next, jumper
212
+ - background 是否为分页按钮添加背景色,默认 false
213
+ - hidden 是否隐藏分页组件,默认 false
214
+ - Methods(Events)
215
+ - pagination 页码或每页条数变更时触发,参数:更新后的 pageOption 对象
216
+
217
+ * yks-scrollbar 自定义滚动条
218
+ - Attribute
219
+ - height 滚动区容器高度(CSS 值,如 390px、100%),默认 auto
220
+ - Slot
221
+ - default 被滚动区包裹的内容
222
+
223
+ * yks-select 下拉选择(继承 el-select 全部属性与事件)
224
+ - Attribute
225
+ - data 下拉选项数据列表,默认 []
226
+ - domNum 每次渲染的 DOM 条数,默认 10
227
+ - domLimit 是否启用内部列表渲染模式,默认 true(false 时使用默认 slot)
228
+ - optionMap 自定义字段映射,如 { value: 'id', label: 'name', disabled: 'dis' }
229
+ - valueKey 作为 value 唯一标识的键名(对象值时使用)
230
+ - clearable 是否可清空,默认 false
231
+ - allowBottom 是否显示吸底区域(footer 插槽),默认 false
232
+ - filterableInline 搜索框是否置于下拉框内部,默认 false
233
+ - (其余属性完全继承 el-select)
234
+ - Slot
235
+ - default domLimit=false 时自定义完整选项列表
236
+ - options 作用域插槽,自定义每个选项内容,作用域变量:item
237
+ - footer 吸底插槽(需 allow-bottom=true)
238
+ - Methods(Events)
239
+ - input 选中值变化,参数:当前选中值(用于 v-model)
240
+ - scrollBottom remote 模式下滚动到底部时触发(用于加载更多)
241
+ - (其余事件继承 el-select)
242
+ - Ref Methods(通过 $refs 调用)
243
+ - focus() 使选择器聚焦
244
+ - blur() 使选择器失焦
245
+
246
+ * yks-table 表格(继承 el-table 全部属性与事件)
247
+ - Attribute
248
+ - columns 列定义数组,每项属性完全兼容 el-table-column 的 props
249
+ - dom 是否启用内部自动列渲染,默认 true(false 时通过默认 slot 自定义列)
250
+ - emptyMsg 暂无数据时的提示文字,默认 暂无数据~
251
+ - (其余属性完全继承 el-table,如 data、height、stripe、border、row-key 等)
252
+ - Slot
253
+ - default dom=false 时自定义列(直接放 el-table-column)
254
+ - [col.prop] 每列单元格内容插槽,作用域变量:row、$index、column、columnIndex
255
+ - header[col.prop] 每列表头插槽,作用域变量:column、$index
256
+ - expand 展开行插槽,作用域变量:row、scope、$index
257
+ - append 插入至表格最后一行之后
258
+ - empty 空数据时显示的内容
259
+ - (所有 el-table 原生事件均透传,如 selection-change、row-click、sort-change)
260
+
261
+ * yks-tinymce 富文本编辑器
262
+ - Attribute
263
+ - value(v-model) 编辑器绑定值(HTML 富文本),必填
264
+ - videoWidth 附件区视频宽度(px),默认 160
265
+ - videoHeight 附件区视频高度(px),默认 90
266
+ - effect 主题标识,默认 default
267
+ - language 语言包,默认 zh_CN
268
+ - toolbar 扩展工具栏(数组或字符串),默认 []
269
+ - charLimit 字数上限,默认 5000
270
+ - plugins 插件列表,默认 []
271
+ - menubar 菜单栏,默认 file edit insert view format table
272
+ - fontsizeFormats 字号选项字符串
273
+ - height 编辑器高度,默认 660px
274
+ - width 编辑器宽度,默认 auto
275
+ - inline 是否使用内联模式,默认 false
276
+ - autosize 是否显示拖拽调高手柄,默认 false
277
+ - fileParamsAttributes fileParams自定义模式
278
+ - fileParams 附件数据列表,参考yks-multimedia
279
+ - uploadFileToHwCloud 图片上传函数,接收 blobInfo,返回图片 URL
280
+ - uploadFileFunction 音视频/文件上传函数
281
+ - externalPlugins 外部插件扩展对象
282
+ - accept 限制图片上传类型(后缀数组),默认 []
283
+ - moreParameters 透传到 tinymce init 的额外参数对象
284
+ - Methods(Events)
285
+ - input 内容变更,参数:value(用于 v-model)
286
+ - blur 焦点变化,参数:true(失焦)/ false(聚焦)
287
+ - delte 删除附件,参数:{ row, index }(注意事件名拼写为 delte)
288
+ - change 上传音视频/文件确认后触发,参数:{ value, itemAttr: { type, content } }
289
+ - selectVideo 工具栏点击"选择视频"按钮时触发
290
+ - Ref Methods(通过 $refs 调用)
291
+ - handleInsertContent(value) 向编辑器光标处插入 HTML 内容
292
+ - deleFillItem(index) 删除第 index 个填空输入框并重新编号
293
+
294
+ * yks-uploadFile 文件上传弹窗
295
+ - Attribute
296
+ - show 是否显示弹窗,支持 .sync 修饰符,默认 false
297
+ - title Dialog 标题
298
+ - uploadFileFunction 自定义上传函数,接收 { file, fileData, fileSrc },需返回 Promise
299
+ - fileData 文件配置信息,含 fileType、typeList、fileSize、types 字段
300
+ - excludeList 排除的文件类型后缀数组,默认 []
301
+ - Slot
302
+ - footer 自定义底部按钮区,作用域变量:row(当前文件数据)
303
+ - Methods(Events)
304
+ - sure 文件上传成功后触发,参数:上传函数返回的 data
305
+ - update:show 关闭弹窗时触发(.sync 机制)
306
+
307
+ * yks-video 轻量视频/音频播放器
308
+ - Attribute
309
+ - src 视频/音频 URL,必填
310
+ - width 播放器宽度(px),默认 160
311
+ - height 播放器高度(px),默认 90
312
+ - customize 是否使用自定义全屏事件(替换原生全屏),默认 false
313
+ - fullScreen 是否显示全屏图标按钮(仅 mp4 生效),默认 true
314
+ - playLimitEnabled 是否开启播放限制,默认 false(true:点击播放抛 play-request,可禁拖/禁暂停)
315
+ - allowPause 限制开启时是否允许暂停/拖进度,默认 true
316
+ - Methods(Events)
317
+ - customize customize=true 时点击全屏按钮或双击视频触发,参数:videoEl、{ src, musicDuration, id }
318
+ - play-request playLimitEnabled=true 且未在播放时,用户点击播放触发;需外部再调用 play()
319
+ - Ref Methods(通过 $refs 调用)
320
+ - play() 外部触发播放,返回 Promise
321
+ - forcePause() 外部强制暂停
473
322
  ```
474
323
 
475
- `yks-icon-camera`, `yks-icon-download`, `yks-icon-excel`, `yks-icon-other`, `yks-icon-pdf`, `yks-icon-ppt`, `yks-icon-word`, `yks-icon-play`, `yks-icon-microphone`, `yks-icon-finish`, `yks-icon-puase`, `yks-icon-bichen`, `yks-icon-edit`, `yks-icon-message`, `yks-icon-notification`, `yks-icon-duixiao`, `yks-icon-circle`, `yks-icon-export`, `yks-icon-publish`, `yks-icon-close`, `yks-icon-select`, `yks-icon-import`, `yks-icon-filter`, `yks-icon-merge`, `yks-icon-split`, `yks-icon-archive`, `yks-icon-calendar`, `yks-icon-warning`, `yks-icon-toggle`, `yks-icon-up-arrow`, `yks-icon-down-arrow`, `yks-icon-left-arrow`, `yks-icon-right-arrow`, `yks-icon-caret-bottom`, `yks-icon-report`, `yks-icon-notes`, `yks-icon-settings`, `yks-icon-exam`, `yks-icon-log`, `yks-icon-management`, `yks-icon-practice`, `yks-icon-user`, `yks-icon-add`, `yks-icon-audio`, `yks-icon-video`, `yks-icon-refresh-time`, `yks-icon-list`, `yks-icon-pause`, `yks-icon-flag`, `yks-icon-voice`, `yks-icon-quiz`, `yks-icon-alert`, `yks-icon-application`, `yks-icon-setting`, `yks-icon-organization`, `yks-icon-clipboard`, `yks-icon-duplicate`, `yks-icon-zoom`, `yks-icon-translate`, `yks-icon-record`, `yks-icon-snapshot`, `yks-icon-synchronize`, `yks-icon-volume`, `yks-icon-gear`, `yks-icon-arrow-down`, `yks-icon-silence`, `yks-icon-sound`, `yks-icon-exam-receive`, `yks-icon-exam-warning`, `yks-icon-expand`, `yks-icon-strengthen`, `yks-icon-collapse`, `yks-icon-restrict-video`, `yks-icon-carousel-settings`, `yks-icon-video-guard`, `yks-icon-restriction`, `yks-icon-live-broadcast`, `yks-icon-refresh`, `yks-icon-message-normal`, `yks-icon-message-small`, `yks-icon-id-route`, `yks-icon-unified-route`, `yks-icon-tracking`, `yks-icon-notification-log`, `yks-icon-multi-notification`, `yks-icon-voice-4`, `yks-icon-fullscreen`, `yks-icon-device-monitor`, `yks-icon-person-recognition`, `yks-icon-search-small`, `yks-icon-dropdown`, `yks-icon-mute`, `yks-icon-unmute`.
324
+ ### 更新依赖
476
325
 
477
- `yks-icon-puase` is the published class name. `yks-icon-pause` is a separate icon.
478
-
479
- ![Icon sheet 1](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353086056-image_92206224151742353086019.png)
480
- ![Icon sheet 2](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353119277-image_90261787661742353119254.png)
481
-
482
- ## Local development
483
-
484
- ```bash
485
- yarn
486
- yarn serve # example app
487
- yarn lint
488
- yarn dist # library bundle and theme CSS
326
+ ```shell
327
+ npm install yks-element@latest -S
328
+ or
329
+ yarn add yks-element@latest -S
489
330
  ```
490
331
 
491
- `yarn dist` runs `yarn build` (webpack, output `lib/yks.js`) and `yarn theme` (gulp, output `lib/theme-chalk`).
492
-
493
- The published package only includes `lib` and `types`.
332
+ ### 发布npm包
494
333
 
495
- ## Publish
496
-
497
- ```bash
334
+ ```shell
498
335
  npm publish
499
336
  ```
500
337
 
501
- Beta:
338
+ ### 发布测试包
502
339
 
503
- ```bash
504
- # set version to x.y.z-beta.n first
340
+ ```shell
341
+ version : '0.0.1-beta'
505
342
  npm publish --tag=beta
506
343
  ```
507
344
 
508
- Unpublishing a version is destructive. Use it only for a release that was never consumed:
345
+ ### 下载测试包
509
346
 
510
- ```bash
511
- npm unpublish yks-element@0.0.1 --force
347
+ ```shell
348
+ npm install yks-element@beta
512
349
  ```
513
350
 
514
- ## Changelog
515
-
516
- ### 2.0.4-english.1
517
-
518
- - Element UI defaults to English when `Vue.use` is called without `locale`.
519
- - `yks-tinymce` `language` defaults to `en` and does not request `language_url` for English.
520
- - `yks-video-player` uses video.js language `en`.
521
- - `yks-table` empty text defaults to `No data`.
522
- - `yks-dialog` footer buttons read Confirm and Cancel.
523
-
524
- ### 2.0.0
525
-
526
- - Added `yks-audio`.
527
- - `yks-multimedia` uses `yks-audio` when `isAudioPlay` is set and the file is `mp3`, `wav`, or `aac`.
528
- - Class `is-audio-play-bar` makes that bar full width.
529
- - `playLimitEnabled` emits `play-request` and blocks seeking until the parent calls `play()`.
351
+ ### 删除npm包
530
352
 
531
- ### 1.7.0
532
-
533
- - Added `yks-video-player`.
534
- - Adjusted `yks-multimedia` layout.
535
-
536
- ### 1.6.3
537
-
538
- - TinyMCE toolbar item `selectVideo`. Clicking it emits `selectVideo`.
353
+ ```shell
354
+ npm unpublish yks-element@0.0.1 --force
355
+ ```
539
356
 
540
- ### 1.6.2
357
+ ### yks-icon 图标库
358
+
359
+ ```text
360
+ * yks-icon-camera
361
+ * yks-icon-download
362
+ * yks-icon-excel
363
+ * yks-icon-other
364
+ * yks-icon-pdf
365
+ * yks-icon-ppt
366
+ * yks-icon-word
367
+ * yks-icon-play
368
+ * yks-icon-microphone
369
+ * yks-icon-finish
370
+ * yks-icon-puase
371
+ * yks-icon-bichen
372
+ * yks-icon-edit
373
+ * yks-icon-message
374
+ * yks-icon-notification
375
+ * yks-icon-duixiao
376
+ * yks-icon-circle
377
+ * yks-icon-export
378
+ * yks-icon-publish
379
+ * yks-icon-close
380
+ * yks-icon-select
381
+ * yks-icon-import
382
+ * yks-icon-filter
383
+ * yks-icon-merge
384
+ * yks-icon-split
385
+ * yks-icon-archive
386
+ * yks-icon-calendar
387
+ * yks-icon-warning
388
+ * yks-icon-toggle
389
+ * yks-icon-up-arrow
390
+ * yks-icon-down-arrow
391
+ * yks-icon-left-arrow
392
+ * yks-icon-right-arrow
393
+ * yks-icon-caret-bottom
394
+ * yks-icon-report
395
+ * yks-icon-notes
396
+ * yks-icon-settings
397
+ * yks-icon-exam
398
+ * yks-icon-log
399
+ * yks-icon-management
400
+ * yks-icon-practice
401
+ * yks-icon-user
402
+ * yks-icon-add
403
+ * yks-icon-audio
404
+ * yks-icon-video
405
+ * yks-icon-refresh-time
406
+ * yks-icon-list
407
+ * yks-icon-pause
408
+ * yks-icon-flag
409
+ * yks-icon-voice
410
+ * yks-icon-quiz
411
+ * yks-icon-alert
412
+ * yks-icon-application
413
+ * yks-icon-setting
414
+ * yks-icon-organization
415
+ * yks-icon-clipboard
416
+ * yks-icon-duplicate
417
+ * yks-icon-zoom
418
+ * yks-icon-translate
419
+ * yks-icon-record
420
+ * yks-icon-snapshot
421
+ * yks-icon-synchronize
422
+ * yks-icon-volume
423
+ * yks-icon-gear
424
+ * yks-icon-arrow-down
425
+ * yks-icon-silence
426
+ * yks-icon-sound
427
+ * yks-icon-exam-receive
428
+ * yks-icon-exam-warning
429
+ * yks-icon-expand
430
+ * yks-icon-strengthen
431
+ * yks-icon-collapse
432
+ * yks-icon-restrict-video
433
+ * yks-icon-carousel-settings
434
+ * yks-icon-video-guard
435
+ * yks-icon-restriction
436
+ * yks-icon-live-broadcast
437
+ * yks-icon-refresh
438
+ * yks-icon-message-normal
439
+ * yks-icon-message-small
440
+ * yks-icon-id-route
441
+ * yks-icon-unified-route
442
+ * yks-icon-tracking
443
+ * yks-icon-notification-log
444
+ * yks-icon-multi-notification
445
+ * yks-icon-voice-4
446
+ * yks-icon-fullscreen
447
+ * yks-icon-device-monitor
448
+ * yks-icon-person-recognition
449
+ * yks-icon-search-small
450
+ * yks-icon-dropdown
451
+ * yks-icon-mute
452
+ * yks-icon-unmute
453
+ ```
541
454
 
542
- - TinyMCE `emphasis` plugin.
543
- - Added `yks-acebuilds`.
455
+ ![图标1](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353086056-image_92206224151742353086019.png)
456
+ ![图标2](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353119277-image_90261787661742353119254.png)
544
457
 
545
- ## License
458
+ ### LICENSE
546
459
 
547
460
  [MIT](LICENSE)