phecda-vue 1.4.0 → 1.5.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 +9 -6
- package/dist/index.js +39 -2
- package/dist/index.mjs +38 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { PhecdaEvents } from 'phecda-core';
|
|
2
2
|
export * from 'phecda-core';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
|
-
import { Ref, App, UnwrapNestedRefs, Component, DefineComponent, VNode } from 'vue';
|
|
4
|
+
import { DeepReadonly, Ref, App, UnwrapNestedRefs, Component, DefineComponent, VNode } from 'vue';
|
|
5
5
|
import { Handler } from 'mitt';
|
|
6
6
|
|
|
7
|
-
type ReadonlyValue<T> = {
|
|
8
|
-
readonly [K in keyof T]: K extends 'value' ? T[K] : ReadonlyValue<T[K]>;
|
|
9
|
-
};
|
|
10
7
|
type PublicOnly<T> = {
|
|
11
8
|
[K in keyof T]: T[K] extends Function ? T[K] : K extends string ? T[K] extends ('private' | 'protected') ? never : T[K] : never;
|
|
12
9
|
};
|
|
13
10
|
type ReplaceInstanceValues<I> = {
|
|
14
|
-
[P in keyof I]: I[P] extends (...args: any[]) => any ? I[P] : I[P] extends Readonly<any> ?
|
|
11
|
+
[P in keyof I]: I[P] extends (...args: any[]) => any ? I[P] : I[P] extends Readonly<any> ? DeepReadonly<Ref<I[P]>> : Ref<I[P]>;
|
|
15
12
|
};
|
|
16
13
|
type SchemaToObj<S> = {
|
|
17
14
|
[P in keyof S]: S[P] extends object ? SchemaToObj<S[P]> : (S[P] extends string ? any : S[P]);
|
|
@@ -119,6 +116,12 @@ interface PipeRet {
|
|
|
119
116
|
get: Record<string, () => VNode>;
|
|
120
117
|
}
|
|
121
118
|
|
|
119
|
+
declare const createModal: <T1, T2>(wrapComp: Component<T1>, comp: Component<T2>, opts?: {
|
|
120
|
+
modelKey?: string;
|
|
121
|
+
wrapProps?: Partial<T1>;
|
|
122
|
+
compProps?: Partial<T2>;
|
|
123
|
+
}) => (props?: Partial<T2>, modalProps?: Partial<T1>) => void;
|
|
124
|
+
|
|
122
125
|
declare class PV {
|
|
123
126
|
constructor();
|
|
124
127
|
get tag(): any;
|
|
@@ -127,4 +130,4 @@ declare class PV {
|
|
|
127
130
|
off<Key extends keyof PhecdaEvents>(type: Key, handler?: (arg: PhecdaEvents[Key]) => void): void;
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
export { EXPRESS_RE, FN_RE, GetDevUIRules, PV, PhecdaEmitter, PublicOnly, ReplaceInstanceValues, SchemaToObj, createFilter, createForm, createFormData, createLayer, createPhecda, createPipe, createTable, emitter, getActivePhecda, getAntDRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initialize, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
|
|
133
|
+
export { EXPRESS_RE, FN_RE, GetDevUIRules, PV, PhecdaEmitter, PublicOnly, 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 };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
createForm: () => createForm,
|
|
37
37
|
createFormData: () => createFormData,
|
|
38
38
|
createLayer: () => createLayer,
|
|
39
|
+
createModal: () => createModal,
|
|
39
40
|
createPhecda: () => createPhecda,
|
|
40
41
|
createPipe: () => createPipe,
|
|
41
42
|
createTable: () => createTable,
|
|
@@ -449,7 +450,6 @@ function createForm(compSet, form, formItem, options = {}) {
|
|
|
449
450
|
const { property } = props;
|
|
450
451
|
const item = props.config[property];
|
|
451
452
|
return (0, import_vue5.h)(compSet[item._component], {
|
|
452
|
-
...item,
|
|
453
453
|
onVnodeMounted: (vnode) => item._mount?.(vnode),
|
|
454
454
|
onVnodeUnmounted: (vnode) => item._unmount?.(vnode),
|
|
455
455
|
[`${modelKey}`]: props.data[property],
|
|
@@ -458,7 +458,8 @@ function createForm(compSet, form, formItem, options = {}) {
|
|
|
458
458
|
onUpdate(property, v);
|
|
459
459
|
else
|
|
460
460
|
props.data[property] = v;
|
|
461
|
-
}
|
|
461
|
+
},
|
|
462
|
+
...item
|
|
462
463
|
}, {
|
|
463
464
|
default: () => generateChildVNode(props.config[props.property])
|
|
464
465
|
});
|
|
@@ -775,6 +776,41 @@ function createPipe(comp, props, to = "default", slot) {
|
|
|
775
776
|
}
|
|
776
777
|
__name(createPipe, "createPipe");
|
|
777
778
|
|
|
779
|
+
// src/components/createModal.ts
|
|
780
|
+
var import_vue10 = require("vue");
|
|
781
|
+
var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
|
|
782
|
+
let isMounted = false;
|
|
783
|
+
const { modelKey = "modelValue", wrapProps = {}, compProps = {} } = opts;
|
|
784
|
+
const isShow = (0, import_vue10.shallowRef)(true);
|
|
785
|
+
const contentProps = (0, import_vue10.shallowRef)({});
|
|
786
|
+
const modalProps = (0, import_vue10.shallowRef)({});
|
|
787
|
+
const wrapper = (0, import_vue10.defineComponent)({
|
|
788
|
+
setup() {
|
|
789
|
+
return () => (0, import_vue10.h)(wrapComp, {
|
|
790
|
+
[modelKey]: isShow.value,
|
|
791
|
+
[`onUpdate:${modelKey}`]: (v) => {
|
|
792
|
+
isShow.value = v;
|
|
793
|
+
},
|
|
794
|
+
...modalProps.value
|
|
795
|
+
}, {
|
|
796
|
+
default: () => (0, import_vue10.h)(comp, contentProps.value)
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
return (props, wrap_props) => {
|
|
801
|
+
contentProps.value = Object.assign({}, compProps, props);
|
|
802
|
+
modalProps.value = Object.assign({}, wrapProps, wrap_props);
|
|
803
|
+
if (!isMounted) {
|
|
804
|
+
const el = document.createElement("div");
|
|
805
|
+
const vnode = (0, import_vue10.h)(wrapper);
|
|
806
|
+
document.body.appendChild(((0, import_vue10.render)(vnode, el), el));
|
|
807
|
+
isMounted = true;
|
|
808
|
+
} else {
|
|
809
|
+
isShow.value = true;
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
}, "createModal");
|
|
813
|
+
|
|
778
814
|
// src/wrapper.ts
|
|
779
815
|
var PV = class {
|
|
780
816
|
constructor() {
|
|
@@ -803,6 +839,7 @@ __name(PV, "PV");
|
|
|
803
839
|
createForm,
|
|
804
840
|
createFormData,
|
|
805
841
|
createLayer,
|
|
842
|
+
createModal,
|
|
806
843
|
createPhecda,
|
|
807
844
|
createPipe,
|
|
808
845
|
createTable,
|
package/dist/index.mjs
CHANGED
|
@@ -392,7 +392,6 @@ function createForm(compSet, form, formItem, options = {}) {
|
|
|
392
392
|
const { property } = props;
|
|
393
393
|
const item = props.config[property];
|
|
394
394
|
return h(compSet[item._component], {
|
|
395
|
-
...item,
|
|
396
395
|
onVnodeMounted: (vnode) => item._mount?.(vnode),
|
|
397
396
|
onVnodeUnmounted: (vnode) => item._unmount?.(vnode),
|
|
398
397
|
[`${modelKey}`]: props.data[property],
|
|
@@ -401,7 +400,8 @@ function createForm(compSet, form, formItem, options = {}) {
|
|
|
401
400
|
onUpdate(property, v);
|
|
402
401
|
else
|
|
403
402
|
props.data[property] = v;
|
|
404
|
-
}
|
|
403
|
+
},
|
|
404
|
+
...item
|
|
405
405
|
}, {
|
|
406
406
|
default: () => generateChildVNode(props.config[props.property])
|
|
407
407
|
});
|
|
@@ -718,6 +718,41 @@ function createPipe(comp, props, to = "default", slot) {
|
|
|
718
718
|
}
|
|
719
719
|
__name(createPipe, "createPipe");
|
|
720
720
|
|
|
721
|
+
// src/components/createModal.ts
|
|
722
|
+
import { defineComponent as defineComponent4, h as h5, render as render2, shallowRef as shallowRef2 } from "vue";
|
|
723
|
+
var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
|
|
724
|
+
let isMounted = false;
|
|
725
|
+
const { modelKey = "modelValue", wrapProps = {}, compProps = {} } = opts;
|
|
726
|
+
const isShow = shallowRef2(true);
|
|
727
|
+
const contentProps = shallowRef2({});
|
|
728
|
+
const modalProps = shallowRef2({});
|
|
729
|
+
const wrapper = defineComponent4({
|
|
730
|
+
setup() {
|
|
731
|
+
return () => h5(wrapComp, {
|
|
732
|
+
[modelKey]: isShow.value,
|
|
733
|
+
[`onUpdate:${modelKey}`]: (v) => {
|
|
734
|
+
isShow.value = v;
|
|
735
|
+
},
|
|
736
|
+
...modalProps.value
|
|
737
|
+
}, {
|
|
738
|
+
default: () => h5(comp, contentProps.value)
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
return (props, wrap_props) => {
|
|
743
|
+
contentProps.value = Object.assign({}, compProps, props);
|
|
744
|
+
modalProps.value = Object.assign({}, wrapProps, wrap_props);
|
|
745
|
+
if (!isMounted) {
|
|
746
|
+
const el = document.createElement("div");
|
|
747
|
+
const vnode = h5(wrapper);
|
|
748
|
+
document.body.appendChild((render2(vnode, el), el));
|
|
749
|
+
isMounted = true;
|
|
750
|
+
} else {
|
|
751
|
+
isShow.value = true;
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
}, "createModal");
|
|
755
|
+
|
|
721
756
|
// src/wrapper.ts
|
|
722
757
|
var PV = class {
|
|
723
758
|
constructor() {
|
|
@@ -745,6 +780,7 @@ export {
|
|
|
745
780
|
createForm,
|
|
746
781
|
createFormData,
|
|
747
782
|
createLayer,
|
|
783
|
+
createModal,
|
|
748
784
|
createPhecda,
|
|
749
785
|
createPipe,
|
|
750
786
|
createTable,
|