@tianditu/vue 0.0.1-edge.0 → 0.0.2
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/LICENSE +21 -21
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.mjs +52 -22
- package/package.json +4 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Demo Macro
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Demo Macro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue from 'vue';
|
|
2
2
|
import { Plugin } from 'vue';
|
|
3
|
+
import { JSX } from '@tianditu/wc';
|
|
3
4
|
|
|
4
5
|
interface InputProps<T> {
|
|
5
6
|
modelValue?: T;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
declare const TdtControl:
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
9
|
+
declare const TdtControl: vue.DefineSetupFnComponent<JSX.TdtControl & InputProps<string | number | boolean>, {}, {}, JSX.TdtControl & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
10
|
+
declare const TdtControlCopyright: vue.DefineSetupFnComponent<JSX.TdtControlCopyright & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlCopyright & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
11
|
+
declare const TdtControlOverviewMap: vue.DefineSetupFnComponent<JSX.TdtControlOverviewMap & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlOverviewMap & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
12
|
+
declare const TdtControlScale: vue.DefineSetupFnComponent<JSX.TdtControlScale & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlScale & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
13
|
+
declare const TdtControlZoom: vue.DefineSetupFnComponent<JSX.TdtControlZoom & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlZoom & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
14
|
+
declare const TdtMap: vue.DefineSetupFnComponent<JSX.TdtMap & InputProps<string | number | boolean>, {}, {}, JSX.TdtMap & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
12
15
|
|
|
13
16
|
declare const ComponentLibrary: Plugin;
|
|
14
17
|
|
|
15
|
-
export { ComponentLibrary, TdtControl, TdtControlScale, TdtControlZoom, TdtMap };
|
|
18
|
+
export { ComponentLibrary, TdtControl, TdtControlCopyright, TdtControlOverviewMap, TdtControlScale, TdtControlZoom, TdtMap };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue from 'vue';
|
|
2
2
|
import { Plugin } from 'vue';
|
|
3
|
+
import { JSX } from '@tianditu/wc';
|
|
3
4
|
|
|
4
5
|
interface InputProps<T> {
|
|
5
6
|
modelValue?: T;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
declare const TdtControl:
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
9
|
+
declare const TdtControl: vue.DefineSetupFnComponent<JSX.TdtControl & InputProps<string | number | boolean>, {}, {}, JSX.TdtControl & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
10
|
+
declare const TdtControlCopyright: vue.DefineSetupFnComponent<JSX.TdtControlCopyright & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlCopyright & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
11
|
+
declare const TdtControlOverviewMap: vue.DefineSetupFnComponent<JSX.TdtControlOverviewMap & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlOverviewMap & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
12
|
+
declare const TdtControlScale: vue.DefineSetupFnComponent<JSX.TdtControlScale & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlScale & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
13
|
+
declare const TdtControlZoom: vue.DefineSetupFnComponent<JSX.TdtControlZoom & InputProps<string | number | boolean>, {}, {}, JSX.TdtControlZoom & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
14
|
+
declare const TdtMap: vue.DefineSetupFnComponent<JSX.TdtMap & InputProps<string | number | boolean>, {}, {}, JSX.TdtMap & InputProps<string | number | boolean> & {}, vue.PublicProps>;
|
|
12
15
|
|
|
13
16
|
declare const ComponentLibrary: Plugin;
|
|
14
17
|
|
|
15
|
-
export { ComponentLibrary, TdtControl, TdtControlScale, TdtControlZoom, TdtMap };
|
|
18
|
+
export { ComponentLibrary, TdtControl, TdtControlCopyright, TdtControlOverviewMap, TdtControlScale, TdtControlZoom, TdtMap };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, ref, getCurrentInstance, inject, h } from 'vue';
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, ref, getCurrentInstance, inject, h, withDirectives } from 'vue';
|
|
2
|
+
import { defineCustomElements } from '@tianditu/wc/dist/loader';
|
|
3
3
|
|
|
4
4
|
const UPDATE_VALUE_EVENT = "update:modelValue";
|
|
5
5
|
const MODEL_VALUE = "modelValue";
|
|
@@ -17,7 +17,7 @@ const getElementClasses = (ref2, componentClasses, defaultClasses = []) => {
|
|
|
17
17
|
(c, i, self) => !componentClasses.has(c) && self.indexOf(c) === i
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
|
-
const defineContainer = (name, defineCustomElement, componentProps = [], modelProp, modelUpdateEvent
|
|
20
|
+
const defineContainer = (name, defineCustomElement, componentProps = [], modelProp, modelUpdateEvent) => {
|
|
21
21
|
if (defineCustomElement !== void 0) {
|
|
22
22
|
defineCustomElement();
|
|
23
23
|
}
|
|
@@ -26,15 +26,14 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
26
26
|
let modelPropValue = props[modelProp];
|
|
27
27
|
const containerRef = ref();
|
|
28
28
|
const classes = new Set(getComponentClasses(attrs.class));
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const vModelDirective = {
|
|
30
|
+
created: (el) => {
|
|
31
31
|
const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
|
|
32
32
|
eventsNames.forEach((eventName) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
emit(externalModelUpdateEvent, e);
|
|
33
|
+
el.addEventListener(eventName.toLowerCase(), (e) => {
|
|
34
|
+
if (e.target.tagName === el.tagName) {
|
|
35
|
+
modelPropValue = (e?.target)[modelProp];
|
|
36
|
+
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
|
38
37
|
}
|
|
39
38
|
});
|
|
40
39
|
});
|
|
@@ -48,6 +47,7 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
48
47
|
if (routerLink === EMPTY_PROP)
|
|
49
48
|
return;
|
|
50
49
|
if (navManager !== void 0) {
|
|
50
|
+
ev.preventDefault();
|
|
51
51
|
let navigationPayload = { event: ev };
|
|
52
52
|
for (const key in props) {
|
|
53
53
|
const value = props[key];
|
|
@@ -79,8 +79,7 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
79
79
|
let propsToAdd = {
|
|
80
80
|
ref: containerRef,
|
|
81
81
|
class: getElementClasses(containerRef, classes),
|
|
82
|
-
onClick: handleClick
|
|
83
|
-
onVnodeBeforeMount: modelUpdateEvent ? onVnodeBeforeMount : void 0
|
|
82
|
+
onClick: handleClick
|
|
84
83
|
};
|
|
85
84
|
for (const key in props) {
|
|
86
85
|
const value = props[key];
|
|
@@ -101,7 +100,14 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
|
-
|
|
103
|
+
if (props[ROUTER_LINK_VALUE] !== EMPTY_PROP) {
|
|
104
|
+
propsToAdd = {
|
|
105
|
+
...propsToAdd,
|
|
106
|
+
href: props[ROUTER_LINK_VALUE]
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const node = h(name, propsToAdd, slots.default && slots.default());
|
|
110
|
+
return modelProp === void 0 ? node : withDirectives(node, [[vModelDirective]]);
|
|
105
111
|
};
|
|
106
112
|
}
|
|
107
113
|
);
|
|
@@ -115,7 +121,7 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
115
121
|
});
|
|
116
122
|
if (modelProp) {
|
|
117
123
|
Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
|
|
118
|
-
Container.emits = [UPDATE_VALUE_EVENT
|
|
124
|
+
Container.emits = [UPDATE_VALUE_EVENT];
|
|
119
125
|
}
|
|
120
126
|
}
|
|
121
127
|
return Container;
|
|
@@ -124,30 +130,54 @@ const defineContainer = (name, defineCustomElement, componentProps = [], modelPr
|
|
|
124
130
|
const TdtControl = /* @__PURE__ */ defineContainer(
|
|
125
131
|
"tdt-control",
|
|
126
132
|
void 0,
|
|
127
|
-
["control", "position", "offset", "options"]
|
|
133
|
+
["control", "position", "visible", "offset", "options", "uniqueId"]
|
|
134
|
+
);
|
|
135
|
+
const TdtControlCopyright = /* @__PURE__ */ defineContainer(
|
|
136
|
+
"tdt-control-copyright",
|
|
137
|
+
void 0,
|
|
138
|
+
["position", "content", "uniqueId"]
|
|
139
|
+
);
|
|
140
|
+
const TdtControlOverviewMap = /* @__PURE__ */ defineContainer(
|
|
141
|
+
"tdt-control-overview-map",
|
|
142
|
+
void 0,
|
|
143
|
+
["position", "isOpen", "uniqueId"]
|
|
128
144
|
);
|
|
129
145
|
const TdtControlScale = /* @__PURE__ */ defineContainer(
|
|
130
146
|
"tdt-control-scale",
|
|
131
147
|
void 0,
|
|
132
|
-
["position", "color"]
|
|
148
|
+
["position", "color", "uniqueId"]
|
|
133
149
|
);
|
|
134
150
|
const TdtControlZoom = /* @__PURE__ */ defineContainer(
|
|
135
151
|
"tdt-control-zoom",
|
|
136
152
|
void 0,
|
|
137
|
-
[
|
|
153
|
+
[
|
|
154
|
+
"position",
|
|
155
|
+
"zoomInText",
|
|
156
|
+
"zoomInTitle",
|
|
157
|
+
"zoomOutText",
|
|
158
|
+
"zoomOutTitle",
|
|
159
|
+
"uniqueId"
|
|
160
|
+
]
|
|
138
161
|
);
|
|
139
162
|
const TdtMap = /* @__PURE__ */ defineContainer(
|
|
140
163
|
"tdt-map",
|
|
141
164
|
void 0,
|
|
142
|
-
[
|
|
165
|
+
[
|
|
166
|
+
"tk",
|
|
167
|
+
"projection",
|
|
168
|
+
"minZoom",
|
|
169
|
+
"maxZoom",
|
|
170
|
+
"maxBounds",
|
|
171
|
+
"center",
|
|
172
|
+
"zoom",
|
|
173
|
+
"uniqueId"
|
|
174
|
+
]
|
|
143
175
|
);
|
|
144
176
|
|
|
145
177
|
const ComponentLibrary = {
|
|
146
178
|
async install() {
|
|
147
|
-
|
|
148
|
-
defineCustomElements();
|
|
149
|
-
});
|
|
179
|
+
defineCustomElements();
|
|
150
180
|
}
|
|
151
181
|
};
|
|
152
182
|
|
|
153
|
-
export { ComponentLibrary, TdtControl, TdtControlScale, TdtControlZoom, TdtMap };
|
|
183
|
+
export { ComponentLibrary, TdtControl, TdtControlCopyright, TdtControlOverviewMap, TdtControlScale, TdtControlZoom, TdtMap };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianditu/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Vue components for tianditu, powered by Demo Macro.",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,11 +29,10 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/DemoMacro/tianditu#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"vue": "3.
|
|
33
|
-
"@tianditu/wc": "0.0.
|
|
32
|
+
"vue": "3.4.37",
|
|
33
|
+
"@tianditu/wc": "0.0.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"dev": "unbuild --stub"
|
|
37
|
-
"postinstall": "pnpm prepack"
|
|
36
|
+
"dev": "unbuild --stub"
|
|
38
37
|
}
|
|
39
38
|
}
|