@jetlinks-web/components 2.0.2-2 → 2.0.2-4

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 (225) hide show
  1. package/es/AMap/Map.js +124 -0
  2. package/es/AMap/index.js +2 -0
  3. package/es/AMap/util.js +56 -0
  4. package/es/BadgeStatus/Badge.js +54 -0
  5. package/es/BadgeStatus/color.js +21 -0
  6. package/es/BadgeStatus/index.js +3 -0
  7. package/es/CardSelect/CardSelect.js +123 -0
  8. package/es/CardSelect/index.js +2 -0
  9. package/es/CheckButton/CheckButton.js +121 -0
  10. package/es/CheckButton/index.js +2 -0
  11. package/es/ConfigProvider/context.js +12 -0
  12. package/es/ConfigProvider/index.js +31 -0
  13. package/es/Echarts/Echarts.js +47 -0
  14. package/es/Echarts/index.js +2 -0
  15. package/es/Ellipsis/Ellipsis.js +189 -0
  16. package/es/Ellipsis/index.js +2 -0
  17. package/es/Empty/Empty.js +56 -0
  18. package/es/Empty/image.js +2 -0
  19. package/es/Empty/index.js +2 -0
  20. package/es/FullPage/FullPage.js +31 -0
  21. package/es/FullPage/index.js +2 -0
  22. package/es/Icon/icon.js +43 -0
  23. package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
  24. package/es/MonacoEditor/Monaco.js +238 -0
  25. package/es/MonacoEditor/index.js +2 -0
  26. package/es/PermissionButton/index.js +117 -0
  27. package/es/ProLayout/Basic/BasicLayout.js +255 -0
  28. package/es/ProLayout/Basic/Header.js +93 -0
  29. package/es/ProLayout/PageContainer/index.js +318 -0
  30. package/es/ProLayout/PageContainer/typings.js +1 -0
  31. package/es/ProLayout/RouteContext.js +22 -0
  32. package/es/ProLayout/SiderMenu/BaseMenu.js +262 -0
  33. package/es/ProLayout/SiderMenu/SiderMenu.js +258 -0
  34. package/es/ProLayout/SiderMenu/index.js +2 -0
  35. package/es/ProLayout/SiderMenu/typings.js +1 -0
  36. package/es/ProLayout/TopHeader/index.js +155 -0
  37. package/es/ProLayout/defaultSettings.js +66 -0
  38. package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
  39. package/{src → es}/ProLayout/style/default.less +4 -4
  40. package/es/ProLayout/style/index.js +1 -0
  41. package/es/ProLayout/typings.js +1 -0
  42. package/es/ProLayout/util.js +61 -0
  43. package/es/ProTable/index.js +406 -0
  44. package/es/ProTable/proTableTypes.js +11 -0
  45. package/es/ProTable/style/index.css +65 -0
  46. package/es/ProTable/style/index.js +1 -0
  47. package/es/Scrollbar/Bar.js +114 -0
  48. package/es/Scrollbar/Scrollbar.js +100 -0
  49. package/es/Scrollbar/Thumb.js +10 -0
  50. package/es/Scrollbar/constants.js +1 -0
  51. package/es/Scrollbar/index.js +2 -0
  52. package/es/Scrollbar/util.js +30 -0
  53. package/es/Search/Advanced/History.js +183 -0
  54. package/es/Search/Advanced/SaveHistory.js +153 -0
  55. package/es/Search/Advanced/index.js +520 -0
  56. package/es/Search/Item.js +497 -0
  57. package/es/Search/Search.js +249 -0
  58. package/es/Search/hooks/index.js +1 -0
  59. package/es/Search/hooks/useSearchItems.js +40 -0
  60. package/es/Search/index.js +4 -0
  61. package/es/Search/setting.js +91 -0
  62. package/es/Search/typing.js +1 -0
  63. package/es/Search/util.js +234 -0
  64. package/es/ValueItem/ValueItem.js +233 -0
  65. package/es/ValueItem/index.js +2 -0
  66. package/es/ValueItem/util.js +16 -0
  67. package/es/index.js +24 -0
  68. package/es/style/index.js +3 -0
  69. package/es/style/variable.css +0 -0
  70. package/{src → es}/style/variable.less +0 -2
  71. package/lib/AMap/Map.js +124 -0
  72. package/lib/AMap/index.js +9 -0
  73. package/lib/AMap/util.js +62 -0
  74. package/lib/BadgeStatus/Badge.js +54 -0
  75. package/lib/BadgeStatus/color.js +27 -0
  76. package/lib/BadgeStatus/index.js +22 -0
  77. package/lib/CardSelect/CardSelect.js +123 -0
  78. package/lib/CardSelect/index.js +9 -0
  79. package/lib/CheckButton/CheckButton.js +121 -0
  80. package/lib/CheckButton/index.js +9 -0
  81. package/lib/ConfigProvider/context.js +19 -0
  82. package/lib/ConfigProvider/index.js +37 -0
  83. package/lib/Echarts/Echarts.js +47 -0
  84. package/lib/Echarts/index.js +9 -0
  85. package/lib/Ellipsis/Ellipsis.js +189 -0
  86. package/lib/Ellipsis/index.js +9 -0
  87. package/lib/Empty/Empty.js +56 -0
  88. package/lib/Empty/image.js +8 -0
  89. package/lib/Empty/index.js +9 -0
  90. package/lib/FullPage/FullPage.js +31 -0
  91. package/lib/FullPage/index.js +9 -0
  92. package/lib/Icon/icon.js +52 -0
  93. package/lib/Icon/index.js +9 -0
  94. package/lib/MonacoEditor/Monaco.js +238 -0
  95. package/lib/MonacoEditor/index.js +9 -0
  96. package/lib/PermissionButton/index.js +124 -0
  97. package/lib/ProLayout/Basic/BasicLayout.js +264 -0
  98. package/lib/ProLayout/Basic/BasicLayout.less +66 -0
  99. package/lib/ProLayout/Basic/Header.js +99 -0
  100. package/lib/ProLayout/Basic/Header.less +8 -0
  101. package/lib/ProLayout/PageContainer/index.js +323 -0
  102. package/lib/ProLayout/PageContainer/index.less +103 -0
  103. package/lib/ProLayout/PageContainer/typings.js +5 -0
  104. package/lib/ProLayout/RouteContext.js +28 -0
  105. package/lib/ProLayout/SiderMenu/BaseMenu.js +268 -0
  106. package/lib/ProLayout/SiderMenu/SiderMenu.js +267 -0
  107. package/lib/ProLayout/SiderMenu/index.js +20 -0
  108. package/lib/ProLayout/SiderMenu/index.less +212 -0
  109. package/lib/ProLayout/SiderMenu/typings.js +5 -0
  110. package/lib/ProLayout/TopHeader/index.js +161 -0
  111. package/lib/ProLayout/TopHeader/index.less +174 -0
  112. package/lib/ProLayout/defaultSettings.js +72 -0
  113. package/lib/ProLayout/index.js +16 -0
  114. package/lib/ProLayout/style/default.less +4 -0
  115. package/lib/ProLayout/style/index.js +3 -0
  116. package/lib/ProLayout/style/style.less +7 -0
  117. package/lib/ProLayout/typings.js +5 -0
  118. package/lib/ProLayout/util.js +72 -0
  119. package/lib/ProTable/index.js +412 -0
  120. package/lib/ProTable/proTableTypes.js +17 -0
  121. package/lib/ProTable/style/index.css +65 -0
  122. package/lib/ProTable/style/index.js +3 -0
  123. package/lib/ProTable/style/index.less +92 -0
  124. package/lib/Scrollbar/Bar.js +114 -0
  125. package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/Scrollbar.js} +106 -108
  126. package/lib/Scrollbar/Thumb.js +16 -0
  127. package/lib/Scrollbar/constants.js +7 -0
  128. package/lib/Scrollbar/index.js +9 -0
  129. package/lib/Scrollbar/util.js +37 -0
  130. package/lib/Search/Advanced/History.js +183 -0
  131. package/lib/Search/Advanced/SaveHistory.js +153 -0
  132. package/lib/Search/Advanced/index.js +520 -0
  133. package/lib/Search/Item.js +497 -0
  134. package/lib/Search/Search.js +249 -0
  135. package/lib/Search/hooks/index.js +16 -0
  136. package/lib/Search/hooks/useSearchItems.js +47 -0
  137. package/lib/Search/index.js +16 -0
  138. package/lib/Search/setting.js +97 -0
  139. package/lib/Search/typing.js +5 -0
  140. package/lib/Search/util.js +241 -0
  141. package/lib/ValueItem/ValueItem.js +233 -0
  142. package/lib/ValueItem/index.js +9 -0
  143. package/lib/ValueItem/util.js +22 -0
  144. package/lib/index.js +158 -0
  145. package/lib/style/components.less +1 -0
  146. package/lib/style/index.js +4 -0
  147. package/lib/style/variable.css +0 -0
  148. package/lib/style/variable.less +2 -0
  149. package/package.json +121 -12
  150. package/index.ts +0 -64
  151. package/src/AMap/Map.vue +0 -110
  152. package/src/AMap/index.ts +0 -1
  153. package/src/AMap/util.ts +0 -56
  154. package/src/BadgeStatus/Badge.vue +0 -41
  155. package/src/BadgeStatus/color.ts +0 -25
  156. package/src/BadgeStatus/index.ts +0 -4
  157. package/src/CardSelect/CardSelect.vue +0 -136
  158. package/src/CardSelect/index.ts +0 -3
  159. package/src/CheckButton/CheckButton.vue +0 -146
  160. package/src/CheckButton/index.md +0 -27
  161. package/src/CheckButton/index.ts +0 -3
  162. package/src/ConfigProvider/context.ts +0 -17
  163. package/src/ConfigProvider/index.tsx +0 -40
  164. package/src/Echarts/Echarts.vue +0 -43
  165. package/src/Echarts/index.ts +0 -3
  166. package/src/Ellipsis/Ellipsis.vue +0 -182
  167. package/src/Ellipsis/index.ts +0 -3
  168. package/src/Empty/Empty.vue +0 -43
  169. package/src/Empty/image.ts +0 -3
  170. package/src/Empty/index.ts +0 -2
  171. package/src/FullPage/FullPage.vue +0 -30
  172. package/src/FullPage/index.ts +0 -3
  173. package/src/Icon/icon.tsx +0 -40
  174. package/src/MonacoEditor/Monaco.vue +0 -242
  175. package/src/MonacoEditor/index.md +0 -26
  176. package/src/MonacoEditor/index.ts +0 -2
  177. package/src/PermissionButton/index.tsx +0 -110
  178. package/src/ProLayout/Basic/BasicLayout.tsx +0 -395
  179. package/src/ProLayout/Basic/Header.tsx +0 -115
  180. package/src/ProLayout/PageContainer/index.tsx +0 -441
  181. package/src/ProLayout/PageContainer/typings.ts +0 -56
  182. package/src/ProLayout/RouteContext.ts +0 -87
  183. package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
  184. package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
  185. package/src/ProLayout/SiderMenu/index.ts +0 -2
  186. package/src/ProLayout/SiderMenu/typings.ts +0 -49
  187. package/src/ProLayout/TopHeader/index.tsx +0 -210
  188. package/src/ProLayout/defaultSettings.ts +0 -106
  189. package/src/ProLayout/style/index.ts +0 -1
  190. package/src/ProLayout/typings.ts +0 -87
  191. package/src/ProLayout/util.ts +0 -64
  192. package/src/ProTable/index.md +0 -53
  193. package/src/ProTable/index.tsx +0 -551
  194. package/src/ProTable/proTableTypes.ts +0 -70
  195. package/src/ProTable/style/index.ts +0 -1
  196. package/src/Scrollbar/Bar.vue +0 -75
  197. package/src/Scrollbar/Scrollbar.vue +0 -260
  198. package/src/Scrollbar/Thumb.vue +0 -163
  199. package/src/Scrollbar/constants.ts +0 -10
  200. package/src/Scrollbar/index.ts +0 -4
  201. package/src/Scrollbar/thumb.ts +0 -16
  202. package/src/Scrollbar/util.ts +0 -38
  203. package/src/Search/Advanced/History.vue +0 -140
  204. package/src/Search/Advanced/SaveHistory.vue +0 -108
  205. package/src/Search/Advanced/index.vue +0 -435
  206. package/src/Search/Item.vue +0 -525
  207. package/src/Search/Search.vue +0 -398
  208. package/src/Search/hooks/index.ts +0 -1
  209. package/src/Search/hooks/useSearchItems.ts +0 -68
  210. package/src/Search/index.md +0 -57
  211. package/src/Search/index.ts +0 -5
  212. package/src/Search/setting.ts +0 -55
  213. package/src/Search/typing.ts +0 -76
  214. package/src/Search/util.ts +0 -263
  215. package/src/ValueItem/ValueItem.vue +0 -192
  216. package/src/ValueItem/index.ts +0 -3
  217. package/src/ValueItem/util.ts +0 -16
  218. package/src/style/index.ts +0 -3
  219. /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
  220. /package/{src → es}/ProLayout/Basic/Header.less +0 -0
  221. /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
  222. /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
  223. /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
  224. /package/{src → es}/ProLayout/style/style.less +0 -0
  225. /package/{src → es}/ProTable/style/index.less +0 -0
