@jetlinks-web/components 1.0.5 → 2.0.0

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 (80) hide show
  1. package/index.ts +54 -15
  2. package/package.json +9 -6
  3. package/src/AMap/Map.vue +110 -107
  4. package/src/BadgeStatus/Badge.vue +41 -40
  5. package/src/BadgeStatus/color.ts +25 -23
  6. package/src/CardSelect/CardSelect.vue +136 -0
  7. package/src/CardSelect/index.ts +3 -0
  8. package/src/CheckButton/CheckButton.vue +146 -0
  9. package/src/CheckButton/index.md +27 -0
  10. package/src/CheckButton/index.ts +3 -0
  11. package/src/ConfigProvider/context.ts +17 -0
  12. package/src/ConfigProvider/index.tsx +42 -0
  13. package/src/Echarts/Echarts.vue +43 -43
  14. package/src/Ellipsis/Ellipsis.vue +182 -0
  15. package/src/Ellipsis/index.ts +3 -0
  16. package/src/Empty/Empty.vue +43 -0
  17. package/src/Empty/image.ts +3 -0
  18. package/src/Empty/index.ts +2 -0
  19. package/src/FullPage/{index.vue → FullPage.vue} +30 -27
  20. package/src/FullPage/index.ts +3 -0
  21. package/src/Icon/icon.tsx +40 -0
  22. package/src/Icon/index.ts +3 -0
  23. package/src/MonacoEditor/Monaco.vue +242 -0
  24. package/src/MonacoEditor/index.md +26 -0
  25. package/src/MonacoEditor/index.ts +2 -0
  26. package/src/PermissionButton/index.tsx +95 -92
  27. package/src/ProLayout/Basic/BasicLayout.less +66 -0
  28. package/src/ProLayout/Basic/BasicLayout.tsx +392 -0
  29. package/src/ProLayout/Basic/Header.less +8 -0
  30. package/src/ProLayout/Basic/Header.tsx +115 -0
  31. package/src/ProLayout/PageContainer/index.less +103 -0
  32. package/src/ProLayout/PageContainer/index.tsx +441 -0
  33. package/src/ProLayout/PageContainer/typings.ts +56 -0
  34. package/src/ProLayout/RouteContext.ts +87 -0
  35. package/src/ProLayout/SiderMenu/BaseMenu.tsx +296 -0
  36. package/src/ProLayout/SiderMenu/SiderMenu.tsx +320 -0
  37. package/src/ProLayout/SiderMenu/index.less +212 -0
  38. package/src/ProLayout/SiderMenu/index.ts +2 -0
  39. package/src/ProLayout/SiderMenu/typings.ts +49 -0
  40. package/src/ProLayout/TopHeader/index.less +174 -0
  41. package/src/ProLayout/TopHeader/index.tsx +210 -0
  42. package/src/ProLayout/defaultSettings.ts +106 -0
  43. package/src/ProLayout/index.ts +6 -0
  44. package/src/ProLayout/style/default.less +4 -0
  45. package/src/ProLayout/style/index.ts +1 -0
  46. package/src/ProLayout/style/style.less +7 -0
  47. package/src/ProLayout/typings.ts +87 -0
  48. package/src/ProLayout/util.ts +64 -0
  49. package/src/ProTable/index.md +53 -0
  50. package/src/ProTable/index.tsx +551 -0
  51. package/src/ProTable/proTableTypes.ts +70 -0
  52. package/src/ProTable/style/index.less +92 -0
  53. package/src/ProTable/style/index.ts +1 -0
  54. package/src/Scrollbar/Bar.vue +75 -0
  55. package/src/Scrollbar/Scrollbar.vue +260 -0
  56. package/src/Scrollbar/Thumb.vue +163 -0
  57. package/src/Scrollbar/constants.ts +10 -0
  58. package/src/Scrollbar/index.ts +4 -0
  59. package/src/Scrollbar/scrollbar.ts +108 -0
  60. package/src/Scrollbar/thumb.ts +16 -0
  61. package/src/Scrollbar/util.ts +38 -0
  62. package/src/Search/Advanced/History.vue +140 -0
  63. package/src/Search/Advanced/SaveHistory.vue +108 -0
  64. package/src/Search/Advanced/index.vue +435 -0
  65. package/src/Search/Item.vue +525 -0
  66. package/src/Search/Search.vue +398 -0
  67. package/src/Search/hooks/index.ts +1 -0
  68. package/src/Search/hooks/useSearchItems.ts +68 -0
  69. package/src/Search/index.md +57 -0
  70. package/src/Search/index.ts +5 -0
  71. package/src/Search/setting.ts +55 -0
  72. package/src/Search/typing.ts +76 -0
  73. package/src/Search/util.ts +263 -0
  74. package/src/ValueItem/ValueItem.vue +50 -35
  75. package/src/ValueItem/util.ts +2 -1
  76. package/src/style/index.ts +3 -0
  77. package/src/style/variable.less +4 -0
  78. package/src/GeoComponent/GeoComponent.vue +0 -139
  79. package/src/GeoComponent/index.ts +0 -3
  80. package/src/PermissionButton/hooks.ts +0 -20
