sohelp-eleplus 1.1.26 → 1.1.28
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.
- package/components.js +1 -0
- package/icons/flag/README.md +2 -2
- package/icons/flag/index.js +0 -1
- package/package.json +1 -1
- package/sohelp-ace-editor/README.md +32 -42
- package/sohelp-ace-editor/index.vue +166 -156
- package/sohelp-api-doc/README.md +36 -0
- package/sohelp-api-doc/index.vue +160 -0
- package/sohelp-application-select/README.md +9 -7
- package/sohelp-application-select/index.vue +10 -13
- package/sohelp-autocode/README.md +14 -26
- package/sohelp-calendar-view/README.md +9 -7
- package/sohelp-calendar-view/index.vue +10 -9
- package/sohelp-card/README.md +15 -17
- package/sohelp-card/index.vue +1 -1
- package/sohelp-card-view/README.md +9 -7
- package/sohelp-card-view/index.vue +10 -9
- package/sohelp-condition/README.md +29 -49
- package/sohelp-condition/index.vue +2 -1
- package/sohelp-country-select/README.md +15 -123
- package/sohelp-country-select/index.vue +1 -1
- package/sohelp-cry-input/README.md +19 -195
- package/sohelp-cry-input/index.vue +6 -2
- package/sohelp-date/README.md +12 -15
- package/sohelp-datetime/README.md +15 -17
- package/sohelp-datetime-picker/README.md +18 -18
- package/sohelp-datetime-picker/index.vue +11 -4
- package/sohelp-datetime-range/README.md +20 -23
- package/sohelp-demo-block/README.md +43 -0
- package/sohelp-demo-block/index.vue +229 -0
- package/sohelp-dict/README.md +28 -23
- package/sohelp-dict/index.vue +17 -17
- package/sohelp-drawer/README.md +28 -26
- package/sohelp-drop-card/README.md +29 -28
- package/sohelp-drop-card/index.vue +0 -1
- package/sohelp-dyn-select/README.md +31 -16
- package/sohelp-dyn-select/index.vue +65 -67
- package/sohelp-dyn-tree/README.md +26 -20
- package/sohelp-dyn-tree/index.vue +2 -2
- package/sohelp-dyn-tree-select/README.md +28 -19
- package/sohelp-dyn-tree-select/index.vue +23 -7
- package/sohelp-entity-form/README.md +65 -30
- package/sohelp-entity-form/index.vue +3 -2
- package/sohelp-entity-grid/README.md +13 -11
- package/sohelp-entity-grid/index.vue +1 -1
- package/sohelp-file-upload/README.md +25 -27
- package/sohelp-file-upload/index.vue +1 -1
- package/sohelp-filter-scheme/README.md +34 -30
- package/sohelp-filter-scheme/index.vue +2 -2
- package/sohelp-grid/README.md +52 -33
- package/sohelp-grid/index.vue +41 -39
- package/sohelp-grid/js/SohelpGridConfig.js +3 -3
- package/sohelp-grid/js/useSohelpGridConfig.js +4 -6
- package/sohelp-grid-select/README.md +32 -27
- package/sohelp-grid-select/index.vue +6 -5
- package/sohelp-grid-view/README.md +51 -22
- package/sohelp-grid-view-select/README.md +33 -25
- package/sohelp-grid-view-select/index.vue +2 -1
- package/sohelp-group-view/README.md +14 -4
- package/sohelp-group-view/index.vue +10 -9
- package/sohelp-icon-select/README.md +14 -12
- package/sohelp-image-upload/README.md +27 -27
- package/sohelp-image-upload/index.vue +2 -2
- package/sohelp-import/README.md +25 -24
- package/sohelp-input/README.md +27 -11
- package/sohelp-input/index.vue +15 -2
- package/sohelp-input-tag/README.md +53 -0
- package/sohelp-input-tag/index.vue +337 -0
- package/sohelp-modal/README.md +42 -16
- package/sohelp-modal/index.vue +21 -4
- package/sohelp-modal-select/README.md +745 -0
- package/sohelp-modal-select/index.vue +705 -0
- package/sohelp-module/README.md +24 -13
- package/sohelp-number-input/README.md +15 -8
- package/sohelp-number-input/index.vue +3 -0
- package/sohelp-number-range/README.md +22 -12
- package/sohelp-number-range/index.vue +3 -11
- package/sohelp-org-modal-select/README.md +47 -0
- package/sohelp-org-modal-select/index.vue +411 -0
- package/sohelp-org-select/README.md +23 -10
- package/sohelp-org-select/index.vue +41 -24
- package/sohelp-org-tree/README.md +19 -7
- package/sohelp-org-tree/index.vue +1 -2
- package/sohelp-org-tree-select/README.md +22 -11
- package/sohelp-org-tree-select/index.vue +1 -2
- package/sohelp-org-user-tree/README.md +19 -7
- package/sohelp-org-user-tree/index.vue +1 -2
- package/sohelp-org-user-tree-select/README.md +8 -3
- package/sohelp-org-user-tree-select/index.vue +8 -7
- package/sohelp-page/README.md +20 -11
- package/sohelp-page/index.vue +1 -1
- package/sohelp-pagination/README.md +14 -6
- package/sohelp-pagination/index.vue +1 -1
- package/sohelp-power/README.md +34 -19
- package/sohelp-power/index.vue +2 -2
- package/sohelp-pro-form/README.md +64 -21
- package/sohelp-pro-layout/README.md +10 -4
- package/sohelp-pro-layout/index.vue +8 -7
- package/sohelp-pro-table/README.md +30 -6
- package/sohelp-process/README.md +26 -13
- package/sohelp-process/index.vue +6 -6
- package/sohelp-rate/README.md +24 -12
- package/sohelp-rate/index.vue +5 -1
- package/sohelp-relation/README.md +10 -4
- package/sohelp-relation/index.vue +8 -7
- package/sohelp-relation-modal-select/README.md +41 -0
- package/sohelp-relation-modal-select/index.vue +70 -0
- package/sohelp-rich-text/README.md +29 -11
- package/sohelp-rich-text/index.vue +21 -20
- package/sohelp-richtext/README.md +12 -2
- package/sohelp-richtext/index.vue +8 -6
- package/sohelp-role-modal-select/README.md +45 -0
- package/sohelp-role-modal-select/index.vue +111 -0
- package/sohelp-role-select/README.md +18 -10
- package/sohelp-role-select/index.vue +36 -27
- package/sohelp-search/README.md +12 -4
- package/sohelp-search/index.vue +2 -2
- package/sohelp-search-pro-form/README.md +15 -1
- package/sohelp-search-pro-form/index.vue +2 -1
- package/sohelp-select/README.md +31 -30
- package/sohelp-select/index.vue +79 -84
- package/sohelp-split-panel/README.md +17 -18
- package/sohelp-switch/README.md +21 -19
- package/sohelp-switch/index.vue +34 -33
- package/sohelp-table/README.md +35 -27
- package/sohelp-table/index.vue +110 -109
- package/sohelp-table-select/README.md +55 -0
- package/sohelp-tenant-select/README.md +19 -18
- package/sohelp-tenant-select/index.vue +105 -109
- package/sohelp-text/README.md +16 -10
- package/sohelp-text/index.vue +5 -5
- package/sohelp-textarea-input/README.md +19 -12
- package/sohelp-time/README.md +11 -10
- package/sohelp-tree/README.md +24 -19
- package/sohelp-tree/index.vue +21 -23
- package/sohelp-tree-select/README.md +23 -10
- package/sohelp-user-modal-select/README.md +739 -0
- package/sohelp-user-modal-select/index.vue +87 -0
- package/sohelp-user-select/README.md +26 -15
- package/sohelp-user-select/index.vue +6 -2
- package/sohelp-user-tag/README.md +5 -7
- package/sohelp-user-tag/index.vue +8 -8
- package/sohelp-user-tree/README.md +5 -8
- package/sohelp-user-tree/index.vue +8 -7
- package/sohelp-vform-drawer/README.md +36 -18
- package/sohelp-vform-drawer/index.vue +2 -2
- package/sohelp-vform-eleplus/README.md +33 -31
- package/sohelp-vform-eleplus/index.vue +2 -2
- package/sohelp-vform-eleplus/tinymce/langs/zh_CN.js +461 -461
- package/sohelp-vform-eleplus/tinymce/langs/zh_TW.js +418 -418
- package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.css +72 -72
- package/sohelp-vform-eleplus/tinymce/skins/content/dark/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/content/default/content.css +67 -67
- package/sohelp-vform-eleplus/tinymce/skins/content/default/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/content/document/content.css +72 -72
- package/sohelp-vform-eleplus/tinymce/skins/content/document/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.css +68 -68
- package/sohelp-vform-eleplus/tinymce/skins/content/writer/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.css +732 -732
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.css +726 -726
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.inline.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.css +29 -29
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/content.mobile.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.css +3047 -3047
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.css +673 -673
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.css +37 -37
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide/skin.shadowdom.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.css +714 -714
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.css +726 -726
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.css +29 -29
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/content.mobile.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.css +3047 -3047
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.css +673 -673
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +7 -7
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +37 -37
- package/sohelp-vform-eleplus/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +7 -7
- package/sohelp-vform-modal/README.md +36 -18
- package/sohelp-vform-modal/index.vue +2 -2
- package/sohelp-vform-select/README.md +9 -7
- package/sohelp-vform-select/index.vue +8 -7
- package/sohelp-vxe-grid/DefaultGridOptions.js +5 -3
- package/sohelp-vxe-grid/DefaultProps.js +0 -1
- package/sohelp-vxe-grid/README.md +540 -35
- package/sohelp-vxe-grid/SohelpGridConfig.js +8 -6
- package/sohelp-vxe-grid/index.vue +141 -94
- package/sohelp-vxe-grid-select/README.md +41 -26
- package/sohelp-vxe-table/README.md +23 -20
- package/sohelp-vxe-table/index.vue +5 -4
- package/sohelp-workflow/README.md +21 -17
- package/sohelp-workflow/index.vue +25 -22
- package/sohelp-workflow-drawer/README.md +41 -28
- package/sohelp-workflow-drawer/components/table.vue +7 -1
- package/sohelp-workflow-drawer/index.vue +86 -71
- package/sohelp-workflow-drawer/js/index.js +15 -13
- package/style/index.scss +0 -0
- package/utils/safe-eval.js +89 -0
- package/sohelp-dyn-select/props.js +0 -67
- package/sohelp-user-select/index.vue~ +0 -53
- package/sohelp-user-select/props.js +0 -71
package/components.js
CHANGED
|
@@ -21,6 +21,7 @@ export { default as SohelpDatetimeRange } from './sohelp-datetime-range/index.vu
|
|
|
21
21
|
export { default as SohelpDatetime } from './sohelp-datetime/index.vue';
|
|
22
22
|
export { default as SohelpDatetimePicker } from './sohelp-datetime-picker/index.vue';
|
|
23
23
|
export { default as SohelpInput } from './sohelp-input/index.vue';
|
|
24
|
+
export { default as SohelpInputTag } from './sohelp-input-tag/index.vue';
|
|
24
25
|
export { default as SohelpNumberInput } from './sohelp-number-input/index.vue';
|
|
25
26
|
export { default as SohelpNumberRange } from './sohelp-number-range/index.vue';
|
|
26
27
|
export { default as SohelpSwitch } from './sohelp-switch/index.vue';
|
package/icons/flag/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
|
-
import { UsaFlag, ChinaFlag, EuropeFlag } from '
|
|
19
|
+
import { UsaFlag, ChinaFlag, EuropeFlag } from 'sohelp-eleplus/icons/flag';
|
|
20
20
|
</script>
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ import { UsaFlag, ChinaFlag, EuropeFlag } from '@/components/sohelp-eleplus/icon
|
|
|
24
24
|
|
|
25
25
|
```vue
|
|
26
26
|
<script setup>
|
|
27
|
-
import * as FlagIcons from '
|
|
27
|
+
import * as FlagIcons from 'sohelp-eleplus/icons/flag';
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
30
|
<template>
|
package/icons/flag/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export { default as JapanFlag } from './JapanFlag.vue';
|
|
|
6
6
|
export { default as KoreaFlag } from './KoreaFlag.vue';
|
|
7
7
|
export { default as HongkongFlag } from './HongkongFlag.vue';
|
|
8
8
|
export { default as SingaporeFlag } from './SingaporeFlag.vue';
|
|
9
|
-
export { default as AustraliaFlag } from './AustraliaFlag.vue';
|
|
10
9
|
export { default as CanadaFlag } from './CanadaFlag.vue';
|
|
11
10
|
export { default as SwitzerlandFlag } from './SwitzerlandFlag.vue';
|
|
12
11
|
export { default as SwedenFlag } from './SwedenFlag.vue';
|
package/package.json
CHANGED
|
@@ -1,53 +1,43 @@
|
|
|
1
|
-
# 代码编辑器
|
|
1
|
+
# SohelpAceEditor 代码编辑器
|
|
2
2
|
|
|
3
|
-
基于
|
|
3
|
+
基于 Ace Editor 封装的代码编辑器组件,支持 JavaScript、JSON、CSS 语法高亮,自动补全和自定义快捷键。
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- **多语言支持**:内置支持 JavaScript, JSON, CSS 等模式。
|
|
8
|
-
- **智能提示**:支持代码片段提示和自定义代码补全。
|
|
9
|
-
- **快捷键绑定**:支持自定义快捷键触发回调。
|
|
10
|
-
- **格式化**:支持 JSON 格式化。
|
|
11
|
-
|
|
12
|
-
## 属性 (Props)
|
|
13
|
-
|
|
14
|
-
| 属性名 | 类型 | 默认值 | 说明 |
|
|
15
|
-
| :--- | :--- | :--- | :--- |
|
|
16
|
-
| modelValue | String | - | 绑定的代码内容 (v-model)。 |
|
|
17
|
-
| height | String | '400px' | 编辑器高度。 |
|
|
18
|
-
| readonly | Boolean | false | 是否只读。 |
|
|
19
|
-
| mode | String | 'javascript' | 语言模式,可选值:'javascript', 'json', 'css' 等。 |
|
|
20
|
-
| userWorker | Boolean | true | 是否开启语法检查。 |
|
|
21
|
-
| wrap | Boolean | true | 是否开启自动换行。 |
|
|
22
|
-
| bindKey | Object | null | 自定义快捷键配置对象。 |
|
|
23
|
-
|
|
24
|
-
## 事件 (Events)
|
|
25
|
-
|
|
26
|
-
| 事件名 | 说明 | 回调参数 |
|
|
27
|
-
| :--- | :--- | :--- |
|
|
28
|
-
| update:modelValue | 代码内容变化时触发。 | `value: string` |
|
|
29
|
-
| bindExec | 触发自定义快捷键时触发。 | `value: string` |
|
|
30
|
-
|
|
31
|
-
## 使用示例
|
|
5
|
+
## 基础用法
|
|
32
6
|
|
|
33
7
|
```vue
|
|
34
8
|
<template>
|
|
35
|
-
<sohelp-ace-editor
|
|
36
|
-
v-model="code"
|
|
37
|
-
mode="json"
|
|
38
|
-
height="500px"
|
|
39
|
-
:bindKey="{ win: 'Ctrl-S', mac: 'Command-S' }"
|
|
40
|
-
@bindExec="handleSave"
|
|
41
|
-
/>
|
|
9
|
+
<sohelp-ace-editor v-model="code" mode="javascript" height="400px" />
|
|
42
10
|
</template>
|
|
43
11
|
|
|
44
12
|
<script setup>
|
|
45
13
|
import { ref } from 'vue';
|
|
46
|
-
|
|
47
|
-
const code = ref('{"key": "value"}');
|
|
48
|
-
|
|
49
|
-
const handleSave = (val) => {
|
|
50
|
-
console.log('保存代码:', val);
|
|
51
|
-
};
|
|
14
|
+
const code = ref('console.log("Hello")');
|
|
52
15
|
</script>
|
|
53
16
|
```
|
|
17
|
+
|
|
18
|
+
## 属性 (Props)
|
|
19
|
+
|
|
20
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
| modelValue (v-model) | String | - | 否 | 编辑器内容 |
|
|
23
|
+
| height | String | `'400px'` | 否 | 编辑器高度 |
|
|
24
|
+
| readonly | Boolean | `false` | 否 | 是否只读 |
|
|
25
|
+
| mode | String | `'javascript'` | 否 | 语言模式,支持 `javascript`、`json`、`css` |
|
|
26
|
+
| userWorker | Boolean | `true` | 否 | 是否开启语法检查 |
|
|
27
|
+
| wrap | Boolean | `true` | 否 | 是否自动换行 |
|
|
28
|
+
| bindKey | Object | `null` | 否 | 自定义快捷键绑定,如 `{ win: 'Ctrl-Enter', mac: 'Command-Enter' }` |
|
|
29
|
+
|
|
30
|
+
## 事件 (Events)
|
|
31
|
+
|
|
32
|
+
| 事件名 | 回调参数 | 说明 |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| update:modelValue | `value: String` | 编辑器内容变化时触发 |
|
|
35
|
+
| bindExec | `value: String` | 自定义快捷键触发时的回调,返回当前内容 |
|
|
36
|
+
|
|
37
|
+
## 公开方法 (Expose)
|
|
38
|
+
|
|
39
|
+
- `getEditorAnnotations()` - 获取编辑器语法检查注解
|
|
40
|
+
- `setValue(newValue)` - 设置编辑器内容
|
|
41
|
+
- `formatJson(val)` - 格式化 JSON 内容
|
|
42
|
+
- `setJsonMode()` - 切换到 JSON 模式
|
|
43
|
+
- `setCssMode()` - 切换到 CSS 模式
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ace-container" ref="aceContainer">
|
|
3
3
|
<!-- 官方文档中使用id,这里禁止使用,在后期打包后容易出现问题,使用 ref 或者 DOM 就行 -->
|
|
4
|
-
<div class="ace-editor" ref="
|
|
4
|
+
<div class="ace-editor" ref="aceRef"></div>
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
|
-
<script>
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, onMounted, nextTick } from 'vue';
|
|
9
10
|
import ace from 'ace-builds';
|
|
10
11
|
/* 启用此行后webpack打包回生成很多动态加载的js文件,不便于部署,故禁用!!
|
|
11
12
|
特别提示:禁用此行后,需要调用ace.config.set('basePath', 'path...')指定动态js加载URL!!
|
|
@@ -19,173 +20,182 @@ import 'ace-builds/src-min-noconflict/mode-json'; //
|
|
|
19
20
|
import 'ace-builds/src-min-noconflict/mode-css'; //
|
|
20
21
|
import 'ace-builds/src-min-noconflict/ext-language_tools';
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
height: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '400px'
|
|
27
|
+
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: String
|
|
30
|
+
//required: true
|
|
31
|
+
},
|
|
32
|
+
readonly: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
mode: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'javascript'
|
|
39
|
+
},
|
|
40
|
+
userWorker: {
|
|
41
|
+
//是否开启语法检查,默认开启
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true
|
|
44
|
+
},
|
|
45
|
+
wrap: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
bindKey: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: null
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits(['update:modelValue', 'bindExec']);
|
|
56
|
+
|
|
57
|
+
const aceContainer = ref(null);
|
|
58
|
+
const aceRef = ref(null);
|
|
59
|
+
let aceEditor = null;
|
|
60
|
+
const themePath = 'ace/theme/sqlserver';
|
|
61
|
+
const modePath = 'ace/mode/javascript';
|
|
62
|
+
const codeValue = props.modelValue;
|
|
63
|
+
|
|
64
|
+
const addAutoCompletion = (aceLib) => {
|
|
65
|
+
let acData = [
|
|
66
|
+
{
|
|
67
|
+
meta: 'VForm API',
|
|
68
|
+
caption: 'getWidgetRef',
|
|
69
|
+
value: 'getWidgetRef()',
|
|
70
|
+
score: 1
|
|
45
71
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
72
|
+
{
|
|
73
|
+
meta: 'VForm API',
|
|
74
|
+
caption: 'getFormRef',
|
|
75
|
+
value: 'getFormRef()',
|
|
76
|
+
score: 1
|
|
49
77
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
78
|
+
{
|
|
79
|
+
meta: 'VForm API',
|
|
80
|
+
caption: 'getParentFormRef',
|
|
81
|
+
value: 'getParentFormRef()',
|
|
82
|
+
score: 1
|
|
53
83
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.aceEditor = ace.edit(this.$refs.ace, {
|
|
65
|
-
maxLines: maxLine, // 最大行数,超过会自动出现滚动条
|
|
66
|
-
minLines: 5, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
|
|
67
|
-
fontSize: 12, // 编辑器内字体大小
|
|
68
|
-
theme: this.themePath, // 默认设置的主题
|
|
69
|
-
mode: this.modePath, // 默认设置的语言模式
|
|
70
|
-
tabSize: 2, // 制表符设置为2个空格大小
|
|
71
|
-
readOnly: this.readonly,
|
|
72
|
-
highlightActiveLine: true,
|
|
73
|
-
value: this.codeValue,
|
|
74
|
-
wrap: this.wrap
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
this.aceEditor.setOptions({
|
|
78
|
-
enableBasicAutocompletion: true,
|
|
79
|
-
enableSnippets: true, // 设置代码片段提示
|
|
80
|
-
enableLiveAutocompletion: true // 设置自动提示
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (this.bindKey) {
|
|
84
|
-
this.aceEditor.commands.addCommand({
|
|
85
|
-
name: 'myShortcut',
|
|
86
|
-
bindKey: {
|
|
87
|
-
...this.bindKey
|
|
88
|
-
},
|
|
89
|
-
exec: (editor) => {
|
|
90
|
-
this.$emit('bindExec', this.modelValue);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (this.mode === 'json') {
|
|
96
|
-
this.setJsonMode();
|
|
97
|
-
} else if (this.mode === 'css') {
|
|
98
|
-
this.setCssMode();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!this.userWorker) {
|
|
102
|
-
this.aceEditor.getSession().setUseWorker(false);
|
|
84
|
+
//TODO: 待补充!!
|
|
85
|
+
];
|
|
86
|
+
let langTools = aceLib.require('ace/ext/language_tools');
|
|
87
|
+
langTools.addCompleter({
|
|
88
|
+
getCompletions: function (editor, session, pos, prefix, callback) {
|
|
89
|
+
if (prefix.length === 0) {
|
|
90
|
+
return callback(null, []);
|
|
91
|
+
} else {
|
|
92
|
+
return callback(null, acData);
|
|
93
|
+
}
|
|
103
94
|
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
const setJsonMode = () => {
|
|
99
|
+
aceEditor.getSession().setMode('ace/mode/json');
|
|
100
|
+
formatJson(codeValue);
|
|
101
|
+
};
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
data() {
|
|
115
|
-
return {
|
|
116
|
-
aceEditor: null,
|
|
117
|
-
themePath: 'ace/theme/sqlserver', // 不导入 webpack-resolver,该模块路径会报错
|
|
118
|
-
modePath: 'ace/mode/javascript', // 同上
|
|
119
|
-
codeValue: this.modelValue
|
|
120
|
-
};
|
|
121
|
-
},
|
|
103
|
+
const setCssMode = () => {
|
|
104
|
+
aceEditor.getSession().setMode('ace/mode/css');
|
|
105
|
+
};
|
|
122
106
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
meta: 'VForm API',
|
|
128
|
-
caption: 'getWidgetRef',
|
|
129
|
-
value: 'getWidgetRef()',
|
|
130
|
-
score: 1
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
meta: 'VForm API',
|
|
134
|
-
caption: 'getFormRef',
|
|
135
|
-
value: 'getFormRef()',
|
|
136
|
-
score: 1
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
meta: 'VForm API',
|
|
140
|
-
caption: 'getParentFormRef',
|
|
141
|
-
value: 'getParentFormRef()',
|
|
142
|
-
score: 1
|
|
143
|
-
}
|
|
144
|
-
//TODO: 待补充!!
|
|
145
|
-
];
|
|
146
|
-
let langTools = ace.require('ace/ext/language_tools');
|
|
147
|
-
langTools.addCompleter({
|
|
148
|
-
getCompletions: function (editor, session, pos, prefix, callback) {
|
|
149
|
-
if (prefix.length === 0) {
|
|
150
|
-
return callback(null, []);
|
|
151
|
-
} else {
|
|
152
|
-
return callback(null, acData);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
},
|
|
107
|
+
const getEditorAnnotations = () => {
|
|
108
|
+
return aceEditor.getSession().getAnnotations();
|
|
109
|
+
};
|
|
157
110
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
111
|
+
const setValue = (newValue) => {
|
|
112
|
+
aceEditor.getSession().setValue(newValue);
|
|
113
|
+
};
|
|
162
114
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
115
|
+
const formatJson = (val) => {
|
|
116
|
+
if (val) {
|
|
117
|
+
try {
|
|
118
|
+
var jsonValue = JSON.parse(val);
|
|
119
|
+
var formattedJson = JSON.stringify(jsonValue, null, 2);
|
|
120
|
+
aceEditor.setValue(formattedJson);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error('无效的json');
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
aceEditor.setValue('{}');
|
|
126
|
+
}
|
|
127
|
+
};
|
|
166
128
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
ace.config.set(
|
|
131
|
+
'basePath',
|
|
132
|
+
'https://ks3-cn-beijing.ksyun.com/vform2021/ace'
|
|
133
|
+
);
|
|
134
|
+
const h = Number(props.height.replace("px",""));
|
|
135
|
+
const maxLine = h/10 < 5 ? 5 : h /10;
|
|
136
|
+
addAutoCompletion(ace); //添加自定义代码提示!!
|
|
137
|
+
aceEditor = ace.edit(aceRef.value, {
|
|
138
|
+
maxLines: maxLine, // 最大行数,超过会自动出现滚动条
|
|
139
|
+
minLines: 5, // 最小行数,还未到最大行数时,编辑器会自动伸缩大小
|
|
140
|
+
fontSize: 12, // 编辑器内字体大小
|
|
141
|
+
theme: themePath, // 默认设置的主题
|
|
142
|
+
mode: modePath, // 默认设置的语言模式
|
|
143
|
+
tabSize: 2, // 制表符设置为2个空格大小
|
|
144
|
+
readOnly: props.readonly,
|
|
145
|
+
highlightActiveLine: true,
|
|
146
|
+
value: codeValue,
|
|
147
|
+
wrap: props.wrap
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
aceEditor.setOptions({
|
|
151
|
+
enableBasicAutocompletion: true,
|
|
152
|
+
enableSnippets: true, // 设置代码片段提示
|
|
153
|
+
enableLiveAutocompletion: true // 设置自动提示
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (props.bindKey) {
|
|
157
|
+
aceEditor.commands.addCommand({
|
|
158
|
+
name: 'myShortcut',
|
|
159
|
+
bindKey: {
|
|
160
|
+
...props.bindKey
|
|
161
|
+
},
|
|
162
|
+
exec: (editor) => {
|
|
163
|
+
emit('bindExec', props.modelValue);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
170
167
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
if (props.mode === 'json') {
|
|
169
|
+
setJsonMode();
|
|
170
|
+
} else if (props.mode === 'css') {
|
|
171
|
+
setCssMode();
|
|
172
|
+
}
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
var jsonValue = JSON.parse(val);
|
|
179
|
-
var formattedJson = JSON.stringify(jsonValue, null, 2);
|
|
180
|
-
this.aceEditor.setValue(formattedJson);
|
|
181
|
-
} catch (error) {
|
|
182
|
-
console.error('无效的json');
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
this.aceEditor.setValue('{}');
|
|
186
|
-
}
|
|
187
|
-
}
|
|
174
|
+
if (!props.userWorker) {
|
|
175
|
+
aceEditor.getSession().setUseWorker(false);
|
|
188
176
|
}
|
|
177
|
+
|
|
178
|
+
//编辑时同步数据
|
|
179
|
+
aceEditor.getSession().on('change', (ev) => {
|
|
180
|
+
emit('update:modelValue', aceEditor.getValue());
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
nextTick(() => {
|
|
184
|
+
aceRef.value.style.minHeight = props.height;
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
defineExpose({
|
|
189
|
+
getEditorAnnotations,
|
|
190
|
+
setValue,
|
|
191
|
+
formatJson,
|
|
192
|
+
setJsonMode,
|
|
193
|
+
setCssMode
|
|
194
|
+
});
|
|
195
|
+
</script>
|
|
196
|
+
<script>
|
|
197
|
+
export default {
|
|
198
|
+
name: 'SohelpAceEditor'
|
|
189
199
|
};
|
|
190
200
|
</script>
|
|
191
201
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# SohelpApiDoc API 文档
|
|
2
|
+
|
|
3
|
+
可折叠的组件 API 文档展示组件,支持展示 Props、Events、Methods 和 Slots 表格。
|
|
4
|
+
|
|
5
|
+
## 基础用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<sohelp-api-doc
|
|
10
|
+
title="MyComponent"
|
|
11
|
+
description="这是一个自定义组件"
|
|
12
|
+
:props="propsData"
|
|
13
|
+
:events="eventsData"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
const propsData = [
|
|
19
|
+
{ name: 'size', type: 'String', default: 'medium', required: false, desc: '尺寸' }
|
|
20
|
+
];
|
|
21
|
+
const eventsData = [
|
|
22
|
+
{ name: 'change', params: 'value', desc: '值变化时触发' }
|
|
23
|
+
];
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 属性 (Props)
|
|
28
|
+
|
|
29
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 |
|
|
30
|
+
| --- | --- | --- | --- | --- |
|
|
31
|
+
| title | String | `'组件'` | 否 | 文档标题 |
|
|
32
|
+
| description | String | `''` | 否 | 组件描述 |
|
|
33
|
+
| props | Array | `[]` | 否 | Props 数据,每项含 `name/type/default/required/desc` |
|
|
34
|
+
| events | Array | `[]` | 否 | Events 数据,每项含 `name/params/desc` |
|
|
35
|
+
| methods | Array | `[]` | 否 | Methods 数据,每项含 `name/params/desc` |
|
|
36
|
+
| slots | Array | `[]` | 否 | Slots 数据,每项含 `name/params/desc` |
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sohelp-api-doc">
|
|
3
|
+
<div class="doc-header" @click="expanded = !expanded">
|
|
4
|
+
<el-icon size="16"><Document /></el-icon>
|
|
5
|
+
<span class="doc-title">{{ title }} API 文档</span>
|
|
6
|
+
<el-icon size="14" class="arrow" :class="{ 'is-expanded': expanded }"><ArrowRight /></el-icon>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<el-collapse-transition>
|
|
10
|
+
<div v-show="expanded" class="doc-body">
|
|
11
|
+
<!-- 组件说明 -->
|
|
12
|
+
<div v-if="description" class="doc-desc">{{ description }}</div>
|
|
13
|
+
|
|
14
|
+
<!-- Props 属性 -->
|
|
15
|
+
<div v-if="props?.length" class="doc-section">
|
|
16
|
+
<div class="section-title">Props 属性</div>
|
|
17
|
+
<el-table :data="props" border size="small" class="doc-table">
|
|
18
|
+
<el-table-column prop="name" label="属性名" width="160" />
|
|
19
|
+
<el-table-column prop="type" label="类型" width="140" />
|
|
20
|
+
<el-table-column prop="default" label="默认值" width="120" />
|
|
21
|
+
<el-table-column label="必填" width="60" align="center">
|
|
22
|
+
<template #default="{ row }">
|
|
23
|
+
<el-tag v-if="row.required" type="danger" size="small">是</el-tag>
|
|
24
|
+
<span v-else>否</span>
|
|
25
|
+
</template>
|
|
26
|
+
</el-table-column>
|
|
27
|
+
<el-table-column prop="desc" label="说明" min-width="200" />
|
|
28
|
+
</el-table>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- Events 事件 -->
|
|
32
|
+
<div v-if="events?.length" class="doc-section">
|
|
33
|
+
<div class="section-title">Events 事件</div>
|
|
34
|
+
<el-table :data="events" border size="small" class="doc-table">
|
|
35
|
+
<el-table-column prop="name" label="事件名" width="160" />
|
|
36
|
+
<el-table-column prop="params" label="回调参数" width="240" />
|
|
37
|
+
<el-table-column prop="desc" label="说明" min-width="200" />
|
|
38
|
+
</el-table>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<!-- Methods 方法 -->
|
|
42
|
+
<div v-if="methods?.length" class="doc-section">
|
|
43
|
+
<div class="section-title">Methods 方法</div>
|
|
44
|
+
<el-table :data="methods" border size="small" class="doc-table">
|
|
45
|
+
<el-table-column prop="name" label="方法名" width="160" />
|
|
46
|
+
<el-table-column prop="params" label="参数" width="240" />
|
|
47
|
+
<el-table-column prop="desc" label="说明" min-width="200" />
|
|
48
|
+
</el-table>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<!-- Slots 插槽 -->
|
|
52
|
+
<div v-if="slots?.length" class="doc-section">
|
|
53
|
+
<div class="section-title">Slots 插槽</div>
|
|
54
|
+
<el-table :data="slots" border size="small" class="doc-table">
|
|
55
|
+
<el-table-column prop="name" label="插槽名" width="160" />
|
|
56
|
+
<el-table-column prop="params" label="作用域参数" width="240" />
|
|
57
|
+
<el-table-column prop="desc" label="说明" min-width="200" />
|
|
58
|
+
</el-table>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</el-collapse-transition>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
export default { name: 'SohelpApiDoc' };
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<script setup>
|
|
70
|
+
import { ref } from 'vue';
|
|
71
|
+
import { Document, ArrowRight } from '@element-plus/icons-vue';
|
|
72
|
+
|
|
73
|
+
defineProps({
|
|
74
|
+
title: { type: String, default: '组件' },
|
|
75
|
+
description: { type: String, default: '' },
|
|
76
|
+
props: { type: Array, default: () => [] },
|
|
77
|
+
events: { type: Array, default: () => [] },
|
|
78
|
+
methods: { type: Array, default: () => [] },
|
|
79
|
+
slots: { type: Array, default: () => [] }
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const expanded = ref(false);
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style lang="scss" scoped>
|
|
86
|
+
.sohelp-api-doc {
|
|
87
|
+
margin-top: 12px;
|
|
88
|
+
border: 1px solid var(--el-border-color-lighter);
|
|
89
|
+
border-radius: 6px;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
|
|
92
|
+
.doc-header {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 6px;
|
|
96
|
+
padding: 8px 14px;
|
|
97
|
+
background: var(--el-fill-color-lighter);
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
user-select: none;
|
|
100
|
+
font-size: 13px;
|
|
101
|
+
color: var(--el-text-color-regular);
|
|
102
|
+
transition: background 0.2s;
|
|
103
|
+
|
|
104
|
+
&:hover {
|
|
105
|
+
background: var(--el-fill-color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.doc-title {
|
|
109
|
+
font-weight: 500;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.arrow {
|
|
113
|
+
margin-left: auto;
|
|
114
|
+
transition: transform 0.3s;
|
|
115
|
+
|
|
116
|
+
&.is-expanded {
|
|
117
|
+
transform: rotate(90deg);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.doc-body {
|
|
123
|
+
padding: 16px;
|
|
124
|
+
|
|
125
|
+
.doc-desc {
|
|
126
|
+
margin-bottom: 16px;
|
|
127
|
+
padding: 10px 14px;
|
|
128
|
+
background: var(--el-color-primary-light-9);
|
|
129
|
+
border-radius: 4px;
|
|
130
|
+
font-size: 13px;
|
|
131
|
+
color: var(--el-text-color-regular);
|
|
132
|
+
line-height: 1.6;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.doc-section {
|
|
136
|
+
margin-bottom: 20px;
|
|
137
|
+
|
|
138
|
+
&:last-child {
|
|
139
|
+
margin-bottom: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.section-title {
|
|
143
|
+
font-size: 14px;
|
|
144
|
+
font-weight: 600;
|
|
145
|
+
color: var(--el-text-color-primary);
|
|
146
|
+
margin-bottom: 8px;
|
|
147
|
+
padding-left: 8px;
|
|
148
|
+
border-left: 3px solid var(--el-color-primary);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.doc-table {
|
|
153
|
+
:deep(.el-table__cell) {
|
|
154
|
+
font-size: 12px;
|
|
155
|
+
padding: 6px 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</style>
|