chuangskui 0.0.1
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/README.md +137 -0
- package/dist/chuangskui.css +1 -0
- package/dist/cskui.es.js +331 -0
- package/dist/cskui.umd.js +1 -0
- package/dist/favicon.ico +0 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# GIS 组件配置说明文档
|
|
2
|
+
|
|
3
|
+
## 使用方法
|
|
4
|
+
|
|
5
|
+
### 插件引入
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
需要注入axios和eventBus,具体配置如下
|
|
9
|
+
import CskUi from "@src/utils/cskUi.js";
|
|
10
|
+
import { eventBus } from "@src/assets/core/index";
|
|
11
|
+
import { axios } from "@src/assets/core";
|
|
12
|
+
|
|
13
|
+
app.use(CskUi, {
|
|
14
|
+
axios,
|
|
15
|
+
eventBus,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 组件引入
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<Map :config="config" ref="gisRef"></Map>
|
|
24
|
+
|
|
25
|
+
import Map from './components/map.vue'
|
|
26
|
+
import { ref, onMounted } from 'vue'
|
|
27
|
+
|
|
28
|
+
const gisRef = ref(null)
|
|
29
|
+
|
|
30
|
+
// config 什么都不配置,一个空对象,表示使用默认配置,导航,六大模块搜索,绘制图形,表单,专题图层,天地图,打印,工具。等功能全部拥有
|
|
31
|
+
const config = {}
|
|
32
|
+
onMounted(() => {
|
|
33
|
+
tools: {}, // 没有工具栏,具体配置如下
|
|
34
|
+
special: [] // 没有专题图层,具体配置如下
|
|
35
|
+
navbar: {
|
|
36
|
+
tabsData: [] // 没有导航
|
|
37
|
+
},
|
|
38
|
+
hideTable: false, // 隐藏查询结果表格
|
|
39
|
+
performance: { // 默认没有性能分析
|
|
40
|
+
performance: true, // 开启内存监控
|
|
41
|
+
layerMonitor: true // 开启图层监控
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## map 配置
|
|
47
|
+
|
|
48
|
+
默认不配置,使用默认地图。
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
// 地图配置路径default/map.js
|
|
52
|
+
{
|
|
53
|
+
center: [106.54, 33.19],
|
|
54
|
+
zoom: 4.5,
|
|
55
|
+
showZoom: false,
|
|
56
|
+
projection: "EPSG:4326",
|
|
57
|
+
multiWorld: true,
|
|
58
|
+
type: 'tile'
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
target 无需设置,强制使用 map 组件的 target,避免出现多个地图实例时造成冲突。
|
|
63
|
+
|
|
64
|
+
## tools 配置
|
|
65
|
+
|
|
66
|
+
默认不配置,使用默认工具。全部展示,如果不需要显示某个工具,设置对应工具为{}即可。工具方法为内部方法,尽量避免直接调用内部方法
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
// 配置路径default/tools.js
|
|
70
|
+
{
|
|
71
|
+
zoomIn: {},
|
|
72
|
+
zoomOut: {},
|
|
73
|
+
identify: {},
|
|
74
|
+
fullExtent: {},
|
|
75
|
+
layerControl: {
|
|
76
|
+
name: "layerControl",
|
|
77
|
+
title: "图层控制",
|
|
78
|
+
icon: "fas fa-layer-group",
|
|
79
|
+
visible: true,
|
|
80
|
+
dropdownItems: [],
|
|
81
|
+
},
|
|
82
|
+
specialLayer: {},
|
|
83
|
+
plot: {},
|
|
84
|
+
print: {},
|
|
85
|
+
tool: {},
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 天地图配置
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
// 配置路径default/tianditu.js
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 专题图层配置
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
// 配置路径default/special.js
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 绘制图形配置
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
// 配置路径default/draw.js
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 表单配置
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
// 配置路径default/form.js
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 导航配置
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
// 配置路径default/navbar.js
|
|
117
|
+
// 如果只需要查看矿权的,只需要引入navbar后,设置show为['kq']即可。
|
|
118
|
+
navbar.show = ['kq']
|
|
119
|
+
|
|
120
|
+
// 如果请求路径、方式全都和默认配置不一样,则需要自己放在navbar的写法重新配置
|
|
121
|
+
```
|
|
122
|
+
## 其他配置
|
|
123
|
+
```
|
|
124
|
+
// 暴露给父组件的点击事件
|
|
125
|
+
mapClick: (feature) => {
|
|
126
|
+
console.log('map click', feature)
|
|
127
|
+
},
|
|
128
|
+
// 暴露给父组件的选中事件
|
|
129
|
+
mapChecked: (features) => {
|
|
130
|
+
console.log('map checked', features)
|
|
131
|
+
},
|
|
132
|
+
// 暴露给父组件的切换导航事件
|
|
133
|
+
changeNavbarTab: (tab) => {
|
|
134
|
+
console.log('changeNavbarTab', tab)
|
|
135
|
+
},
|
|
136
|
+
// 其他具体配置可以参考 CskMap.vue 中的各种computed属性运算
|
|
137
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root{--primary-color: #3498db;--text-color: #333;--text-color-light: #666;--background-color: #fff;--border-color: #ddd;--focus-color: #3498db}html{line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:16px;line-height:1.5;color:var(--text-color);background-color:var(--background-color);text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}p{margin-bottom:1em}br{line-height:normal}a{color:inherit;text-decoration:none;background-color:transparent;-webkit-text-decoration-skip:objects}a:focus,a:hover{text-decoration:underline}ol,ul{list-style:none}img,picture,video,canvas,svg{display:block;max-width:100%;height:auto;border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;padding:0;color:inherit;background-color:transparent;border:none;outline:none}button{overflow:visible;text-transform:none;cursor:pointer}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0;text-align:left;font-weight:400}code,kbd,samp,pre{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}:focus{outline:2px solid var(--focus-color);outline-offset:2px}:focus:not(:focus-visible){outline:none}:focus-visible{outline:2px solid var(--focus-color);outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media print{*,*:before,*:after{text-shadow:none!important;box-shadow:none!important}a{text-decoration:underline}img{page-break-inside:avoid}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}@media(prefers-reduced-motion:no-preference){html{scroll-behavior:smooth}}::selection{background-color:#3498db4d;color:inherit}.el-table,.el-table thead,.el-form-item__label{color:#000}.el-dialog__header{padding:0 0 8px!important;margin-right:0;word-break:break-all;border-bottom:1px solid #D9D9D9}.el-dialog__title{line-height:16px;font-size:14px;color:#000;font-weight:700;display:inline-block;border-left:4px solid #108ee9;padding-left:8px}.border-box{box-sizing:border-box}.pull-left{float:left}.pull-right{float:right}.clearfix:after{content:"";display:table;clear:both}.hidden{display:none!important}.visible{display:block!important}.flex{display:flex}.flex-column{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-center{justify-content:center;align-items:center}.flex-between{justify-content:space-between}.flex-around{justify-content:space-around}.flex-start{justify-content:flex-start}.flex-end{justify-content:flex-end}.flex-align-center{align-items:center}.flex-align-start{align-items:flex-start}.flex-align-end{align-items:flex-end}.flex-1{flex:1}.relative{position:relative}.absolute{position:absolute}.fixed{position:fixed}.sticky{position:sticky}.top-0{top:0}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-justify{text-align:justify}.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-nowrap{white-space:nowrap}.text-break{word-break:break-all}.text-uppercase{text-transform:uppercase}.text-lowercase{text-transform:lowercase}.text-capitalize{text-transform:capitalize}.font-light{font-weight:300}.font-normal{font-weight:400}.font-medium{font-weight:500}.font-bold{font-weight:700}.font-bolder{font-weight:900}.m-0{margin:0!important}.m-5{margin:5px!important}.m-10{margin:10px!important}.m-15{margin:15px!important}.m-20{margin:20px!important}.mt-0{margin-top:0!important}.mt-5{margin-top:5px!important}.mt-10{margin-top:10px!important}.mt-15{margin-top:15px!important}.mt-20{margin-top:20px!important}.mr-0{margin-right:0!important}.mr-5{margin-right:5px!important}.mr-10{margin-right:10px!important}.mr-15{margin-right:15px!important}.mr-20{margin-right:20px!important}.mb-0{margin-bottom:0!important}.mb-5{margin-bottom:5px!important}.mb-10{margin-bottom:10px!important}.mb-15{margin-bottom:15px!important}.mb-20{margin-bottom:20px!important}.ml-0{margin-left:0!important}.ml-5{margin-left:5px!important}.ml-10{margin-left:10px!important}.ml-15{margin-left:15px!important}.ml-20{margin-left:20px!important}.mlr-6{margin-left:6px!important;margin-right:6px!important}.mx-auto{margin-left:auto;margin-right:auto}.p-0{padding:0!important}.p-5{padding:5px!important}.p-10{padding:10px!important}.p-15{padding:15px!important}.p-16{padding:16px!important}.p-20{padding:20px!important}.pt-0{padding-top:0!important}.pt-5{padding-top:5px!important}.pt-10{padding-top:10px!important}.pt-15{padding-top:15px!important}.pt-20{padding-top:20px!important}.pr-0{padding-right:0!important}.pr-5{padding-right:5px!important}.pr-10{padding-right:10px!important}.pr-15{padding-right:15px!important}.pr-20{padding-right:20px!important}.pb-0{padding-bottom:0!important}.pb-5{padding-bottom:5px!important}.pb-10{padding-bottom:10px!important}.pb-15{padding-bottom:15px!important}.pb-20{padding-bottom:20px!important}.pl-0{padding-left:0!important}.pl-5{padding-left:5px!important}.pl-10{padding-left:10px!important}.pl-15{padding-left:15px!important}.pl-20{padding-left:20px!important}.w-100{width:100%!important}.w-80{width:80%!important}.w-75{width:75%!important}.w-60{width:60%!important}.w-50{width:50%!important}.w-40{width:40%!important}.w-33{width:33.333%!important}.w-25{width:25%!important}.w-0{width:0!important}.w-auto{width:auto}.h-100{height:100%}.h-auto{height:auto}.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.border{border:1px solid #ddd}.border-top{border-top:1px solid #ddd}.border-right{border-right:1px solid #ddd}.border-bottom{border-bottom:1px solid #ddd}.border-left{border-left:1px solid #ddd}.border-none{border:none}.rounded{border-radius:4px}.rounded-circle{border-radius:50%}.rounded-0{border-radius:0}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.opacity-100{opacity:1}.shadow{box-shadow:0 2px 4px #0000001a}.shadow-lg{box-shadow:0 4px 8px #00000026}.shadow-none{box-shadow:none}.text-primary{color:#007bff}.text-success{color:#28a745}.text-danger{color:#dc3545}.text-warning{color:#ffc107}.text-info{color:#17a2b8}.text-dark{color:#343a40}.text-muted{color:#6c757d}.text-white{color:#fff}.bg-primary{background-color:#007bff}.bg-success{background-color:#28a745}.bg-danger{background-color:#dc3545}.bg-warning{background-color:#ffc107}.bg-info{background-color:#17a2b8}.bg-light{background-color:#f8f9fa}.bg-dark{background-color:#343a40}.bg-transparent{background-color:transparent}@media(max-width:575.98px){.hidden-xs{display:none!important}.visible-xs{display:block!important}}@media(min-width:576px)and (max-width:767.98px){.hidden-sm{display:none!important}.visible-sm{display:block!important}}@media(min-width:768px)and (max-width:991.98px){.hidden-md{display:none!important}.visible-md{display:block!important}}@media(min-width:992px)and (max-width:1199.98px){.hidden-lg{display:none!important}.visible-lg{display:block!important}}@media(min-width:1200px){.hidden-xl{display:none!important}.visible-xl{display:block!important}}.align-baseline{vertical-align:baseline}.align-top{vertical-align:top}.align-middle{vertical-align:middle}.align-bottom{vertical-align:bottom}.align-text-top{vertical-align:text-top}.align-text-bottom{vertical-align:text-bottom}.line-height-1{line-height:1}.line-height-normal{line-height:1.5}.line-height-lg{line-height:2}.user-select-none{-webkit-user-select:none;user-select:none}.pointer-events-none{pointer-events:none}.transition{transition:all .3s ease}.transition-fast{transition:all .15s ease}.transition-slow{transition:all .5s ease}.transform-none{transform:none}.transform-rotate-90{transform:rotate(90deg)}.transform-rotate-180{transform:rotate(180deg)}.transform-scale-1{transform:scale(1)}.transform-scale-1-1{transform:scale(1.1)}.z-index-0{z-index:0}.z-index-1{z-index:1}.z-index-10{z-index:10}.z-index-100{z-index:100}.z-index-1000{z-index:1000}.min-w-0{min-width:0}.min-h-0{min-height:0}.max-w-100{max-width:100%}.max-h-100{max-height:100%}.visible{visibility:visible}.invisible{visibility:hidden}.line-clamp-1{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.line-clamp-3{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.w-100{width:100%}.blue{color:#108ee9}.green{color:#3cc500}.yellow{color:#ffa600}.red{color:#ff4d4e}.purple{color:#ab61e5}.darkSeaGreen{color:#8fbc8f}.bg-white{background-color:#fff}.csk-container{width:100%;height:100%}.top-10{top:10px}.right-10{right:10px}.noEvent{pointer-events:none}.writing-lr{writing-mode:sideways-lr}.writing-rl{writing-mode:sideways-rl}.writing-vrl{writing-mode:vertical-rl}.writing-vlr{writing-mode:vertical-lr}.vh100{height:100vh}.map-container{position:relative;width:100%;height:100%;overflow:hidden}.map-wrap{width:100%;height:100%}.map-toolbar{position:absolute;top:65px;left:50%;transform:translate(-50%);z-index:1000;display:flex;justify-content:center;pointer-events:none}.toolbar-horizontal{display:flex;background:#ffffffe6;border-radius:8px;box-shadow:0 2px 10px #0003;align-items:center;pointer-events:auto}.tool-group{display:flex;gap:5px}.tool-group button{width:32px;height:32px;border:none;background:none;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;border-radius:4px;color:#333;font-size:16px;transition:all .2s}.tool-group button:hover{background:#0000001a;color:#06c}.tool-group button.active{background:#06c3;color:#06c}.settings-panel{width:400px;border:1px solid #ebeef5;border-radius:4px;background-color:#fff;position:absolute;right:10px;bottom:40px}.panel-header{padding:12px 16px;background-color:#409eff;color:#fff;font-weight:700;text-align:left;border-radius:4px 4px 0 0;position:relative}.settings-form{padding:16px}.style-section-title{display:flex;align-items:center;margin:16px 0;font-weight:700}.blue-block{width:4px;height:16px;background-color:#409eff;margin-right:8px}.slider-container{display:flex;align-items:center;gap:12px}.settings-form .el-form-item{margin-bottom:18px}.button-group{display:flex;justify-content:center;gap:20px;margin-top:24px}.close-btn{position:absolute;right:16px;top:50%;transform:translateY(-50%);font-size:20px;cursor:pointer;color:#fff;font-weight:700;width:20px;height:20px;display:flex;align-items:center;justify-content:center;transition:all .2s}.close-btn:hover{color:#f0f0f0;transform:translateY(-50%) scale(1.1)}.tool-group{position:relative;display:inline-block}.dropdown-menu{position:absolute;top:100%;left:0;margin-top:5px;background:#fff;border-radius:4px;box-shadow:0 2px 12px #0000001a;padding:5px 0 10px;min-width:150px;z-index:10;opacity:0;transform:translateY(-10px);transition:all .3s;pointer-events:none}.tool-group:hover .dropdown-menu{opacity:1;transform:translateY(0);pointer-events:auto}.dropdown-menu:before{content:"";position:absolute;top:-5px;left:0;width:100%;height:5px;background:transparent}.dropdown-menu.show{opacity:1;transform:translateY(0);pointer-events:auto}.dropdown-item{padding:8px 15px;cursor:pointer;display:flex;flex:1;align-items:center;transition:background .3s}.dropdown-item:hover{background:#ecf5ff;color:#409eff}.dropdown-item i{margin-right:8px;font-size:14px}:deep(.el-tabs__item){padding:0 8px!important}.performance-container{position:absolute;top:10px;right:10px;z-index:1000}.el-table__column-filter-trigger i{font-size:16px;padding:0 3px;font-weight:900}.map-info-overlay{pointer-events:auto}.popup-card{min-width:280px;max-width:420px;background:#fff;border-radius:8px;box-shadow:0 6px 16px #0003;overflow:hidden;font-size:14px}.popup-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid #eee}.popup-title{font-weight:600}.popup-actions .btn-close{border:none;background:transparent;font-size:18px;line-height:1;cursor:pointer}.popup-body{padding:10px 12px}.popup-row{display:flex;align-items:center;justify-content:space-between;padding:6px 0}.popup-label{font-weight:900;color:#000}.popup-value{color:#111;margin-left:8px}.popup-link{color:#108ee9;cursor:pointer}.ol-hidden{display:none}.el-tabs__item:focus-visible{box-shadow:none!important;outline:none!important}.el-tabs__item:focus-visible:not(.is-active){background:#f5f7fa}.el-message{z-index:4000!important}
|
package/dist/cskui.es.js
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { defineAsyncComponent as c } from "vue";
|
|
2
|
+
class h {
|
|
3
|
+
constructor(e = {}) {
|
|
4
|
+
this.options = {
|
|
5
|
+
storageKey: "debug",
|
|
6
|
+
storage: localStorage,
|
|
7
|
+
enableColors: !0,
|
|
8
|
+
prefix: "🔧",
|
|
9
|
+
showMethodName: !1,
|
|
10
|
+
...e
|
|
11
|
+
}, this.init(), this.setupGlobalHooks();
|
|
12
|
+
}
|
|
13
|
+
// 初始化,绑定所有方法
|
|
14
|
+
init() {
|
|
15
|
+
[
|
|
16
|
+
"log",
|
|
17
|
+
"info",
|
|
18
|
+
"warn",
|
|
19
|
+
"error",
|
|
20
|
+
"debug",
|
|
21
|
+
"table",
|
|
22
|
+
"group",
|
|
23
|
+
"groupCollapsed",
|
|
24
|
+
"groupEnd",
|
|
25
|
+
"time",
|
|
26
|
+
"timeLog",
|
|
27
|
+
"timeEnd",
|
|
28
|
+
"trace",
|
|
29
|
+
"dir",
|
|
30
|
+
"dirxml",
|
|
31
|
+
"count",
|
|
32
|
+
"countReset",
|
|
33
|
+
"assert",
|
|
34
|
+
"clear"
|
|
35
|
+
].forEach((t) => {
|
|
36
|
+
this[t] = this.createMethod(t);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// 创建代理方法
|
|
40
|
+
createMethod(e) {
|
|
41
|
+
return (...t) => {
|
|
42
|
+
if (!this.isEnabled()) return;
|
|
43
|
+
const o = console[e];
|
|
44
|
+
if (this.options.enableColors && ["log", "info", "warn", "error", "debug"].includes(e)) {
|
|
45
|
+
const s = this.addStyle(e, t);
|
|
46
|
+
o.apply(console, s);
|
|
47
|
+
} else
|
|
48
|
+
this.options.showMethodName && e !== "log" ? o.apply(console, [
|
|
49
|
+
`[${e.toUpperCase()}]`,
|
|
50
|
+
...t
|
|
51
|
+
]) : o.apply(console, t);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// 添加样式和前缀
|
|
55
|
+
addStyle(e, t) {
|
|
56
|
+
const o = {
|
|
57
|
+
log: "color: #3498db; font-weight: normal;",
|
|
58
|
+
info: "color: #e74c3c; font-weight: bold;",
|
|
59
|
+
warn: "color: #f39c12; font-weight: bold;",
|
|
60
|
+
error: "color: #2ecc71; font-weight: normal;",
|
|
61
|
+
debug: "color: #9b59b6; font-weight: normal;"
|
|
62
|
+
}, s = this.options.prefix, n = o[e] || "", i = this.options.showMethodName ? `[${e.toUpperCase()}]` : "";
|
|
63
|
+
return [`%c${s}${i}`, n, ...t];
|
|
64
|
+
}
|
|
65
|
+
// 检查调试模式
|
|
66
|
+
isEnabled() {
|
|
67
|
+
try {
|
|
68
|
+
return this.options.storage.getItem(this.options.storageKey) !== null;
|
|
69
|
+
} catch (e) {
|
|
70
|
+
return console.warn("DebugConsole: 无法访问 storage", e), !1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 启用调试模式
|
|
74
|
+
enable() {
|
|
75
|
+
try {
|
|
76
|
+
this.options.storage.setItem(this.options.storageKey, "true"), this.dispatchGlobalEvent("debugEnabled"), console.log("🔧 调试模式已开启");
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.warn("DebugConsole: 无法启用调试模式", e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// 禁用调试模式
|
|
82
|
+
disable() {
|
|
83
|
+
try {
|
|
84
|
+
this.options.storage.removeItem(this.options.storageKey), this.dispatchGlobalEvent("debugDisabled"), console.log("🔧 调试模式已关闭");
|
|
85
|
+
} catch (e) {
|
|
86
|
+
console.warn("DebugConsole: 无法禁用调试模式", e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// 切换调试模式
|
|
90
|
+
toggle() {
|
|
91
|
+
this.isEnabled() ? this.disable() : this.enable();
|
|
92
|
+
}
|
|
93
|
+
// 检查当前状态
|
|
94
|
+
getStatus() {
|
|
95
|
+
return this.isEnabled();
|
|
96
|
+
}
|
|
97
|
+
// 设置全局事件钩子
|
|
98
|
+
setupGlobalHooks() {
|
|
99
|
+
this.setupKeyboardShortcut(), this.exposeToWindow();
|
|
100
|
+
}
|
|
101
|
+
// 设置键盘快捷键(Ctrl+Shift+D)
|
|
102
|
+
setupKeyboardShortcut() {
|
|
103
|
+
document.addEventListener("keydown", (e) => {
|
|
104
|
+
e.ctrlKey && e.shiftKey && e.key === "D" && (e.preventDefault(), this.toggle());
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// 暴露到 window 对象
|
|
108
|
+
exposeToWindow() {
|
|
109
|
+
window.__DEBUG_CONSOLE__ = this, window.enableDebug = () => this.enable(), window.disableDebug = () => this.disable(), window.toggleDebug = () => this.toggle(), window.isDebugEnabled = () => this.isEnabled();
|
|
110
|
+
}
|
|
111
|
+
// 分发全局事件
|
|
112
|
+
dispatchGlobalEvent(e) {
|
|
113
|
+
try {
|
|
114
|
+
const t = new CustomEvent(e, {
|
|
115
|
+
detail: { timestamp: Date.now() }
|
|
116
|
+
});
|
|
117
|
+
window.dispatchEvent(t);
|
|
118
|
+
} catch (t) {
|
|
119
|
+
console.warn("DebugConsole: 无法分发事件", t);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// 分组日志(增强版)
|
|
123
|
+
group(e, t, o = !1) {
|
|
124
|
+
if (!this.isEnabled()) return;
|
|
125
|
+
(o ? console.groupCollapsed : console.group).call(console, `🔧 ${e}`);
|
|
126
|
+
try {
|
|
127
|
+
t();
|
|
128
|
+
} finally {
|
|
129
|
+
console.groupEnd();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// 性能监控
|
|
133
|
+
time(e) {
|
|
134
|
+
if (!this.isEnabled()) return;
|
|
135
|
+
const t = `🔧 ${e}`;
|
|
136
|
+
return console.time(t), () => {
|
|
137
|
+
console.timeEnd(t);
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const u = (r = {}) => {
|
|
142
|
+
if (window.__GLOBAL_DEBUG_CONSOLE__)
|
|
143
|
+
return window.__GLOBAL_DEBUG_CONSOLE__;
|
|
144
|
+
const e = new h(r);
|
|
145
|
+
return window.debug = e, window.__GLOBAL_DEBUG_CONSOLE__ = e, e.isEnabled() ? e.log("全局调试控制台已初始化,调试模式已开启") : console.log(
|
|
146
|
+
'🔧 全局调试控制台已初始化,使用 localStorage.setItem("debug", "true") 开启调试'
|
|
147
|
+
), e;
|
|
148
|
+
};
|
|
149
|
+
u({
|
|
150
|
+
enableColors: !0,
|
|
151
|
+
prefix: "🐛",
|
|
152
|
+
showMethodName: !0
|
|
153
|
+
});
|
|
154
|
+
class d {
|
|
155
|
+
constructor() {
|
|
156
|
+
this.events = /* @__PURE__ */ new Map();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 监听事件
|
|
160
|
+
* @param {string} eventName 事件名称
|
|
161
|
+
* @param {Function} callback 回调函数
|
|
162
|
+
* @param {Object} options 配置选项
|
|
163
|
+
* @returns {Function} 取消监听函数
|
|
164
|
+
*/
|
|
165
|
+
on(e, t, o = {}) {
|
|
166
|
+
if (!e || typeof t != "function")
|
|
167
|
+
throw new Error("Event name and callback function are required");
|
|
168
|
+
this.events.has(e) || this.events.set(e, []);
|
|
169
|
+
const s = this.events.get(e), n = {
|
|
170
|
+
callback: t,
|
|
171
|
+
once: !!o.once,
|
|
172
|
+
context: o.context || null,
|
|
173
|
+
id: /* @__PURE__ */ Symbol("listener_id")
|
|
174
|
+
};
|
|
175
|
+
return s.push(n), () => this.off(e, t);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 监听一次事件
|
|
179
|
+
* @param {string} eventName 事件名称
|
|
180
|
+
* @param {Function} callback 回调函数
|
|
181
|
+
* @param {Object} context 执行上下文
|
|
182
|
+
* @returns {Function} 取消监听函数
|
|
183
|
+
*/
|
|
184
|
+
once(e, t, o = null) {
|
|
185
|
+
return this.on(e, t, { once: !0, context: o });
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 触发事件
|
|
189
|
+
* @param {string} eventName 事件名称
|
|
190
|
+
* @param {...any} args 传递给回调函数的参数
|
|
191
|
+
*/
|
|
192
|
+
emit(e, ...t) {
|
|
193
|
+
if (!this.events.has(e))
|
|
194
|
+
return;
|
|
195
|
+
const o = this.events.get(e), s = [], n = [...o];
|
|
196
|
+
for (let i = 0; i < n.length; i++) {
|
|
197
|
+
const l = n[i];
|
|
198
|
+
try {
|
|
199
|
+
(l.context ? l.callback.bind(l.context) : l.callback)(...t), l.once && s.push(l);
|
|
200
|
+
} catch (a) {
|
|
201
|
+
console.error(
|
|
202
|
+
`Error executing listener for event "${e}":`,
|
|
203
|
+
a
|
|
204
|
+
), e !== "error" && this.emit("error", a, e);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
s.length > 0 && this._removeListeners(e, s);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 移除事件监听
|
|
211
|
+
* @param {string} eventName 事件名称
|
|
212
|
+
* @param {Function} callback 要移除的回调函数(可选,不传则移除所有该事件的监听)
|
|
213
|
+
*/
|
|
214
|
+
off(e, t) {
|
|
215
|
+
if (!this.events.has(e))
|
|
216
|
+
return;
|
|
217
|
+
if (!t) {
|
|
218
|
+
this.events.delete(e);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const s = this.events.get(e).filter(
|
|
222
|
+
(n) => n.callback !== t
|
|
223
|
+
);
|
|
224
|
+
s.length === 0 ? this.events.delete(e) : this.events.set(e, s);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* 移除特定上下文的所有监听器
|
|
228
|
+
* @param {Object} context 执行上下文
|
|
229
|
+
*/
|
|
230
|
+
offAllByContext(e) {
|
|
231
|
+
if (e)
|
|
232
|
+
for (const [t, o] of this.events.entries()) {
|
|
233
|
+
const s = o.filter(
|
|
234
|
+
(n) => n.context !== e
|
|
235
|
+
);
|
|
236
|
+
s.length === 0 ? this.events.delete(t) : this.events.set(t, s);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 检查事件是否有监听器
|
|
241
|
+
* @param {string} eventName 事件名称
|
|
242
|
+
* @returns {boolean}
|
|
243
|
+
*/
|
|
244
|
+
has(e) {
|
|
245
|
+
return this.events.has(e) && this.events.get(e).length > 0;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 获取事件的所有监听器
|
|
249
|
+
* @param {string} eventName 事件名称
|
|
250
|
+
* @returns {Array}
|
|
251
|
+
*/
|
|
252
|
+
getListeners(e) {
|
|
253
|
+
return this.events.get(e) || [];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 移除所有事件监听器
|
|
257
|
+
*/
|
|
258
|
+
clear() {
|
|
259
|
+
this.events.clear();
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* 私有方法:移除指定监听器
|
|
263
|
+
*/
|
|
264
|
+
_removeListeners(e, t) {
|
|
265
|
+
if (!this.events.has(e))
|
|
266
|
+
return;
|
|
267
|
+
const s = this.events.get(e).filter(
|
|
268
|
+
(n) => !t.some((i) => i.id === n.id)
|
|
269
|
+
);
|
|
270
|
+
s.length === 0 ? this.events.delete(e) : this.events.set(e, s);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const g = [
|
|
274
|
+
{
|
|
275
|
+
path: "../CskMap.vue",
|
|
276
|
+
name: "CskMap"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
path: "../crud/index.vue",
|
|
280
|
+
name: "CskCrud"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
path: "../crud/CskTree.vue",
|
|
284
|
+
name: "CskTree"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
path: "../crud/CskCol.vue",
|
|
288
|
+
name: "CskCol"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
path: "../crud/CskGrid.vue",
|
|
292
|
+
name: "CskGrid"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
path: "../crud/CskTable.vue",
|
|
296
|
+
name: "CskTable"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
path: "../crud/CskForm.vue",
|
|
300
|
+
name: "CskForm"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
path: "../crud/CskEcharts.vue",
|
|
304
|
+
name: "CskEcharts"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
path: "../crud/CskDownload.vue",
|
|
308
|
+
name: "CskDownload"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
path: "../crud/CskDownloadByUrl.vue",
|
|
312
|
+
name: "CskDownloadByUrl"
|
|
313
|
+
}
|
|
314
|
+
], f = {
|
|
315
|
+
install(r, e) {
|
|
316
|
+
if (!e)
|
|
317
|
+
throw new Error("请提供 options 参数");
|
|
318
|
+
if (!e.axios)
|
|
319
|
+
throw new Error("缺少 axios 实例,请在 options 中传入 axios");
|
|
320
|
+
const { axios: t, eventBus: o } = e;
|
|
321
|
+
r.config.globalProperties.$axios = t, r.config.globalProperties.$eventBus = o || new d(), g.forEach((s) => {
|
|
322
|
+
r.component(
|
|
323
|
+
s.name,
|
|
324
|
+
c(() => import(s.path))
|
|
325
|
+
);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
export {
|
|
330
|
+
f as default
|
|
331
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(l,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("vue")):typeof define=="function"&&define.amd?define(["vue"],c):(l=typeof globalThis<"u"?globalThis:l||self,l.cskui=c(l.Vue))})(this,(function(l){"use strict";class c{constructor(e={}){this.options={storageKey:"debug",storage:localStorage,enableColors:!0,prefix:"🔧",showMethodName:!1,...e},this.init(),this.setupGlobalHooks()}init(){["log","info","warn","error","debug","table","group","groupCollapsed","groupEnd","time","timeLog","timeEnd","trace","dir","dirxml","count","countReset","assert","clear"].forEach(t=>{this[t]=this.createMethod(t)})}createMethod(e){return(...t)=>{if(!this.isEnabled())return;const o=console[e];if(this.options.enableColors&&["log","info","warn","error","debug"].includes(e)){const s=this.addStyle(e,t);o.apply(console,s)}else this.options.showMethodName&&e!=="log"?o.apply(console,[`[${e.toUpperCase()}]`,...t]):o.apply(console,t)}}addStyle(e,t){const o={log:"color: #3498db; font-weight: normal;",info:"color: #e74c3c; font-weight: bold;",warn:"color: #f39c12; font-weight: bold;",error:"color: #2ecc71; font-weight: normal;",debug:"color: #9b59b6; font-weight: normal;"},s=this.options.prefix,n=o[e]||"",i=this.options.showMethodName?`[${e.toUpperCase()}]`:"";return[`%c${s}${i}`,n,...t]}isEnabled(){try{return this.options.storage.getItem(this.options.storageKey)!==null}catch(e){return console.warn("DebugConsole: 无法访问 storage",e),!1}}enable(){try{this.options.storage.setItem(this.options.storageKey,"true"),this.dispatchGlobalEvent("debugEnabled"),console.log("🔧 调试模式已开启")}catch(e){console.warn("DebugConsole: 无法启用调试模式",e)}}disable(){try{this.options.storage.removeItem(this.options.storageKey),this.dispatchGlobalEvent("debugDisabled"),console.log("🔧 调试模式已关闭")}catch(e){console.warn("DebugConsole: 无法禁用调试模式",e)}}toggle(){this.isEnabled()?this.disable():this.enable()}getStatus(){return this.isEnabled()}setupGlobalHooks(){this.setupKeyboardShortcut(),this.exposeToWindow()}setupKeyboardShortcut(){document.addEventListener("keydown",e=>{e.ctrlKey&&e.shiftKey&&e.key==="D"&&(e.preventDefault(),this.toggle())})}exposeToWindow(){window.__DEBUG_CONSOLE__=this,window.enableDebug=()=>this.enable(),window.disableDebug=()=>this.disable(),window.toggleDebug=()=>this.toggle(),window.isDebugEnabled=()=>this.isEnabled()}dispatchGlobalEvent(e){try{const t=new CustomEvent(e,{detail:{timestamp:Date.now()}});window.dispatchEvent(t)}catch(t){console.warn("DebugConsole: 无法分发事件",t)}}group(e,t,o=!1){if(!this.isEnabled())return;(o?console.groupCollapsed:console.group).call(console,`🔧 ${e}`);try{t()}finally{console.groupEnd()}}time(e){if(!this.isEnabled())return;const t=`🔧 ${e}`;return console.time(t),()=>{console.timeEnd(t)}}}((r={})=>{if(window.__GLOBAL_DEBUG_CONSOLE__)return window.__GLOBAL_DEBUG_CONSOLE__;const e=new c(r);return window.debug=e,window.__GLOBAL_DEBUG_CONSOLE__=e,e.isEnabled()?e.log("全局调试控制台已初始化,调试模式已开启"):console.log('🔧 全局调试控制台已初始化,使用 localStorage.setItem("debug", "true") 开启调试'),e})({enableColors:!0,prefix:"🐛",showMethodName:!0});class u{constructor(){this.events=new Map}on(e,t,o={}){if(!e||typeof t!="function")throw new Error("Event name and callback function are required");this.events.has(e)||this.events.set(e,[]);const s=this.events.get(e),n={callback:t,once:!!o.once,context:o.context||null,id:Symbol("listener_id")};return s.push(n),()=>this.off(e,t)}once(e,t,o=null){return this.on(e,t,{once:!0,context:o})}emit(e,...t){if(!this.events.has(e))return;const o=this.events.get(e),s=[],n=[...o];for(let i=0;i<n.length;i++){const a=n[i];try{(a.context?a.callback.bind(a.context):a.callback)(...t),a.once&&s.push(a)}catch(h){console.error(`Error executing listener for event "${e}":`,h),e!=="error"&&this.emit("error",h,e)}}s.length>0&&this._removeListeners(e,s)}off(e,t){if(!this.events.has(e))return;if(!t){this.events.delete(e);return}const s=this.events.get(e).filter(n=>n.callback!==t);s.length===0?this.events.delete(e):this.events.set(e,s)}offAllByContext(e){if(e)for(const[t,o]of this.events.entries()){const s=o.filter(n=>n.context!==e);s.length===0?this.events.delete(t):this.events.set(t,s)}}has(e){return this.events.has(e)&&this.events.get(e).length>0}getListeners(e){return this.events.get(e)||[]}clear(){this.events.clear()}_removeListeners(e,t){if(!this.events.has(e))return;const s=this.events.get(e).filter(n=>!t.some(i=>i.id===n.id));s.length===0?this.events.delete(e):this.events.set(e,s)}}const d=[{path:"../CskMap.vue",name:"CskMap"},{path:"../crud/index.vue",name:"CskCrud"},{path:"../crud/CskTree.vue",name:"CskTree"},{path:"../crud/CskCol.vue",name:"CskCol"},{path:"../crud/CskGrid.vue",name:"CskGrid"},{path:"../crud/CskTable.vue",name:"CskTable"},{path:"../crud/CskForm.vue",name:"CskForm"},{path:"../crud/CskEcharts.vue",name:"CskEcharts"},{path:"../crud/CskDownload.vue",name:"CskDownload"},{path:"../crud/CskDownloadByUrl.vue",name:"CskDownloadByUrl"}];return{install(r,e){if(!e)throw new Error("请提供 options 参数");if(!e.axios)throw new Error("缺少 axios 实例,请在 options 中传入 axios");const{axios:t,eventBus:o}=e;r.config.globalProperties.$axios=t,r.config.globalProperties.$eventBus=o||new u,d.forEach(s=>{r.component(s.name,l.defineAsyncComponent(()=>import(s.path)))})}}}));
|
package/dist/favicon.ico
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chuangskui",
|
|
3
|
+
"author": "大圣",
|
|
4
|
+
"description": "cskui组件库",
|
|
5
|
+
"keywords": ["vue3", "ui", "components", "cskui"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"version": "0.0.1",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/cskui.umd.js",
|
|
10
|
+
"module": "dist/cskui.es.js",
|
|
11
|
+
"private": false,
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/cskui.es.js",
|
|
15
|
+
"require": "./dist/cskui.umd.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": ["dist"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "vite build",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
31
|
+
"@fortawesome/fontawesome-free": "^7.1.0",
|
|
32
|
+
"@supermap/iclient-classic": "^11.1.1",
|
|
33
|
+
"@supermap/iclient-ol": "^11.1.1",
|
|
34
|
+
"@turf/turf": "^7.3.1",
|
|
35
|
+
"axios": "^1.13.2",
|
|
36
|
+
"echarts": "^6.0.0",
|
|
37
|
+
"element-plus": "^2.13.0",
|
|
38
|
+
"file-saver": "^2.0.5",
|
|
39
|
+
"ol": "^7.5.2",
|
|
40
|
+
"vue": "^3.5.17",
|
|
41
|
+
"xlsx": "^0.19.3"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
45
|
+
"vite": "^7.0.0",
|
|
46
|
+
"vite-plugin-vue-devtools": "^7.7.7"
|
|
47
|
+
}
|
|
48
|
+
}
|