phecda-vue 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -4
- package/dist/index.js +123 -69
- package/dist/index.mjs +125 -69
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,14 @@ import { Ref, App, UnwrapNestedRefs, Component, DefineComponent, ExtractPropType
|
|
|
5
5
|
import { Phecda } from 'phecda-core';
|
|
6
6
|
export * from 'phecda-core';
|
|
7
7
|
|
|
8
|
-
type
|
|
9
|
-
[
|
|
8
|
+
type ReadonlyValue<T> = {
|
|
9
|
+
readonly [K in keyof T]: K extends 'value' ? T[K] : ReadonlyValue<T[K]>;
|
|
10
|
+
};
|
|
11
|
+
type PublicOnly<T> = {
|
|
12
|
+
[K in keyof T]: T[K] extends Function ? T[K] : K extends string ? T[K] extends ('private' | 'protected') ? never : T[K] : never;
|
|
13
|
+
};
|
|
14
|
+
type ReplaceInstanceValues<I> = {
|
|
15
|
+
[P in keyof I]: I[P] extends (...args: any[]) => any ? I[P] : I[P] extends Readonly<any> ? ReadonlyValue<Ref<I[P]>> : Ref<I[P]>;
|
|
10
16
|
};
|
|
11
17
|
type SchemaToObj<S> = {
|
|
12
18
|
[P in keyof S]: S[P] extends object ? SchemaToObj<S[P]> : (S[P] extends string ? any : S[P]);
|
|
@@ -48,7 +54,7 @@ type _DeepPartial<T> = {
|
|
|
48
54
|
declare function useO<T extends new (...args: any) => any>(Model: T): UnwrapNestedRefs<InstanceType<T>>;
|
|
49
55
|
declare function usePatch<T extends new (...args: any) => any>(Model: T, Data: _DeepPartial<InstanceType<T>>): void;
|
|
50
56
|
declare function useR<T extends new (...args: any) => any>(Model: T): UnwrapNestedRefs<InstanceType<T>>;
|
|
51
|
-
declare function useV<T extends new (...args: any) => any>(Model: T):
|
|
57
|
+
declare function useV<T extends new (...args: any) => any>(Model: T): PublicOnly<ReplaceInstanceValues<InstanceType<T>>>;
|
|
52
58
|
declare function useEvent<Key extends keyof PhecdaEvents>(eventName: Key, cb: Handler<PhecdaEvents[Key]>): () => void;
|
|
53
59
|
declare function initalize<M extends new (...args: any) => any>(Model: M): InstanceType<M> | void;
|
|
54
60
|
declare function clearStorage<M extends new (...args: any) => any>(Model: M, isForceUpdate?: boolean): void;
|
|
@@ -130,4 +136,4 @@ interface PipeRet {
|
|
|
130
136
|
get: Record<string, () => VNode>;
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
export { EXPRESS_RE, FN_RE, GetDevUIRules, P, PhecdaEvents,
|
|
139
|
+
export { EXPRESS_RE, FN_RE, GetDevUIRules, P, PhecdaEvents, PublicOnly, ReplaceInstanceValues, SchemaToObj, clearStorage, createFilter, createForm, createFormData, createModal, createPhecda, createPipe, createTable, deleteStorage, emitter, getActivePhecda, getAntDRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initalize, invokeAction, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
var __export = (target, all) => {
|
|
9
11
|
for (var name in all)
|
|
10
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -23,6 +25,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
25
|
mod
|
|
24
26
|
));
|
|
25
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var __publicField = (obj, key, value) => {
|
|
29
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
26
32
|
|
|
27
33
|
// src/index.ts
|
|
28
34
|
var src_exports = {};
|
|
@@ -82,7 +88,10 @@ function createPhecda(symbol) {
|
|
|
82
88
|
snapshot: () => {
|
|
83
89
|
const ret = [];
|
|
84
90
|
for (const [key, value] of phecda.useOMap)
|
|
85
|
-
ret.push({
|
|
91
|
+
ret.push({
|
|
92
|
+
key: (0, import_phecda_core.getTag)(key) || key.name,
|
|
93
|
+
value
|
|
94
|
+
});
|
|
86
95
|
return ret;
|
|
87
96
|
}
|
|
88
97
|
};
|
|
@@ -90,14 +99,15 @@ function createPhecda(symbol) {
|
|
|
90
99
|
const eventRecord = [];
|
|
91
100
|
(0, import_phecda_core.injectProperty)("watcher", ({ eventName, instance, key }) => {
|
|
92
101
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
93
|
-
eventRecord.push([
|
|
102
|
+
eventRecord.push([
|
|
103
|
+
eventName,
|
|
104
|
+
fn
|
|
105
|
+
]);
|
|
94
106
|
emitter.on(eventName, fn);
|
|
95
107
|
});
|
|
96
108
|
const originUnmount = app.unmount.bind(app);
|
|
97
109
|
app.unmount = () => {
|
|
98
|
-
eventRecord.forEach(
|
|
99
|
-
([eventName, handler]) => emitter.off(eventName, handler)
|
|
100
|
-
);
|
|
110
|
+
eventRecord.forEach(([eventName, handler]) => emitter.off(eventName, handler));
|
|
101
111
|
if (symbol)
|
|
102
112
|
delete window.__PHECDA_VUE__[symbol];
|
|
103
113
|
originUnmount();
|
|
@@ -111,6 +121,7 @@ function createPhecda(symbol) {
|
|
|
111
121
|
});
|
|
112
122
|
return phecda;
|
|
113
123
|
}
|
|
124
|
+
__name(createPhecda, "createPhecda");
|
|
114
125
|
var activePhecda = {
|
|
115
126
|
useVMap: /* @__PURE__ */ new WeakMap(),
|
|
116
127
|
useOMap: /* @__PURE__ */ new WeakMap(),
|
|
@@ -121,9 +132,11 @@ var activePhecda = {
|
|
|
121
132
|
function setActivePhecda(phecda) {
|
|
122
133
|
activePhecda = phecda;
|
|
123
134
|
}
|
|
135
|
+
__name(setActivePhecda, "setActivePhecda");
|
|
124
136
|
function getActivePhecda() {
|
|
125
137
|
return activePhecda;
|
|
126
138
|
}
|
|
139
|
+
__name(getActivePhecda, "getActivePhecda");
|
|
127
140
|
function getReactiveMap(symbol) {
|
|
128
141
|
if (!window.__PHECDA_VUE__?.[symbol])
|
|
129
142
|
return null;
|
|
@@ -133,6 +146,7 @@ function getReactiveMap(symbol) {
|
|
|
133
146
|
});
|
|
134
147
|
return ret;
|
|
135
148
|
}
|
|
149
|
+
__name(getReactiveMap, "getReactiveMap");
|
|
136
150
|
|
|
137
151
|
// src/vue/composable.ts
|
|
138
152
|
var import_vue3 = require("vue");
|
|
@@ -143,6 +157,7 @@ var import_vue2 = require("vue");
|
|
|
143
157
|
function isObject(o) {
|
|
144
158
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
145
159
|
}
|
|
160
|
+
__name(isObject, "isObject");
|
|
146
161
|
function mergeReactiveObjects(target, patchToApply) {
|
|
147
162
|
for (const key in patchToApply) {
|
|
148
163
|
if (!patchToApply.hasOwnProperty(key))
|
|
@@ -157,6 +172,7 @@ function mergeReactiveObjects(target, patchToApply) {
|
|
|
157
172
|
}
|
|
158
173
|
return target;
|
|
159
174
|
}
|
|
175
|
+
__name(mergeReactiveObjects, "mergeReactiveObjects");
|
|
160
176
|
function wrapError(target, key, errorHandler) {
|
|
161
177
|
if (isAsyncFunc(target[key])) {
|
|
162
178
|
return (...args) => {
|
|
@@ -172,19 +188,21 @@ function wrapError(target, key, errorHandler) {
|
|
|
172
188
|
};
|
|
173
189
|
}
|
|
174
190
|
}
|
|
191
|
+
__name(wrapError, "wrapError");
|
|
175
192
|
function isAsyncFunc(fn) {
|
|
176
193
|
return fn[Symbol.toStringTag] === "AsyncFunction";
|
|
177
194
|
}
|
|
195
|
+
__name(isAsyncFunc, "isAsyncFunc");
|
|
178
196
|
function createSharedReactive(composable) {
|
|
179
197
|
let subscribers = 0;
|
|
180
198
|
let state;
|
|
181
199
|
let scope;
|
|
182
|
-
const dispose = () => {
|
|
200
|
+
const dispose = /* @__PURE__ */ __name(() => {
|
|
183
201
|
if (scope && --subscribers <= 0) {
|
|
184
202
|
scope.stop();
|
|
185
203
|
state = scope = null;
|
|
186
204
|
}
|
|
187
|
-
};
|
|
205
|
+
}, "dispose");
|
|
188
206
|
return () => {
|
|
189
207
|
subscribers++;
|
|
190
208
|
if (!state) {
|
|
@@ -195,6 +213,7 @@ function createSharedReactive(composable) {
|
|
|
195
213
|
return state;
|
|
196
214
|
};
|
|
197
215
|
}
|
|
216
|
+
__name(createSharedReactive, "createSharedReactive");
|
|
198
217
|
|
|
199
218
|
// src/vue/composable.ts
|
|
200
219
|
function useO(Model) {
|
|
@@ -211,12 +230,14 @@ function useO(Model) {
|
|
|
211
230
|
}
|
|
212
231
|
return useOMap.get(Model);
|
|
213
232
|
}
|
|
233
|
+
__name(useO, "useO");
|
|
214
234
|
function usePatch(Model, Data) {
|
|
215
235
|
useO(Model);
|
|
216
236
|
const { useOMap } = getActivePhecda();
|
|
217
237
|
const target = useOMap.get(Model);
|
|
218
238
|
mergeReactiveObjects(target, Data);
|
|
219
239
|
}
|
|
240
|
+
__name(usePatch, "usePatch");
|
|
220
241
|
function useR(Model) {
|
|
221
242
|
useO(Model);
|
|
222
243
|
const { useRMap, useOMap, fnMap } = getActivePhecda();
|
|
@@ -245,6 +266,7 @@ function useR(Model) {
|
|
|
245
266
|
useRMap.set(Model, proxy);
|
|
246
267
|
return proxy;
|
|
247
268
|
}
|
|
269
|
+
__name(useR, "useR");
|
|
248
270
|
function useV(Model) {
|
|
249
271
|
useO(Model);
|
|
250
272
|
const { useVMap, useOMap, fnMap, computedMap } = getActivePhecda();
|
|
@@ -286,6 +308,7 @@ function useV(Model) {
|
|
|
286
308
|
useVMap.set(Model, proxy);
|
|
287
309
|
return proxy;
|
|
288
310
|
}
|
|
311
|
+
__name(useV, "useV");
|
|
289
312
|
function useEvent(eventName, cb) {
|
|
290
313
|
(0, import_vue3.onBeforeUnmount)(() => {
|
|
291
314
|
emitter.off(eventName, cb);
|
|
@@ -293,6 +316,7 @@ function useEvent(eventName, cb) {
|
|
|
293
316
|
emitter.on(eventName, cb);
|
|
294
317
|
return () => emitter.off(eventName, cb);
|
|
295
318
|
}
|
|
319
|
+
__name(useEvent, "useEvent");
|
|
296
320
|
function initalize(Model) {
|
|
297
321
|
const instance = useO(Model);
|
|
298
322
|
if (instance) {
|
|
@@ -300,27 +324,27 @@ function initalize(Model) {
|
|
|
300
324
|
return instance;
|
|
301
325
|
}
|
|
302
326
|
}
|
|
327
|
+
__name(initalize, "initalize");
|
|
303
328
|
function clearStorage(Model, isForceUpdate = true) {
|
|
304
329
|
localStorage.removeItem(`_phecda_${useO(Model)._symbol}`);
|
|
305
330
|
isForceUpdate && initalize(Model);
|
|
306
331
|
}
|
|
332
|
+
__name(clearStorage, "clearStorage");
|
|
307
333
|
function deleteStorage(tag) {
|
|
308
334
|
localStorage.removeItem(`_phecda_${tag}`);
|
|
309
335
|
}
|
|
336
|
+
__name(deleteStorage, "deleteStorage");
|
|
310
337
|
|
|
311
338
|
// src/filter.ts
|
|
312
339
|
var import_vue4 = require("vue");
|
|
313
340
|
var EXPRESS_RE = /^{{(.*)}}$/;
|
|
314
341
|
var FN_RE = /^\[\[(.*)\]\]$/;
|
|
315
342
|
function createFilter(initState = {}, option = {}) {
|
|
316
|
-
const resolveOption = Object.assign(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
},
|
|
322
|
-
option
|
|
323
|
-
);
|
|
343
|
+
const resolveOption = Object.assign({
|
|
344
|
+
expressionRE: EXPRESS_RE,
|
|
345
|
+
fnRE: FN_RE,
|
|
346
|
+
exclude: []
|
|
347
|
+
}, option);
|
|
324
348
|
const scope = (0, import_vue4.effectScope)(true);
|
|
325
349
|
let data = scope.run(() => (0, import_vue4.ref)(initState));
|
|
326
350
|
let store = {};
|
|
@@ -336,10 +360,7 @@ function createFilter(initState = {}, option = {}) {
|
|
|
336
360
|
const body = obj[i].match(resolveOption.expressionRE)[1];
|
|
337
361
|
Object.defineProperty(obj, i, {
|
|
338
362
|
get() {
|
|
339
|
-
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{return ${body}}catch(e){return _eh(e,"${errorPath}")}` : `return ${body}`)(
|
|
340
|
-
...Object.values(data.value),
|
|
341
|
-
resolveOption.errorHandler
|
|
342
|
-
);
|
|
363
|
+
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{return ${body}}catch(e){return _eh(e,"${errorPath}")}` : `return ${body}`)(...Object.values(data.value), resolveOption.errorHandler);
|
|
343
364
|
}
|
|
344
365
|
});
|
|
345
366
|
}
|
|
@@ -347,52 +368,69 @@ function createFilter(initState = {}, option = {}) {
|
|
|
347
368
|
const body = obj[i].match(resolveOption.fnRE)[1];
|
|
348
369
|
Object.defineProperty(obj, i, {
|
|
349
370
|
get() {
|
|
350
|
-
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{${body}}catch(e){return _eh(e,"${errorPath}")}` : `${body}`)(
|
|
351
|
-
...Object.values(data.value),
|
|
352
|
-
resolveOption.errorHandler
|
|
353
|
-
);
|
|
371
|
+
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{${body}}catch(e){return _eh(e,"${errorPath}")}` : `${body}`)(...Object.values(data.value), resolveOption.errorHandler);
|
|
354
372
|
}
|
|
355
373
|
});
|
|
356
374
|
}
|
|
357
375
|
}
|
|
358
376
|
}
|
|
359
377
|
}
|
|
378
|
+
__name(traverse, "traverse");
|
|
360
379
|
function filter(obj) {
|
|
361
380
|
obj = (0, import_vue4.reactive)(obj);
|
|
362
381
|
traverse(obj);
|
|
363
382
|
return obj;
|
|
364
383
|
}
|
|
384
|
+
__name(filter, "filter");
|
|
365
385
|
function setState(key, value) {
|
|
366
386
|
data.value[key] = value;
|
|
367
387
|
}
|
|
388
|
+
__name(setState, "setState");
|
|
368
389
|
function storeState(key, params) {
|
|
369
390
|
store[key] = data.value;
|
|
370
391
|
init(params);
|
|
371
392
|
}
|
|
393
|
+
__name(storeState, "storeState");
|
|
372
394
|
function applyStore(key) {
|
|
373
395
|
if (!store[key])
|
|
374
396
|
return;
|
|
375
397
|
data.value = store[key];
|
|
376
398
|
}
|
|
399
|
+
__name(applyStore, "applyStore");
|
|
377
400
|
function init(params) {
|
|
378
401
|
data.value = params || initState || {};
|
|
379
402
|
}
|
|
403
|
+
__name(init, "init");
|
|
380
404
|
function clearStore(key) {
|
|
381
405
|
delete store[key];
|
|
382
406
|
}
|
|
407
|
+
__name(clearStore, "clearStore");
|
|
383
408
|
function dispose() {
|
|
384
409
|
data = null;
|
|
385
410
|
store = null;
|
|
386
411
|
scope.stop();
|
|
387
412
|
}
|
|
388
|
-
|
|
413
|
+
__name(dispose, "dispose");
|
|
414
|
+
return {
|
|
415
|
+
filter,
|
|
416
|
+
data,
|
|
417
|
+
init,
|
|
418
|
+
setState,
|
|
419
|
+
storeState,
|
|
420
|
+
store,
|
|
421
|
+
applyStore,
|
|
422
|
+
dispose,
|
|
423
|
+
clearStore
|
|
424
|
+
};
|
|
389
425
|
}
|
|
426
|
+
__name(createFilter, "createFilter");
|
|
390
427
|
|
|
391
428
|
// src/index.ts
|
|
392
429
|
__reExport(src_exports, require("phecda-core"), module.exports);
|
|
393
430
|
|
|
394
431
|
// src/wrapper.ts
|
|
395
432
|
var _P = class {
|
|
433
|
+
_namespace;
|
|
396
434
|
constructor() {
|
|
397
435
|
}
|
|
398
436
|
get tag() {
|
|
@@ -409,35 +447,34 @@ var _P = class {
|
|
|
409
447
|
}
|
|
410
448
|
};
|
|
411
449
|
var P = _P;
|
|
412
|
-
P
|
|
450
|
+
__name(P, "P");
|
|
451
|
+
__publicField(P, "emitter", emitter);
|
|
413
452
|
|
|
414
453
|
// src/components/createForm.ts
|
|
415
454
|
var import_vue5 = require("vue");
|
|
416
455
|
function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
417
456
|
function generateChildVNode(props) {
|
|
418
|
-
return props._children?.map(
|
|
419
|
-
(item) => item._active === false ? null : (0, import_vue5.h)(compSet[item._component], item)
|
|
420
|
-
);
|
|
457
|
+
return props._children?.map((item) => item._active === false ? null : (0, import_vue5.h)(compSet[item._component], item));
|
|
421
458
|
}
|
|
459
|
+
__name(generateChildVNode, "generateChildVNode");
|
|
422
460
|
function generateVNode(props) {
|
|
423
|
-
return (0, import_vue5.h)(
|
|
424
|
-
|
|
425
|
-
{
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
[`onUpdate:${modelKey}`]: (v) => {
|
|
429
|
-
props.data[props.property] = v;
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
default: () => generateChildVNode(props.config[props.property])
|
|
461
|
+
return (0, import_vue5.h)(compSet[props.config[props.property]._component], {
|
|
462
|
+
...props.config[props.property],
|
|
463
|
+
[`${modelKey}`]: props.data[props.property],
|
|
464
|
+
[`onUpdate:${modelKey}`]: (v) => {
|
|
465
|
+
props.data[props.property] = v;
|
|
434
466
|
}
|
|
435
|
-
|
|
467
|
+
}, {
|
|
468
|
+
default: () => generateChildVNode(props.config[props.property])
|
|
469
|
+
});
|
|
436
470
|
}
|
|
471
|
+
__name(generateVNode, "generateVNode");
|
|
437
472
|
const FormItem = (0, import_vue5.defineComponent)({
|
|
438
473
|
name: "CustomFormItem",
|
|
439
474
|
props: {
|
|
440
|
-
formItem: {
|
|
475
|
+
formItem: {
|
|
476
|
+
type: Object
|
|
477
|
+
},
|
|
441
478
|
config: {
|
|
442
479
|
type: Object,
|
|
443
480
|
required: true
|
|
@@ -453,17 +490,13 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
453
490
|
},
|
|
454
491
|
setup(props) {
|
|
455
492
|
return () => {
|
|
456
|
-
return formItem ? (0, import_vue5.h)(
|
|
457
|
-
formItem
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
{
|
|
462
|
-
default: () => {
|
|
463
|
-
return generateVNode(props);
|
|
464
|
-
}
|
|
493
|
+
return formItem ? (0, import_vue5.h)(formItem, {
|
|
494
|
+
...props.formItem
|
|
495
|
+
}, {
|
|
496
|
+
default: () => {
|
|
497
|
+
return generateVNode(props);
|
|
465
498
|
}
|
|
466
|
-
) : generateVNode(props);
|
|
499
|
+
}) : generateVNode(props);
|
|
467
500
|
};
|
|
468
501
|
}
|
|
469
502
|
});
|
|
@@ -482,10 +515,14 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
482
515
|
setup(props, ctx) {
|
|
483
516
|
const dom = (0, import_vue5.ref)();
|
|
484
517
|
(0, import_vue5.onMounted)(() => {
|
|
485
|
-
ctx.expose({
|
|
518
|
+
ctx.expose({
|
|
519
|
+
...dom.value
|
|
520
|
+
});
|
|
486
521
|
});
|
|
487
522
|
return () => {
|
|
488
|
-
return (0, import_vue5.h)(form, Object.assign({
|
|
523
|
+
return (0, import_vue5.h)(form, Object.assign({
|
|
524
|
+
ref: dom
|
|
525
|
+
}, ctx.attrs), {
|
|
489
526
|
default: () => Object.keys(props.config).map((item) => {
|
|
490
527
|
return props.config[item]._active === false ? null : (0, import_vue5.h)(FormItem, {
|
|
491
528
|
formItem: props.config[item]._formItem,
|
|
@@ -499,6 +536,7 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
499
536
|
}
|
|
500
537
|
});
|
|
501
538
|
}
|
|
539
|
+
__name(createForm, "createForm");
|
|
502
540
|
|
|
503
541
|
// src/components/formFilter.ts
|
|
504
542
|
function createFormData(schema, initData = {}, options = {}) {
|
|
@@ -511,8 +549,13 @@ function createFormData(schema, initData = {}, options = {}) {
|
|
|
511
549
|
obj2[i] = obj1[i]._default;
|
|
512
550
|
}
|
|
513
551
|
}
|
|
514
|
-
|
|
552
|
+
__name(initlize, "initlize");
|
|
553
|
+
return {
|
|
554
|
+
config: filterRet,
|
|
555
|
+
data
|
|
556
|
+
};
|
|
515
557
|
}
|
|
558
|
+
__name(createFormData, "createFormData");
|
|
516
559
|
|
|
517
560
|
// src/components/formResolve.ts
|
|
518
561
|
var import_phecda_core3 = require("phecda-core");
|
|
@@ -543,6 +586,7 @@ function getElementPlusRules(Model, options = {}) {
|
|
|
543
586
|
}
|
|
544
587
|
return ret;
|
|
545
588
|
}
|
|
589
|
+
__name(getElementPlusRules, "getElementPlusRules");
|
|
546
590
|
var GetDevUIRules = getElementPlusRules;
|
|
547
591
|
function getNaiveUIRules(Model, options = {}) {
|
|
548
592
|
const stateVars = (0, import_phecda_core3.getModelState)(Model);
|
|
@@ -571,6 +615,7 @@ function getNaiveUIRules(Model, options = {}) {
|
|
|
571
615
|
}
|
|
572
616
|
return ret;
|
|
573
617
|
}
|
|
618
|
+
__name(getNaiveUIRules, "getNaiveUIRules");
|
|
574
619
|
var getAntDRules = getNaiveUIRules;
|
|
575
620
|
function getNutUIRules(Model, options = {}) {
|
|
576
621
|
const stateVars = (0, import_phecda_core3.getModelState)(Model);
|
|
@@ -600,11 +645,12 @@ function getNutUIRules(Model, options = {}) {
|
|
|
600
645
|
}
|
|
601
646
|
return ret;
|
|
602
647
|
}
|
|
648
|
+
__name(getNutUIRules, "getNutUIRules");
|
|
603
649
|
var getVantRules = getNutUIRules;
|
|
604
650
|
|
|
605
651
|
// src/components/createModal.ts
|
|
606
652
|
var import_vue6 = require("vue");
|
|
607
|
-
var createModal = function(modalWrapper, modelKey = "modelValue") {
|
|
653
|
+
var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "modelValue") {
|
|
608
654
|
let isMounted = false;
|
|
609
655
|
const isShow = (0, import_vue6.ref)(true);
|
|
610
656
|
const content = (0, import_vue6.shallowRef)();
|
|
@@ -633,7 +679,7 @@ var createModal = function(modalWrapper, modelKey = "modelValue") {
|
|
|
633
679
|
isShow.value = true;
|
|
634
680
|
}
|
|
635
681
|
};
|
|
636
|
-
};
|
|
682
|
+
}, "createModal");
|
|
637
683
|
|
|
638
684
|
// src/components/createTable.ts
|
|
639
685
|
var import_vue7 = require("vue");
|
|
@@ -648,17 +694,17 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
648
694
|
},
|
|
649
695
|
setup(props) {
|
|
650
696
|
const compName = props.tableColumn._component;
|
|
651
|
-
return () => (0, import_vue7.h)(
|
|
652
|
-
tableColumn
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
697
|
+
return () => (0, import_vue7.h)(tableColumn, {
|
|
698
|
+
...props.tableColumn
|
|
699
|
+
}, {
|
|
700
|
+
default: (scope) => {
|
|
701
|
+
return compName ? (0, import_vue7.h)(compSet[compName], {
|
|
702
|
+
scope,
|
|
703
|
+
data,
|
|
704
|
+
...props.tableColumn._props || {}
|
|
705
|
+
}) : null;
|
|
660
706
|
}
|
|
661
|
-
);
|
|
707
|
+
});
|
|
662
708
|
}
|
|
663
709
|
});
|
|
664
710
|
return (0, import_vue7.defineComponent)({
|
|
@@ -672,10 +718,14 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
672
718
|
setup(props, ctx) {
|
|
673
719
|
const dom = (0, import_vue7.ref)();
|
|
674
720
|
(0, import_vue7.onMounted)(() => {
|
|
675
|
-
ctx.expose({
|
|
721
|
+
ctx.expose({
|
|
722
|
+
...dom.value
|
|
723
|
+
});
|
|
676
724
|
});
|
|
677
725
|
return () => {
|
|
678
|
-
return (0, import_vue7.h)(table, Object.assign({
|
|
726
|
+
return (0, import_vue7.h)(table, Object.assign({
|
|
727
|
+
ref: dom
|
|
728
|
+
}, ctx.attrs), {
|
|
679
729
|
default: () => props.config.map((item) => {
|
|
680
730
|
return (0, import_vue7.h)(TableColumn, {
|
|
681
731
|
tableColumn: item
|
|
@@ -686,11 +736,14 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
686
736
|
}
|
|
687
737
|
});
|
|
688
738
|
}
|
|
739
|
+
__name(createTable, "createTable");
|
|
689
740
|
|
|
690
741
|
// src/components/helper/pipe.ts
|
|
691
742
|
var import_vue8 = require("vue");
|
|
692
743
|
function createPipe(comp, props, to = "default", slot) {
|
|
693
|
-
const vnodeMap = {
|
|
744
|
+
const vnodeMap = {
|
|
745
|
+
[`${to}`]: () => (0, import_vue8.h)(comp, props, slot)
|
|
746
|
+
};
|
|
694
747
|
return {
|
|
695
748
|
to(comp2, props2, to2 = "default") {
|
|
696
749
|
return createPipe(comp2, props2, to2, vnodeMap);
|
|
@@ -703,6 +756,7 @@ function createPipe(comp, props, to = "default", slot) {
|
|
|
703
756
|
}
|
|
704
757
|
};
|
|
705
758
|
}
|
|
759
|
+
__name(createPipe, "createPipe");
|
|
706
760
|
// Annotate the CommonJS export names for ESM import in node:
|
|
707
761
|
0 && (module.exports = {
|
|
708
762
|
EXPRESS_RE,
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
8
|
+
|
|
1
9
|
// src/emitter.ts
|
|
2
10
|
import mitt from "mitt";
|
|
3
11
|
var emitter = mitt();
|
|
@@ -20,7 +28,10 @@ function createPhecda(symbol) {
|
|
|
20
28
|
snapshot: () => {
|
|
21
29
|
const ret = [];
|
|
22
30
|
for (const [key, value] of phecda.useOMap)
|
|
23
|
-
ret.push({
|
|
31
|
+
ret.push({
|
|
32
|
+
key: getTag(key) || key.name,
|
|
33
|
+
value
|
|
34
|
+
});
|
|
24
35
|
return ret;
|
|
25
36
|
}
|
|
26
37
|
};
|
|
@@ -28,14 +39,15 @@ function createPhecda(symbol) {
|
|
|
28
39
|
const eventRecord = [];
|
|
29
40
|
injectProperty("watcher", ({ eventName, instance, key }) => {
|
|
30
41
|
const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
|
|
31
|
-
eventRecord.push([
|
|
42
|
+
eventRecord.push([
|
|
43
|
+
eventName,
|
|
44
|
+
fn
|
|
45
|
+
]);
|
|
32
46
|
emitter.on(eventName, fn);
|
|
33
47
|
});
|
|
34
48
|
const originUnmount = app.unmount.bind(app);
|
|
35
49
|
app.unmount = () => {
|
|
36
|
-
eventRecord.forEach(
|
|
37
|
-
([eventName, handler]) => emitter.off(eventName, handler)
|
|
38
|
-
);
|
|
50
|
+
eventRecord.forEach(([eventName, handler]) => emitter.off(eventName, handler));
|
|
39
51
|
if (symbol)
|
|
40
52
|
delete window.__PHECDA_VUE__[symbol];
|
|
41
53
|
originUnmount();
|
|
@@ -49,6 +61,7 @@ function createPhecda(symbol) {
|
|
|
49
61
|
});
|
|
50
62
|
return phecda;
|
|
51
63
|
}
|
|
64
|
+
__name(createPhecda, "createPhecda");
|
|
52
65
|
var activePhecda = {
|
|
53
66
|
useVMap: /* @__PURE__ */ new WeakMap(),
|
|
54
67
|
useOMap: /* @__PURE__ */ new WeakMap(),
|
|
@@ -59,9 +72,11 @@ var activePhecda = {
|
|
|
59
72
|
function setActivePhecda(phecda) {
|
|
60
73
|
activePhecda = phecda;
|
|
61
74
|
}
|
|
75
|
+
__name(setActivePhecda, "setActivePhecda");
|
|
62
76
|
function getActivePhecda() {
|
|
63
77
|
return activePhecda;
|
|
64
78
|
}
|
|
79
|
+
__name(getActivePhecda, "getActivePhecda");
|
|
65
80
|
function getReactiveMap(symbol) {
|
|
66
81
|
if (!window.__PHECDA_VUE__?.[symbol])
|
|
67
82
|
return null;
|
|
@@ -71,6 +86,7 @@ function getReactiveMap(symbol) {
|
|
|
71
86
|
});
|
|
72
87
|
return ret;
|
|
73
88
|
}
|
|
89
|
+
__name(getReactiveMap, "getReactiveMap");
|
|
74
90
|
|
|
75
91
|
// src/vue/composable.ts
|
|
76
92
|
import { computed, getCurrentInstance, inject, onBeforeUnmount, reactive } from "vue";
|
|
@@ -81,6 +97,7 @@ import { effectScope, isReactive, isRef, onScopeDispose } from "vue";
|
|
|
81
97
|
function isObject(o) {
|
|
82
98
|
return Object.prototype.toString.call(o) === "[object Object]";
|
|
83
99
|
}
|
|
100
|
+
__name(isObject, "isObject");
|
|
84
101
|
function mergeReactiveObjects(target, patchToApply) {
|
|
85
102
|
for (const key in patchToApply) {
|
|
86
103
|
if (!patchToApply.hasOwnProperty(key))
|
|
@@ -95,6 +112,7 @@ function mergeReactiveObjects(target, patchToApply) {
|
|
|
95
112
|
}
|
|
96
113
|
return target;
|
|
97
114
|
}
|
|
115
|
+
__name(mergeReactiveObjects, "mergeReactiveObjects");
|
|
98
116
|
function wrapError(target, key, errorHandler) {
|
|
99
117
|
if (isAsyncFunc(target[key])) {
|
|
100
118
|
return (...args) => {
|
|
@@ -110,19 +128,21 @@ function wrapError(target, key, errorHandler) {
|
|
|
110
128
|
};
|
|
111
129
|
}
|
|
112
130
|
}
|
|
131
|
+
__name(wrapError, "wrapError");
|
|
113
132
|
function isAsyncFunc(fn) {
|
|
114
133
|
return fn[Symbol.toStringTag] === "AsyncFunction";
|
|
115
134
|
}
|
|
135
|
+
__name(isAsyncFunc, "isAsyncFunc");
|
|
116
136
|
function createSharedReactive(composable) {
|
|
117
137
|
let subscribers = 0;
|
|
118
138
|
let state;
|
|
119
139
|
let scope;
|
|
120
|
-
const dispose = () => {
|
|
140
|
+
const dispose = /* @__PURE__ */ __name(() => {
|
|
121
141
|
if (scope && --subscribers <= 0) {
|
|
122
142
|
scope.stop();
|
|
123
143
|
state = scope = null;
|
|
124
144
|
}
|
|
125
|
-
};
|
|
145
|
+
}, "dispose");
|
|
126
146
|
return () => {
|
|
127
147
|
subscribers++;
|
|
128
148
|
if (!state) {
|
|
@@ -133,6 +153,7 @@ function createSharedReactive(composable) {
|
|
|
133
153
|
return state;
|
|
134
154
|
};
|
|
135
155
|
}
|
|
156
|
+
__name(createSharedReactive, "createSharedReactive");
|
|
136
157
|
|
|
137
158
|
// src/vue/composable.ts
|
|
138
159
|
function useO(Model) {
|
|
@@ -149,12 +170,14 @@ function useO(Model) {
|
|
|
149
170
|
}
|
|
150
171
|
return useOMap.get(Model);
|
|
151
172
|
}
|
|
173
|
+
__name(useO, "useO");
|
|
152
174
|
function usePatch(Model, Data) {
|
|
153
175
|
useO(Model);
|
|
154
176
|
const { useOMap } = getActivePhecda();
|
|
155
177
|
const target = useOMap.get(Model);
|
|
156
178
|
mergeReactiveObjects(target, Data);
|
|
157
179
|
}
|
|
180
|
+
__name(usePatch, "usePatch");
|
|
158
181
|
function useR(Model) {
|
|
159
182
|
useO(Model);
|
|
160
183
|
const { useRMap, useOMap, fnMap } = getActivePhecda();
|
|
@@ -183,6 +206,7 @@ function useR(Model) {
|
|
|
183
206
|
useRMap.set(Model, proxy);
|
|
184
207
|
return proxy;
|
|
185
208
|
}
|
|
209
|
+
__name(useR, "useR");
|
|
186
210
|
function useV(Model) {
|
|
187
211
|
useO(Model);
|
|
188
212
|
const { useVMap, useOMap, fnMap, computedMap } = getActivePhecda();
|
|
@@ -224,6 +248,7 @@ function useV(Model) {
|
|
|
224
248
|
useVMap.set(Model, proxy);
|
|
225
249
|
return proxy;
|
|
226
250
|
}
|
|
251
|
+
__name(useV, "useV");
|
|
227
252
|
function useEvent(eventName, cb) {
|
|
228
253
|
onBeforeUnmount(() => {
|
|
229
254
|
emitter.off(eventName, cb);
|
|
@@ -231,6 +256,7 @@ function useEvent(eventName, cb) {
|
|
|
231
256
|
emitter.on(eventName, cb);
|
|
232
257
|
return () => emitter.off(eventName, cb);
|
|
233
258
|
}
|
|
259
|
+
__name(useEvent, "useEvent");
|
|
234
260
|
function initalize(Model) {
|
|
235
261
|
const instance = useO(Model);
|
|
236
262
|
if (instance) {
|
|
@@ -238,27 +264,27 @@ function initalize(Model) {
|
|
|
238
264
|
return instance;
|
|
239
265
|
}
|
|
240
266
|
}
|
|
267
|
+
__name(initalize, "initalize");
|
|
241
268
|
function clearStorage(Model, isForceUpdate = true) {
|
|
242
269
|
localStorage.removeItem(`_phecda_${useO(Model)._symbol}`);
|
|
243
270
|
isForceUpdate && initalize(Model);
|
|
244
271
|
}
|
|
272
|
+
__name(clearStorage, "clearStorage");
|
|
245
273
|
function deleteStorage(tag) {
|
|
246
274
|
localStorage.removeItem(`_phecda_${tag}`);
|
|
247
275
|
}
|
|
276
|
+
__name(deleteStorage, "deleteStorage");
|
|
248
277
|
|
|
249
278
|
// src/filter.ts
|
|
250
279
|
import { effectScope as effectScope2, reactive as reactive2, ref } from "vue";
|
|
251
280
|
var EXPRESS_RE = /^{{(.*)}}$/;
|
|
252
281
|
var FN_RE = /^\[\[(.*)\]\]$/;
|
|
253
282
|
function createFilter(initState = {}, option = {}) {
|
|
254
|
-
const resolveOption = Object.assign(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
},
|
|
260
|
-
option
|
|
261
|
-
);
|
|
283
|
+
const resolveOption = Object.assign({
|
|
284
|
+
expressionRE: EXPRESS_RE,
|
|
285
|
+
fnRE: FN_RE,
|
|
286
|
+
exclude: []
|
|
287
|
+
}, option);
|
|
262
288
|
const scope = effectScope2(true);
|
|
263
289
|
let data = scope.run(() => ref(initState));
|
|
264
290
|
let store = {};
|
|
@@ -274,10 +300,7 @@ function createFilter(initState = {}, option = {}) {
|
|
|
274
300
|
const body = obj[i].match(resolveOption.expressionRE)[1];
|
|
275
301
|
Object.defineProperty(obj, i, {
|
|
276
302
|
get() {
|
|
277
|
-
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{return ${body}}catch(e){return _eh(e,"${errorPath}")}` : `return ${body}`)(
|
|
278
|
-
...Object.values(data.value),
|
|
279
|
-
resolveOption.errorHandler
|
|
280
|
-
);
|
|
303
|
+
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{return ${body}}catch(e){return _eh(e,"${errorPath}")}` : `return ${body}`)(...Object.values(data.value), resolveOption.errorHandler);
|
|
281
304
|
}
|
|
282
305
|
});
|
|
283
306
|
}
|
|
@@ -285,52 +308,69 @@ function createFilter(initState = {}, option = {}) {
|
|
|
285
308
|
const body = obj[i].match(resolveOption.fnRE)[1];
|
|
286
309
|
Object.defineProperty(obj, i, {
|
|
287
310
|
get() {
|
|
288
|
-
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{${body}}catch(e){return _eh(e,"${errorPath}")}` : `${body}`)(
|
|
289
|
-
...Object.values(data.value),
|
|
290
|
-
resolveOption.errorHandler
|
|
291
|
-
);
|
|
311
|
+
return new Function(...Object.keys(data.value), "_eh", resolveOption.errorHandler ? `try{${body}}catch(e){return _eh(e,"${errorPath}")}` : `${body}`)(...Object.values(data.value), resolveOption.errorHandler);
|
|
292
312
|
}
|
|
293
313
|
});
|
|
294
314
|
}
|
|
295
315
|
}
|
|
296
316
|
}
|
|
297
317
|
}
|
|
318
|
+
__name(traverse, "traverse");
|
|
298
319
|
function filter(obj) {
|
|
299
320
|
obj = reactive2(obj);
|
|
300
321
|
traverse(obj);
|
|
301
322
|
return obj;
|
|
302
323
|
}
|
|
324
|
+
__name(filter, "filter");
|
|
303
325
|
function setState(key, value) {
|
|
304
326
|
data.value[key] = value;
|
|
305
327
|
}
|
|
328
|
+
__name(setState, "setState");
|
|
306
329
|
function storeState(key, params) {
|
|
307
330
|
store[key] = data.value;
|
|
308
331
|
init(params);
|
|
309
332
|
}
|
|
333
|
+
__name(storeState, "storeState");
|
|
310
334
|
function applyStore(key) {
|
|
311
335
|
if (!store[key])
|
|
312
336
|
return;
|
|
313
337
|
data.value = store[key];
|
|
314
338
|
}
|
|
339
|
+
__name(applyStore, "applyStore");
|
|
315
340
|
function init(params) {
|
|
316
341
|
data.value = params || initState || {};
|
|
317
342
|
}
|
|
343
|
+
__name(init, "init");
|
|
318
344
|
function clearStore(key) {
|
|
319
345
|
delete store[key];
|
|
320
346
|
}
|
|
347
|
+
__name(clearStore, "clearStore");
|
|
321
348
|
function dispose() {
|
|
322
349
|
data = null;
|
|
323
350
|
store = null;
|
|
324
351
|
scope.stop();
|
|
325
352
|
}
|
|
326
|
-
|
|
353
|
+
__name(dispose, "dispose");
|
|
354
|
+
return {
|
|
355
|
+
filter,
|
|
356
|
+
data,
|
|
357
|
+
init,
|
|
358
|
+
setState,
|
|
359
|
+
storeState,
|
|
360
|
+
store,
|
|
361
|
+
applyStore,
|
|
362
|
+
dispose,
|
|
363
|
+
clearStore
|
|
364
|
+
};
|
|
327
365
|
}
|
|
366
|
+
__name(createFilter, "createFilter");
|
|
328
367
|
|
|
329
368
|
// src/index.ts
|
|
330
369
|
export * from "phecda-core";
|
|
331
370
|
|
|
332
371
|
// src/wrapper.ts
|
|
333
372
|
var _P = class {
|
|
373
|
+
_namespace;
|
|
334
374
|
constructor() {
|
|
335
375
|
}
|
|
336
376
|
get tag() {
|
|
@@ -347,35 +387,34 @@ var _P = class {
|
|
|
347
387
|
}
|
|
348
388
|
};
|
|
349
389
|
var P = _P;
|
|
350
|
-
P
|
|
390
|
+
__name(P, "P");
|
|
391
|
+
__publicField(P, "emitter", emitter);
|
|
351
392
|
|
|
352
393
|
// src/components/createForm.ts
|
|
353
394
|
import { defineComponent, h, onMounted, ref as ref2 } from "vue";
|
|
354
395
|
function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
355
396
|
function generateChildVNode(props) {
|
|
356
|
-
return props._children?.map(
|
|
357
|
-
(item) => item._active === false ? null : h(compSet[item._component], item)
|
|
358
|
-
);
|
|
397
|
+
return props._children?.map((item) => item._active === false ? null : h(compSet[item._component], item));
|
|
359
398
|
}
|
|
399
|
+
__name(generateChildVNode, "generateChildVNode");
|
|
360
400
|
function generateVNode(props) {
|
|
361
|
-
return h(
|
|
362
|
-
|
|
363
|
-
{
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
[`onUpdate:${modelKey}`]: (v) => {
|
|
367
|
-
props.data[props.property] = v;
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
default: () => generateChildVNode(props.config[props.property])
|
|
401
|
+
return h(compSet[props.config[props.property]._component], {
|
|
402
|
+
...props.config[props.property],
|
|
403
|
+
[`${modelKey}`]: props.data[props.property],
|
|
404
|
+
[`onUpdate:${modelKey}`]: (v) => {
|
|
405
|
+
props.data[props.property] = v;
|
|
372
406
|
}
|
|
373
|
-
|
|
407
|
+
}, {
|
|
408
|
+
default: () => generateChildVNode(props.config[props.property])
|
|
409
|
+
});
|
|
374
410
|
}
|
|
411
|
+
__name(generateVNode, "generateVNode");
|
|
375
412
|
const FormItem = defineComponent({
|
|
376
413
|
name: "CustomFormItem",
|
|
377
414
|
props: {
|
|
378
|
-
formItem: {
|
|
415
|
+
formItem: {
|
|
416
|
+
type: Object
|
|
417
|
+
},
|
|
379
418
|
config: {
|
|
380
419
|
type: Object,
|
|
381
420
|
required: true
|
|
@@ -391,17 +430,13 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
391
430
|
},
|
|
392
431
|
setup(props) {
|
|
393
432
|
return () => {
|
|
394
|
-
return formItem ? h(
|
|
395
|
-
formItem
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
{
|
|
400
|
-
default: () => {
|
|
401
|
-
return generateVNode(props);
|
|
402
|
-
}
|
|
433
|
+
return formItem ? h(formItem, {
|
|
434
|
+
...props.formItem
|
|
435
|
+
}, {
|
|
436
|
+
default: () => {
|
|
437
|
+
return generateVNode(props);
|
|
403
438
|
}
|
|
404
|
-
) : generateVNode(props);
|
|
439
|
+
}) : generateVNode(props);
|
|
405
440
|
};
|
|
406
441
|
}
|
|
407
442
|
});
|
|
@@ -420,10 +455,14 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
420
455
|
setup(props, ctx) {
|
|
421
456
|
const dom = ref2();
|
|
422
457
|
onMounted(() => {
|
|
423
|
-
ctx.expose({
|
|
458
|
+
ctx.expose({
|
|
459
|
+
...dom.value
|
|
460
|
+
});
|
|
424
461
|
});
|
|
425
462
|
return () => {
|
|
426
|
-
return h(form, Object.assign({
|
|
463
|
+
return h(form, Object.assign({
|
|
464
|
+
ref: dom
|
|
465
|
+
}, ctx.attrs), {
|
|
427
466
|
default: () => Object.keys(props.config).map((item) => {
|
|
428
467
|
return props.config[item]._active === false ? null : h(FormItem, {
|
|
429
468
|
formItem: props.config[item]._formItem,
|
|
@@ -437,6 +476,7 @@ function createForm(compSet, form, formItem, modelKey = "modelValue") {
|
|
|
437
476
|
}
|
|
438
477
|
});
|
|
439
478
|
}
|
|
479
|
+
__name(createForm, "createForm");
|
|
440
480
|
|
|
441
481
|
// src/components/formFilter.ts
|
|
442
482
|
function createFormData(schema, initData = {}, options = {}) {
|
|
@@ -449,8 +489,13 @@ function createFormData(schema, initData = {}, options = {}) {
|
|
|
449
489
|
obj2[i] = obj1[i]._default;
|
|
450
490
|
}
|
|
451
491
|
}
|
|
452
|
-
|
|
492
|
+
__name(initlize, "initlize");
|
|
493
|
+
return {
|
|
494
|
+
config: filterRet,
|
|
495
|
+
data
|
|
496
|
+
};
|
|
453
497
|
}
|
|
498
|
+
__name(createFormData, "createFormData");
|
|
454
499
|
|
|
455
500
|
// src/components/formResolve.ts
|
|
456
501
|
import { getHandler as getHandler2, getModelState, validate } from "phecda-core";
|
|
@@ -481,6 +526,7 @@ function getElementPlusRules(Model, options = {}) {
|
|
|
481
526
|
}
|
|
482
527
|
return ret;
|
|
483
528
|
}
|
|
529
|
+
__name(getElementPlusRules, "getElementPlusRules");
|
|
484
530
|
var GetDevUIRules = getElementPlusRules;
|
|
485
531
|
function getNaiveUIRules(Model, options = {}) {
|
|
486
532
|
const stateVars = getModelState(Model);
|
|
@@ -509,6 +555,7 @@ function getNaiveUIRules(Model, options = {}) {
|
|
|
509
555
|
}
|
|
510
556
|
return ret;
|
|
511
557
|
}
|
|
558
|
+
__name(getNaiveUIRules, "getNaiveUIRules");
|
|
512
559
|
var getAntDRules = getNaiveUIRules;
|
|
513
560
|
function getNutUIRules(Model, options = {}) {
|
|
514
561
|
const stateVars = getModelState(Model);
|
|
@@ -538,11 +585,12 @@ function getNutUIRules(Model, options = {}) {
|
|
|
538
585
|
}
|
|
539
586
|
return ret;
|
|
540
587
|
}
|
|
588
|
+
__name(getNutUIRules, "getNutUIRules");
|
|
541
589
|
var getVantRules = getNutUIRules;
|
|
542
590
|
|
|
543
591
|
// src/components/createModal.ts
|
|
544
592
|
import { defineComponent as defineComponent2, h as h2, ref as ref3, render, shallowRef } from "vue";
|
|
545
|
-
var createModal = function(modalWrapper, modelKey = "modelValue") {
|
|
593
|
+
var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "modelValue") {
|
|
546
594
|
let isMounted = false;
|
|
547
595
|
const isShow = ref3(true);
|
|
548
596
|
const content = shallowRef();
|
|
@@ -571,7 +619,7 @@ var createModal = function(modalWrapper, modelKey = "modelValue") {
|
|
|
571
619
|
isShow.value = true;
|
|
572
620
|
}
|
|
573
621
|
};
|
|
574
|
-
};
|
|
622
|
+
}, "createModal");
|
|
575
623
|
|
|
576
624
|
// src/components/createTable.ts
|
|
577
625
|
import { defineComponent as defineComponent3, h as h3, onMounted as onMounted2, ref as ref4 } from "vue";
|
|
@@ -586,17 +634,17 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
586
634
|
},
|
|
587
635
|
setup(props) {
|
|
588
636
|
const compName = props.tableColumn._component;
|
|
589
|
-
return () => h3(
|
|
590
|
-
tableColumn
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
637
|
+
return () => h3(tableColumn, {
|
|
638
|
+
...props.tableColumn
|
|
639
|
+
}, {
|
|
640
|
+
default: (scope) => {
|
|
641
|
+
return compName ? h3(compSet[compName], {
|
|
642
|
+
scope,
|
|
643
|
+
data,
|
|
644
|
+
...props.tableColumn._props || {}
|
|
645
|
+
}) : null;
|
|
598
646
|
}
|
|
599
|
-
);
|
|
647
|
+
});
|
|
600
648
|
}
|
|
601
649
|
});
|
|
602
650
|
return defineComponent3({
|
|
@@ -610,10 +658,14 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
610
658
|
setup(props, ctx) {
|
|
611
659
|
const dom = ref4();
|
|
612
660
|
onMounted2(() => {
|
|
613
|
-
ctx.expose({
|
|
661
|
+
ctx.expose({
|
|
662
|
+
...dom.value
|
|
663
|
+
});
|
|
614
664
|
});
|
|
615
665
|
return () => {
|
|
616
|
-
return h3(table, Object.assign({
|
|
666
|
+
return h3(table, Object.assign({
|
|
667
|
+
ref: dom
|
|
668
|
+
}, ctx.attrs), {
|
|
617
669
|
default: () => props.config.map((item) => {
|
|
618
670
|
return h3(TableColumn, {
|
|
619
671
|
tableColumn: item
|
|
@@ -624,11 +676,14 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
624
676
|
}
|
|
625
677
|
});
|
|
626
678
|
}
|
|
679
|
+
__name(createTable, "createTable");
|
|
627
680
|
|
|
628
681
|
// src/components/helper/pipe.ts
|
|
629
682
|
import { h as h4 } from "vue";
|
|
630
683
|
function createPipe(comp, props, to = "default", slot) {
|
|
631
|
-
const vnodeMap = {
|
|
684
|
+
const vnodeMap = {
|
|
685
|
+
[`${to}`]: () => h4(comp, props, slot)
|
|
686
|
+
};
|
|
632
687
|
return {
|
|
633
688
|
to(comp2, props2, to2 = "default") {
|
|
634
689
|
return createPipe(comp2, props2, to2, vnodeMap);
|
|
@@ -641,6 +696,7 @@ function createPipe(comp, props, to = "default", slot) {
|
|
|
641
696
|
}
|
|
642
697
|
};
|
|
643
698
|
}
|
|
699
|
+
__name(createPipe, "createPipe");
|
|
644
700
|
export {
|
|
645
701
|
EXPRESS_RE,
|
|
646
702
|
FN_RE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"mitt": "^3.0.0",
|
|
16
16
|
"vue": "^3.2.45",
|
|
17
|
-
"phecda-core": "1.0.
|
|
17
|
+
"phecda-core": "1.0.6"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^6.5.0"
|