phecda-vue 1.6.1 → 1.6.3
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 +2 -1
- package/dist/index.js +38 -2
- package/dist/index.mjs +37 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ declare function getNaiveUIRules<M, O extends object>(Model: M, options?: O): an
|
|
|
91
91
|
declare const getAntDRules: typeof getNaiveUIRules;
|
|
92
92
|
declare function getNutUIRules<M, O extends object>(Model: M, options?: O): any;
|
|
93
93
|
declare const getVantRules: typeof getNutUIRules;
|
|
94
|
+
declare function getArcoRules<M, O extends object>(Model: M, options?: O): any;
|
|
94
95
|
|
|
95
96
|
declare const createLayer: <T>(wrapComp: Component<T>, props?: Partial<T>, modelKey?: string) => <P>(comp: Component<P>, props?: P, modalProps?: Partial<T>) => void;
|
|
96
97
|
|
|
@@ -128,4 +129,4 @@ declare class PV {
|
|
|
128
129
|
off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
export { EXPRESS_RE, FN_RE, GetDevUIRules, PV, PhecdaEmitter, ReplaceInstanceValues, SchemaToObj, createFilter, createForm, createFormData, createLayer, createModal, createPhecda, createPipe, createTable, emitter, getActivePhecda, getAntDRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initialize, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
|
|
132
|
+
export { EXPRESS_RE, FN_RE, GetDevUIRules, PV, PhecdaEmitter, ReplaceInstanceValues, SchemaToObj, createFilter, createForm, createFormData, createLayer, createModal, createPhecda, createPipe, createTable, emitter, getActivePhecda, getAntDRules, getArcoRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initialize, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
emitter: () => emitter,
|
|
44
44
|
getActivePhecda: () => getActivePhecda,
|
|
45
45
|
getAntDRules: () => getAntDRules,
|
|
46
|
+
getArcoRules: () => getArcoRules,
|
|
46
47
|
getElementPlusRules: () => getElementPlusRules,
|
|
47
48
|
getNaiveUIRules: () => getNaiveUIRules,
|
|
48
49
|
getNutUIRules: () => getNutUIRules,
|
|
@@ -456,13 +457,21 @@ var import_vue5 = require("vue");
|
|
|
456
457
|
function createForm(compSet, form, formItem, options = {}) {
|
|
457
458
|
const { modelKey = "modelValue", onUpdate } = options;
|
|
458
459
|
function generateChildVNode(props) {
|
|
459
|
-
return props._children?.map((item) =>
|
|
460
|
+
return props._children?.map((item) => {
|
|
461
|
+
if (item._active === false)
|
|
462
|
+
return null;
|
|
463
|
+
if (typeof item === "string")
|
|
464
|
+
return item;
|
|
465
|
+
return (0, import_vue5.h)(compSet[item._component] || item._component, item);
|
|
466
|
+
});
|
|
460
467
|
}
|
|
461
468
|
__name(generateChildVNode, "generateChildVNode");
|
|
462
469
|
function generateVNode(props) {
|
|
463
470
|
const { property } = props;
|
|
464
471
|
const item = props.config[property];
|
|
465
|
-
|
|
472
|
+
if (!item._component)
|
|
473
|
+
return (0, import_vue5.h)(item);
|
|
474
|
+
return (0, import_vue5.h)(compSet[item._component] || item._component, {
|
|
466
475
|
onVnodeMounted: (vnode) => item._mount?.(vnode),
|
|
467
476
|
onVnodeUnmounted: (vnode) => item._unmount?.(vnode),
|
|
468
477
|
[`${modelKey}`]: props.data[property],
|
|
@@ -675,6 +684,32 @@ function getNutUIRules(Model, options = {}) {
|
|
|
675
684
|
}
|
|
676
685
|
__name(getNutUIRules, "getNutUIRules");
|
|
677
686
|
var getVantRules = getNutUIRules;
|
|
687
|
+
function getArcoRules(Model, options = {}) {
|
|
688
|
+
const stateVars = (0, import_phecda_core3.getExposeKey)(Model);
|
|
689
|
+
const ret = {};
|
|
690
|
+
for (const item of stateVars) {
|
|
691
|
+
const handlers = (0, import_phecda_core3.getHandler)(Model, item);
|
|
692
|
+
if (handlers) {
|
|
693
|
+
for (const handler of handlers) {
|
|
694
|
+
const { rule, meta, info } = handler;
|
|
695
|
+
if (rule) {
|
|
696
|
+
if (!ret[item])
|
|
697
|
+
ret[item] = [];
|
|
698
|
+
ret[item].push({
|
|
699
|
+
validator: async (value, cb) => {
|
|
700
|
+
if (!await (0, import_phecda_core3.validate)(rule, value))
|
|
701
|
+
cb(info);
|
|
702
|
+
},
|
|
703
|
+
...options,
|
|
704
|
+
...meta || {}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
return ret;
|
|
711
|
+
}
|
|
712
|
+
__name(getArcoRules, "getArcoRules");
|
|
678
713
|
|
|
679
714
|
// src/components/createLayer.ts
|
|
680
715
|
var import_vue7 = require("vue");
|
|
@@ -859,6 +894,7 @@ __name(PV, "PV");
|
|
|
859
894
|
emitter,
|
|
860
895
|
getActivePhecda,
|
|
861
896
|
getAntDRules,
|
|
897
|
+
getArcoRules,
|
|
862
898
|
getElementPlusRules,
|
|
863
899
|
getNaiveUIRules,
|
|
864
900
|
getNutUIRules,
|
package/dist/index.mjs
CHANGED
|
@@ -398,13 +398,21 @@ import { defineComponent, h, onMounted, ref as ref2 } from "vue";
|
|
|
398
398
|
function createForm(compSet, form, formItem, options = {}) {
|
|
399
399
|
const { modelKey = "modelValue", onUpdate } = options;
|
|
400
400
|
function generateChildVNode(props) {
|
|
401
|
-
return props._children?.map((item) =>
|
|
401
|
+
return props._children?.map((item) => {
|
|
402
|
+
if (item._active === false)
|
|
403
|
+
return null;
|
|
404
|
+
if (typeof item === "string")
|
|
405
|
+
return item;
|
|
406
|
+
return h(compSet[item._component] || item._component, item);
|
|
407
|
+
});
|
|
402
408
|
}
|
|
403
409
|
__name(generateChildVNode, "generateChildVNode");
|
|
404
410
|
function generateVNode(props) {
|
|
405
411
|
const { property } = props;
|
|
406
412
|
const item = props.config[property];
|
|
407
|
-
|
|
413
|
+
if (!item._component)
|
|
414
|
+
return h(item);
|
|
415
|
+
return h(compSet[item._component] || item._component, {
|
|
408
416
|
onVnodeMounted: (vnode) => item._mount?.(vnode),
|
|
409
417
|
onVnodeUnmounted: (vnode) => item._unmount?.(vnode),
|
|
410
418
|
[`${modelKey}`]: props.data[property],
|
|
@@ -617,6 +625,32 @@ function getNutUIRules(Model, options = {}) {
|
|
|
617
625
|
}
|
|
618
626
|
__name(getNutUIRules, "getNutUIRules");
|
|
619
627
|
var getVantRules = getNutUIRules;
|
|
628
|
+
function getArcoRules(Model, options = {}) {
|
|
629
|
+
const stateVars = getExposeKey(Model);
|
|
630
|
+
const ret = {};
|
|
631
|
+
for (const item of stateVars) {
|
|
632
|
+
const handlers = getHandler2(Model, item);
|
|
633
|
+
if (handlers) {
|
|
634
|
+
for (const handler of handlers) {
|
|
635
|
+
const { rule, meta, info } = handler;
|
|
636
|
+
if (rule) {
|
|
637
|
+
if (!ret[item])
|
|
638
|
+
ret[item] = [];
|
|
639
|
+
ret[item].push({
|
|
640
|
+
validator: async (value, cb) => {
|
|
641
|
+
if (!await validate(rule, value))
|
|
642
|
+
cb(info);
|
|
643
|
+
},
|
|
644
|
+
...options,
|
|
645
|
+
...meta || {}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return ret;
|
|
652
|
+
}
|
|
653
|
+
__name(getArcoRules, "getArcoRules");
|
|
620
654
|
|
|
621
655
|
// src/components/createLayer.ts
|
|
622
656
|
import { defineComponent as defineComponent2, h as h2, render, shallowRef } from "vue";
|
|
@@ -800,6 +834,7 @@ export {
|
|
|
800
834
|
emitter,
|
|
801
835
|
getActivePhecda,
|
|
802
836
|
getAntDRules,
|
|
837
|
+
getArcoRules,
|
|
803
838
|
getElementPlusRules,
|
|
804
839
|
getNaiveUIRules,
|
|
805
840
|
getNutUIRules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "provide store/form/table with phecda function to vue",
|
|
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.
|
|
17
|
+
"phecda-core": "1.7.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^6.5.0"
|