phecda-vue 2.0.0-alpha.2 → 2.0.0-alpha.4
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 -2
- package/dist/index.js +33 -21
- package/dist/index.mjs +33 -22
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ type _DeepPartial<T> = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
declare function useO<T extends new (...args: any) => any>(Model: T): UnwrapNestedRefs<InstanceType<T>>;
|
|
41
|
+
declare function useRaw<T extends new (...args: any) => any>(Model: T): InstanceType<T>;
|
|
41
42
|
declare function usePatch<T extends new (...args: any) => any>(Model: T, Data: _DeepPartial<InstanceType<T>>): void;
|
|
42
43
|
declare function useR<T extends new (...args: any) => any>(Model: T): UnwrapNestedRefs<InstanceType<T>>;
|
|
43
44
|
declare function useV<T extends new (...args: any) => any>(Model: T): ReplaceInstanceValues<InstanceType<T>>;
|
|
@@ -97,7 +98,13 @@ declare const createLayer: <T>(wrapComp: Component<T>, props?: Partial<T>, model
|
|
|
97
98
|
|
|
98
99
|
declare function createTable<P extends {
|
|
99
100
|
$props: any;
|
|
100
|
-
}>(compSet: Record<string, Component> | any,
|
|
101
|
+
}>(compSet: Record<string, Component> | any, options: {
|
|
102
|
+
table: Component<P>;
|
|
103
|
+
column?: Component | false;
|
|
104
|
+
data?: any;
|
|
105
|
+
columnSlot?: string;
|
|
106
|
+
cellSlot?: string;
|
|
107
|
+
}): DefineComponent<{
|
|
101
108
|
config: Object;
|
|
102
109
|
} & P['$props']>;
|
|
103
110
|
|
|
@@ -129,4 +136,4 @@ declare class PV {
|
|
|
129
136
|
off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
|
|
130
137
|
}
|
|
131
138
|
|
|
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 };
|
|
139
|
+
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, useRaw, useV };
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(src_exports, {
|
|
|
56
56
|
useO: () => useO,
|
|
57
57
|
usePatch: () => usePatch,
|
|
58
58
|
useR: () => useR,
|
|
59
|
+
useRaw: () => useRaw,
|
|
59
60
|
useV: () => useV
|
|
60
61
|
});
|
|
61
62
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -251,6 +252,10 @@ function useO(Model) {
|
|
|
251
252
|
return useOMap.get(Model);
|
|
252
253
|
}
|
|
253
254
|
__name(useO, "useO");
|
|
255
|
+
function useRaw(Model) {
|
|
256
|
+
return (0, import_vue3.toRaw)(useO(Model));
|
|
257
|
+
}
|
|
258
|
+
__name(useRaw, "useRaw");
|
|
254
259
|
function usePatch(Model, Data) {
|
|
255
260
|
useO(Model);
|
|
256
261
|
const { useOMap } = getActivePhecda();
|
|
@@ -749,28 +754,35 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
|
|
|
749
754
|
|
|
750
755
|
// src/components/createTable.ts
|
|
751
756
|
var import_vue8 = require("vue");
|
|
752
|
-
function createTable(compSet,
|
|
757
|
+
function createTable(compSet, options) {
|
|
758
|
+
const { table, column: tableColumn, data, cellSlot = "default", columnSlot = "default" } = options;
|
|
753
759
|
const TableColumn = (0, import_vue8.defineComponent)({
|
|
754
760
|
name: "PhecdaTableColumn",
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
761
|
+
setup(_props, { attrs }) {
|
|
762
|
+
const compName = attrs._component;
|
|
763
|
+
const childrens = attrs._children && {
|
|
764
|
+
default: () => attrs._children.map((child) => (0, import_vue8.h)(tableColumn, child))
|
|
765
|
+
};
|
|
766
|
+
if (tableColumn) {
|
|
767
|
+
return () => (0, import_vue8.h)(tableColumn, attrs, compName ? {
|
|
768
|
+
[`${cellSlot}`]: (scope) => {
|
|
769
|
+
const childrenProps = typeof attrs._props === "function" ? attrs._props?.(scope) : attrs._props;
|
|
770
|
+
return (0, import_vue8.h)(compSet[compName], {
|
|
771
|
+
data,
|
|
772
|
+
...childrenProps || {}
|
|
773
|
+
}, childrenProps?._slots);
|
|
774
|
+
}
|
|
775
|
+
} : childrens);
|
|
776
|
+
} else {
|
|
777
|
+
return (scope) => {
|
|
778
|
+
const childrenProps = typeof attrs._props === "function" ? attrs._props?.(scope) : attrs._props;
|
|
767
779
|
return compName ? (0, import_vue8.h)(compSet[compName], {
|
|
768
780
|
scope,
|
|
769
781
|
data,
|
|
770
|
-
...
|
|
771
|
-
}) :
|
|
772
|
-
}
|
|
773
|
-
}
|
|
782
|
+
...childrenProps || {}
|
|
783
|
+
}, childrenProps?._slots) : childrens;
|
|
784
|
+
};
|
|
785
|
+
}
|
|
774
786
|
}
|
|
775
787
|
});
|
|
776
788
|
return (0, import_vue8.defineComponent)({
|
|
@@ -792,10 +804,9 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
792
804
|
return (0, import_vue8.h)(table, Object.assign({
|
|
793
805
|
ref: dom
|
|
794
806
|
}, ctx.attrs), {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
});
|
|
807
|
+
[`${columnSlot}`]: (scope) => props.config.map((item) => {
|
|
808
|
+
item = typeof item === "function" ? item(scope) : item;
|
|
809
|
+
return (0, import_vue8.h)(TableColumn, item);
|
|
799
810
|
})
|
|
800
811
|
});
|
|
801
812
|
};
|
|
@@ -907,5 +918,6 @@ __name(PV, "PV");
|
|
|
907
918
|
useO,
|
|
908
919
|
usePatch,
|
|
909
920
|
useR,
|
|
921
|
+
useRaw,
|
|
910
922
|
useV
|
|
911
923
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function getReactiveMap(symbol) {
|
|
|
115
115
|
__name(getReactiveMap, "getReactiveMap");
|
|
116
116
|
|
|
117
117
|
// src/vue/composable.ts
|
|
118
|
-
import { computed, onBeforeUnmount, reactive } from "vue";
|
|
118
|
+
import { computed, onBeforeUnmount, reactive, toRaw } from "vue";
|
|
119
119
|
import { getHandler, register } from "phecda-core";
|
|
120
120
|
|
|
121
121
|
// src/vue/utils.ts
|
|
@@ -192,6 +192,10 @@ function useO(Model) {
|
|
|
192
192
|
return useOMap.get(Model);
|
|
193
193
|
}
|
|
194
194
|
__name(useO, "useO");
|
|
195
|
+
function useRaw(Model) {
|
|
196
|
+
return toRaw(useO(Model));
|
|
197
|
+
}
|
|
198
|
+
__name(useRaw, "useRaw");
|
|
195
199
|
function usePatch(Model, Data) {
|
|
196
200
|
useO(Model);
|
|
197
201
|
const { useOMap } = getActivePhecda();
|
|
@@ -690,28 +694,35 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
|
|
|
690
694
|
|
|
691
695
|
// src/components/createTable.ts
|
|
692
696
|
import { defineComponent as defineComponent3, h as h3, onMounted as onMounted2, ref as ref3 } from "vue";
|
|
693
|
-
function createTable(compSet,
|
|
697
|
+
function createTable(compSet, options) {
|
|
698
|
+
const { table, column: tableColumn, data, cellSlot = "default", columnSlot = "default" } = options;
|
|
694
699
|
const TableColumn = defineComponent3({
|
|
695
700
|
name: "PhecdaTableColumn",
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
701
|
+
setup(_props, { attrs }) {
|
|
702
|
+
const compName = attrs._component;
|
|
703
|
+
const childrens = attrs._children && {
|
|
704
|
+
default: () => attrs._children.map((child) => h3(tableColumn, child))
|
|
705
|
+
};
|
|
706
|
+
if (tableColumn) {
|
|
707
|
+
return () => h3(tableColumn, attrs, compName ? {
|
|
708
|
+
[`${cellSlot}`]: (scope) => {
|
|
709
|
+
const childrenProps = typeof attrs._props === "function" ? attrs._props?.(scope) : attrs._props;
|
|
710
|
+
return h3(compSet[compName], {
|
|
711
|
+
data,
|
|
712
|
+
...childrenProps || {}
|
|
713
|
+
}, childrenProps?._slots);
|
|
714
|
+
}
|
|
715
|
+
} : childrens);
|
|
716
|
+
} else {
|
|
717
|
+
return (scope) => {
|
|
718
|
+
const childrenProps = typeof attrs._props === "function" ? attrs._props?.(scope) : attrs._props;
|
|
708
719
|
return compName ? h3(compSet[compName], {
|
|
709
720
|
scope,
|
|
710
721
|
data,
|
|
711
|
-
...
|
|
712
|
-
}) :
|
|
713
|
-
}
|
|
714
|
-
}
|
|
722
|
+
...childrenProps || {}
|
|
723
|
+
}, childrenProps?._slots) : childrens;
|
|
724
|
+
};
|
|
725
|
+
}
|
|
715
726
|
}
|
|
716
727
|
});
|
|
717
728
|
return defineComponent3({
|
|
@@ -733,10 +744,9 @@ function createTable(compSet, table, tableColumn, data) {
|
|
|
733
744
|
return h3(table, Object.assign({
|
|
734
745
|
ref: dom
|
|
735
746
|
}, ctx.attrs), {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
});
|
|
747
|
+
[`${columnSlot}`]: (scope) => props.config.map((item) => {
|
|
748
|
+
item = typeof item === "function" ? item(scope) : item;
|
|
749
|
+
return h3(TableColumn, item);
|
|
740
750
|
})
|
|
741
751
|
});
|
|
742
752
|
};
|
|
@@ -847,5 +857,6 @@ export {
|
|
|
847
857
|
useO,
|
|
848
858
|
usePatch,
|
|
849
859
|
useR,
|
|
860
|
+
useRaw,
|
|
850
861
|
useV
|
|
851
862
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phecda-vue",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
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": "2.0.0-alpha.
|
|
17
|
+
"phecda-core": "2.0.0-alpha.3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^6.5.0"
|