phecda-vue 2.0.1 → 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
@@ -19,6 +19,7 @@ interface PhecdaEmitter {
19
19
  declare const emitter: PhecdaEmitter;
20
20
 
21
21
  declare const phecdaSymbol: unique symbol;
22
+ declare const interval: any;
22
23
  declare function createPhecda(symbol?: string): vue.Raw<{
23
24
  install(app: App): void;
24
25
  }>;
@@ -127,6 +128,11 @@ declare const createModal: <T1, T2>(wrapComp: Component<T1>, comp: Component<T2>
127
128
  compProps?: Partial<T2>;
128
129
  }) => (props?: Partial<T2>, modalProps?: Partial<T1>) => void;
129
130
 
131
+ declare const createDialog: <T>(comp: Component<T>, opts?: {
132
+ modelKey?: string;
133
+ props?: Partial<T>;
134
+ }) => (props?: Partial<T>) => void;
135
+
130
136
  declare class PV {
131
137
  constructor();
132
138
  get tag(): any;
@@ -135,4 +141,4 @@ declare class PV {
135
141
  off<Key extends keyof Events>(type: Key, handler?: (arg: Events[Key]) => void): void;
136
142
  }
137
143
 
138
- 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, 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,
@@ -49,6 +50,7 @@ __export(src_exports, {
49
50
  getReactiveMap: () => getReactiveMap,
50
51
  getVantRules: () => getVantRules,
51
52
  initialize: () => initialize,
53
+ interval: () => interval,
52
54
  phecdaSymbol: () => phecdaSymbol,
53
55
  setActivePhecda: () => setActivePhecda,
54
56
  useEvent: () => useEvent,
@@ -68,9 +70,11 @@ var emitter = (0, import_mitt.default)();
68
70
  var import_vue = require("vue");
69
71
  var import_phecda_core = require("phecda-core");
70
72
  var phecdaSymbol = Symbol("phecda");
73
+ var interval = {};
71
74
  function createPhecda(symbol) {
72
75
  const phecda = (0, import_vue.markRaw)({
73
76
  install(app) {
77
+ interval.app = app;
74
78
  app.provide(phecdaSymbol, phecda);
75
79
  app.config.globalProperties.$phecda = phecda;
76
80
  if (!window.__PHECDA_VUE__)
@@ -717,7 +721,10 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
717
721
  },
718
722
  ...modalProps.value
719
723
  }, {
720
- 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
+ })
721
728
  });
722
729
  }
723
730
  });
@@ -728,6 +735,7 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
728
735
  if (!isMounted) {
729
736
  const el = document.createElement("div");
730
737
  const vnode = (0, import_vue7.h)(wrapper);
738
+ vnode.appContext = interval.app?._context;
731
739
  document.body.appendChild(((0, import_vue7.render)(vnode, el), el));
732
740
  isMounted = true;
733
741
  } else {
@@ -836,7 +844,10 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
836
844
  },
837
845
  ...modalProps.value
838
846
  }, {
839
- default: () => (0, import_vue10.h)(comp, contentProps.value)
847
+ default: (slot = {}) => (0, import_vue10.h)(comp, {
848
+ ...slot,
849
+ ...contentProps.value
850
+ })
840
851
  });
841
852
  }
842
853
  });
@@ -846,6 +857,7 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
846
857
  if (!isMounted) {
847
858
  const el = document.createElement("div");
848
859
  const vnode = (0, import_vue10.h)(wrapper);
860
+ vnode.appContext = interval.app?._context;
849
861
  document.body.appendChild(((0, import_vue10.render)(vnode, el), el));
850
862
  isMounted = true;
851
863
  } else {
@@ -854,6 +866,38 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
854
866
  };
855
867
  }, "createModal");
856
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
+
857
901
  // src/wrapper.ts
858
902
  var PV = class {
859
903
  constructor() {
@@ -877,6 +921,7 @@ __name(PV, "PV");
877
921
  GetDevUIRules,
878
922
  PV,
879
923
  RE,
924
+ createDialog,
880
925
  createFilter,
881
926
  createForm,
882
927
  createFormData,
@@ -895,6 +940,7 @@ __name(PV, "PV");
895
940
  getReactiveMap,
896
941
  getVantRules,
897
942
  initialize,
943
+ interval,
898
944
  phecdaSymbol,
899
945
  setActivePhecda,
900
946
  useEvent,
package/dist/index.mjs CHANGED
@@ -9,9 +9,11 @@ var emitter = mitt();
9
9
  import { markRaw } from "vue";
10
10
  import { getProperty, getTag, injectProperty } from "phecda-core";
11
11
  var phecdaSymbol = Symbol("phecda");
12
+ var interval = {};
12
13
  function createPhecda(symbol) {
13
14
  const phecda = markRaw({
14
15
  install(app) {
16
+ interval.app = app;
15
17
  app.provide(phecdaSymbol, phecda);
16
18
  app.config.globalProperties.$phecda = phecda;
17
19
  if (!window.__PHECDA_VUE__)
@@ -658,7 +660,10 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
658
660
  },
659
661
  ...modalProps.value
660
662
  }, {
661
- default: () => content.value && h2(content.value, contentProps.value)
663
+ default: (slot = {}) => content.value && h2(content.value, {
664
+ ...contentProps.value,
665
+ ...slot
666
+ })
662
667
  });
663
668
  }
664
669
  });
@@ -669,6 +674,7 @@ var createLayer = /* @__PURE__ */ __name(function(modalWrapper, content_props =
669
674
  if (!isMounted) {
670
675
  const el = document.createElement("div");
671
676
  const vnode = h2(wrapper);
677
+ vnode.appContext = interval.app?._context;
672
678
  document.body.appendChild((render(vnode, el), el));
673
679
  isMounted = true;
674
680
  } else {
@@ -777,7 +783,10 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
777
783
  },
778
784
  ...modalProps.value
779
785
  }, {
780
- default: () => h5(comp, contentProps.value)
786
+ default: (slot = {}) => h5(comp, {
787
+ ...slot,
788
+ ...contentProps.value
789
+ })
781
790
  });
782
791
  }
783
792
  });
@@ -787,6 +796,7 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
787
796
  if (!isMounted) {
788
797
  const el = document.createElement("div");
789
798
  const vnode = h5(wrapper);
799
+ vnode.appContext = interval.app?._context;
790
800
  document.body.appendChild((render2(vnode, el), el));
791
801
  isMounted = true;
792
802
  } else {
@@ -795,6 +805,38 @@ var createModal = /* @__PURE__ */ __name(function(wrapComp, comp, opts = {}) {
795
805
  };
796
806
  }, "createModal");
797
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
+
798
840
  // src/wrapper.ts
799
841
  var PV = class {
800
842
  constructor() {
@@ -817,6 +859,7 @@ export {
817
859
  GetDevUIRules,
818
860
  PV,
819
861
  RE,
862
+ createDialog,
820
863
  createFilter,
821
864
  createForm,
822
865
  createFormData,
@@ -835,6 +878,7 @@ export {
835
878
  getReactiveMap,
836
879
  getVantRules,
837
880
  initialize,
881
+ interval,
838
882
  phecdaSymbol,
839
883
  setActivePhecda,
840
884
  useEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "2.0.1",
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",