easy-soft-dva 3.8.1 → 3.9.1
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/es/index.js +1 -1
- package/es/utils/dvaAssist.d.ts +2 -1
- package/package.json +7 -3
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t}from"./index2.js";import{_ as i,c as e}from"./index3.js";import{logDevelop as
|
|
1
|
+
import{_ as t}from"./index2.js";import{_ as i,c as e}from"./index3.js";import n from"react";import{logDevelop as a,isObject as r,promptTextBuilder as o,checkObjectIsNullOrEmpty as l,isArray as p,getModelCollection as c,tryDoDvaPrepareWork as s,logException as u,getModelNameList as m,checkInCollection as f,logDebug as d,buildPromptModuleInfo as v,mergeTextMessage as y}from"easy-soft-utility";import{createLoading as h}from"./dva-loading/index.js";import{Provider as w}from"react-redux";export{Provider,connect}from"react-redux";import"invariant";import"redux";import"redux-saga";import"is-plain-object";import"flatten";import"@reduxjs/toolkit";import"warning";var b="easy-soft-dva";function g(t,i){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=function(t,i){if(!t)return;if("string"==typeof t)return C(t,i);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return C(t,i)}(t))||i&&t&&"number"==typeof t.length){e&&(t=e);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==e.return||e.return()}finally{if(l)throw r}}}}function C(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,n=new Array(i);e<i;e++)n[e]=t[e];return n}function S(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return v(b,y(t,i),x)}var x="dvaAssist",O={application:null,initialOption:{initialState:{},models:[]},initialOptionSetComplete:!1,applicationInitializeComplete:!1};function A(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(O.initialOptionSetComplete)a(S("setApplicationInitialOption"),"reset is not allowed, it can be set only once");else{if(!r(t))throw new Error(S("setApplicationInitialOption",o.buildMustObject({})));var e=t||{};l(e)?a("application initial option","empty"):a(e,"application initial option"),e.models=p(e.models)?[].concat(i(e.models),i(c())):c(),O.initialOption=e,O.initialOptionSetComplete=!0}}function E(){if(!O.initialOptionSetComplete)throw new Error(S("initializeApplication","please exec setApplicationInitialOption to set application initial option"));if(null==O.application||!O.applicationInitializeComplete){s(),O.application=e(O.initialOption),O.application.use(h({}));var i,n=t({models:[]},O.initialOption).models,r=g(void 0===n?[]:n);try{for(r.s();!(i=r.n()).done;){var o=i.value;O.application.model(o)}}catch(t){r.e(t)}finally{r.f()}O.application.start(),a(S("initializeApplication","dva app start complete")),O.application.getStore=function(){return O.application._store},O.application.use({onError:function(t){u(t)}}),O.application.dispatch=O.application._store.dispatch,O.applicationInitializeComplete=!0}}function j(){if(!O.applicationInitializeComplete)throw new Error(S("getStore","please exec initializeApplication to start application before get store"))}function k(){return j(),O.application}function I(){return j(),O.application._store}function z(){return j(),O.application.dispatch}function _(t){var i=t.type,e=t.payload,n=void 0===e?{}:e,a=t.alias,r=void 0===a?"data":a,o=t.pretreatmentSuccessCallback,p=void 0===o?null:o,c=t.pretreatmentFailCallback,s=void 0===c?null:c;if(l(i))throw new Error(S("dispatch","parameter type must be string and not allow empty"));var u=i.split("/");if(2!=u.length)throw new Error(S("dispatch",'parameter type must be like "modelName/effect"'));var v=u[0],y=m();if(!f(y.split(","),v))throw new Error(S("dispatch","model ".concat(v,' do not exist, current models is "').concat(y,'"')));var h=z();return d("model access: ".concat(i)),h({type:i,payload:n,alias:r,pretreatmentSuccessCallback:p||null,pretreatmentFailCallback:s||null})}function F(t){var i=t.model,e=t.effect,n=t.payload,a=void 0===n?{}:n,r=t.alias,o=void 0===r?"data":r,p=t.pretreatmentSuccessCallback,c=void 0===p?null:p,s=t.pretreatmentFailCallback,u=void 0===s?null:s;if(l(i))throw new Error(S("dispatch","parameter model must be string and not allow empty"));if(l(e))throw new Error(S("dispatch","parameter effect must be string and not allow empty"));return _({type:"".concat(i,"/").concat(e),payload:a,alias:o,pretreatmentSuccessCallback:c||null,pretreatmentFailCallback:u||null})}function M(){return k()._models}function N(t){var i=M(),e=i.filter((function(i){return i.namespace===t}));if(e.length>0)return e[0];throw new Error("".concat(t," not in dva models, current models is ").concat(i.map((function(t){return t.namespace})).join(",")))}function P(t){return N(t).state}function T(i){return t({data:{}},P(i)).data||{}}var U=function(t){return n.createElement(w,{store:I()},t.children)};export{U as ApplicationProvider,O as applicationAssist,_ as dispatch,F as dispatchModel,M as getAllModel,z as getDispatch,k as getDvaApplication,N as getModel,T as getModelRemoteData,P as getModelState,I as getStore,E as initializeApplication,A as setApplicationInitialOption};
|
package/es/utils/dvaAssist.d.ts
CHANGED
|
@@ -85,5 +85,6 @@ export namespace applicationAssist {
|
|
|
85
85
|
* Encapsulation dva Provider with store
|
|
86
86
|
* @param {Object} properties properties
|
|
87
87
|
*/
|
|
88
|
-
export function ApplicationProvider(properties: Object):
|
|
88
|
+
export function ApplicationProvider(properties: Object): React.JSX.Element;
|
|
89
|
+
import React from "react";
|
|
89
90
|
export { connect, Provider } from "../dva-core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-soft-dva",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "The core lightweight library for dva, based on redux and redux-saga.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -49,11 +49,13 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@babel/runtime": "^7.22.5",
|
|
51
51
|
"@reduxjs/toolkit": "^1.9.5",
|
|
52
|
-
"easy-soft-utility": "^2.
|
|
52
|
+
"easy-soft-utility": "^2.7.1",
|
|
53
53
|
"flatten": "^1.0.3",
|
|
54
54
|
"global": "^4.4.0",
|
|
55
55
|
"invariant": "^2.2.4",
|
|
56
56
|
"is-plain-object": "^5.0.0",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-dom": "^18.2.0",
|
|
57
59
|
"react-redux": "^8.1.1",
|
|
58
60
|
"redux": "^4.2.1",
|
|
59
61
|
"redux-saga": "^1.2.3",
|
|
@@ -86,6 +88,8 @@
|
|
|
86
88
|
"@types/fs-extra": "^11.0.1",
|
|
87
89
|
"@types/jest": "^29.5.2",
|
|
88
90
|
"@types/node": "^20.3.2",
|
|
91
|
+
"@types/react": "^18.2.14",
|
|
92
|
+
"@types/react-dom": "^18.2.6",
|
|
89
93
|
"@types/shelljs": "^0.8.12",
|
|
90
94
|
"@typescript-eslint/parser": "^5.60.1",
|
|
91
95
|
"autoprefixer": "^10.4.14",
|
|
@@ -95,7 +99,7 @@
|
|
|
95
99
|
"cross-env": "^7.0.3",
|
|
96
100
|
"cssnano": "^6.0.1",
|
|
97
101
|
"documentation": "^14.0.2",
|
|
98
|
-
"easy-soft-develop": "^2.1.
|
|
102
|
+
"easy-soft-develop": "^2.1.26",
|
|
99
103
|
"eslint": "^8.43.0",
|
|
100
104
|
"eslint-config-airbnb": "^19.0.4",
|
|
101
105
|
"eslint-config-airbnb-typescript": "^17.0.0",
|