@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
package/src/AMap/Map.vue DELETED
@@ -1,110 +0,0 @@
1
- <template>
2
- <div
3
- :style="props.style || { width: '100%', height: '100%' }"
4
- :class="props.class"
5
- >
6
- <el-amap
7
- v-if="hasAMapKey"
8
- :map-style="_mapStyle"
9
- v-bind="{
10
- ...props,
11
- ...$attrs
12
- }"
13
- @init="initMap"
14
- >
15
- <template v-if="uiLoading">
16
- <slot></slot>
17
- </template>
18
- <template v-else><slot></slot></template>
19
- </el-amap>
20
- <Empty v-else description="请配置高德地图key" style="padding: 20%" />
21
- </div>
22
- </template>
23
-
24
- <script setup name="InitAMap" lang="ts">
25
- import type { CSSProperties, PropType } from 'vue';
26
- import { ref, computed } from 'vue'
27
- import { initAMapApiLoader, ElAmap } from '@vuemap/vue-amap';
28
- import { getAMapUiPromise } from '@jetlinks-web/utils'
29
- import { MapProps } from './util'
30
- import { MAPConfig } from "@jetlinks-web/constants";
31
- import Empty from '../Empty'
32
- import '@vuemap/vue-amap/dist/style.css';
33
-
34
- interface AMapProps {
35
- style?: CSSProperties;
36
- class?: string;
37
- AMapUI?: string | boolean;
38
- plugins?: string[]
39
- }
40
-
41
- const emit = defineEmits([
42
- 'initMap',
43
- ])
44
-
45
- const props = defineProps({
46
- ...MapProps(),
47
- style: Object as PropType<AMapProps['style']>,
48
- class: String as PropType<AMapProps['class']>,
49
- AMapUI: [String, Boolean],
50
- center: Array,
51
- plugins: Array as PropType<string[]>,
52
- zooms: {
53
- type: Array,
54
- default: [3, 20]
55
- },
56
- JSKey: String,
57
- WebKey: String,
58
- });
59
-
60
- const config = inject<{ mapStyle: any, JSKey: string, WebKey: string }>(MAPConfig)
61
-
62
- const _mapStyle = computed(() => {
63
- if (props.mapStyle) {
64
- return `amap://styles/${props.mapStyle}`
65
- }
66
-
67
- if (config.mapStyle) {
68
- return config.mapStyle
69
- }
70
-
71
- return undefined
72
- })
73
-
74
- const hasAMapKey = computed(() => {
75
- return !!(props.JSKey || config.JSKey)
76
- })
77
-
78
- initAMapApiLoader({
79
- key: props.JSKey || config.JSKey || '',
80
- securityJsCode: props.WebKey || config.WebKey,
81
- plugins: props.plugins
82
- });
83
-
84
- const uiLoading = ref<boolean>(false);
85
-
86
- const map = ref<any>(null);
87
-
88
- const isOpenUi = computed(() => {
89
- return 'AMapUI' in props || props.AMapUI;
90
- });
91
- const getAMapUI = () => {
92
- const version = typeof props.AMapUI === 'string' ? props.AMapUI : '1.1';
93
- getAMapUiPromise(version).then(() => {
94
- uiLoading.value = true;
95
- });
96
- };
97
-
98
- const initMap = (e: any) => {
99
- map.value = e;
100
- emit('initMap', e)
101
- if (isOpenUi.value) {
102
- getAMapUI();
103
- }
104
- };
105
-
106
- </script>
107
-
108
- <style scoped>
109
-
110
- </style>
package/src/AMap/index.ts DELETED
@@ -1 +0,0 @@
1
- export { default as InitAMap } from './Map.vue'
package/src/AMap/util.ts DELETED
@@ -1,56 +0,0 @@
1
- export const MapProps = () => ({
2
- // 响应式
3
- center: Array,
4
- labelzIndex: Number,
5
- lang: String,
6
- mapStyle: String,
7
-
8
- // 静态属性
9
- vid: String,
10
- amapManager: Object as any,
11
- defaultCursor: String,
12
- animateEnable: {
13
- type: Boolean,
14
- default: true
15
- },
16
- isHotspot: Boolean,
17
- rotateEnable: {
18
- type: Boolean,
19
- default: true
20
- },
21
- resizeEnable: {
22
- type: Boolean,
23
- default: true
24
- },
25
- showIndoorMap: Boolean,
26
- expandZoomRange: Boolean,
27
- dragEnable: {
28
- type: Boolean,
29
- default: true
30
- },
31
- zoomEnable: {
32
- type: Boolean,
33
- default: true
34
- },
35
- doubleClickZoom: {
36
- type: Boolean,
37
- default: true
38
- },
39
- keyboardEnable: {
40
- type: Boolean,
41
- default: true
42
- },
43
- jogEnable: {
44
- type: Boolean,
45
- default: true
46
- },
47
- scrollWheel: {
48
- type: Boolean,
49
- default: true
50
- },
51
- touchZoom: {
52
- type: Boolean,
53
- default: true
54
- },
55
-
56
- })
@@ -1,41 +0,0 @@
1
- <template>
2
- <a-badge
3
- :color="_color"
4
- :text="text"
5
- ></a-badge>
6
- </template>
7
-
8
- <script setup lang="ts" name="BadgeStatus">
9
- import { computed } from 'vue'
10
- import { getHexColor } from './color'
11
-
12
- const props = defineProps({
13
- text: {
14
- type: String,
15
- },
16
- status: {
17
- type: [String, Number],
18
- default: 'default',
19
- },
20
- /**
21
- * 自定义status值颜色
22
- * @example {
23
- * 1: 'success',
24
- * 0: 'error'
25
- * }
26
- */
27
- statusNames: {
28
- type: Object,
29
- default: () => ({
30
- 'success': 'success',
31
- 'warning': 'warning',
32
- 'error': 'error',
33
- 'default': 'default',
34
- })
35
- },
36
- });
37
-
38
- const _color = computed(() => {
39
- return getHexColor(props.status, props.statusNames, 1)
40
- })
41
- </script>
@@ -1,25 +0,0 @@
1
- const colorMap = {
2
- 'success': '36, 178, 118',
3
- 'warning': '255, 144, 0',
4
- 'error': '229, 0, 18',
5
- 'processing': '9, 46, 231',
6
- 'default': '102, 102, 102',
7
- }
8
-
9
- export const getHexColor = (code: string | number, statusNames: Record<string | number, any>, pe: number = 0.1) => {
10
- if (!code) {
11
- return `rgba(102, 102, 102, ${pe})`
12
- }
13
-
14
- if (colorMap[code]) {
15
- return `rgba(${colorMap[code]}, ${pe})`
16
- }
17
-
18
- if (Object.keys(statusNames).length) {
19
- return statusNames[code]
20
- }
21
-
22
- return
23
- }
24
-
25
- export default colorMap
@@ -1,4 +0,0 @@
1
- import BadgeStatus from './Badge.vue'
2
- export * from './color'
3
-
4
- export default BadgeStatus
@@ -1,136 +0,0 @@
1
- <template>
2
- <div class="j-card-select" :style="CardSelectStyle">
3
- <div
4
- v-for="item in options"
5
- :class="{
6
- 'j-card-select-item': true,
7
- 'disabled': disabled || item.disabled,
8
- 'active': selectKeys.includes(item.value)
9
- }"
10
- @click="() => handleSelect(item.value, item)"
11
- >
12
- <slot name="itemRender" :node="item" >
13
- <div class="j-card-select-item-content">
14
- <div class="j-card-select-title">
15
- {{ item.label }}
16
- </div>
17
- <div class="j-card-select-describe">
18
- {{ item.describe }}
19
- </div>
20
- </div>
21
- </slot>
22
- </div>
23
- </div>
24
- </template>
25
-
26
- <script setup name="CardSelect">
27
- import { has } from 'lodash-es'
28
- const props = defineProps({
29
- layout: {
30
- type: String,
31
- default: 'horizontal'
32
- },
33
- options: {
34
- type: Array,
35
- default: () => [],
36
- },
37
- disabled: {
38
- type: Boolean,
39
- default: false,
40
- },
41
- multiple: {
42
- type: Boolean,
43
- default: false,
44
- },
45
- column: {
46
- type: Number,
47
- default: 3,
48
- },
49
- value: {
50
- type: [String, Array],
51
- default: undefined,
52
- },
53
- itemLayout: {
54
- type: String,
55
- default: 'horizontal'
56
- }
57
- })
58
-
59
- const emit = defineEmits(['select', 'change', 'update:value'])
60
-
61
- const selectKeys = ref([])
62
-
63
- const CardSelectStyle = computed(() => {
64
- const _column = props.column > 0 && props.layout === 'horizontal' ? props.column : 1
65
-
66
- return {
67
- 'grid-template-columns': `repeat(${_column}, 1fr)`
68
- }
69
- })
70
-
71
- const isMultiple = computed(() => {
72
- return has(props, 'multiple') && props.multiple !== false
73
- })
74
-
75
- const handleSelect = (key, node) => {
76
- if (props.disabled || node.disabled) {
77
- return
78
- }
79
-
80
- const selectKeysSet = new Set(selectKeys.value)
81
- const isActive = selectKeysSet.has(key)
82
-
83
- if (isMultiple.value) {
84
- if (isActive) {
85
- selectKeysSet.delete(key)
86
- } else {
87
- selectKeysSet.add(key)
88
- }
89
- selectKeys.value = [...selectKeysSet.values()]
90
- const nodes = props.options.filter(item => selectKeys.value.includes(item.value))
91
- emit('select', selectKeys.value, nodes)
92
- emit('change', selectKeys.value, nodes)
93
- emit('update:value', selectKeys.value)
94
- } else {
95
- selectKeys.value = [key]
96
-
97
- emit('select', key, node)
98
- emit('change', key, node)
99
- emit('update:value', key)
100
- }
101
- }
102
-
103
- watch(() => props.value, () => {
104
- selectKeys.value = isMultiple.value ? props.value : [props.value]
105
- }, { immediate: true })
106
-
107
- </script>
108
-
109
- <style lang="less">
110
- @import '../style/variable.less';
111
-
112
- .j-card-select {
113
- display: grid;
114
- gap: 12px;
115
-
116
- .j-card-select-item {
117
- padding: 12px;
118
- border: 1px solid #e6e6e6;
119
- border-radius: @border-radius-base;
120
- cursor: pointer;
121
-
122
- &.active {
123
- border-color: @primary-color;
124
- }
125
-
126
- &.disabled {
127
- cursor: not-allowed;
128
- opacity: 0.75;
129
- }
130
-
131
- .j-card-select-describe {
132
- color: @text-color-subtitle;
133
- }
134
- }
135
- }
136
- </style>
@@ -1,3 +0,0 @@
1
- import CardSelect from "./CardSelect.vue";
2
-
3
- export default CardSelect
@@ -1,146 +0,0 @@
1
- <template>
2
- <div :class="['j-check-button', props.class]" :style="style">
3
- <div
4
- v-for="item in _options"
5
- :key="item.value"
6
- :class="[
7
- 'j-check-button-item',
8
- myValue.includes(item.value) ? 'selected' : '',
9
- item.disabled ? 'disabled' : '',
10
- ]"
11
- @click="
12
- () => {
13
- selected(item.value, item.disabled);
14
- }
15
- "
16
- >
17
- {{ item.label }}
18
- </div>
19
- </div>
20
- </template>
21
-
22
- <script setup lang="ts">
23
- import { computed, CSSProperties, PropType, ref, watch } from 'vue';
24
- import { isArray } from '@jetlinks-web/utils';
25
-
26
- const props = defineProps({
27
- value: {
28
- type: [String, Array],
29
- default: undefined,
30
- },
31
- options: {
32
- type: Array as PropType<{ disabled?: boolean; label: string; value: string }[]>,
33
- default: () => [],
34
- },
35
- multiple: {
36
- type: Boolean,
37
- default: false,
38
- },
39
- disabled: {
40
- type: Boolean,
41
- default: false,
42
- },
43
- class: {
44
- type: String,
45
- default: undefined,
46
- },
47
- style: {
48
- type: Object as PropType<CSSProperties>,
49
- default: () => ({}),
50
- },
51
- });
52
- const emit = defineEmits(['update:value', 'change', 'select']);
53
-
54
- const myValue = ref();
55
- const optionsMap = ref(new Map());
56
-
57
- const _options = computed(() => {
58
- props.options.forEach((item: any) => {
59
- if (props.disabled) {
60
- item.display = props.disabled;
61
- }
62
- optionsMap.value.set(item.value, item);
63
- });
64
- return props.options;
65
- });
66
-
67
- watch(
68
- () => props.value,
69
- () => {
70
- if (props.value) {
71
- myValue.value = isArray(props.value) ? props.value : [props.value];
72
- } else {
73
- myValue.value = [];
74
- }
75
- },
76
- {immediate: true, deep: true},
77
- );
78
-
79
- const selected = (key: string | number, disabled: boolean) => {
80
- if (disabled) return;
81
-
82
- const values = new Set(myValue.value);
83
-
84
- if (values.has(key)) {
85
- values.delete(key);
86
- } else {
87
- if (!props.multiple) {
88
- values.clear();
89
- }
90
- values.add(key);
91
- }
92
-
93
- myValue.value = [...values.values()];
94
-
95
- const optionsItems = myValue.value.map((_key) => {
96
- return optionsMap.value.get(_key);
97
- });
98
-
99
- const _value = props.multiple ? myValue.value : myValue.value[0];
100
-
101
- emit('update:value', _value);
102
- emit('change', _value, props.multiple ? optionsItems : optionsItems[0]);
103
- emit('select', _value, props.multiple ? optionsItems : optionsItems[0]);
104
- };
105
- </script>
106
-
107
- <style scoped lang="less">
108
- .j-check-button {
109
- display: flex;
110
- gap: 16px;
111
- width: 100%;
112
-
113
- .j-check-button-item {
114
- flex: 1;
115
- min-width: 0;
116
- padding: 8px;
117
- border-radius: @border-radius-base;
118
- background-color: #f2f3f5;
119
- transition: all 0.3s;
120
- color: #333;
121
- text-align: center;
122
- cursor: pointer;
123
-
124
- &:hover {
125
- background-color: @primary-color;
126
- opacity: 0.85;
127
- color: #fff;
128
- }
129
-
130
- &.selected {
131
- background-color: @primary-color;
132
- color: #fff;
133
- }
134
-
135
- &.disabled {
136
- cursor: not-allowed;
137
- color: #00000060;
138
-
139
- &:hover {
140
- background-color: #f2f3f5;
141
- color: #00000060;
142
- }
143
- }
144
- }
145
- }
146
- </style>
@@ -1,27 +0,0 @@
1
- ---
2
- category: Components
3
- subtitle: 选择按钮
4
- type: 数据录入
5
- title: Checkbutton
6
- ---
7
-
8
- ## API
9
-
10
- ### 属性
11
-
12
- #### CheckButton
13
-
14
- | 参数 | 说明 | 类型 | 默认值 | 版本 |
15
- | -------- | ------------------------------- | ------------------------------------------------------------ | ------ | ---- |
16
- | multiple | 多选 | boolean | false | |
17
- | disabled | 失效状态 | boolean | false | |
18
- | value | 与 CheckboxGroup 组合使用时的值 | boolean \| string \| number | - | |
19
- | options | 选择项 | Array&lt;{ label: string value: string disabled?: boolean }> | \[] | |
20
- | class | 类名 | string | undefined | - |
21
- | style | css样式 | CSSProperties | {} | - |
22
-
23
- #### 事件
24
-
25
- | 事件名称 | 说明 | 回调参数 | 默认值 |版本 | |
26
- | -------- | -------------- | --------------------- | ----------------------- | --- | --- |
27
- | change | 变化时回调函数 | Function(keys: string | string[], nodes: any[]) | - | |
@@ -1,3 +0,0 @@
1
- import CheckButton from './CheckButton.vue';
2
-
3
- export default CheckButton;
@@ -1,17 +0,0 @@
1
- import type {PropType} from "vue";
2
- import { configProviderProps } from 'ant-design-vue/es/config-provider/context';
3
-
4
- export type MapConfigType = {
5
- mapStyle?: any
6
- JSKey?: string
7
- WebKey?: string
8
- }
9
- export const configProps = () => ({
10
- ...configProviderProps(),
11
- IconConfig: {
12
- type: Object as PropType<{ scriptUrl: string }>
13
- },
14
- MapConfig: {
15
- type: Object as PropType<MapConfigType>
16
- }
17
- })
@@ -1,40 +0,0 @@
1
- import {defineComponent, provide, reactive, h} from 'vue'
2
- import { configProps } from './context'
3
- import type { MapConfigType } from './context'
4
- import { ComponentsEnum, MAPConfig } from '@jetlinks-web/constants'
5
- import { ConfigProvider } from 'ant-design-vue'
6
- import {omit} from 'lodash-es'
7
- import Empty from '../Empty'
8
-
9
- const JConfigProvider = defineComponent({
10
- name: 'JConfigProvider',
11
- inheritAttrs: false,
12
- props: {
13
- ...configProps()
14
- },
15
- setup(props, { slots }) {
16
-
17
- const _iconConfig = reactive(props.IconConfig || {})
18
- const _mapConfig = reactive<MapConfigType>(props.MapConfig || {})
19
-
20
- provide(ComponentsEnum.Icon, _iconConfig) // 全局Icon 配置
21
-
22
- provide(MAPConfig, _mapConfig) // 全局地图配置
23
-
24
- return () => {
25
-
26
- return h(
27
- ConfigProvider,
28
- {...omit(props, ['IconConfig', 'MapConfig'])},
29
- {
30
- default: slots.default,
31
- renderEmpty: () => (slots.renderEmpty?.() || <Empty />)
32
- }
33
- )
34
- }
35
- }
36
- })
37
-
38
- JConfigProvider.config = ConfigProvider.config
39
-
40
- export default JConfigProvider
@@ -1,43 +0,0 @@
1
- <template>
2
- <div ref="echartsDom" class="echarts-warp" :style="style"></div>
3
- </template>
4
-
5
- <script lang="ts" name="Echarts" setup>
6
- import {CSSProperties, nextTick, ref, watch, Ref} from 'vue'
7
- import {useECharts} from '@jetlinks-web/hooks'
8
-
9
- interface Props {
10
- style?: CSSProperties
11
- }
12
-
13
- const props = defineProps({
14
- options: {
15
- type: Object,
16
- default: undefined,
17
- },
18
- style: Object as PropType<Props['style']>,
19
- })
20
-
21
- const echartsDom = ref<Ref<HTMLDivElement> | HTMLDivElement>()
22
-
23
- const {setOptions} = useECharts(echartsDom.value)
24
-
25
- watch(
26
- () => JSON.stringify(props.options),
27
- () => {
28
- if (props.options) {
29
- nextTick(() => {
30
- setOptions(props.options)
31
- })
32
- }
33
- },
34
- {immediate: true},
35
- )
36
- </script>
37
-
38
- <style scoped>
39
- .echarts-warp {
40
- width: 100%;
41
- height: 100%;
42
- }
43
- </style>
@@ -1,3 +0,0 @@
1
- import Echarts from './Echarts.vue'
2
-
3
- export default Echarts