yks-element 2.0.4-private.3 → 2.0.5

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 +407 -498
  2. package/lib/yks.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,547 +1,456 @@
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
8
+ import '~yks-element/lib/theme-chalk/index.css';
59
9
 
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 |
10
+ Vue.use(YksElement)
66
11
 
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:
76
-
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.
81
-
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
- ```
111
-
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
19
  ```
120
20
 
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 |
134
-
135
- ## Components
21
+ ### YKS-ELEMENT 文档
136
22
 
137
- Template tags use the component `name`. `YksDialog` is `<yks-dialog>`.
23
+ #### 2.0.0 更新文档
138
24
 
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` |
25
+ 新增 `YksAudio` 音频条播放器;`YksMultimedia` 在 `isAudioPlay` 且音频后缀时走 `yks-audio`(mp3/wav/aac),外层可加 `is-audio-play-bar` 全宽条;`playLimitEnabled` 开启后点击播放抛 `play-request`(需外部调用 `play()`),并禁止拖进度。
156
26
 
157
- Element UI components (`Button`, `Input`, `Table`, `DatePicker`, and the rest of the public export list) are re-exported from this package.
27
+ #### 1.7.0 更新文档()
158
28
 
159
- ### yks-dialog
29
+ 新增YksVideoPlayer组件,支持视频播放功能;在App.vue中添加示例用法;优化Multimedia组件的样式和功能;更新依赖项以支持新特性。
160
30
 
161
- Extends `el-dialog`. Unlisted props and events are passed through.
31
+ #### 1.6.3 更新文档
162
32
 
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` |
171
-
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
33
+ ``` javascript
298
34
  {
299
- toolbar: ['selectVideo']
35
+ toolbar : ['selectVideo']
300
36
  }
301
37
  ```
302
38
 
303
- Emphasis mark plugin:
39
+ ```text
40
+ selectVideo 新增选择视频
41
+ 点击抛出 selectVideo 事件
42
+ ```
43
+
44
+ #### 1.6.2 新增着重号 emphasis
304
45
 
305
- ```javascript
46
+ ``` javascript
306
47
  {
307
- plugins: ['emphasis'],
308
- toolbar: ['emphasis']
48
+ plugins : ['emphasis'],
49
+ toolbar : ['emphasis']
309
50
  }
