@fangzhongya/vue-archive 0.0.76 → 0.0.78
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/node/index.cjs +145 -108
- package/dist/node/index.js +145 -108
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +25 -17
- package/dist/packages/components/use/code.js +92 -92
- package/dist/packages/components/use/edit.cjs +5 -5
- package/dist/packages/components/use/edit.js +63 -63
- package/dist/packages/components/use/retrie/any/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/any/index.vue.js +27 -49
- package/dist/packages/components/use/retrie/choice/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/choice/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/choice/index.vue.js +24 -27
- package/dist/packages/components/use/retrie/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/index.vue.js +12 -12
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.d.ts +41 -0
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/editor.js +50 -29
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.cjs +416 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.d.ts +2 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.js +427 -0
- package/dist/packages/components/use/retrie/other/index.d.ts +13 -12
- package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/other/index.vue.js +1 -1
- package/dist/packages/components/use/retrie/select/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/select/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/select/index.vue.js +26 -26
- package/dist/packages/components/use/set-props.d.ts +1 -1
- package/dist/packages/components/use/set-props.vue.cjs +1 -1
- package/dist/packages/components/use/set-props.vue.js +21 -24
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.d.ts +23 -25
- package/dist/packages/components/use/util.js +161 -136
- package/package.json +2 -2
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
const e = `
|
|
2
|
+
// ====================== 核心响应式 API ======================
|
|
3
|
+
export interface Ref<T> {
|
|
4
|
+
value: T;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ComputedRef<T> extends Readonly<Ref<T>> {}
|
|
8
|
+
|
|
9
|
+
export interface WritableComputedRef<T> extends Ref<T> {}
|
|
10
|
+
|
|
11
|
+
export function ref<T>(value: T): Ref<T>;
|
|
12
|
+
export function ref<T>(): Ref<T | undefined>;
|
|
13
|
+
|
|
14
|
+
export function reactive<T extends object>(target: T): T;
|
|
15
|
+
|
|
16
|
+
export function computed<T>(
|
|
17
|
+
getter: () => T,
|
|
18
|
+
debuggerOptions?: DebuggerOptions
|
|
19
|
+
): ComputedRef<T>;
|
|
20
|
+
|
|
21
|
+
export function computed<T>(
|
|
22
|
+
options: {
|
|
23
|
+
get: () => T;
|
|
24
|
+
set: (value: T) => void;
|
|
25
|
+
},
|
|
26
|
+
debuggerOptions?: DebuggerOptions
|
|
27
|
+
): WritableComputedRef<T>;
|
|
28
|
+
|
|
29
|
+
// ====================== 生命周期钩子 ======================
|
|
30
|
+
export function onBeforeMount(callback: () => void): void;
|
|
31
|
+
export function onMounted(callback: () => void): void;
|
|
32
|
+
export function onBeforeUpdate(callback: () => void): void;
|
|
33
|
+
export function onUpdated(callback: () => void): void;
|
|
34
|
+
export function onBeforeUnmount(callback: () => void): void;
|
|
35
|
+
export function onUnmounted(callback: () => void): void;
|
|
36
|
+
export function onErrorCaptured(callback: (err: unknown) => boolean | void): void;
|
|
37
|
+
export function onRenderTracked(callback: (e: DebuggerEvent) => void): void;
|
|
38
|
+
export function onRenderTriggered(callback: (e: DebuggerEvent) => void): void;
|
|
39
|
+
export function onActivated(callback: () => void): void;
|
|
40
|
+
export function onDeactivated(callback: () => void): void;
|
|
41
|
+
export function onServerPrefetch(callback: () => Promise<void>): void;
|
|
42
|
+
|
|
43
|
+
// ====================== 依赖注入 API ======================
|
|
44
|
+
export type InjectionKey<T> = Symbol | string;
|
|
45
|
+
|
|
46
|
+
export function provide<T>(key: InjectionKey<T> | string, value: T): void;
|
|
47
|
+
|
|
48
|
+
export function inject<T>(key: InjectionKey<T> | string): T | undefined;
|
|
49
|
+
export function inject<T>(key: InjectionKey<T> | string, defaultValue: T): T;
|
|
50
|
+
export function inject<T>(key: InjectionKey<T> | string, defaultValue: () => T, treatDefaultAsFactory: true): T;
|
|
51
|
+
|
|
52
|
+
// ====================== 响应式工具函数 ======================
|
|
53
|
+
export function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
|
54
|
+
|
|
55
|
+
export function unref<T>(ref: T | Ref<T>): T;
|
|
56
|
+
|
|
57
|
+
export function toRef<T extends object, K extends keyof T>(
|
|
58
|
+
object: T,
|
|
59
|
+
key: K
|
|
60
|
+
): Ref<T[K]>;
|
|
61
|
+
|
|
62
|
+
export function toRefs<T extends object>(
|
|
63
|
+
object: T
|
|
64
|
+
): { [K in keyof T]: Ref<T[K]> };
|
|
65
|
+
|
|
66
|
+
export function isProxy(value: unknown): boolean;
|
|
67
|
+
|
|
68
|
+
export function isReactive(value: unknown): boolean;
|
|
69
|
+
|
|
70
|
+
export function isReadonly(value: unknown): boolean;
|
|
71
|
+
|
|
72
|
+
export function markRaw<T extends object>(value: T): T;
|
|
73
|
+
|
|
74
|
+
export function shallowRef<T>(value: T): Ref<T>;
|
|
75
|
+
|
|
76
|
+
export function triggerRef(ref: Ref<any>): void;
|
|
77
|
+
|
|
78
|
+
export function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
|
79
|
+
|
|
80
|
+
export function shallowReactive<T extends object>(target: T): T;
|
|
81
|
+
|
|
82
|
+
export function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
|
83
|
+
|
|
84
|
+
// ====================== Watch API ======================
|
|
85
|
+
export type WatchSource<T = any> = Ref<T> | (() => T);
|
|
86
|
+
|
|
87
|
+
export type WatchCallback<V = any, OV = any> = (
|
|
88
|
+
value: V,
|
|
89
|
+
oldValue: OV,
|
|
90
|
+
onInvalidate: InvalidateCbRegistrator
|
|
91
|
+
) => any;
|
|
92
|
+
|
|
93
|
+
export interface WatchOptions {
|
|
94
|
+
immediate?: boolean;
|
|
95
|
+
deep?: boolean;
|
|
96
|
+
flush?: 'pre' | 'post' | 'sync';
|
|
97
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
98
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface WatchEffectOptions {
|
|
102
|
+
flush?: 'pre' | 'post' | 'sync';
|
|
103
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
104
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function watch<T>(
|
|
108
|
+
source: WatchSource<T>,
|
|
109
|
+
callback: WatchCallback<T>,
|
|
110
|
+
options?: WatchOptions
|
|
111
|
+
): StopHandle;
|
|
112
|
+
|
|
113
|
+
export function watch<T>(
|
|
114
|
+
sources: WatchSource<T>[],
|
|
115
|
+
callback: WatchCallback<T[], T[]>,
|
|
116
|
+
options?: WatchOptions
|
|
117
|
+
): StopHandle;
|
|
118
|
+
|
|
119
|
+
export function watchEffect(
|
|
120
|
+
effect: (onInvalidate: InvalidateCbRegistrator) => void,
|
|
121
|
+
options?: WatchEffectOptions
|
|
122
|
+
): StopHandle;
|
|
123
|
+
|
|
124
|
+
export function watchPostEffect(
|
|
125
|
+
effect: (onInvalidate: InvalidateCbRegistrator) => void,
|
|
126
|
+
options?: Omit<WatchEffectOptions, 'flush'>
|
|
127
|
+
): StopHandle;
|
|
128
|
+
|
|
129
|
+
export function watchSyncEffect(
|
|
130
|
+
effect: (onInvalidate: InvalidateCbRegistrator) => void,
|
|
131
|
+
options?: Omit<WatchEffectOptions, 'flush'>
|
|
132
|
+
): StopHandle;
|
|
133
|
+
|
|
134
|
+
// ====================== 组件 API ======================
|
|
135
|
+
export function defineComponent<Props, RawBindings = object>(
|
|
136
|
+
setup: (
|
|
137
|
+
props: Readonly<Props>,
|
|
138
|
+
ctx: SetupContext
|
|
139
|
+
) => RawBindings | (() => JSX.Element | null)
|
|
140
|
+
): {
|
|
141
|
+
new (): {
|
|
142
|
+
$props: Props;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export interface SetupContext {
|
|
147
|
+
attrs: Record<string, any>;
|
|
148
|
+
slots: Record<string, Function | undefined>;
|
|
149
|
+
emit: (event: string, ...args: any[]) => void;
|
|
150
|
+
expose: (exposed: Record<string, any>) => void;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ====================== 模板引用 API ======================
|
|
154
|
+
export function templateRef<T extends HTMLElement = HTMLElement>(
|
|
155
|
+
key: string
|
|
156
|
+
): Ref<T | null>;
|
|
157
|
+
|
|
158
|
+
// ====================== 类型定义 ======================
|
|
159
|
+
export interface DebuggerOptions {
|
|
160
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
161
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface DebuggerEvent {
|
|
165
|
+
effect: ReactiveEffect;
|
|
166
|
+
target: any;
|
|
167
|
+
type: OperationTypes;
|
|
168
|
+
key: string | symbol | undefined;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type StopHandle = () => void;
|
|
172
|
+
|
|
173
|
+
export type InvalidateCbRegistrator = (cb: () => void) => void;
|
|
174
|
+
|
|
175
|
+
export type CustomRefFactory<T> = (
|
|
176
|
+
track: () => void,
|
|
177
|
+
trigger: () => void
|
|
178
|
+
) => {
|
|
179
|
+
get: () => T;
|
|
180
|
+
set: (value: T) => void;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export interface ReactiveEffect<T = any> {
|
|
184
|
+
(): T;
|
|
185
|
+
id: number;
|
|
186
|
+
active: boolean;
|
|
187
|
+
raw: () => T;
|
|
188
|
+
deps: Array<Dep>;
|
|
189
|
+
options: ReactiveEffectOptions;
|
|
190
|
+
allowRecurse: boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ReactiveEffectOptions {
|
|
194
|
+
lazy?: boolean;
|
|
195
|
+
scheduler?: (job: ReactiveEffect) => void;
|
|
196
|
+
onTrack?: (event: DebuggerEvent) => void;
|
|
197
|
+
onTrigger?: (event: DebuggerEvent) => void;
|
|
198
|
+
onStop?: () => void;
|
|
199
|
+
allowRecurse?: boolean;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type Dep = Set<ReactiveEffect>;
|
|
203
|
+
|
|
204
|
+
export const enum OperationTypes {
|
|
205
|
+
GET = 'get',
|
|
206
|
+
SET = 'set',
|
|
207
|
+
HAS = 'has',
|
|
208
|
+
ADD = 'add',
|
|
209
|
+
DELETE = 'delete',
|
|
210
|
+
CLEAR = 'clear',
|
|
211
|
+
ITERATE = 'iterate'
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ====================== 其他实用 API ======================
|
|
215
|
+
export function nextTick(callback?: () => void): Promise<void>;
|
|
216
|
+
|
|
217
|
+
export function set<T>(object: object, key: string | number, value: T): T;
|
|
218
|
+
|
|
219
|
+
export function del<T>(object: object, key: string | number): void;
|
|
220
|
+
|
|
221
|
+
export function useCssModule(name?: string): Record<string, string>;
|
|
222
|
+
|
|
223
|
+
// ====================== Suspense API ======================
|
|
224
|
+
export function onSuspenseEvent(callback: () => void): void;
|
|
225
|
+
|
|
226
|
+
// ====================== 服务端渲染 API ======================
|
|
227
|
+
export function useSSRContext<T = Record<string, any>>(): T | void;
|
|
228
|
+
|
|
229
|
+
// ====================== 组合函数工具 ======================
|
|
230
|
+
export function useAttrs(): Record<string, string>;
|
|
231
|
+
|
|
232
|
+
export function useSlots(): Record<string, Function | undefined>;
|
|
233
|
+
|
|
234
|
+
// ====================== 路由相关 (Vue Router) ======================
|
|
235
|
+
export function useRoute(): RouteLocationNormalizedLoaded;
|
|
236
|
+
|
|
237
|
+
export function useRouter(): Router;
|
|
238
|
+
|
|
239
|
+
export interface RouteLocationNormalizedLoaded {
|
|
240
|
+
path: string;
|
|
241
|
+
name: string | null | undefined;
|
|
242
|
+
params: Record<string, string | string[]>;
|
|
243
|
+
query: Record<string, string | string[]>;
|
|
244
|
+
hash: string;
|
|
245
|
+
fullPath: string;
|
|
246
|
+
matched: RouteRecordNormalized[];
|
|
247
|
+
meta: Record<string | number | symbol, any>;
|
|
248
|
+
redirectedFrom: RouteLocationNormalizedLoaded | undefined;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface Router {
|
|
252
|
+
push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
253
|
+
replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
|
|
254
|
+
go(delta: number): void;
|
|
255
|
+
back(): void;
|
|
256
|
+
forward(): void;
|
|
257
|
+
addRoute(route: RouteRecordRaw): () => void;
|
|
258
|
+
removeRoute(name: string): void;
|
|
259
|
+
hasRoute(name: string): boolean;
|
|
260
|
+
getRoutes(): RouteRecordNormalized[];
|
|
261
|
+
resolve(to: RouteLocationRaw): RouteLocation & {
|
|
262
|
+
href: string;
|
|
263
|
+
};
|
|
264
|
+
beforeEach(guard: NavigationGuard): () => void;
|
|
265
|
+
beforeResolve(guard: NavigationGuard): () => void;
|
|
266
|
+
afterEach(guard: NavigationHookAfter): () => void;
|
|
267
|
+
onError(handler: (error: any) => any): () => void;
|
|
268
|
+
isReady(): Promise<void>;
|
|
269
|
+
install(app: App): void;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ====================== 状态管理 (Pinia) ======================
|
|
273
|
+
export function defineStore<Id extends string, S, G, A>(
|
|
274
|
+
id: Id,
|
|
275
|
+
options: Omit<DefineStoreOptions<Id, S, G, A>, 'id'>
|
|
276
|
+
): StoreDefinition<Id, S, G, A>;
|
|
277
|
+
|
|
278
|
+
export interface StoreDefinition<Id extends string, S, G, A> {
|
|
279
|
+
(): Store<Id, S, G, A>;
|
|
280
|
+
$id: Id;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface Store<Id extends string, S, G, A> {
|
|
284
|
+
$id: Id;
|
|
285
|
+
$state: S;
|
|
286
|
+
$patch(partialState: Partial<S>): void;
|
|
287
|
+
$patch(fn: (state: S) => void): void;
|
|
288
|
+
$reset(): void;
|
|
289
|
+
$subscribe(callback: (mutation: SubscriptionCallback<S>, state: S) => void, options?: { detached?: boolean }): () => void;
|
|
290
|
+
$onAction(callback: (context: ActionContext<S, G, A>) => void, options?: { detached?: boolean }): () => void;
|
|
291
|
+
$dispose(): void;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface DefineStoreOptions<Id extends string, S, G, A> {
|
|
295
|
+
id: Id;
|
|
296
|
+
state?: () => S;
|
|
297
|
+
getters?: G & ThisType<Store<Id, S, G, A>> & Record<string, (state: S) => any>;
|
|
298
|
+
actions?: A & ThisType<Store<Id, S, G, A>>;
|
|
299
|
+
hydrate?(storeState: S, initialState: S): void;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ====================== 类型工具 ======================
|
|
303
|
+
export type MaybeRef<T> = T | Ref<T>;
|
|
304
|
+
export type MaybeRefOrGetter<T> = MaybeRef<T> | (() => T);
|
|
305
|
+
|
|
306
|
+
// ====================== 组合式函数 ======================
|
|
307
|
+
export function useMouse(): {
|
|
308
|
+
x: Ref<number>;
|
|
309
|
+
y: Ref<number>;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export function useFetch<T>(url: MaybeRefOrGetter<string>, options?: any): {
|
|
313
|
+
data: Ref<T | null>;
|
|
314
|
+
error: Ref<any | null>;
|
|
315
|
+
isFetching: Ref<boolean>;
|
|
316
|
+
execute: () => Promise<void>;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export function useDebounceFn<T extends Function>(fn: T, delay?: number): T;
|
|
320
|
+
|
|
321
|
+
export function useThrottleFn<T extends Function>(fn: T, delay?: number): T;
|
|
322
|
+
|
|
323
|
+
export function useLocalStorage<T>(key: string, initialValue: T): Ref<T>;
|
|
324
|
+
|
|
325
|
+
export function useSessionStorage<T>(key: string, initialValue: T): Ref<T>;
|
|
326
|
+
|
|
327
|
+
export function useElementBounding(ref: Ref<HTMLElement | null>): {
|
|
328
|
+
width: Ref<number>;
|
|
329
|
+
height: Ref<number>;
|
|
330
|
+
top: Ref<number>;
|
|
331
|
+
right: Ref<number>;
|
|
332
|
+
bottom: Ref<number>;
|
|
333
|
+
left: Ref<number>;
|
|
334
|
+
x: Ref<number>;
|
|
335
|
+
y: Ref<number>;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// ====================== 全局配置 ======================
|
|
339
|
+
export interface GlobalConfig {
|
|
340
|
+
silent: boolean;
|
|
341
|
+
devtools: boolean;
|
|
342
|
+
performance: boolean;
|
|
343
|
+
errorHandler?: (err: unknown, vm: ComponentPublicInstance | null, info: string) => void;
|
|
344
|
+
warnHandler?: (msg: string, vm: ComponentPublicInstance | null, trace: string) => void;
|
|
345
|
+
globalProperties: Record<string, any>;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function useConfig(): GlobalConfig;
|
|
349
|
+
`;
|
|
350
|
+
function o() {
|
|
351
|
+
return e;
|
|
352
|
+
}
|
|
353
|
+
const t = `
|
|
354
|
+
export {}
|
|
355
|
+
declare global {
|
|
356
|
+
const computed: typeof import('vue')['computed']
|
|
357
|
+
const createApp: typeof import('vue')['createApp']
|
|
358
|
+
const customRef: typeof import('vue')['customRef']
|
|
359
|
+
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
|
360
|
+
const defineComponent: typeof import('vue')['defineComponent']
|
|
361
|
+
const effectScope: typeof import('vue')['effectScope']
|
|
362
|
+
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
|
363
|
+
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
|
364
|
+
const getCurrentWatcher: typeof import('vue')['getCurrentWatcher']
|
|
365
|
+
const h: typeof import('vue')['h']
|
|
366
|
+
const inject: typeof import('vue')['inject']
|
|
367
|
+
const isProxy: typeof import('vue')['isProxy']
|
|
368
|
+
const isReactive: typeof import('vue')['isReactive']
|
|
369
|
+
const isReadonly: typeof import('vue')['isReadonly']
|
|
370
|
+
const isRef: typeof import('vue')['isRef']
|
|
371
|
+
const isShallow: typeof import('vue')['isShallow']
|
|
372
|
+
const markRaw: typeof import('vue')['markRaw']
|
|
373
|
+
const nextTick: typeof import('vue')['nextTick']
|
|
374
|
+
const onActivated: typeof import('vue')['onActivated']
|
|
375
|
+
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
|
376
|
+
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
|
377
|
+
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
|
378
|
+
const onDeactivated: typeof import('vue')['onDeactivated']
|
|
379
|
+
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
|
380
|
+
const onMounted: typeof import('vue')['onMounted']
|
|
381
|
+
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
|
382
|
+
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
|
383
|
+
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
|
384
|
+
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
|
385
|
+
const onUnmounted: typeof import('vue')['onUnmounted']
|
|
386
|
+
const onUpdated: typeof import('vue')['onUpdated']
|
|
387
|
+
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
|
|
388
|
+
const provide: typeof import('vue')['provide']
|
|
389
|
+
const reactive: typeof import('vue')['reactive']
|
|
390
|
+
const readonly: typeof import('vue')['readonly']
|
|
391
|
+
const ref: typeof import('vue')['ref']
|
|
392
|
+
const resolveComponent: typeof import('vue')['resolveComponent']
|
|
393
|
+
const shallowReactive: typeof import('vue')['shallowReactive']
|
|
394
|
+
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
|
395
|
+
const shallowRef: typeof import('vue')['shallowRef']
|
|
396
|
+
const toRaw: typeof import('vue')['toRaw']
|
|
397
|
+
const toRef: typeof import('vue')['toRef']
|
|
398
|
+
const toRefs: typeof import('vue')['toRefs']
|
|
399
|
+
const toValue: typeof import('vue')['toValue']
|
|
400
|
+
const triggerRef: typeof import('vue')['triggerRef']
|
|
401
|
+
const unref: typeof import('vue')['unref']
|
|
402
|
+
const useAttrs: typeof import('vue')['useAttrs']
|
|
403
|
+
const useCssModule: typeof import('vue')['useCssModule']
|
|
404
|
+
const useCssVars: typeof import('vue')['useCssVars']
|
|
405
|
+
const useId: typeof import('vue')['useId']
|
|
406
|
+
const useModel: typeof import('vue')['useModel']
|
|
407
|
+
const useSlots: typeof import('vue')['useSlots']
|
|
408
|
+
const useTemplateRef: typeof import('vue')['useTemplateRef']
|
|
409
|
+
const watch: typeof import('vue')['watch']
|
|
410
|
+
const watchEffect: typeof import('vue')['watchEffect']
|
|
411
|
+
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
|
412
|
+
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
|
413
|
+
}
|
|
414
|
+
// for type re-export
|
|
415
|
+
declare global {
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
|
|
418
|
+
import('vue')
|
|
419
|
+
}
|
|
420
|
+
`;
|
|
421
|
+
function n() {
|
|
422
|
+
return t;
|
|
423
|
+
}
|
|
424
|
+
export {
|
|
425
|
+
n as getGlobals,
|
|
426
|
+
o as getVue
|
|
427
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { DataType } from '../../util';
|
|
1
2
|
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from '../../../../../vue/dist/vue.esm-bundler.js';
|
|
2
3
|
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
3
4
|
modelValue: {
|
|
4
5
|
type: null;
|
|
5
6
|
};
|
|
6
7
|
dataType: {
|
|
7
|
-
type:
|
|
8
|
-
(arrayLength: number):
|
|
9
|
-
(...items:
|
|
10
|
-
new (arrayLength: number):
|
|
11
|
-
new (...items:
|
|
8
|
+
type: {
|
|
9
|
+
(arrayLength: number): DataType[];
|
|
10
|
+
(...items: DataType[]): DataType[];
|
|
11
|
+
new (arrayLength: number): DataType[];
|
|
12
|
+
new (...items: DataType[]): DataType[];
|
|
12
13
|
isArray(arg: any): arg is any[];
|
|
13
14
|
readonly prototype: any[];
|
|
14
15
|
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
@@ -19,7 +20,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
19
20
|
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
20
21
|
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
21
22
|
readonly [Symbol.species]: ArrayConstructor;
|
|
22
|
-
}
|
|
23
|
+
}[];
|
|
23
24
|
};
|
|
24
25
|
disabled: BooleanConstructor;
|
|
25
26
|
list: {
|
|
@@ -40,11 +41,11 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
40
41
|
type: null;
|
|
41
42
|
};
|
|
42
43
|
dataType: {
|
|
43
|
-
type:
|
|
44
|
-
(arrayLength: number):
|
|
45
|
-
(...items:
|
|
46
|
-
new (arrayLength: number):
|
|
47
|
-
new (...items:
|
|
44
|
+
type: {
|
|
45
|
+
(arrayLength: number): DataType[];
|
|
46
|
+
(...items: DataType[]): DataType[];
|
|
47
|
+
new (arrayLength: number): DataType[];
|
|
48
|
+
new (...items: DataType[]): DataType[];
|
|
48
49
|
isArray(arg: any): arg is any[];
|
|
49
50
|
readonly prototype: any[];
|
|
50
51
|
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
@@ -55,7 +56,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
55
56
|
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
56
57
|
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
57
58
|
readonly [Symbol.species]: ArrayConstructor;
|
|
58
|
-
}
|
|
59
|
+
}[];
|
|
59
60
|
};
|
|
60
61
|
disabled: BooleanConstructor;
|
|
61
62
|
list: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const
|
|
1
|
+
"use strict";const o=require("vue"),m=require("../input/index.vue.cjs");;/* empty css */const c=require("../../util.cjs"),f={class:"form-other"},v=o.defineComponent({__name:"index",props:{modelValue:{type:null},dataType:{type:[Array]},disabled:Boolean,list:{type:Array},config:{type:Object,default(){return{label:"label",prop:"prop"}}}},emits:["value","error"],setup(i,{emit:p}){const a=i,t=p,n=o.ref("");o.watch(()=>a.modelValue,async()=>{let e=a.modelValue;n.value=await u(e)||e},{immediate:!0});function d(e){return new Function("",`{ return ${e} }`)}async function u(e){let r;if(e)try{const s=d(e)();c.isTypeEqual(s,a.dataType||[])?(r=await c.prettierFormat(e),t("value",s,r),t("error",!1)):(t("error",!0),console.log("error","类型不匹配"))}catch(l){t("error",!0),console.log("error",l)}else r="",t("value",void 0,r),t("error",!1);return r}return(e,r)=>(o.openBlock(),o.createElementBlock("div",f,[o.createVNode(m,{format:"js",modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=l=>n.value=l),check:u},null,8,["modelValue"])]))}});module.exports=v;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
import { DataType } from '../../util';
|
|
1
2
|
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from '../../../../../vue/dist/vue.esm-bundler.js';
|
|
2
3
|
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
3
4
|
modelValue: {
|
|
4
5
|
type: null;
|
|
5
6
|
};
|
|
6
7
|
dataType: {
|
|
7
|
-
type:
|
|
8
|
+
type: {
|
|
9
|
+
(arrayLength: number): DataType[];
|
|
10
|
+
(...items: DataType[]): DataType[];
|
|
11
|
+
new (arrayLength: number): DataType[];
|
|
12
|
+
new (...items: DataType[]): DataType[];
|
|
13
|
+
isArray(arg: any): arg is any[];
|
|
14
|
+
readonly prototype: any[];
|
|
15
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
16
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
17
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
18
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
19
|
+
of<T>(...items: T[]): T[];
|
|
20
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
21
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
22
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
23
|
+
};
|
|
8
24
|
};
|
|
9
25
|
disabled: BooleanConstructor;
|
|
10
26
|
list: {
|
|
@@ -26,7 +42,22 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
26
42
|
type: null;
|
|
27
43
|
};
|
|
28
44
|
dataType: {
|
|
29
|
-
type:
|
|
45
|
+
type: {
|
|
46
|
+
(arrayLength: number): DataType[];
|
|
47
|
+
(...items: DataType[]): DataType[];
|
|
48
|
+
new (arrayLength: number): DataType[];
|
|
49
|
+
new (...items: DataType[]): DataType[];
|
|
50
|
+
isArray(arg: any): arg is any[];
|
|
51
|
+
readonly prototype: any[];
|
|
52
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
53
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
54
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
55
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
56
|
+
of<T>(...items: T[]): T[];
|
|
57
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
58
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
59
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
60
|
+
};
|
|
30
61
|
};
|
|
31
62
|
disabled: BooleanConstructor;
|
|
32
63
|
list: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),p=require("../../util.cjs"),b={class:"form-select"},g=["value","disabled"],B={class:"form-select-box"},V={class:"form-select-list"},E={key:0,class:"form-select-list-div"},N=["onClick"],w={key:1,class:"no-data"},C=e.defineComponent({__name:"index",props:{modelValue:{type:null},dataType:{type:Array},disabled:Boolean,list:{type:Array},noValue:Boolean,config:{type:Object,default(){return{label:"label",prop:"prop"}}}},emits:["value","change"],setup(f,{emit:m}){const o=f,r=m,a=e.ref(!1),s=e.ref({});e.watch(()=>o.modelValue,()=>{h()},{immediate:!0});function h(){if(o.list)for(let t=0;t<o.list.length;t++){const l=o.list[t];if(i(l)===o.modelValue){s.value=l,o.noValue||d();break}}}function u(t){let l=o.config?.label;return l&&typeof t=="object"&&t?t[l]:t}function i(t){let l=o.config?.prop;return l&&typeof t=="object"&&t?t[l]:t}function y(t){return i(t)===i(s.value)}function _(){o.disabled||(a.value=!0)}function v(){setTimeout(()=>{a.value=!1},300)}function k(t){s.value=t,d()}function d(){const t=i(s.value);let l;if(o.dataType&&o.dataType.length==1){let n=p.getDataTypeType(o.dataType);if(n=="string")l=p.getString(t);else if(n=="number"){const c=Number(t);isNaN(c)?l=0:l=c}else l=t}else l=t;r("value",l,JSON.stringify(t)),r("change",l,s.value)}return(t,l)=>(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("input",{class:"form-select-input",value:u(s.value),readonly:"",placeholder:"请选择",type:"text",disabled:o.disabled,onClick:e.withModifiers(_,["stop"]),onBlur:e.withModifiers(v,["stop"])},null,40,g),e.createElementVNode("div",B,[e.withDirectives(e.createElementVNode("div",V,[o.list&&o.list.length>0?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.list,(n,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-select-list-li",{active:y(n)}]),onClick:e.withModifiers(T=>k(n),["stop"])},[e.createElementVNode("span",null,e.toDisplayString(u(n)),1)],10,N))),256))])):(e.openBlock(),e.createElementBlock("div",w,"暂无数据"))],512),[[e.vShow,a.value]])])]))}});module.exports=C;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as C, ref as
|
|
2
|
-
import {
|
|
3
|
-
const z = { class: "form-select" },
|
|
1
|
+
import { defineComponent as C, ref as y, watch as T, createElementBlock as s, openBlock as i, createElementVNode as c, withModifiers as d, withDirectives as x, Fragment as B, renderList as S, normalizeClass as w, toDisplayString as N, vShow as j } from "vue";
|
|
2
|
+
import { getDataTypeType as A, getString as D } from "../../util.js";
|
|
3
|
+
const z = { class: "form-select" }, E = ["value", "disabled"], L = { class: "form-select-box" }, O = { class: "form-select-list" }, F = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "form-select-list-div"
|
|
6
|
-
},
|
|
6
|
+
}, J = ["onClick"], M = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "no-data"
|
|
9
|
-
},
|
|
9
|
+
}, G = /* @__PURE__ */ C({
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: {
|
|
12
12
|
modelValue: {
|
|
13
13
|
type: null
|
|
14
14
|
},
|
|
15
|
-
dataType: { type:
|
|
15
|
+
dataType: { type: Array },
|
|
16
16
|
disabled: Boolean,
|
|
17
17
|
list: {
|
|
18
18
|
type: Array
|
|
@@ -29,9 +29,9 @@ const z = { class: "form-select" }, D = ["value", "disabled"], E = { class: "for
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
emits: ["value", "change"],
|
|
32
|
-
setup(
|
|
33
|
-
const l =
|
|
34
|
-
|
|
32
|
+
setup(h, { emit: _ }) {
|
|
33
|
+
const l = h, f = _, r = y(!1), n = y({});
|
|
34
|
+
T(
|
|
35
35
|
() => l.modelValue,
|
|
36
36
|
() => {
|
|
37
37
|
v();
|
|
@@ -62,11 +62,11 @@ const z = { class: "form-select" }, D = ["value", "disabled"], E = { class: "for
|
|
|
62
62
|
return a(e) === a(n.value);
|
|
63
63
|
}
|
|
64
64
|
function g() {
|
|
65
|
-
l.disabled || (
|
|
65
|
+
l.disabled || (r.value = !0);
|
|
66
66
|
}
|
|
67
67
|
function k() {
|
|
68
68
|
setTimeout(() => {
|
|
69
|
-
|
|
69
|
+
r.value = !1;
|
|
70
70
|
}, 300);
|
|
71
71
|
}
|
|
72
72
|
function V(e) {
|
|
@@ -76,9 +76,9 @@ const z = { class: "form-select" }, D = ["value", "disabled"], E = { class: "for
|
|
|
76
76
|
const e = a(n.value);
|
|
77
77
|
let t;
|
|
78
78
|
if (l.dataType && l.dataType.length == 1) {
|
|
79
|
-
let o = l.dataType
|
|
79
|
+
let o = A(l.dataType);
|
|
80
80
|
if (o == "string")
|
|
81
|
-
t =
|
|
81
|
+
t = D(e);
|
|
82
82
|
else if (o == "number") {
|
|
83
83
|
const u = Number(e);
|
|
84
84
|
isNaN(u) ? t = 0 : t = u;
|
|
@@ -89,7 +89,7 @@ const z = { class: "form-select" }, D = ["value", "disabled"], E = { class: "for
|
|
|
89
89
|
f("value", t, JSON.stringify(e)), f("change", t, n.value);
|
|
90
90
|
}
|
|
91
91
|
return (e, t) => (i(), s("div", z, [
|
|
92
|
-
|
|
92
|
+
c("input", {
|
|
93
93
|
class: "form-select-input",
|
|
94
94
|
value: p(n.value),
|
|
95
95
|
readonly: "",
|
|
@@ -98,26 +98,26 @@ const z = { class: "form-select" }, D = ["value", "disabled"], E = { class: "for
|
|
|
98
98
|
disabled: l.disabled,
|
|
99
99
|
onClick: d(g, ["stop"]),
|
|
100
100
|
onBlur: d(k, ["stop"])
|
|
101
|
-
}, null, 40,
|
|
102
|
-
|
|
103
|
-
x(
|
|
104
|
-
l.list && l.list.length > 0 ? (i(), s("div",
|
|
105
|
-
(i(!0), s(B, null,
|
|
106
|
-
class:
|
|
101
|
+
}, null, 40, E),
|
|
102
|
+
c("div", L, [
|
|
103
|
+
x(c("div", O, [
|
|
104
|
+
l.list && l.list.length > 0 ? (i(), s("div", F, [
|
|
105
|
+
(i(!0), s(B, null, S(l.list, (o, u) => (i(), s("div", {
|
|
106
|
+
class: w(["form-select-list-li", {
|
|
107
107
|
active: b(o)
|
|
108
108
|
}]),
|
|
109
|
-
onClick: d((
|
|
109
|
+
onClick: d((P) => V(o), ["stop"])
|
|
110
110
|
}, [
|
|
111
|
-
|
|
112
|
-
], 10,
|
|
113
|
-
])) : (i(), s("div",
|
|
111
|
+
c("span", null, N(p(o)), 1)
|
|
112
|
+
], 10, J))), 256))
|
|
113
|
+
])) : (i(), s("div", M, "暂无数据"))
|
|
114
114
|
], 512), [
|
|
115
|
-
[j,
|
|
115
|
+
[j, r.value]
|
|
116
116
|
])
|
|
117
117
|
])
|
|
118
118
|
]));
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
G as default
|
|
123
123
|
};
|