@@ -1,182 +0,0 @@
1
- <template>
2
- <Tooltip ref="tooltipRef" placement="top" v-bind="tooltip" :visible="visible">
3
- <template v-if="tooltip">
4
- <div :class="[jEllipsisLineClampClass, jEllipsis, 'j-ellipsis-deep']">
5
- <slot></slot>
6
- <slot name="tooltip"></slot>
7
- </div>
8
- </template>
9
- <span
10
- ref="triggerRef"
11
- v-bind="triggerAttrs()"
12
- @click="handleClickRef"
13
- @mouseleave="visible = false"
14
- @mouseenter="
15
- ;[
16
- props.expandTrigger === 'click'
17
- ? getTooltipDisabled()
18
- : showTooltip(),
19
- ]
20
- "
21
- >
22
- </span>
23
- </Tooltip>
24
- </template>
25
-
26
- <script setup>
27
- import { Tooltip } from 'ant-design-vue'
28
- import { computed, mergeProps, ref, useAttrs } from 'vue'
29
-
30
- defineOptions({
31
- name: 'Ellipsis',
32
- })
33
-
34
- const props = defineProps({
35
- expandTrigger: {
36
- type: String,
37
- default: undefined,
38
- },
39
- /** multiline ellipsis */
40
- lineClamp: {
41
- type: [Number, String],
42
- default: 1,
43
- },
44
- tooltip: {
45
- type: [Boolean, Object],
46
- default: true,
47
- },
48
- })
49
-
50
- // define class name
51
- const jEllipsis = 'j-ellipsis'
52
- const jEllipsisCursorClass = 'j-ellipsis-cursor'
53
- const jEllipsisLineClampClass = 'j-ellipsis-line-clamp'
54
-
55
- const expandedRef = ref(false)
56
- const tooltipRef = ref(null)
57
- const triggerRef = ref(null)
58
- const visible = ref(false)
59
-
60
- const attrs = useAttrs()
61
-
62
- const handleClickRef = computed(() => {
63
- return props.expandTrigger === 'click'
64
- ? () => {
65
- const { value: expanded } = expandedRef
66
- expandedRef.value = !expanded
67
- }
68
- : undefined
69
- })
70
-
71
- function triggerAttrs() {
72
- return {
73
- ...mergeProps(attrs, {
74
- class: [
75
- jEllipsis,
76
- props.lineClamp !== undefined ? jEllipsisLineClampClass : undefined,
77
- props.expandTrigger === 'click' ? jEllipsisCursorClass : undefined,
78
- ],
79
- style: ellipsisStyleRef.value,
80
- }),
81
- }
82
- }
83
-
84
- const showTooltip = () => {
85
- const { value: trigger } = triggerRef
86
- if (trigger) {
87
- visible.value = trigger.scrollHeight > trigger.offsetHeight
88
- }
89
- }
90
-
91
- const ellipsisStyleRef = computed(() => {
92
- const { lineClamp } = props
93
- const { value: expanded } = expandedRef
94
- if (lineClamp !== undefined) {
95
- return {
96
- textOverflow: '',
97
- '-webkit-line-clamp': expanded ? '' : lineClamp,
98
- }
99
- } else {
100
- return {
101
- textOverflow: expanded ? '' : 'ellipsis',
102
- '-webkit-line-clamp': '',
103
- }
104
- }
105
- })
106
-
107
- const syncEllipsisStyle = (trigger) => {
108
- if (!trigger) return
109
- const latestStyle = ellipsisStyleRef.value
110
- const lineClampClass = jEllipsisLineClampClass
111
- if (props.lineClamp !== undefined) {
112
- syncTriggerClass(trigger, lineClampClass, 'add')
113
- } else {
114
- syncTriggerClass(trigger, lineClampClass, 'remove')
115
- }
116
- for (const key in latestStyle) {
117
- if (trigger.style[key] !== latestStyle[key]) {
118
- trigger.style[key] = latestStyle[key]
119
- }
120
- }
121
- }
122
-
123
- const syncTriggerClass = (trigger, styleClass, action) => {
124
- if (action === 'add') {
125
- if (!trigger.classList.contains(styleClass)) {
126
- trigger.classList.add(styleClass)
127
- }
128
- } else {
129
- if (trigger.classList.contains(styleClass)) {
130
- trigger.classList.remove(styleClass)
131
- }
132
- }
133
- }
134
-
135
- const syncCursorStyle = (trigger, tooltipDisabled) => {
136
- if (props.expandTrigger === 'click' && !tooltipDisabled) {
137
- syncTriggerClass(trigger, jEllipsisCursorClass, 'add')
138
- } else {
139
- syncTriggerClass(trigger, jEllipsisCursorClass, 'remove')
140
- }
141
- }
142
-
143
- const getTooltipDisabled = () => {
144
- let tooltipDisabled = false
145
- const { value: expanded } = expandedRef
146
-
147
- if (expanded) return true
148
-
149
- const { value: trigger } = triggerRef
150
-
151
- if (trigger) {
152
- syncEllipsisStyle(trigger)
153
- tooltipDisabled = trigger.scrollHeight <= trigger.offsetHeight
154
-
155
- syncCursorStyle(trigger, tooltipDisabled)
156
- }
157
- return tooltipDisabled
158
- }
159
- </script>
160
-
161
- <style scoped>
162
- .j-ellipsis {
163
- overflow: hidden;
164
- vertical-align: bottom;
165
- }
166
-
167
- .j-ellipsis-cursor {
168
- cursor: pointer;
169
- }
170
-
171
- .j-ellipsis-line-clamp {
172
- display: -webkit-box;
173
- -webkit-box-orient: vertical;
174
- word-break: break-all;
175
- }
176
-
177
- .j-ellipsis-deep {
178
- max-height: 380px;
179
- -webkit-line-clamp: 17;
180
- text-overflow: ellipsis;
181
- }
182
- </style>
@@ -1,3 +0,0 @@
1
- import Ellipsis from './Ellipsis.vue'
2
-
3
- export default Ellipsis
@@ -1,43 +0,0 @@
1
- <template>
2
- <Empty v-bind="baseProps">
3
- <template v-for="item in renderArr" :key="item" #[item]="scope">
4
- <slot :name="item" :scope="scope"></slot>
5
- </template>
6
- </Empty>
7
- </template>
8
-
9
- <script lang="ts" setup name="JEmpty">
10
- import { Empty } from 'ant-design-vue'
11
- import { useSlots } from 'vue'
12
- import NoData from './image'
13
- import { omit } from 'lodash-es'
14
- import type { PropType, CSSProperties } from 'vue'
15
-
16
- const slots = useSlots()
17
- const renderArr = Object.keys(slots)
18
-
19
- const props = defineProps({
20
- description: {
21
- type: String,
22
- default: '暂无数据',
23
- },
24
- image: {
25
- type: String,
26
- default: NoData,
27
- },
28
- imageStyle: {
29
- type: Object as PropType<CSSProperties>,
30
- default: () => {
31
- return { height: '60px' }
32
- },
33
- },
34
- })
35
-
36
- const baseProps = omit(props, ...renderArr)
37
- </script>
38
- <style lang="less">
39
- .@{ant-prefix}-empty-description {
40
- color: #b3b3b3;
41
- font-size: 14px;
42
- }
43
- </style>
@@ -1,3 +0,0 @@
1
- const img =
2
- 'data:image/png;base64,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';
3
- export default img;
@@ -1,2 +0,0 @@
1
- import Empty from './Empty.vue'
2
- export default Empty;
@@ -1,30 +0,0 @@
1
- <template>
2
- <div
3
- class="full-page-warp"
4
- ref="fullPage"
5
- :style="{ minHeight: `calc(100vh - ${y + 24}px)` }"
6
- >
7
- <div class="full-page-warp-content">
8
- <slot></slot>
9
- </div>
10
- </div>
11
- </template>
12
-
13
- <script setup lang="ts" name="FullPage">
14
- import { ref } from 'vue'
15
- import { useElementBounding } from '@vueuse/core'
16
-
17
- const fullPage = ref(null)
18
- const { y } = useElementBounding(fullPage)
19
- </script>
20
-
21
- <style scoped lang="less">
22
- .full-page-warp {
23
- background: #fff;
24
- display: flex;
25
-
26
- .full-page-warp-content {
27
- width: 100%;
28
- }
29
- }
30
- </style>
@@ -1,3 +0,0 @@
1
- import FullPage from './FullPage.vue'
2
-
3
- export default FullPage
package/src/Icon/icon.tsx DELETED
@@ -1,40 +0,0 @@
1
- import { defineComponent, createVNode, watchEffect } from 'vue';
2
- import * as aIcon from '@ant-design/icons-vue';
3
- import { createFromIconfontCN } from '@ant-design/icons-vue';
4
- import { useIcon } from '@jetlinks-web/hooks'
5
-
6
- let MyIcon = createFromIconfontCN({
7
- scriptUrl: '//at.alicdn.com/t/c/font_3183515_i7oma42he.js', // 在 iconfont.cn 上生成
8
- });
9
-
10
- const AntdIcon = (props: { type: string }) => createVNode(aIcon[props.type]);
11
-
12
- const Icon = (props: any) =>
13
- Object.keys(aIcon).includes(props.type) ? (
14
- <AntdIcon {...props} />
15
- ) : (
16
- <MyIcon {...props} />
17
- );
18
-
19
- export default defineComponent({
20
- name: 'AIcon',
21
- // 传入组件配置
22
- props: ['type', 'scriptUrl', 'class'],
23
- emits: ['click'],
24
- setup(props, {emit, attrs}) {
25
- const config = useIcon()
26
- watchEffect(() => {
27
- const url = props.scriptUrl || config.scriptUrl
28
- if (url) {
29
- MyIcon = createFromIconfontCN({
30
- scriptUrl: url,
31
- });
32
- }
33
- });
34
-
35
- const click = () => {
36
- emit('click');
37
- };
38
- return () => <Icon {...props} style={attrs.style} onClick={click}/>;
39
- },
40
- });
@@ -1,242 +0,0 @@
1
- <!-- 代码编辑器 -->
2
- <template>
3
- <div ref="dom" class="j-monaco-editor"></div>
4
- </template>
5
-
6
- <script setup>
7
- import {
8
- ref,
9
- onMounted,
10
- watch,
11
- onUnmounted,
12
- toRaw,
13
- nextTick
14
- } from 'vue';
15
- import * as monaco from 'monaco-editor';
16
- import { omit } from 'lodash-es';
17
-
18
- const props = defineProps({
19
- modelValue: [String, Number],
20
- theme: {type: String, default: 'vs-dark'},
21
- language: {type: String, default: 'json'},
22
- codeTips: {type: Array, default: () => []},
23
- init: {type: Function, default: undefined},
24
- registrationTips: {type: Object, default: () => ({})},
25
- registrationTypescript: {type: Object, default: () => ({})},
26
- blurFormat: {type: Boolean, default: true},
27
- readOnly: {type: Boolean, default: false},
28
- options: {type: Object, default: () => ({})},
29
- });
30
-
31
- const emit = defineEmits([
32
- 'update:modelValue',
33
- 'blur',
34
- 'focus',
35
- 'change',
36
- 'errorChange',
37
- ]);
38
-
39
- const dom = ref();
40
-
41
- const instance = ref();
42
-
43
- const monacoProviderRef = ref();
44
- const monacoTypescriptProviderRef = ref();
45
-
46
- // codeTipItem.dispose() // 销毁自定义提示
47
-
48
- const handleSuggestions = (suggestions, range) => {
49
- return Array.isArray(suggestions)
50
- ? suggestions.map((item) => ({...item, range}))
51
- : [];
52
- };
53
-
54
- const disposeRegister = () => {
55
- monacoProviderRef.value?.dispose();
56
- monacoProviderRef.value = null;
57
- };
58
- /**
59
- * 代码提示注册
60
- */
61
- const registerCompletionItemProvider = () => {
62
- disposeRegister();
63
- if (monaco.languages && props.registrationTips?.suggestions) {
64
- const {name, suggestions} = props.registrationTips;
65
- monacoProviderRef.value =
66
- monaco.languages.registerCompletionItemProvider(name || 'json', {
67
- provideCompletionItems: function (model, position) {
68
- const word = model.getWordUntilPosition(position); // 获取提示代码范围位置
69
- const range = {
70
- startLineNumber: position.lineNumber,
71
- endLineNumber: position.lineNumber,
72
- startColumn: word.startColumn,
73
- endColumn: word.endColumn,
74
- };
75
-
76
- return {
77
- suggestions: handleSuggestions(suggestions, range),
78
- };
79
- },
80
- });
81
- }
82
- };
83
-
84
- const disposeTypescript = () => {
85
- monacoTypescriptProviderRef.value?.dispose();
86
- monacoTypescriptProviderRef.value = null;
87
- };
88
-
89
- const registerTypescript = () => {
90
- disposeTypescript();
91
- if (monaco.languages && props.registrationTypescript?.typescript) {
92
- const {name, typescript} = props.registrationTypescript;
93
- monacoTypescriptProviderRef.value =
94
- monaco.languages.typescript.javascriptDefaults.addExtraLib(
95
- typescript,
96
- );
97
- }
98
- };
99
-
100
- /**
101
- * 代码格式化
102
- */
103
- const editorFormat = () => {
104
- if (!instance.value) return;
105
- toRaw(instance.value).getAction('editor.action.formatDocument')?.run();
106
- if (props.hasOwnProperty('readOnly')) {
107
- setTimeout(() => {
108
- toRaw(instance.value).updateOptions({
109
- readOnly: props.readOnly !== false,
110
- });
111
- }, 100);
112
- }
113
- };
114
-
115
- monaco.editor.onDidChangeMarkers(([uri]) => {
116
- const markers = monaco.editor.getModelMarkers({resource: uri});
117
- emit('errorChange', markers);
118
- });
119
-
120
- onMounted(async () => {
121
- const _model = monaco.editor.createModel(props.modelValue, props.language);
122
-
123
- instance.value = monaco.editor.create(dom.value, {
124
- model: _model,
125
- tabSize: 2,
126
- automaticLayout: true,
127
- scrollBeyondLastLine: false,
128
- theme: props.theme, // 主题色: vs(默认高亮), vs-dark(黑色), hc-black(高亮黑色)
129
- formatOnPaste: true,
130
- ...(omit(props.options, ['readOnly']) || {}),
131
- });
132
-
133
- instance.value.onDidChangeModelContent(() => {
134
- //
135
- const value = toRaw(instance.value).getValue();
136
- nextTick(() => {
137
- emit('update:modelValue', value);
138
- emit('change', value);
139
- });
140
- });
141
-
142
- instance.value.onDidBlurEditorText(() => {
143
- emit('blur');
144
- if (props.blurFormat) {
145
- editorFormat();
146
- }
147
- });
148
-
149
- instance.value.onDidFocusEditorText(() => {
150
- emit('focus');
151
- });
152
-
153
- if (props.modelValue) {
154
- setTimeout(() => {
155
- editorFormat();
156
- }, 200);
157
- }
158
-
159
- props.init?.(instance.value, monaco);
160
- });
161
-
162
- /**
163
- * 光标位置插入内容
164
- * @param {String} val
165
- * @param position
166
- */
167
- const insert = (val, position) => {
168
- if (!instance.value) return;
169
- const _position = position || toRaw(instance.value).getPosition();
170
- const value = toRaw(instance.value).getValue();
171
-
172
- if (position && position.lineNumber) {
173
- toRaw(instance.value).setPosition(position);
174
- }
175
-
176
- toRaw(instance.value).executeEdits(value, [
177
- {
178
- range: new monaco.Range(
179
- _position?.lineNumber,
180
- _position?.column,
181
- _position?.lineNumber,
182
- _position?.column,
183
- ),
184
- text: val,
185
- },
186
- ]);
187
- };
188
-
189
- watch(
190
- () => props.modelValue,
191
- (val) => {
192
- if (
193
- !instance.value ||
194
- (instance.value &&
195
- props.modelValue === toRaw(instance.value).getValue())
196
- )
197
- return;
198
- // setValue之前获取光标位置
199
- const position = toRaw(instance.value).getPosition();
200
-
201
- // setValue之后光标位置改变
202
- toRaw(instance.value).setValue(val);
203
- // 设置光标位置为setValue之前的位置
204
- toRaw(instance.value).setPosition(position);
205
-
206
- editorFormat();
207
- },
208
- );
209
-
210
- watch(
211
- () => JSON.stringify(props.registrationTips),
212
- () => {
213
- registerCompletionItemProvider();
214
- },
215
- {immediate: true},
216
- );
217
-
218
- watch(
219
- () => JSON.stringify(props.registrationTypescript),
220
- () => {
221
- registerTypescript();
222
- },
223
- {immediate: true},
224
- );
225
-
226
- onUnmounted(() => {
227
- disposeRegister();
228
- disposeTypescript();
229
- toRaw(instance.value).editor?.dispose?.();
230
- });
231
-
232
- defineExpose({
233
- editorFormat,
234
- insert,
235
- });
236
- </script>
237
- <style lang="less" scoped>
238
- .j-monaco-editor {
239
- min-height: 50px;
240
- height: 100%;
241
- }
242
- </style>
@@ -1,26 +0,0 @@
1
- ---
2
- category: Components
3
- type: 数据录入
4
- title: MonacoEditor
5
- subtitle: 代码编辑器
6
- cols: 1
7
- cover: https://gw.alipayobjects.com/zos/alicdn/xS9YEJhfe/Input.svg
8
- ---
9
-
10
- ## API
11
-
12
- > 在 vite 项目中使用需要安装[`vite-plugin-monaco-editor`](https://github.com/vdesjs/vite-plugin-monaco-editor), 并在 vite.config.ts 中配置
13
-
14
- ### MonacoEditor
15
-
16
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
17
- | --- |-----------------------------------------------------------| --- | --- | --- |
18
- | value(v-model) | 编辑器内容 | string | | |
19
- | theme | 主题色: vs(默认高亮), vs-dark(黑色), hc-black(高亮黑色) | string | | |
20
- | language | 编辑器支持的语言: json, css, html, typescript, javascript, vue | string | | |
21
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
22
- | -------------- | --------------------------------------------------------- | ------ | ------ | ---- |
23
- | value(v-model) | 编辑器内容 | string | | |
24
- | theme | 主题色: vs(默认高亮), vs-dark(黑色), hc-black(高亮黑色) | string | | |
25
- | language | 编辑器支持的语言: json, css, html, typescript, javascript, vue | string | | |
26
-
@@ -1,2 +0,0 @@
1
- import Monaco from './Monaco.vue';
2
- export default Monaco;
@@ -1,110 +0,0 @@
1
- import { h, defineComponent, computed } from "vue";
2
- import type { PropType, CSSProperties, ExtractPropTypes } from 'vue'
3
- import { Button, Tooltip, Popconfirm } from 'ant-design-vue'
4
- import { PopconfirmProps, TooltipProps } from "ant-design-vue/es";
5
- import { omit } from "lodash-es";
6
- import { buttonProps } from "ant-design-vue/es/button/button";
7
- import { usePermission } from '@jetlinks-web/hooks'
8
-
9
- type PermissionType = string | Array<string> | boolean
10
-
11
- const definedProps = {
12
- tooltip: {
13
- type: Object as PropType<TooltipProps>,
14
- },
15
- popConfirm: {
16
- type: Object as PropType<PopconfirmProps>,
17
- },
18
- hasPermission: {
19
- type: [String, Array, Boolean] as PropType<PermissionType>,
20
- default: undefined
21
- },
22
- style: {
23
- type: Object as PropType<CSSProperties>
24
- },
25
- noPermissionTitle: {
26
- type: String
27
- },
28
- ...omit(buttonProps(), 'icon')
29
- }
30
-
31
- type DefinedPropsType = Partial<ExtractPropTypes<typeof definedProps>>
32
-
33
- const PermissionButton = defineComponent({
34
- name: 'PermissionButton',
35
- // @ts-ignore
36
- slots: ['button', 'icon'],
37
- props: definedProps,
38
- setup(props, {slots}) {
39
-
40
- const {popConfirm, tooltip} = props
41
- const {hasPerm} = usePermission(props.hasPermission as PermissionType)
42
-
43
- const permission = computed(() => {
44
- if (!props.hasPermission || props.hasPermission === true) {
45
- return true
46
- }
47
- return hasPerm.value
48
- })
49
-
50
- const isPermission = computed(() => {
51
- if ('hasPermission' in props && permission.value) {
52
- return 'disabled' in props ? props.disabled : false
53
- }
54
- return true
55
- })
56
-
57
- const hasPopConfirm = computed(() => !!popConfirm) // 是否包含确认弹窗
58
- const hasTooltip = computed(() => !!tooltip) // 是否包含文字提示
59
-
60
- return () => {
61
- const {popConfirm, tooltip, hasPermission, noPermissionTitle, ...buttonProps} = props
62
-
63
- const button = !slots.button ?
64
- h(Button,
65
- {
66
- ...buttonProps,
67
- disabled: isPermission.value,
68
- },
69
- {
70
- default: () => slots?.default?.(),
71
- icon: () => slots?.icon?.()
72
- }) :
73
- slots.button()
74
-
75
- // 文字提示
76
- const _tooltip = tooltip ? h(Tooltip, Object.assign(tooltip, {disabled: isPermission.value}), {default: () => button}) : undefined
77
-
78
- // 无权限
79
- const noPermissionButton = !permission.value ? h(Tooltip, {title: noPermissionTitle || '暂无权限,请联系管理员'}, {default: () => button}) : undefined
80
-
81
- // 二次确认
82
- const _popConfirm = popConfirm ?
83
- h(Popconfirm,
84
- Object.assign(
85
- {overlayStyle: {width: '220px'}},
86
- popConfirm,
87
- {
88
- disabled: !permission.value || buttonProps.disabled
89
- }
90
- ),
91
- {default: () => tooltip ? _tooltip : button})
92
- : undefined
93
-
94
- if (permission.value) {
95
- if (hasPopConfirm.value) {
96
- return _popConfirm
97
- }
98
-
99
- if (hasTooltip.value) {
100
- return _tooltip
101
- }
102
-
103
- return button
104
- }
105
- return noPermissionButton
106
- }
107
- }
108
- })
109
-
110
- export default PermissionButton