310
51
  ```
311
52
 
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'
53
+ #### 新增ace-builds 编辑器
54
+
55
+ ``` javascript
56
+ [
57
+ { label: 'JavaScript', value: 'javascript' },
58
+ { label: 'Objective-C', value: 'objectivec' },
59
+ { label: 'C++', value: 'c_cpp' },
60
+ { label: 'Java', value: 'java' },
61
+ { label: 'C#', value: 'csharp' },
62
+ { label: 'Go', value: 'golang' },
63
+ { label: 'Python', value: 'python' },
64
+ { label: 'PHP', value: 'php' },
65
+ { label: 'SQL', value: 'sql' },
66
+ ]
410
67
  ```
411
68
 
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>
69
+ ```text
70
+ * yks-video-player 播放器(基于 vue-video-player@5 + video.js@6)
71
+ - 使用前需在项目入口引入 video.js 样式:
72
+ import 'video.js/dist/video-js.css'
73
+ - Attribute
74
+ - src 视频/音频 URL
75
+ - width 播放器宽度(px),默认 640
76
+ - height 播放器高度(px),默认 360
77
+ - poster 封面图片 URL,为空时自动截取视频第一帧
78
+ - autoplay 是否自动播放,默认 false
79
+ - loop 是否循环播放,默认 false
80
+ - muted 是否静音,默认 false
81
+ - fluid 是否响应式撑满父容器,默认 false(开启后 width/height 失效)
82
+ - sources 多清晰度源数组 [{ src, type, label }],优先级高于 src
83
+ - playbackRates 倍速选项数组,默认 [0.5, 1, 1.5, 2]
84
+ - options video.js 原生 options 对象透传(高级配置)
85
+ - Methods(Events)
86
+ - ready 播放器实例就绪,参数:player(video.js 实例)
87
+ - play 开始播放,参数:player
88
+ - pause 暂停,参数:player
89
+ - ended 播放结束,参数:player
90
+ - timeupdate 进度更新,参数:{ currentTime, duration }
91
+ - error 播放错误,参数:err
92
+
93
+ * yks-acebuilds 代码编辑器
94
+ - Attribute
95
+ - value(v-model) 编辑器绑定值(代码字符串),必填
96
+ - theme 主题,默认 tomorrow_night(可选 monokai、chrome)
97
+ - language 编程语言,默认 javascript(可选 java、python、sql 等)
98
+ - disabled 是否只读,默认 false
99
+ - noCopy 是否禁用 Ctrl+C/V/X,默认 false
100
+ - autosize 是否显示拖拽调高手柄,默认 false
101
+ - height 编辑器高度(px),默认 400
102
+ - fontSize 字体大小(px),默认 16
103
+ - tabSize Tab 缩进空格数,默认 4
104
+ - lockedLines 锁定只读的行号数组(1-based),默认 []
105
+ - Methods(Events)
106
+ - input 内容变更,参数:value(用于 v-model)
107
+ - Ref Methods(通过 $refs 调用)
108
+ - setValue() 将当前 value prop 重新同步到编辑器
109
+ - setTheme() 将当前 theme prop 应用到编辑器
110
+ - setTabSize() 将当前 tabSize prop 应用到编辑器
111
+ - setFontSize() 将当前 fontSize prop 应用到编辑器
112
+
113
+ * yks-waveview 播放音频并显示波形轨迹
114
+ - Attribute
115
+ - processSlotClass WaveView 视图挂载目标的 class 名,默认 IctrlProcessWave
116
+ - url 要播放的音频文件 URL
117
+ - styleWave 波形容器自定义样式对象
118
+ - loop 是否循环播放
119
+ - Ref Methods(通过 $refs 调用)
120
+ - onStart() 开始加载并播放音频
121
+ - onPause() 暂停播放
122
+ - onResume() 恢复播放
123
+ - onStop() 停止播放并重置状态
124
+ - setRealtimeOn() 切换为实时模式(降低延迟,丢弃积压数据)
125
+ - setRealtimeOff() 切换为非实时模式(顺序完整播放所有数据)
126
+ - receiveAudioChunk(arrayBuffer) 接收外部实时音频片段数据(ArrayBuffer)
127
+
128
+ * yks-recorders 录音并显示音频轨迹
129
+ - Attribute
130
+ - fileSize 录音最大时长(单位 s),0 表示不限制,默认 600
131
+ - sampleRate 录音采样率,默认 16000
132
+ - bitRate 录音比特率,默认 16
133
+ - type 录制输出格式,默认 mp3
134
+ - disabled 是否禁止录制,默认 false
135
+ - processSlotClass 使用 process slot 时 WaveView 挂载目标的 class 名
136
+ - title 自定义状态标题文字
137
+ - showProcess 是否显示录制波形轨迹,默认 false
138
+ - Slot
139
+ - default(作用域插槽) 自定义录音控件 UI,作用域变量:onRecord、timestamp、resetData
140
+ - process 自定义波形显示区域(需配合 processSlotClass 使用)
141
+ - Methods(Events)
142
+ - change 录音完成后触发,参数:{ blob, duration, timestamp, powerLevel, fileSrc }
143
+ - succress 每次录音操作成功后触发,参数:true
144
+ - error 录音出错时触发,参数:error 对象
145
+ - buffers showProcess=true 时实时推送录音缓冲数据,参数:{ buffers, powerLevel, sampleRate }
146
+ - Ref Methods(通过 $refs 调用)
147
+ - onRecord() 开始/停止录音(toggle)
148
+ - resetData() 重置所有录音状态数据
149
+
150
+ * yks-dialog 弹窗(继承 el-dialog 全部属性与事件)
151
+ - Attribute
152
+ - show 是否显示 Dialog,支持 .sync 修饰符,默认 false
153
+ - height 内容区滚动高度,默认 390px
154
+ - loading 确定按钮 loading 状态,默认 false
155
+ - disabledSure 是否禁用确定按钮,默认 false
156
+ - footer 是否显示底部操作区,默认 true
157
+ - (其余属性完全继承 el-dialog,如 title、width、top、modal、append-to-body 等)
158
+ - Slot
159
+ - title 自定义 Dialog 标题区域
160
+ - default 内容区(被 yks-scrollbar 包裹)
161
+ - footer 自定义底部操作区(默认渲染"确定/取消"按钮)
162
+ - Methods(Events)
163
+ - close 点击取消或关闭时触发
164
+ - sure 点击确定时触发
165
+ - (其余事件完全继承 el-dialog,如 open、opened、closed)
166
+
167
+ * yks-audio 音频条播放器(原生 audio + 自定义控制条)
168
+ - Attribute
169
+ - src 音频 URL,必填(mp3 / wav / aac)
170
+ - width 预留宽度(px),默认 160(条形样式以 100% 撑满父级为准)
171
+ - height 预留高度(px),默认 90
172
+ - playLimitEnabled 是否开启播放限制,默认 false(true:点击播放抛 play-request,禁止拖进度)
173
+ - allowPause 限制开启时是否允许暂停,默认 true
174
+ - 展示
175
+ - 有总时长:右侧显示 当前 / 总时长(如 0:00 / 3:43)
176
+ - 拿不到总时长:只显示当前播放时间,进度条不可拖
177
+ - Methods(Events)
178
+ - play-request playLimitEnabled=true 且未在播放时,用户点击播放按钮触发;需外部再调用 play()
179
+ - Ref Methods(通过 $refs 调用)
180
+ - play() 外部触发播放,返回 Promise
181
+ - forcePause() 外部强制暂停(超次等)
182
+ - getMediaEl() 返回内部 HTMLAudioElement
183
+
184
+ * yks-multimedia 媒体文件显示(图片/音频/视频/文档)
185
+ - Attribute
186
+ - data 文件信息对象,含 content(文件 URL)、fileName(文件名)
187
+ - visibleDel 是否显示删除按钮,默认 false
188
+ - width 宽度(px),默认 160(音频条模式下由 is-audio-play-bar 撑满)
189
+ - height 高度(px),默认 90
190
+ - customize 是否自定义视频放大(客户端模式自动为 true,移动端自动为 false),默认 true
191
+ - visibleFileName 是否显示文件名称,默认 true
192
+ - client 是否为客户端模式(android 下自动设置为 true),默认 false
193
+ - isAudioPlay 是否使用音频条 yks-audio,默认 false(需同时为 mp3/wav/aac)
194
+ - playLimitEnabled 是否开启播放限制(透传 yks-audio / yks-video),默认 false
195
+ - allowPause 限制开启时是否允许暂停,默认 true
196
+ - Methods(Events)
197
+ - delete 点击删除图标时触发,参数:data(当前文件信息对象),与 visibleDel 联动
198
+ - play-request 限制模式下用户点击播放时触发,需外部调用内部播放器 play()
199
+ - Ref Methods(通过 $refs 调用)
200
+ - play() 触发内部 yks-video 播放(音频条请 $refs.innerAudio.play())
201
+ - forcePause() 强制暂停内部 yks-video
202
+
203
+ * yks-pagination 分页
204
+ - Attribute
205
+ - pageOption 分页状态对象(必填),含 total(总条数)、page(当前页)、pageSize(每页条数)
206
+ - pageSizes 每页条数可选列表,默认 [10, 20, 50, 100]
207
+ - layout 分页布局,默认 sizes, total, prev, pager, next, jumper
208
+ - background 是否为分页按钮添加背景色,默认 false
209
+ - hidden 是否隐藏分页组件,默认 false
210
+ - Methods(Events)
211
+ - pagination 页码或每页条数变更时触发,参数:更新后的 pageOption 对象
212
+
213
+ * yks-scrollbar 自定义滚动条
214
+ - Attribute
215
+ - height 滚动区容器高度(CSS 值,如 390px、100%),默认 auto
216
+ - Slot
217
+ - default 被滚动区包裹的内容
218
+
219
+ * yks-select 下拉选择(继承 el-select 全部属性与事件)
220
+ - Attribute
221
+ - data 下拉选项数据列表,默认 []
222
+ - domNum 每次渲染的 DOM 条数,默认 10
223
+ - domLimit 是否启用内部列表渲染模式,默认 true(false 时使用默认 slot)
224
+ - optionMap 自定义字段映射,如 { value: 'id', label: 'name', disabled: 'dis' }
225
+ - valueKey 作为 value 唯一标识的键名(对象值时使用)
226
+ - clearable 是否可清空,默认 false
227
+ - allowBottom 是否显示吸底区域(footer 插槽),默认 false
228
+ - filterableInline 搜索框是否置于下拉框内部,默认 false
229
+ - (其余属性完全继承 el-select)
230
+ - Slot
231
+ - default domLimit=false 时自定义完整选项列表
232
+ - options 作用域插槽,自定义每个选项内容,作用域变量:item
233
+ - footer 吸底插槽(需 allow-bottom=true)
234
+ - Methods(Events)
235
+ - input 选中值变化,参数:当前选中值(用于 v-model)
236
+ - scrollBottom remote 模式下滚动到底部时触发(用于加载更多)
237
+ - (其余事件继承 el-select)
238
+ - Ref Methods(通过 $refs 调用)
239
+ - focus() 使选择器聚焦
240
+ - blur() 使选择器失焦
241
+
242
+ * yks-table 表格(继承 el-table 全部属性与事件)
243
+ - Attribute
244
+ - columns 列定义数组,每项属性完全兼容 el-table-column 的 props
245
+ - dom 是否启用内部自动列渲染,默认 true(false 时通过默认 slot 自定义列)
246
+ - emptyMsg 暂无数据时的提示文字,默认 暂无数据~
247
+ - (其余属性完全继承 el-table,如 data、height、stripe、border、row-key 等)
248
+ - Slot
249
+ - default dom=false 时自定义列(直接放 el-table-column)
250
+ - [col.prop] 每列单元格内容插槽,作用域变量:row、$index、column、columnIndex
251
+ - header[col.prop] 每列表头插槽,作用域变量:column、$index
252
+ - expand 展开行插槽,作用域变量:row、scope、$index
253
+ - append 插入至表格最后一行之后
254
+ - empty 空数据时显示的内容
255
+ - (所有 el-table 原生事件均透传,如 selection-change、row-click、sort-change)
256
+
257
+ * yks-tinymce 富文本编辑器
258
+ - Attribute
259
+ - value(v-model) 编辑器绑定值(HTML 富文本),必填
260
+ - videoWidth 附件区视频宽度(px),默认 160
261
+ - videoHeight 附件区视频高度(px),默认 90
262
+ - effect 主题标识,默认 default
263
+ - language 语言包,默认 zh_CN
264
+ - toolbar 扩展工具栏(数组或字符串),默认 []
265
+ - charLimit 字数上限,默认 5000
266
+ - plugins 插件列表,默认 []
267
+ - menubar 菜单栏,默认 file edit insert view format table
268
+ - fontsizeFormats 字号选项字符串
269
+ - height 编辑器高度,默认 660px
270
+ - width 编辑器宽度,默认 auto
271
+ - inline 是否使用内联模式,默认 false
272
+ - autosize 是否显示拖拽调高手柄,默认 false
273
+ - fileParamsAttributes fileParams自定义模式
274
+ - fileParams 附件数据列表,参考yks-multimedia
275
+ - uploadFileToHwCloud 图片上传函数,接收 blobInfo,返回图片 URL
276
+ - uploadFileFunction 音视频/文件上传函数
277
+ - externalPlugins 外部插件扩展对象
278
+ - accept 限制图片上传类型(后缀数组),默认 []
279
+ - moreParameters 透传到 tinymce init 的额外参数对象
280
+ - Methods(Events)
281
+ - input 内容变更,参数:value(用于 v-model)
282
+ - blur 焦点变化,参数:true(失焦)/ false(聚焦)
283
+ - delte 删除附件,参数:{ row, index }(注意事件名拼写为 delte)
284
+ - change 上传音视频/文件确认后触发,参数:{ value, itemAttr: { type, content } }
285
+ - selectVideo 工具栏点击"选择视频"按钮时触发
286
+ - Ref Methods(通过 $refs 调用)
287
+ - handleInsertContent(value) 向编辑器光标处插入 HTML 内容
288
+ - deleFillItem(index) 删除第 index 个填空输入框并重新编号
289
+
290
+ * yks-uploadFile 文件上传弹窗
291
+ - Attribute
292
+ - show 是否显示弹窗,支持 .sync 修饰符,默认 false
293
+ - title Dialog 标题
294
+ - uploadFileFunction 自定义上传函数,接收 { file, fileData, fileSrc },需返回 Promise
295
+ - fileData 文件配置信息,含 fileType、typeList、fileSize、types 字段
296
+ - excludeList 排除的文件类型后缀数组,默认 []
297
+ - Slot
298
+ - footer 自定义底部按钮区,作用域变量:row(当前文件数据)
299
+ - Methods(Events)
300
+ - sure 文件上传成功后触发,参数:上传函数返回的 data
301
+ - update:show 关闭弹窗时触发(.sync 机制)
302
+
303
+ * yks-video 轻量视频/音频播放器
304
+ - Attribute
305
+ - src 视频/音频 URL,必填
306
+ - width 播放器宽度(px),默认 160
307
+ - height 播放器高度(px),默认 90
308
+ - customize 是否使用自定义全屏事件(替换原生全屏),默认 false
309
+ - fullScreen 是否显示全屏图标按钮(仅 mp4 生效),默认 true
310
+ - playLimitEnabled 是否开启播放限制,默认 false(true:点击播放抛 play-request,可禁拖/禁暂停)
311
+ - allowPause 限制开启时是否允许暂停/拖进度,默认 true
312
+ - Methods(Events)
313
+ - customize customize=true 时点击全屏按钮或双击视频触发,参数:videoEl、{ src, musicDuration, id }
314
+ - play-request playLimitEnabled=true 且未在播放时,用户点击播放触发;需外部再调用 play()
315
+ - Ref Methods(通过 $refs 调用)
316
+ - play() 外部触发播放,返回 Promise
317
+ - forcePause() 外部强制暂停
473
318
  ```
474
319
 
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`.
476
-
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
320
+ ### 更新依赖
483
321
 