package/index.ts CHANGED
@@ -1,25 +1,64 @@
1
1
  import type { App } from 'vue'
2
2
 
3
- import FullPage from './src/FullPage/index.vue'
4
- import PermissionButton from './src/PermissionButton/index'
3
+ import { InitAMap } from './src/AMap'
5
4
  import BadgeStatus from './src/BadgeStatus'
6
- import GeoComponent from './src/GeoComponent'
7
- import ValueItem from './src/ValueItem'
5
+ import CardSelect from './src/CardSelect'
6
+ import CheckButton from './src/CheckButton'
7
+ import ConfigProvider from './src/ConfigProvider'
8
8
  import Echarts from './src/Echarts'
9
+ import Ellipsis from './src/Ellipsis'
10
+ import Empty from './src/Empty'
11
+ import FullPage from './src/FullPage'
12
+ import AIcon from './src/Icon'
13
+ import MonacoEditor from './src/MonacoEditor'
14
+ import PermissionButton from './src/PermissionButton'
15
+ import ProLayout, { PageContainer } from './src/ProLayout'
16
+ import ProTable from './src/ProTable'
17
+ import Scrollbar from './src/Scrollbar'
18
+ import Search, { AdvancedSearch } from './src/Search'
19
+ import ValueItem from './src/ValueItem'
9
20
 
10
- import { PageContainer, AIcon } from 'jetlinks-ui-components'
11
- import { InitAMap } from './src/AMap'
21
+ export * from './src/style'
12
22
 
23
+ export {
24
+ BadgeStatus,
25
+ CardSelect,
26
+ CheckButton,
27
+ Echarts,
28
+ Ellipsis,
29
+ Empty,
30
+ FullPage,
31
+ AIcon,
32
+ MonacoEditor,
33
+ PermissionButton,
34
+ ValueItem,
35
+ ProTable,
36
+ Scrollbar,
37
+ Search,
38
+ AdvancedSearch,
39
+ ConfigProvider,
40
+ }
13
41
  export default {
14
42
  install(app: App) {
15
- app.component('PageContainer', PageContainer)
43
+ app
44
+ .component('JAMap', InitAMap)
45
+ .component('JBadgeStatus', BadgeStatus)
46
+ .component('JCardSelect', CardSelect)
47
+ .component('JCheckButton', CheckButton)
48
+ .component('JConfigProvider', ConfigProvider)
49
+ .component('JEcharts', Echarts)
50
+ .component('JEllipsis', Ellipsis)
51
+ .component('JEmpty', Empty)
52
+ .component('JFullPage', FullPage)
16
53
  .component('AIcon', AIcon)
17
- .component('PermissionButton', PermissionButton)
18
- .component('FullPage', FullPage)
19
- .component('BadgeStatus', BadgeStatus)
20
- .component('InitAmap', InitAMap)
21
- .component('GeoComponent', GeoComponent)
22
- .component('ValueItem', ValueItem)
23
- .component('Echarts', Echarts)
24
- }
54
+ .component('JMonacoEditor', MonacoEditor)
55
+ .component('JPermissionButton', PermissionButton)
56
+ .component('JProLayout', ProLayout)
57
+ .component('JPageContainer', PageContainer)
58
+ .component('JProTable', ProTable)
59
+ .component('JScrollbar', Scrollbar)
60
+ .component('JSearch', Search)
61
+ .component('JAdvancedSearch', AdvancedSearch)
62
+ .component('JValueItem', ValueItem)
63
+ },
25
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "1.0.5",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "module": "index.ts",
@@ -13,16 +13,19 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@jetlinks-web/hooks": "^1.0.6",
17
- "@jetlinks-web/stores": "^1.0.1",
18
- "@jetlinks-web/utils": "^1.0.4"
16
+ "@ant-design/icons-vue": "^7.0.1",
17
+ "sortablejs": "^1.15.2",
18
+ "echarts": "^5.4.3",
19
+ "@jetlinks-web/constants": "^1.0.1",
20
+ "@jetlinks-web/hooks": "^1.0.10",
21
+ "@jetlinks-web/utils": "^1.0.5"
19
22
  },
