cc1-ui 0.0.7 → 0.0.9
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/dist/autoimport.js +38 -3
- package/dist/cc1-ui.js +3 -1
- package/dist/components/Button/index.vue.d.ts +64 -4
- package/dist/components/Circle/index.vue.d.ts +56 -2
- package/dist/components/Icon/index.vue.d.ts +21 -0
- package/dist/components/Mask/index.vue.d.ts +36 -0
- package/dist/components/SIcon/index.vue.d.ts +40 -8
- package/dist/components/Select/index.vue.d.ts +3 -0
- package/dist/directive/dominfo.d.ts +2 -0
- package/dist/dominfo-FpTvKs8K.js +90 -0
- package/dist/{index-BlU8Q4GS.js → index-mrAwG3J3.js} +4 -3
- package/dist/index.d.ts +3 -3
- package/package.json +3 -4
package/dist/autoimport.js
CHANGED
|
@@ -45,6 +45,7 @@ const log = (str, time = false) => {
|
|
|
45
45
|
btime = new Date().getTime();
|
|
46
46
|
};
|
|
47
47
|
const tagList = ["VButton", "VSwitch", "VScale", "VMask", "VCircle", "VIcon", "VSelect", "VSIcon"];
|
|
48
|
+
const directiveList = ["dominfo"];
|
|
48
49
|
const extractTags = (str) => {
|
|
49
50
|
const regex = /<([a-zA-Z\-]+)(?=\s|>|\/>)/g;
|
|
50
51
|
const tags = [];
|
|
@@ -59,6 +60,16 @@ const extractTags = (str) => {
|
|
|
59
60
|
}))
|
|
60
61
|
];
|
|
61
62
|
};
|
|
63
|
+
const getDirectiveList = (ctx) => {
|
|
64
|
+
const vDirectiveRegex = /v-([a-zA-Z0-9_-]+)\s*=/g;
|
|
65
|
+
let vMatches = [];
|
|
66
|
+
let match;
|
|
67
|
+
while ((match = vDirectiveRegex.exec(ctx)) !== null) {
|
|
68
|
+
vMatches.push(match[1]);
|
|
69
|
+
}
|
|
70
|
+
vMatches = [...new Set(vMatches)];
|
|
71
|
+
return vMatches;
|
|
72
|
+
};
|
|
62
73
|
const getTagList = (str, name) => {
|
|
63
74
|
const re = new RegExp(`<${name}(.*?)<\/${name}>`, 'gs');
|
|
64
75
|
return Array.from(re[Symbol.matchAll](str)).map((item) => {
|
|
@@ -69,6 +80,7 @@ const cmddir = path.resolve('./');
|
|
|
69
80
|
const conf = {
|
|
70
81
|
src: path.resolve(path.join(cmddir, './src')),
|
|
71
82
|
use: [],
|
|
83
|
+
useDR: [],
|
|
72
84
|
config: {},
|
|
73
85
|
diy: {
|
|
74
86
|
tablecolumn: {
|
|
@@ -104,6 +116,11 @@ const init = async () => {
|
|
|
104
116
|
if (tagList.includes(tag))
|
|
105
117
|
conf.use.push(tag);
|
|
106
118
|
});
|
|
119
|
+
const vDirectiveList = getDirectiveList(ctx);
|
|
120
|
+
vDirectiveList.forEach((v) => {
|
|
121
|
+
if (directiveList.includes(v))
|
|
122
|
+
conf.useDR.push(v);
|
|
123
|
+
});
|
|
107
124
|
if (ctx.indexOf('VTableColumn') != -1 && !conf.diy.tablecolumn.fixed) {
|
|
108
125
|
const _tarr = getTagList(ctx, 'VTableColumn');
|
|
109
126
|
for (let i = 0; i < _tarr.length; i++) {
|
|
@@ -122,7 +139,18 @@ const init = async () => {
|
|
|
122
139
|
conf.use = conf.use.concat(inludeList.filter((_item) => tagList.includes(_item)));
|
|
123
140
|
}
|
|
124
141
|
conf.use = [...new Set(conf.use)];
|
|
125
|
-
|
|
142
|
+
if (conf.use.length > 0) {
|
|
143
|
+
log(`🥰🥰【${getName()}】:使用组件列表 => ${conf.use.join(',')}`);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
log(`🥰🥰【${getName()}】:没有使用组件`);
|
|
147
|
+
}
|
|
148
|
+
if (conf.useDR.length > 0) {
|
|
149
|
+
log(`🥰🥰【${getName()}】:使用指令列表 => ${conf.useDR.join(',')}`);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
log(`🥰🥰【${getName()}】:没有使用指令`);
|
|
153
|
+
}
|
|
126
154
|
};
|
|
127
155
|
export function UIAuto(config) {
|
|
128
156
|
conf.config = config;
|
|
@@ -144,12 +172,19 @@ export function UIAuto(config) {
|
|
|
144
172
|
let res = code.split('\n');
|
|
145
173
|
for (let i = 0; i < res.length; i++) {
|
|
146
174
|
if (res[i].includes('defineAsyncComponent(') || res[i].includes('app.component(')) {
|
|
147
|
-
if (!conf.use.
|
|
175
|
+
if (!conf.use.some((tag) => res[i].includes(tag))) {
|
|
176
|
+
res[i] = '';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else if (res[i].includes('const DR') || res[i].includes('.install(app)')) {
|
|
180
|
+
if (!conf.useDR.some((tag) => res[i].includes('DR' + tag))) {
|
|
148
181
|
res[i] = '';
|
|
149
182
|
}
|
|
150
183
|
}
|
|
151
184
|
}
|
|
152
|
-
|
|
185
|
+
res = res.filter((v) => v.length > 0);
|
|
186
|
+
res = res.join('\n');
|
|
187
|
+
return res;
|
|
153
188
|
}
|
|
154
189
|
else if (comImport.indexOf('cc1-ui#dist#index.css') != -1) {
|
|
155
190
|
return conf.use.map((v) => `@import url('./components/${v.substring(1)}/style.css');`).join('\n');
|
package/dist/cc1-ui.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineAsyncComponent } from 'vue';
|
|
2
2
|
|
|
3
|
+
const DRdominfo = await import('./dominfo-FpTvKs8K.js');
|
|
3
4
|
const VButton = () => defineAsyncComponent(() => import('./index-lDlR9NjA.js'));
|
|
4
5
|
const VSwitch = () => defineAsyncComponent(() => import('./index-BvvdDtUd.js'));
|
|
5
6
|
const VScale = () => defineAsyncComponent(() => import('./index-l4J1-e0K.js'));
|
|
@@ -7,7 +8,7 @@ const VMask = () => defineAsyncComponent(() => import('./index-ycYY--mh.js'));
|
|
|
7
8
|
const VCircle = () => defineAsyncComponent(() => import('./index-ti4E-Nv5.js'));
|
|
8
9
|
const VIcon = () => defineAsyncComponent(() => import('./index-BGzY32VF.js'));
|
|
9
10
|
const VSelect = () => defineAsyncComponent(() => import('./index-CpyM3z5X.js'));
|
|
10
|
-
const VSIcon = () => defineAsyncComponent(() => import('./index-
|
|
11
|
+
const VSIcon = () => defineAsyncComponent(() => import('./index-mrAwG3J3.js'));
|
|
11
12
|
const install = async (app) => {
|
|
12
13
|
app.component("VButton", VButton());
|
|
13
14
|
app.component("VSwitch", VSwitch());
|
|
@@ -17,6 +18,7 @@ const install = async (app) => {
|
|
|
17
18
|
app.component("VIcon", VIcon());
|
|
18
19
|
app.component("VSelect", VSelect());
|
|
19
20
|
app.component("VSIcon", VSIcon());
|
|
21
|
+
DRdominfo.install(app);
|
|
20
22
|
};
|
|
21
23
|
if (!window.VConf) {
|
|
22
24
|
const getLoad = (obj) => {
|
|
@@ -138,15 +138,45 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
138
138
|
default: any;
|
|
139
139
|
};
|
|
140
140
|
}>> & Readonly<{}>, {
|
|
141
|
+
/**
|
|
142
|
+
* 大小
|
|
143
|
+
*/
|
|
144
|
+
size: "middle" | "large" | "small";
|
|
145
|
+
/**
|
|
146
|
+
* 图标的class样式
|
|
147
|
+
*/
|
|
141
148
|
icon: string;
|
|
149
|
+
/**
|
|
150
|
+
* text样式
|
|
151
|
+
*/
|
|
142
152
|
text: any;
|
|
153
|
+
/**
|
|
154
|
+
* 幽灵样式
|
|
155
|
+
*/
|
|
143
156
|
ghost: any;
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
/**
|
|
158
|
+
* 样式类型
|
|
159
|
+
*/
|
|
160
|
+
type: "error" | "primary" | "success" | "warning";
|
|
161
|
+
/**
|
|
162
|
+
* 铺满
|
|
163
|
+
*/
|
|
146
164
|
long: any;
|
|
165
|
+
/**
|
|
166
|
+
* 加载状态
|
|
167
|
+
*/
|
|
147
168
|
loading: any;
|
|
169
|
+
/**
|
|
170
|
+
* 点击函数
|
|
171
|
+
*/
|
|
148
172
|
cmd: any;
|
|
173
|
+
/**
|
|
174
|
+
* 按钮类型
|
|
175
|
+
*/
|
|
149
176
|
htmlType: string;
|
|
177
|
+
/**
|
|
178
|
+
* 点击状态
|
|
179
|
+
*/
|
|
150
180
|
disabled: any;
|
|
151
181
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
152
182
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -272,15 +302,45 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
272
302
|
default: any;
|
|
273
303
|
};
|
|
274
304
|
}>> & Readonly<{}>, {
|
|
305
|
+
/**
|
|
306
|
+
* 大小
|
|
307
|
+
*/
|
|
308
|
+
size: "middle" | "large" | "small";
|
|
309
|
+
/**
|
|
310
|
+
* 图标的class样式
|
|
311
|
+
*/
|
|
275
312
|
icon: string;
|
|
313
|
+
/**
|
|
314
|
+
* text样式
|
|
315
|
+
*/
|
|
276
316
|
text: any;
|
|
317
|
+
/**
|
|
318
|
+
* 幽灵样式
|
|
319
|
+
*/
|
|
277
320
|
ghost: any;
|
|
278
|
-
|
|
279
|
-
|
|
321
|
+
/**
|
|
322
|
+
* 样式类型
|
|
323
|
+
*/
|
|
324
|
+
type: "error" | "primary" | "success" | "warning";
|
|
325
|
+
/**
|
|
326
|
+
* 铺满
|
|
327
|
+
*/
|
|
280
328
|
long: any;
|
|
329
|
+
/**
|
|
330
|
+
* 加载状态
|
|
331
|
+
*/
|
|
281
332
|
loading: any;
|
|
333
|
+
/**
|
|
334
|
+
* 点击函数
|
|
335
|
+
*/
|
|
282
336
|
cmd: any;
|
|
337
|
+
/**
|
|
338
|
+
* 按钮类型
|
|
339
|
+
*/
|
|
283
340
|
htmlType: string;
|
|
341
|
+
/**
|
|
342
|
+
* 点击状态
|
|
343
|
+
*/
|
|
284
344
|
disabled: any;
|
|
285
345
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
286
346
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -129,14 +129,41 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
129
129
|
default: number;
|
|
130
130
|
};
|
|
131
131
|
}>> & Readonly<{}>, {
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* 进度条宽度
|
|
134
|
+
*/
|
|
133
135
|
width: number;
|
|
136
|
+
/**
|
|
137
|
+
* 进度,0-100
|
|
138
|
+
*/
|
|
139
|
+
length: number;
|
|
140
|
+
/**
|
|
141
|
+
* 背景色
|
|
142
|
+
*/
|
|
134
143
|
bgColor: string;
|
|
144
|
+
/**
|
|
145
|
+
* 背景色-渐变
|
|
146
|
+
*/
|
|
135
147
|
bgColors: never[];
|
|
148
|
+
/**
|
|
149
|
+
* 底色
|
|
150
|
+
*/
|
|
136
151
|
runColor: string;
|
|
152
|
+
/**
|
|
153
|
+
* 底色-渐变
|
|
154
|
+
*/
|
|
137
155
|
runColors: never[];
|
|
156
|
+
/**
|
|
157
|
+
* 进度色
|
|
158
|
+
*/
|
|
138
159
|
successColor: string;
|
|
160
|
+
/**
|
|
161
|
+
* 进度色-渐变
|
|
162
|
+
*/
|
|
139
163
|
successColors: never[];
|
|
164
|
+
/**
|
|
165
|
+
* 进度条厚度
|
|
166
|
+
*/
|
|
140
167
|
strokeWidth: number;
|
|
141
168
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
142
169
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -250,14 +277,41 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
250
277
|
default: number;
|
|
251
278
|
};
|
|
252
279
|
}>> & Readonly<{}>, {
|
|
253
|
-
|
|
280
|
+
/**
|
|
281
|
+
* 进度条宽度
|
|
282
|
+
*/
|
|
254
283
|
width: number;
|
|
284
|
+
/**
|
|
285
|
+
* 进度,0-100
|
|
286
|
+
*/
|
|
287
|
+
length: number;
|
|
288
|
+
/**
|
|
289
|
+
* 背景色
|
|
290
|
+
*/
|
|
255
291
|
bgColor: string;
|
|
292
|
+
/**
|
|
293
|
+
* 背景色-渐变
|
|
294
|
+
*/
|
|
256
295
|
bgColors: never[];
|
|
296
|
+
/**
|
|
297
|
+
* 底色
|
|
298
|
+
*/
|
|
257
299
|
runColor: string;
|
|
300
|
+
/**
|
|
301
|
+
* 底色-渐变
|
|
302
|
+
*/
|
|
258
303
|
runColors: never[];
|
|
304
|
+
/**
|
|
305
|
+
* 进度色
|
|
306
|
+
*/
|
|
259
307
|
successColor: string;
|
|
308
|
+
/**
|
|
309
|
+
* 进度色-渐变
|
|
310
|
+
*/
|
|
260
311
|
successColors: never[];
|
|
312
|
+
/**
|
|
313
|
+
* 进度条厚度
|
|
314
|
+
*/
|
|
261
315
|
strokeWidth: number;
|
|
262
316
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
263
317
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -85,12 +85,33 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
85
85
|
default: string;
|
|
86
86
|
};
|
|
87
87
|
}>> & Readonly<{}>, {
|
|
88
|
+
/**
|
|
89
|
+
* 使用的图标大小,默认为'20'
|
|
90
|
+
*/
|
|
88
91
|
size: any;
|
|
92
|
+
/**
|
|
93
|
+
* 使用的图标名称,默认为'up'
|
|
94
|
+
*/
|
|
89
95
|
name: string;
|
|
96
|
+
/**
|
|
97
|
+
* 加载静态资源地址,如https://cdn.xx.xx/vicon或者/static/vicon
|
|
98
|
+
*/
|
|
90
99
|
url: string;
|
|
100
|
+
/**
|
|
101
|
+
* 使用的图标库名称,默认为'ant'
|
|
102
|
+
*/
|
|
91
103
|
lib: string;
|
|
104
|
+
/**
|
|
105
|
+
* 使用的图标颜色,默认为'currentColor'
|
|
106
|
+
*/
|
|
92
107
|
color: any;
|
|
108
|
+
/**
|
|
109
|
+
* 如果为true,使用设计的图标颜色使得color属性无效。默认为false,一般用于多色或固定色图标
|
|
110
|
+
*/
|
|
93
111
|
nofill: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 图标宽高显示单位,默认为px
|
|
114
|
+
*/
|
|
94
115
|
unit: string;
|
|
95
116
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
96
117
|
export default _default;
|
|
@@ -92,11 +92,29 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
92
92
|
}>> & Readonly<{
|
|
93
93
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
94
94
|
}>, {
|
|
95
|
+
/**
|
|
96
|
+
* 开启背景色
|
|
97
|
+
*/
|
|
95
98
|
mask: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* 是否显示
|
|
101
|
+
*/
|
|
96
102
|
show: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* 背景色
|
|
105
|
+
*/
|
|
97
106
|
maskBgColor: string;
|
|
107
|
+
/**
|
|
108
|
+
* 是否可以点击背景关闭
|
|
109
|
+
*/
|
|
98
110
|
closemask: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* 放置位置
|
|
113
|
+
*/
|
|
99
114
|
to: string;
|
|
115
|
+
/**
|
|
116
|
+
* 是否是布局显示,默认是全屏
|
|
117
|
+
*/
|
|
100
118
|
box: any;
|
|
101
119
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
102
120
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -178,11 +196,29 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
178
196
|
}>> & Readonly<{
|
|
179
197
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
180
198
|
}>, {
|
|
199
|
+
/**
|
|
200
|
+
* 开启背景色
|
|
201
|
+
*/
|
|
181
202
|
mask: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* 是否显示
|
|
205
|
+
*/
|
|
182
206
|
show: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* 背景色
|
|
209
|
+
*/
|
|
183
210
|
maskBgColor: string;
|
|
211
|
+
/**
|
|
212
|
+
* 是否可以点击背景关闭
|
|
213
|
+
*/
|
|
184
214
|
closemask: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* 放置位置
|
|
217
|
+
*/
|
|
185
218
|
to: string;
|
|
219
|
+
/**
|
|
220
|
+
* 是否是布局显示,默认是全屏
|
|
221
|
+
*/
|
|
186
222
|
box: any;
|
|
187
223
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
188
224
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -6,13 +6,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
6
6
|
default: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* 使用的图标库名称,默认为''
|
|
9
|
+
* 使用的图标库名称,默认为'',传入wx,此时对应[域名或static]/vsicon/wx目录
|
|
10
10
|
*/
|
|
11
11
|
lib: {
|
|
12
12
|
default: string;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* 使用的图标名称,默认为'up'
|
|
15
|
+
* 使用的图标名称,默认为'up',对应[域名或static]/vsicon/up.svg
|
|
16
|
+
* @p 如果lib存在值比如wx,则对应[域名或static]/vsicon/wx/up.svg
|
|
16
17
|
*/
|
|
17
18
|
name: {
|
|
18
19
|
default: string;
|
|
@@ -42,7 +43,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
42
43
|
default: string[] | string;
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
|
-
* 鼠标悬浮时使用的图标颜色,默认为
|
|
46
|
+
* 鼠标悬浮时使用的图标颜色,默认为undefined
|
|
46
47
|
*/
|
|
47
48
|
hoverColor: {
|
|
48
49
|
default: string[] | string;
|
|
@@ -67,13 +68,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
68
|
default: string;
|
|
68
69
|
};
|
|
69
70
|
/**
|
|
70
|
-
* 使用的图标库名称,默认为''
|
|
71
|
+
* 使用的图标库名称,默认为'',传入wx,此时对应[域名或static]/vsicon/wx目录
|
|
71
72
|
*/
|
|
72
73
|
lib: {
|
|
73
74
|
default: string;
|
|
74
75
|
};
|
|
75
76
|
/**
|
|
76
|
-
* 使用的图标名称,默认为'up'
|
|
77
|
+
* 使用的图标名称,默认为'up',对应[域名或static]/vsicon/up.svg
|
|
78
|
+
* @p 如果lib存在值比如wx,则对应[域名或static]/vsicon/wx/up.svg
|
|
77
79
|
*/
|
|
78
80
|
name: {
|
|
79
81
|
default: string;
|
|
@@ -103,7 +105,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
103
105
|
default: string[] | string;
|
|
104
106
|
};
|
|
105
107
|
/**
|
|
106
|
-
* 鼠标悬浮时使用的图标颜色,默认为
|
|
108
|
+
* 鼠标悬浮时使用的图标颜色,默认为undefined
|
|
107
109
|
*/
|
|
108
110
|
hoverColor: {
|
|
109
111
|
default: string[] | string;
|
|
@@ -121,15 +123,45 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
121
123
|
default: string;
|
|
122
124
|
};
|
|
123
125
|
}>> & Readonly<{}>, {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
/**
|
|
127
|
+
* 图标大小-高
|
|
128
|
+
*/
|
|
126
129
|
height: any;
|
|
130
|
+
/**
|
|
131
|
+
* 图标大小-宽
|
|
132
|
+
*/
|
|
133
|
+
width: any;
|
|
134
|
+
/**
|
|
135
|
+
* 使用的图标大小,默认为'20'
|
|
136
|
+
*/
|
|
137
|
+
size: any;
|
|
138
|
+
/**
|
|
139
|
+
* 使用的图标名称,默认为'up',对应[域名或static]/vsicon/up.svg @p 如果lib存在值比如wx,则对应[域名或static]/vsicon/wx/up.svg
|
|
140
|
+
*/
|
|
127
141
|
name: string;
|
|
142
|
+
/**
|
|
143
|
+
* 加载静态资源地址,如https://cdn.xx.xx/vsicon或者/static/vsicon
|
|
144
|
+
*/
|
|
128
145
|
url: string;
|
|
146
|
+
/**
|
|
147
|
+
* 使用的图标库名称,默认为'',传入wx,此时对应[域名或static]/vsicon/wx目录
|
|
148
|
+
*/
|
|
129
149
|
lib: string;
|
|
150
|
+
/**
|
|
151
|
+
* 使用的图标颜色,默认为[]
|
|
152
|
+
*/
|
|
130
153
|
color: string | string[];
|
|
154
|
+
/**
|
|
155
|
+
* 图标宽高显示单位,默认为px
|
|
156
|
+
*/
|
|
131
157
|
unit: string;
|
|
158
|
+
/**
|
|
159
|
+
* 鼠标悬浮时使用的图标颜色,默认为undefined
|
|
160
|
+
*/
|
|
132
161
|
hoverColor: string | string[];
|
|
162
|
+
/**
|
|
163
|
+
* 用于hover时的dom元素id或者class,默认为undefined
|
|
164
|
+
*/
|
|
133
165
|
pid: string;
|
|
134
166
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
135
167
|
export default _default;
|
|
@@ -44,6 +44,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
44
44
|
active: any;
|
|
45
45
|
placeholder: string;
|
|
46
46
|
list: Item[];
|
|
47
|
+
/**
|
|
48
|
+
* 可输入进行过滤
|
|
49
|
+
*/
|
|
47
50
|
filterable: any;
|
|
48
51
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
52
|
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { reactive } from 'vue';
|
|
2
|
+
|
|
3
|
+
const install = (app) => {
|
|
4
|
+
app.directive("dominfo", {
|
|
5
|
+
mounted(el, binding) {
|
|
6
|
+
const value = binding.value;
|
|
7
|
+
if (typeof value !== "object") {
|
|
8
|
+
console.error("dominfo 指令的值必须是一个对象");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const debounce = (fn, delay) => {
|
|
12
|
+
let timeoutId;
|
|
13
|
+
return (...args) => {
|
|
14
|
+
clearTimeout(timeoutId);
|
|
15
|
+
timeoutId = setTimeout(() => fn.apply(null, args), delay);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const dimensions = reactive({
|
|
19
|
+
height: 0,
|
|
20
|
+
width: 0,
|
|
21
|
+
scrollTop: 0,
|
|
22
|
+
scrollLeft: 0,
|
|
23
|
+
clientHeight: 0,
|
|
24
|
+
clientWidth: 0,
|
|
25
|
+
scrollHeight: 0,
|
|
26
|
+
scrollWidth: 0,
|
|
27
|
+
isScrollTop: false,
|
|
28
|
+
isScrollBottom: false,
|
|
29
|
+
isScrollLeft: false,
|
|
30
|
+
isScrollRight: false,
|
|
31
|
+
el
|
|
32
|
+
});
|
|
33
|
+
value.dominfo = dimensions;
|
|
34
|
+
let resizeObserver = null;
|
|
35
|
+
const updateInfo = (rect, target) => {
|
|
36
|
+
dimensions.height = rect?.height ?? target.offsetHeight;
|
|
37
|
+
dimensions.width = rect?.width ?? target.offsetWidth;
|
|
38
|
+
dimensions.scrollTop = target.scrollTop;
|
|
39
|
+
dimensions.scrollLeft = target.scrollLeft;
|
|
40
|
+
dimensions.clientHeight = target.clientHeight;
|
|
41
|
+
dimensions.clientWidth = target.clientWidth;
|
|
42
|
+
dimensions.scrollHeight = target.scrollHeight;
|
|
43
|
+
dimensions.scrollWidth = target.scrollWidth;
|
|
44
|
+
dimensions.isScrollTop = dimensions.scrollTop === 0;
|
|
45
|
+
dimensions.isScrollBottom = Math.abs(dimensions.scrollTop + dimensions.clientHeight - dimensions.scrollHeight) < 1;
|
|
46
|
+
dimensions.isScrollLeft = dimensions.scrollLeft === 0;
|
|
47
|
+
dimensions.isScrollRight = Math.abs(dimensions.scrollLeft + dimensions.clientWidth - dimensions.scrollWidth) < 1;
|
|
48
|
+
};
|
|
49
|
+
const debouncedUpdate = debounce((rect) => {
|
|
50
|
+
updateInfo(rect || el.getBoundingClientRect(), el);
|
|
51
|
+
}, 16);
|
|
52
|
+
const handleScroll = () => {
|
|
53
|
+
debouncedUpdate();
|
|
54
|
+
};
|
|
55
|
+
const initObservers = () => {
|
|
56
|
+
debouncedUpdate();
|
|
57
|
+
el.addEventListener("scroll", handleScroll, { passive: true });
|
|
58
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
59
|
+
for (const entry of entries) {
|
|
60
|
+
debouncedUpdate(entry.contentRect);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
resizeObserver.observe(el);
|
|
64
|
+
};
|
|
65
|
+
const cleanup = () => {
|
|
66
|
+
if (resizeObserver) {
|
|
67
|
+
resizeObserver.disconnect();
|
|
68
|
+
resizeObserver = null;
|
|
69
|
+
}
|
|
70
|
+
el.removeEventListener("scroll", handleScroll);
|
|
71
|
+
if (value.dominfo) {
|
|
72
|
+
value.dominfo = null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
el._dominfoCleanup = cleanup;
|
|
76
|
+
initObservers();
|
|
77
|
+
},
|
|
78
|
+
unmounted(el, binding) {
|
|
79
|
+
if (typeof el._dominfoCleanup === "function") {
|
|
80
|
+
el._dominfoCleanup();
|
|
81
|
+
delete el._dominfoCleanup;
|
|
82
|
+
}
|
|
83
|
+
if (binding.value?.dominfo) {
|
|
84
|
+
binding.value.dominfo = null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { install };
|
|
@@ -8,11 +8,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8
8
|
*/
|
|
9
9
|
url: { default: "" },
|
|
10
10
|
/**
|
|
11
|
-
* 使用的图标库名称,默认为''
|
|
11
|
+
* 使用的图标库名称,默认为'',传入wx,此时对应[域名或static]/vsicon/wx目录
|
|
12
12
|
*/
|
|
13
13
|
lib: { default: "" },
|
|
14
14
|
/**
|
|
15
|
-
* 使用的图标名称,默认为'up'
|
|
15
|
+
* 使用的图标名称,默认为'up',对应[域名或static]/vsicon/up.svg
|
|
16
|
+
* @p 如果lib存在值比如wx,则对应[域名或static]/vsicon/wx/up.svg
|
|
16
17
|
*/
|
|
17
18
|
name: { default: "" },
|
|
18
19
|
/**
|
|
@@ -32,7 +33,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
33
|
*/
|
|
33
34
|
color: { default: [] },
|
|
34
35
|
/**
|
|
35
|
-
* 鼠标悬浮时使用的图标颜色,默认为
|
|
36
|
+
* 鼠标悬浮时使用的图标颜色,默认为undefined
|
|
36
37
|
*/
|
|
37
38
|
hoverColor: { default: void 0 },
|
|
38
39
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ export {}
|
|
|
12
12
|
/* prettier-ignore */
|
|
13
13
|
declare module 'vue' {
|
|
14
14
|
export interface GlobalComponents {
|
|
15
|
-
VButton:typeof import('./components/Button/index.vue')['default']
|
|
16
15
|
VCircle:typeof import('./components/Circle/index.vue')['default']
|
|
17
|
-
VIcon:typeof import('./components/Icon/index.vue')['default']
|
|
18
16
|
VMask:typeof import('./components/Mask/index.vue')['default']
|
|
19
|
-
|
|
17
|
+
VButton:typeof import('./components/Button/index.vue')['default']
|
|
18
|
+
VIcon:typeof import('./components/Icon/index.vue')['default']
|
|
20
19
|
VScale:typeof import('./components/Scale/index.vue')['default']
|
|
21
20
|
VSelect:typeof import('./components/Select/index.vue')['default']
|
|
22
21
|
VSwitch:typeof import('./components/Switch/index.vue')['default']
|
|
22
|
+
VSIcon:typeof import('./components/SIcon/index.vue')['default']
|
|
23
23
|
}
|
|
24
24
|
export interface ComponentCustomProperties {
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc1-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "我来助你-Vue3UI库",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,11 +33,10 @@
|
|
|
33
33
|
"build": "npm run build:package && npm run build:types && npm run build:auto",
|
|
34
34
|
"build:auto": "cd autoimport && npm run build && cd ..",
|
|
35
35
|
"build:package": "vite build",
|
|
36
|
-
"build:types": "vue-tsc --declaration --emitDeclarationOnly && tsc-alias -p tsconfig.json &&
|
|
36
|
+
"build:types": "vue-tsc --declaration --emitDeclarationOnly --removeComments false && tsc-alias -p tsconfig.json && tsx ./build/restoreComments.ts && tsx ./build/buildTypes.ts",
|
|
37
37
|
"format": "prettier --write . ",
|
|
38
38
|
"typecheck": "vue-tsc --noEmit",
|
|
39
|
-
"
|
|
40
|
-
"publish": "npm publish --access public"
|
|
39
|
+
"publishacc": "npm publish --access public"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@types/node": "22.15.2",
|