phecda-vue 2.0.2 → 2.0.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 CHANGED
@@ -128,6 +128,11 @@ declare const createModal: <T1, T2>(wrapComp: Component<T1>, comp: Component<T2>
128
128
  compProps?: Partial<T2>;
129
129
  }) => (props?: Partial<T2>, modalProps?: Partial<T1>) => void;
130
130
 
131
+ declare const createDialog: <T>(comp: Component<T>, opts?: {
132
+ modelKey?: string;
133
+ props?: Partial<T>;
134
+ }) => (props?: Partial<T>) => void;
135
+
131
136
  declare class PV {
132
137
  constructor();
133
138
  get tag(): any;
@@ -136,4 +141,4 @@ declare class PV {
136
141
  off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
137
142
  }
138
143
 
139
- export { GetDevUIRules, PV, PhecdaEmitter, RE, ReplaceInstanceValues, SchemaToObj, createFilter, createForm, createFormData, createLayer, createModal, createPhecda, createPipe, createTable, emitter, getActivePhecda, getAntDRules, getArcoRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV };
144
+ export { GetDevUIRules, PV, PhecdaEmitter, RE, ReplaceInstanceValues, SchemaToObj, createDialog, createFilter, createForm, createFormData, createLayer, createModal, createPhecda, createPipe, createTable, emitter, getActivePhecda, getAntDRules, getArcoRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initialize, interval, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useRaw, useV };
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ __export(src_exports, {
31
31
  GetDevUIRules: () => GetDevUIRules,
32
32
  PV: () => PV,
33
33
  RE: () => RE,
34
+ createDialog: () => createDialog,
34
35
  createFilter: () => createFilter,
35
36
  createForm: () => createForm,
36
37
  createFormData: () => createFormData,
@@ -720,7 +721,10 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
720
721
  },
721
722
  ...modalProps.value
722
723
  }, {
723
- default: () => content.value && (0, import_vue7.h)(content.value, contentProps.value)
724
+ default: (slot = {}) => content.value && (0, import_vue7.h)(content.value, {
725
+ ...contentProps.value,
726
+ ...slot
727
+ })
724
728
  });
725
729
  }
726
730
  });
@@ -840,7 +844,10 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
840
844
  },
841
845
  ...modalProps.value
842
846
  }, {
843
- default: () => (0, import_vue10.h)(comp, contentProps.value)
847
+ default: (slot = {}) => (0, import_vue10.h)(comp, {
848
+ ...slot,
849
+ ...contentProps.value
850
+ })
844
851
  });
845
852
  }
846
853
  });
@@ -859,6 +866,38 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
859
866
  };
860
867
  }, "createModal");
861
868
 
869
+ // src/components/createDialog.ts
870
+ var import_vue11 = require("vue");
871
+ var createDialog = /* @__PURE__ */ __name(function(comp, opts = {}) {
872
+ let isMounted = false;
873
+ const { modelKey = "modelValue", props = {} } = opts;
874
+ const isShow = (0, import_vue11.shallowRef)(true);
875
+ const contentProps = (0, import_vue11.shallowRef)({});
876
+ const wrapper = (0, import_vue11.defineComponent)({
877
+ setup() {
878
+ return () => (0, import_vue11.h)(comp, {
879
+ [modelKey]: isShow.value,
880
+ [`onUpdate:${modelKey}`]: (v) => {
881
+ isShow.value = v;
882
+ },
883
+ ...contentProps.value
884
+ });
885
+ }
886
+ });
887
+ return (_props = {}) => {
888
+ contentProps.value = Object.assign({}, props, _props);
889
+ if (!isMounted) {
890
+ const el = document.createElement("div");
891
+ const vnode = (0, import_vue11.h)(wrapper);
892
+ vnode.appContext = interval.app?._context;
893
+ document.body.appendChild(((0, import_vue11.render)(vnode, el), el));
894
+ isMounted = true;
895
+ } else {
896
+ isShow.value = true;
897
+ }
898
+ };
899
+ }, "createDialog");
900
+
862
901
  // src/wrapper.ts
863
902
  var PV = class {
864
903
  constructor() {
@@ -882,6 +921,7 @@ __name(PV, "PV");
882
921
  GetDevUIRules,
883
922
  PV,
884
923
  RE,
924
+ createDialog,
885
925
  createFilter,
886
926
  createForm,
887
927
  createFormData,
package/dist/index.mjs CHANGED
@@ -660,7 +660,10 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
660
660
  },
661
661
  ...modalProps.value
662
662
  }, {
663
- default: () => content.value && h2(content.value, contentProps.value)
663
+ default: (slot = {}) => content.value && h2(content.value, {
664
+ ...contentProps.value,
665
+ ...slot
666
+ })
664
667
  });
665
668
  }
666
669
  });
@@ -780,7 +783,10 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
780
783
  },
781
784
  ...modalProps.value
782
785
  }, {
783
- default: () => h5(comp, contentProps.value)
786
+ default: (slot = {}) => h5(comp, {
787
+ ...slot,
788
+ ...contentProps.value
789
+ })
784
790
  });
785
791
  }
786
792
  });
@@ -799,6 +805,38 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
799
805
  };
800
806
  }, "createModal");
801
807
 
808
+ // src/components/createDialog.ts
809
+ import { defineComponent as defineComponent5, h as h6, render as render3, shallowRef as shallowRef3 } from "vue";
810
+ var createDialog = /* @__PURE__ */ __name(function(comp, opts = {}) {
811
+ let isMounted = false;
812
+ const { modelKey = "modelValue", props = {} } = opts;
813
+ const isShow = shallowRef3(true);
814
+ const contentProps = shallowRef3({});
815
+ const wrapper = defineComponent5({
816
+ setup() {
817
+ return () => h6(comp, {
818
+ [modelKey]: isShow.value,
819
+ [`onUpdate:${modelKey}`]: (v) => {
820
+ isShow.value = v;
821
+ },
822
+ ...contentProps.value
823
+ });
824
+ }
825
+ });
826
+ return (_props = {}) => {
827
+ contentProps.value = Object.assign({}, props, _props);
828
+ if (!isMounted) {
829
+ const el = document.createElement("div");
830
+ const vnode = h6(wrapper);
831
+ vnode.appContext = interval.app?._context;
832
+ document.body.appendChild((render3(vnode, el), el));
833
+ isMounted = true;
834
+ } else {
835
+ isShow.value = true;
836
+ }
837
+ };
838
+ }, "createDialog");
839
+
802
840
  // src/wrapper.ts
803
841
  var PV = class {
804
842
  constructor() {
@@ -821,6 +859,7 @@ export {
821
859
  GetDevUIRules,
822
860
  PV,
823
861
  RE,
862
+ createDialog,
824
863
  createFilter,
825
864
  createForm,
826
865
  createFormData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "2.0.2",
3
+ "version": "2.0.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",