484
- ```bash
485
- yarn
486
- yarn serve # example app
487
- yarn lint
488
- yarn dist # library bundle and theme CSS
322
+ ```shell
323
+ npm install yks-element@latest -S
324
+ or
325
+ yarn add yks-element@latest -S
489
326
  ```
490
327
 
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`.
328
+ ### 发布npm包
494
329
 
495
- ## Publish
496
-
497
- ```bash
330
+ ```shell
498
331
  npm publish
499
332
  ```
500
333
 
501
- Beta:
334
+ ### 发布测试包
502
335
 
503
- ```bash
504
- # set version to x.y.z-beta.n first
336
+ ```shell
337
+ version : '0.0.1-beta'
505
338
  npm publish --tag=beta
506
339
  ```
507
340
 
508
- Unpublishing a version is destructive. Use it only for a release that was never consumed:
341
+ ### 下载测试包
509
342
 
510
- ```bash
511
- npm unpublish yks-element@0.0.1 --force
343
+ ```shell
344
+ npm install yks-element@beta
512
345
  ```
513
346
 
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()`.
347
+ ### 删除npm包
530
348
 
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`.
349
+ ```shell
350
+ npm unpublish yks-element@0.0.1 --force
351
+ ```
539
352
 
540
- ### 1.6.2
353
+ ### yks-icon 图标库
354
+
355
+ ```text
356
+ * yks-icon-camera
357
+ * yks-icon-download
358
+ * yks-icon-excel
359
+ * yks-icon-other
360
+ * yks-icon-pdf
361
+ * yks-icon-ppt
362
+ * yks-icon-word
363
+ * yks-icon-play
364
+ * yks-icon-microphone
365
+ * yks-icon-finish
366
+ * yks-icon-puase
367
+ * yks-icon-bichen
368
+ * yks-icon-edit
369
+ * yks-icon-message
370
+ * yks-icon-notification
371
+ * yks-icon-duixiao
372
+ * yks-icon-circle
373
+ * yks-icon-export
374
+ * yks-icon-publish
375
+ * yks-icon-close
376
+ * yks-icon-select
377
+ * yks-icon-import
378
+ * yks-icon-filter
379
+ * yks-icon-merge
380
+ * yks-icon-split
381
+ * yks-icon-archive
382
+ * yks-icon-calendar
383
+ * yks-icon-warning
384
+ * yks-icon-toggle
385
+ * yks-icon-up-arrow
386
+ * yks-icon-down-arrow
387
+ * yks-icon-left-arrow
388
+ * yks-icon-right-arrow
389
+ * yks-icon-caret-bottom
390
+ * yks-icon-report
391
+ * yks-icon-notes
392
+ * yks-icon-settings
393
+ * yks-icon-exam
394
+ * yks-icon-log
395
+ * yks-icon-management
396
+ * yks-icon-practice
397
+ * yks-icon-user
398
+ * yks-icon-add
399
+ * yks-icon-audio
400
+ * yks-icon-video
401
+ * yks-icon-refresh-time
402
+ * yks-icon-list
403
+ * yks-icon-pause
404
+ * yks-icon-flag
405
+ * yks-icon-voice
406
+ * yks-icon-quiz
407
+ * yks-icon-alert
408
+ * yks-icon-application
409
+ * yks-icon-setting
410
+ * yks-icon-organization
411
+ * yks-icon-clipboard
412
+ * yks-icon-duplicate
413
+ * yks-icon-zoom
414
+ * yks-icon-translate
415
+ * yks-icon-record
416
+ * yks-icon-snapshot
417
+ * yks-icon-synchronize
418
+ * yks-icon-volume
419
+ * yks-icon-gear
420
+ * yks-icon-arrow-down
421
+ * yks-icon-silence
422
+ * yks-icon-sound
423
+ * yks-icon-exam-receive
424
+ * yks-icon-exam-warning
425
+ * yks-icon-expand
426
+ * yks-icon-strengthen
427
+ * yks-icon-collapse
428
+ * yks-icon-restrict-video
429
+ * yks-icon-carousel-settings
430
+ * yks-icon-video-guard
431
+ * yks-icon-restriction
432
+ * yks-icon-live-broadcast
433
+ * yks-icon-refresh
434
+ * yks-icon-message-normal
435
+ * yks-icon-message-small
436
+ * yks-icon-id-route
437
+ * yks-icon-unified-route
438
+ * yks-icon-tracking
439
+ * yks-icon-notification-log
440
+ * yks-icon-multi-notification
441
+ * yks-icon-voice-4
442
+ * yks-icon-fullscreen
443
+ * yks-icon-device-monitor
444
+ * yks-icon-person-recognition
445
+ * yks-icon-search-small
446
+ * yks-icon-dropdown
447
+ * yks-icon-mute
448
+ * yks-icon-unmute
449
+ ```
541
450
 
542
- - TinyMCE `emphasis` plugin.
543
- - Added `yks-acebuilds`.
451
+ ![图标1](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353086056-image_92206224151742353086019.png)
452
+ ![图标2](https://obs-ogt.obs.cn-east-3.myhuaweicloud.com:443/tinymce/1742353119277-image_90261787661742353119254.png)
544
453
 
545
- ## License
454
+ ### LICENSE
546
455
 
547
456
  [MIT](LICENSE)