20
23
  "devDependencies": {
21
24
  "@vuemap/vue-amap": "^2.0.17",
22
25
  "@vueuse/core": "^10.2.1",
23
- "ant-design-vue": "^3.2.20",
24
- "jetlinks-ui-components": "^1.0.34-16",
26
+ "@vueuse/router": "^10.9.0",
25
27
  "lodash-es": "^4.17.21",
28
+ "monaco-editor": "^0.40.0",
26
29
  "pinia": "^2.1.6",
27
30
  "vue": "^3.3.4",
28
31
  "vue-router": "^4.2.4"
package/src/AMap/Map.vue CHANGED
@@ -1,107 +1,110 @@
1
- <template>
2
- <div
3
- :style="props.style || { width: '100%', height: '100%' }"
4
- :class="props.class"
5
- >
6
- <el-amap
7
- v-if="amapKey"
8
- v-bind="{
9
- ...props,
10
- ...$attrs
11
- }"
12
- :map-style="_mapStyle"
13
- @init="initMap"
14
- @click="(e) => emit('click', e)"
15
- @dblclick="(e) => emit('dblclick', e)"
16
- @movestart="(e) => emit('movestart', e)"
17
- @moveend="(e) => emit('moveend', e)"
18
- @rightclick="(e) => emit('rightclick', e)"
19
- >
20
- <template v-if="isOpenUi">
21
- <template v-if="uiLoading">
22
- <slot></slot>
23
- </template>
24
- </template>
25
- <template v-else><slot></slot></template>
26
- </el-amap>
27
- <JEmpty v-else description="请配置高德地图key" style="padding: 20%" />
28
- </div>
29
- </template>
30
-
31
- <script setup name="InitAMap" lang="ts">
32
- import type { CSSProperties, PropType } from 'vue';
33
- import { ref, computed } from 'vue'
34
- import { initAMapApiLoader, ElAmap } from '@vuemap/vue-amap';
35
- import '@vuemap/vue-amap/dist/style.css';
36
- import { store } from '@jetlinks-web/stores'
37
- import { getAMapUiPromise } from '@jetlinks-web/utils'
38
- import { MapProps } from './util'
39
- interface AMapProps {
40
- style?: CSSProperties;
41
- class?: string;
42
- AMapUI?: string | boolean;
43
- plugins?: string[]
44
- }
45
-
46
- const systemStore = store.SystemStore
47
-
48
- const amapKey = systemStore.systemInfo.apiKey
49
-
50
- const emit = defineEmits([
51
- 'initMap',
52
- 'click',
53
- 'dblclick',
54
- 'movestart',
55
- 'moveend',
56
- 'rightclick',
57
- ])
58
-
59
- const props = defineProps({
60
- ...MapProps(),
61
- style: Object as PropType<AMapProps['style']>,
62
- class: String as PropType<AMapProps['class']>,
63
- AMapUI: [String, Boolean],
64
- center: Array,
65
- plugin: Array,
66
- zooms: {
67
- type: Array,
68
- default: [3, 20]
69
- }
70
- });
71
-
72
- const _mapStyle = computed(() => {
73
- return props.mapStyle ? `amap://styles/${props.mapStyle}` : undefined
74
- })
75
-
76
- initAMapApiLoader({
77
- key: amapKey || '',
78
- plugin: props.plugin
79
- });
80
-
81
- const uiLoading = ref<boolean>(false);
82
-
83
- const map = ref<any>(null);
84
-
85
- const isOpenUi = computed(() => {
86
- return 'AMapUI' in props || props.AMapUI;
87
- });
88
- const getAMapUI = () => {
89
- const version = typeof props.AMapUI === 'string' ? props.AMapUI : '1.1';
90
- getAMapUiPromise(version).then(() => {
91
- uiLoading.value = true;
92
- });
93
- };
94
-
95
- const initMap = (e: any) => {
96
- map.value = e;
97
- emit('initMap', e)
98
- if (isOpenUi.value) {
99
- getAMapUI();
100
- }
101
- };
102
-
103
- </script>
104
-
105
- <style scoped>
106
-
107
- </style>
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>
@@ -1,40 +1,41 @@
1
- <template>
2
- <j-badge
3
- :color="_color"
4
- :text="text"
5
- ></j-badge>
6
- </template>
7
-
8
- <script setup lang="ts" name="BadgeStatus">
9
- import { defineProps, computed } from 'vue'
10
- import { getHexColor } from './color'
11
- const props = defineProps({
12
- text: {
13
- type: String,
14
- },
15
- status: {
16
- type: [String, Number],
17
- default: 'default',
18
- },
19
- /**
20
- * 自定义status值颜色
21
- * @example {
22
- * 1: 'success',
23
- * 0: 'error'
24
- * }
25
- */
26
- statusNames: {
27
- type: Object,
28
- default: () => ({
29
- 'success': 'success',
30
- 'warning': 'warning',
31
- 'error': 'error',
32
- 'default': 'default',
33
- })
34
- },
35
- });
36
-
37
- const _color = computed(() => {
38
- return getHexColor(props.statusNames[props.status], 1)
39
- })
40
- </script>
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,23 +1,25 @@
1
-
2
- const color = {
3
- 'processing': '9, 46, 231',
4
- 'error': '229, 0, 18',
5
- 'success': '36, 178, 118',
6
- 'warning': '255, 144, 0',
7
- 'default': '102, 102, 102',
8
- //告警颜色
9
- 'level1': '229, 0, 18',
10
- 'level2': '255, 148, 87',
11
- 'level3': '250, 189, 71',
12
- 'level4': '153, 153, 153',
13
- 'level5': '196, 196, 196'
14
- }
15
- export const getHexColor = (code: string, pe: number = 0.1) => {
16
- const _color = color[code] || color.default
17
- if (code === 'default') {
18
- pe = 0.1
19
- }
20
- return `rgba(${_color}, ${pe})`
21
- }
22
-
23
- export default color
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
@@ -0,0 +1,136 @@
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>
@@ -0,0 +1,3 @@
1
+ import CardSelect from "./CardSelect.vue";
2
+
3
+ export default CardSelect