phecda-vue 1.2.1 → 1.2.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 CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as mitt from 'mitt';
2
- import { EventType, Handler, Emitter } from 'mitt';
2
+ import { EventType, Handler } from 'mitt';
3
3
  import * as vue from 'vue';
4
- import { Ref, App, UnwrapNestedRefs, Component, DefineComponent, ExtractPropTypes, VNode } from 'vue';
5
- import { Phecda } from 'phecda-core';
4
+ import { Ref, App, UnwrapNestedRefs, Component, DefineComponent, VNode } from 'vue';
6
5
  export * from 'phecda-core';
7
6
 
8
7
  type ReadonlyValue<T> = {
@@ -81,16 +80,6 @@ declare function createFilter<Data extends Record<string, any>>(initState?: Obje
81
80
  clearStore: (key: string) => void;
82
81
  };
83
82
 
84
- declare class P {
85
- protected static emitter: Emitter<PhecdaEvents>;
86
- protected _namespace: Phecda['_namespace'];
87
- constructor();
88
- get tag(): string;
89
- on<Key extends keyof PhecdaEvents>(type: Key, handler: Handler<PhecdaEvents[Key]>): void;
90
- emit(type: keyof PhecdaEvents, event: PhecdaEvents[keyof PhecdaEvents]): void;
91
- off<Key extends keyof PhecdaEvents>(type: Key, handler?: Handler<PhecdaEvents[Key]>): void;
92
- }
93
-
94
83
  declare function createForm<P extends {
95
84
  $props: any;
96
85
  }>(compSet: Record<string, Component> | any, form: Component<P>, formItem: Component | false, modelKey?: string): DefineComponent<{
@@ -114,7 +103,7 @@ declare const getAntDRules: typeof getNaiveUIRules;
114
103
  declare function getNutUIRules<M, O extends object>(Model: M, options?: O): any;
115
104
  declare const getVantRules: typeof getNutUIRules;
116
105
 
117
- declare const createModal: <P>(w: Component) => (comp: DefineComponent<P, any, any>, props?: ExtractPropTypes<P>) => void;
106
+ declare const createModal: <T>(wrapComp: Component<T>, props?: Partial<T>, modelKey?: string) => <P>(comp: Component<P>, props?: P) => void;
118
107
 
119
108
  declare function createTable<P extends {
120
109
  $props: any;
@@ -136,4 +125,4 @@ interface PipeRet {
136
125
  get: Record<string, () => VNode>;
137
126
  }
138
127
 
139
- export { EXPRESS_RE, FN_RE, GetDevUIRules, P, PhecdaEvents, PublicOnly, ReplaceInstanceValues, SchemaToObj, clearStorage, createFilter, createForm, createFormData, createModal, createPhecda, createPipe, createTable, deleteStorage, emitter, getActivePhecda, getAntDRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initalize, invokeAction, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
128
+ export { EXPRESS_RE, FN_RE, GetDevUIRules, PhecdaEvents, PublicOnly, ReplaceInstanceValues, SchemaToObj, clearStorage, createFilter, createForm, createFormData, createModal, createPhecda, createPipe, createTable, deleteStorage, emitter, getActivePhecda, getAntDRules, getElementPlusRules, getNaiveUIRules, getNutUIRules, getReactiveMap, getVantRules, initalize, invokeAction, phecdaSymbol, setActivePhecda, useEvent, useO, usePatch, useR, useV };
package/dist/index.js CHANGED
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
9
  var __export = (target, all) => {
11
10
  for (var name in all)
@@ -25,10 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
24
  mod
26
25
  ));
27
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __publicField = (obj, key, value) => {
29
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
30
- return value;
31
- };
32
27
 
33
28
  // src/index.ts
34
29
  var src_exports = {};
@@ -36,7 +31,6 @@ __export(src_exports, {
36
31
  EXPRESS_RE: () => EXPRESS_RE,
37
32
  FN_RE: () => FN_RE,
38
33
  GetDevUIRules: () => GetDevUIRules,
39
- P: () => P,
40
34
  clearStorage: () => clearStorage,
41
35
  createFilter: () => createFilter,
42
36
  createForm: () => createForm,
@@ -428,28 +422,6 @@ __name(createFilter, "createFilter");
428
422
  // src/index.ts
429
423
  __reExport(src_exports, require("phecda-core"), module.exports);
430
424
 
431
- // src/wrapper.ts
432
- var _P = class {
433
- _namespace;
434
- constructor() {
435
- }
436
- get tag() {
437
- return this._namespace.__TAG__;
438
- }
439
- on(type, handler) {
440
- _P.emitter.on(type, handler);
441
- }
442
- emit(type, event) {
443
- _P.emitter.emit(type, event);
444
- }
445
- off(type, handler) {
446
- _P.emitter.off(type, handler);
447
- }
448
- };
449
- var P = _P;
450
- __name(P, "P");
451
- __publicField(P, "emitter", emitter);
452
-
453
425
  // src/components/createForm.ts
454
426
  var import_vue5 = require("vue");
455
427
  function createForm(compSet, form, formItem, modelKey = "modelValue") {
@@ -560,7 +532,7 @@ __name(createFormData, "createFormData");
560
532
  // src/components/formResolve.ts
561
533
  var import_phecda_core3 = require("phecda-core");
562
534
  function getElementPlusRules(Model, options = {}) {
563
- const stateVars = (0, import_phecda_core3.getModelState)(Model);
535
+ const stateVars = (0, import_phecda_core3.getExposeKey)(Model);
564
536
  const ret = {};
565
537
  for (const item of stateVars) {
566
538
  const handlers = (0, import_phecda_core3.getHandler)(Model, item);
@@ -589,7 +561,7 @@ function getElementPlusRules(Model, options = {}) {
589
561
  __name(getElementPlusRules, "getElementPlusRules");
590
562
  var GetDevUIRules = getElementPlusRules;
591
563
  function getNaiveUIRules(Model, options = {}) {
592
- const stateVars = (0, import_phecda_core3.getModelState)(Model);
564
+ const stateVars = (0, import_phecda_core3.getExposeKey)(Model);
593
565
  const ret = {};
594
566
  for (const item of stateVars) {
595
567
  const handlers = (0, import_phecda_core3.getHandler)(Model, item);
@@ -618,7 +590,7 @@ function getNaiveUIRules(Model, options = {}) {
618
590
  __name(getNaiveUIRules, "getNaiveUIRules");
619
591
  var getAntDRules = getNaiveUIRules;
620
592
  function getNutUIRules(Model, options = {}) {
621
- const stateVars = (0, import_phecda_core3.getModelState)(Model);
593
+ const stateVars = (0, import_phecda_core3.getExposeKey)(Model);
622
594
  const ret = {};
623
595
  for (const item of stateVars) {
624
596
  const handlers = (0, import_phecda_core3.getHandler)(Model, item);
@@ -650,7 +622,7 @@ var getVantRules = getNutUIRules;
650
622
 
651
623
  // src/components/createModal.ts
652
624
  var import_vue6 = require("vue");
653
- var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "modelValue") {
625
+ var createModal = /* @__PURE__ */ __name(function(modalWrapper, props = {}, modelKey = "modelValue") {
654
626
  let isMounted = false;
655
627
  const isShow = (0, import_vue6.ref)(true);
656
628
  const content = (0, import_vue6.shallowRef)();
@@ -661,15 +633,16 @@ var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "mode
661
633
  [modelKey]: isShow.value,
662
634
  [`onUpdate:${modelKey}`]: (v) => {
663
635
  isShow.value = v;
664
- }
636
+ },
637
+ ...props
665
638
  }, {
666
639
  default: () => content.value && (0, import_vue6.h)(content.value, propsRef.value)
667
640
  });
668
641
  }
669
642
  });
670
- return (comp, props) => {
643
+ return (comp, props2) => {
671
644
  content.value = comp;
672
- propsRef.value = props;
645
+ propsRef.value = props2;
673
646
  if (!isMounted) {
674
647
  const el = document.createElement("div");
675
648
  const vnode = (0, import_vue6.h)(wrapper);
@@ -762,7 +735,6 @@ __name(createPipe, "createPipe");
762
735
  EXPRESS_RE,
763
736
  FN_RE,
764
737
  GetDevUIRules,
765
- P,
766
738
  clearStorage,
767
739
  createFilter,
768
740
  createForm,
package/dist/index.mjs CHANGED
@@ -1,10 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
8
3
 
9
4
  // src/emitter.ts
10
5
  import mitt from "mitt";
@@ -368,28 +363,6 @@ __name(createFilter, "createFilter");
368
363
  // src/index.ts
369
364
  export * from "phecda-core";
370
365
 
371
- // src/wrapper.ts
372
- var _P = class {
373
- _namespace;
374
- constructor() {
375
- }
376
- get tag() {
377
- return this._namespace.__TAG__;
378
- }
379
- on(type, handler) {
380
- _P.emitter.on(type, handler);
381
- }
382
- emit(type, event) {
383
- _P.emitter.emit(type, event);
384
- }
385
- off(type, handler) {
386
- _P.emitter.off(type, handler);
387
- }
388
- };
389
- var P = _P;
390
- __name(P, "P");
391
- __publicField(P, "emitter", emitter);
392
-
393
366
  // src/components/createForm.ts
394
367
  import { defineComponent, h, onMounted, ref as ref2 } from "vue";
395
368
  function createForm(compSet, form, formItem, modelKey = "modelValue") {
@@ -498,9 +471,9 @@ function createFormData(schema, initData = {}, options = {}) {
498
471
  __name(createFormData, "createFormData");
499
472
 
500
473
  // src/components/formResolve.ts
501
- import { getHandler as getHandler2, getModelState, validate } from "phecda-core";
474
+ import { getExposeKey, getHandler as getHandler2, validate } from "phecda-core";
502
475
  function getElementPlusRules(Model, options = {}) {
503
- const stateVars = getModelState(Model);
476
+ const stateVars = getExposeKey(Model);
504
477
  const ret = {};
505
478
  for (const item of stateVars) {
506
479
  const handlers = getHandler2(Model, item);
@@ -529,7 +502,7 @@ function getElementPlusRules(Model, options = {}) {
529
502
  __name(getElementPlusRules, "getElementPlusRules");
530
503
  var GetDevUIRules = getElementPlusRules;
531
504
  function getNaiveUIRules(Model, options = {}) {
532
- const stateVars = getModelState(Model);
505
+ const stateVars = getExposeKey(Model);
533
506
  const ret = {};
534
507
  for (const item of stateVars) {
535
508
  const handlers = getHandler2(Model, item);
@@ -558,7 +531,7 @@ function getNaiveUIRules(Model, options = {}) {
558
531
  __name(getNaiveUIRules, "getNaiveUIRules");
559
532
  var getAntDRules = getNaiveUIRules;
560
533
  function getNutUIRules(Model, options = {}) {
561
- const stateVars = getModelState(Model);
534
+ const stateVars = getExposeKey(Model);
562
535
  const ret = {};
563
536
  for (const item of stateVars) {
564
537
  const handlers = getHandler2(Model, item);
@@ -590,7 +563,7 @@ var getVantRules = getNutUIRules;
590
563
 
591
564
  // src/components/createModal.ts
592
565
  import { defineComponent as defineComponent2, h as h2, ref as ref3, render, shallowRef } from "vue";
593
- var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "modelValue") {
566
+ var createModal = /* @__PURE__ */ __name(function(modalWrapper, props = {}, modelKey = "modelValue") {
594
567
  let isMounted = false;
595
568
  const isShow = ref3(true);
596
569
  const content = shallowRef();
@@ -601,15 +574,16 @@ var createModal = /* @__PURE__ */ __name(function(modalWrapper, modelKey = "mode
601
574
  [modelKey]: isShow.value,
602
575
  [`onUpdate:${modelKey}`]: (v) => {
603
576
  isShow.value = v;
604
- }
577
+ },
578
+ ...props
605
579
  }, {
606
580
  default: () => content.value && h2(content.value, propsRef.value)
607
581
  });
608
582
  }
609
583
  });
610
- return (comp, props) => {
584
+ return (comp, props2) => {
611
585
  content.value = comp;
612
- propsRef.value = props;
586
+ propsRef.value = props2;
613
587
  if (!isMounted) {
614
588
  const el = document.createElement("div");
615
589
  const vnode = h2(wrapper);
@@ -701,7 +675,6 @@ export {
701
675
  EXPRESS_RE,
702
676
  FN_RE,
703
677
  GetDevUIRules,
704
- P,
705
678
  clearStorage,
706
679
  createFilter,
707
680
  createForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "1.2.1",
3
+ "version": "1.2.4",
4
4
  "description": "",
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.0.7"
17
+ "phecda-core": "1.1.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "tsup": "^6.5.0"