bms-shared-components 1.0.10 → 1.0.11
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/README.md
CHANGED
|
@@ -43,6 +43,8 @@ app.mount("#app");
|
|
|
43
43
|
|
|
44
44
|
### С настройкой API и Pinia
|
|
45
45
|
|
|
46
|
+
При использовании плагина по умолчанию (`BmsSharedComponents`) поддерживаются `apiConfig` и `axiosConfig`:
|
|
47
|
+
|
|
46
48
|
```js
|
|
47
49
|
import { createApp } from "vue";
|
|
48
50
|
import { createPinia } from "pinia";
|
|
@@ -58,13 +60,15 @@ app.use(BmsSharedComponents, {
|
|
|
58
60
|
baseURL: "https://api.example.com",
|
|
59
61
|
token: "your-auth-token",
|
|
60
62
|
},
|
|
61
|
-
// или axiosConfig
|
|
63
|
+
// или axiosConfig:
|
|
62
64
|
// axiosConfig: { baseURL: "...", headers: { Authorization: "..." } },
|
|
63
65
|
});
|
|
64
66
|
app.mount("#app");
|
|
65
67
|
```
|
|
66
68
|
|
|
67
|
-
###
|
|
69
|
+
### createBmsComponentsPlugin
|
|
70
|
+
|
|
71
|
+
Плагин принимает `pinia` и `axiosInstance` (конфиг для `setupAxios`):
|
|
68
72
|
|
|
69
73
|
```js
|
|
70
74
|
import { createApp } from "vue";
|
|
@@ -76,8 +80,12 @@ const pinia = createPinia();
|
|
|
76
80
|
const app = createApp(App);
|
|
77
81
|
app.use(createBmsComponentsPlugin({
|
|
78
82
|
pinia,
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
axiosInstance: {
|
|
84
|
+
baseURL: "https://api.example.com",
|
|
85
|
+
headers: { Authorization: "Bearer your-jwt-token" },
|
|
86
|
+
},
|
|
81
87
|
}));
|
|
82
88
|
app.mount("#app");
|
|
83
89
|
```
|
|
90
|
+
|
|
91
|
+
Доступны глобально: `$setupAxios`, `$updateAxiosToken`.
|
|
@@ -119985,7 +119985,7 @@ function useStockStore(I, J) {
|
|
|
119985
119985
|
function createBmsComponentsPlugin(I = {}) {
|
|
119986
119986
|
return {
|
|
119987
119987
|
install(J) {
|
|
119988
|
-
I.pinia && providePinia(J, I.pinia), I.
|
|
119988
|
+
I.pinia && providePinia(J, I.pinia), I.axiosInstance && setupAxios(I.axiosInstance), J.config.globalProperties.$setupAxios = setupAxios, J.config.globalProperties.$updateAxiosToken = (U) => {
|
|
119989
119989
|
updateToken(U);
|
|
119990
119990
|
};
|
|
119991
119991
|
}
|
|
@@ -1301,4 +1301,4 @@ EOD`}return{to_workbook:yt,to_sheet:ve,from_sheet:Bt}}(),Kw=function(){function
|
|
|
1301
1301
|
state: () => new MyClass()
|
|
1302
1302
|
Found in store "${mn.$id}".`),nn&&M&&U.hydrate&&U.hydrate(mn.$state,nn),$t=!0,Mt=!0,mn}/*! #__NO_SIDE_EFFECTS__ */function defineStore(I,J,U){let se;const V=typeof J=="function";se=V?U:J;function M(Tt,Ot){const It=vue.hasInjectionContext();if(Tt=(process.env.NODE_ENV==="test"&&activePinia&&activePinia._testing?null:Tt)||(It?vue.inject(piniaSymbol,null):null),Tt&&setActivePinia(Tt),process.env.NODE_ENV!=="production"&&!activePinia)throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
|
1303
1303
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
|
1304
|
-
This will fail in production.`);Tt=activePinia,Tt._s.has(I)||(V?createSetupStore(I,J,se,Tt):createOptionsStore(I,se,Tt),process.env.NODE_ENV!=="production"&&(M._pinia=Tt));const $t=Tt._s.get(I);if(process.env.NODE_ENV!=="production"&&Ot){const Mt="__hot:"+I,zt=V?createSetupStore(Mt,J,se,Tt,!0):createOptionsStore(Mt,assign({},se),Tt,!0);Ot._hotUpdate(zt),delete Tt.state.value[Mt],Tt._s.delete(Mt)}if(process.env.NODE_ENV!=="production"&&IS_CLIENT){const Mt=vue.getCurrentInstance();if(Mt&&Mt.proxy&&!Ot){const zt=Mt.proxy,Wt="_pStores"in zt?zt._pStores:zt._pStores={};Wt[I]=$t}}return $t}return M.$id=I,M}const useUserStoreImpl=defineStore("user",{state:()=>({user:null}),getters:{EmployeePostId:I=>I.user?.Id??null,LpuId:I=>I.user?.LpuId??null},actions:{setUser(I){this.user=I},clearUser(){this.user=null}}});function useUserStore(I,J){return useUserStoreImpl(I??usePinia(),J)}const usePatientStoreImpl=defineStore("patient",{state:()=>({patient:null}),actions:{setPatient(I){this.patient=I},clearPatient(){this.patient=null}}});function usePatientStore(I,J){return usePatientStoreImpl(I??usePinia(),J)}const useStockStoreImpl=defineStore("stock",{state:()=>({stock:null}),getters:{hasStock:I=>I.stock!=null,stockId:I=>I.stock?.Id??null},actions:{setStock(I){this.stock=I},clearStock(){this.stock=null}}});function useStockStore(I,J){return useStockStoreImpl(I??usePinia(),J)}function createBmsComponentsPlugin(I={}){return{install(J){I.pinia&&providePinia(J,I.pinia),I.
|
|
1304
|
+
This will fail in production.`);Tt=activePinia,Tt._s.has(I)||(V?createSetupStore(I,J,se,Tt):createOptionsStore(I,se,Tt),process.env.NODE_ENV!=="production"&&(M._pinia=Tt));const $t=Tt._s.get(I);if(process.env.NODE_ENV!=="production"&&Ot){const Mt="__hot:"+I,zt=V?createSetupStore(Mt,J,se,Tt,!0):createOptionsStore(Mt,assign({},se),Tt,!0);Ot._hotUpdate(zt),delete Tt.state.value[Mt],Tt._s.delete(Mt)}if(process.env.NODE_ENV!=="production"&&IS_CLIENT){const Mt=vue.getCurrentInstance();if(Mt&&Mt.proxy&&!Ot){const zt=Mt.proxy,Wt="_pStores"in zt?zt._pStores:zt._pStores={};Wt[I]=$t}}return $t}return M.$id=I,M}const useUserStoreImpl=defineStore("user",{state:()=>({user:null}),getters:{EmployeePostId:I=>I.user?.Id??null,LpuId:I=>I.user?.LpuId??null},actions:{setUser(I){this.user=I},clearUser(){this.user=null}}});function useUserStore(I,J){return useUserStoreImpl(I??usePinia(),J)}const usePatientStoreImpl=defineStore("patient",{state:()=>({patient:null}),actions:{setPatient(I){this.patient=I},clearPatient(){this.patient=null}}});function usePatientStore(I,J){return usePatientStoreImpl(I??usePinia(),J)}const useStockStoreImpl=defineStore("stock",{state:()=>({stock:null}),getters:{hasStock:I=>I.stock!=null,stockId:I=>I.stock?.Id??null},actions:{setStock(I){this.stock=I},clearStock(){this.stock=null}}});function useStockStore(I,J){return useStockStoreImpl(I??usePinia(),J)}function createBmsComponentsPlugin(I={}){return{install(J){I.pinia&&providePinia(J,I.pinia),I.axiosInstance&&setupAxios(I.axiosInstance),J.config.globalProperties.$setupAxios=setupAxios,J.config.globalProperties.$updateAxiosToken=U=>{updateToken(U)}}}}function install(I,J={}){J.pinia&&providePinia(I,J.pinia),I.component("FullLoader",FullLoader),I.component("ConstructorReportsQueue",_sfc_main$g),I.component("ConstructorReports",_sfc_main$8),I.component("ApplicationCompanyPatientPage",_sfc_main),J.axiosConfig&&Promise.resolve().then(()=>axiosSetup).then(({setupAxios:U})=>{U(J.axiosConfig)}),J.apiConfig&&Promise.resolve().then(()=>api).then(({configureApi:U})=>{U(J.apiConfig)})}const index={install};typeof window<"u"&&window.Vue&&window.Vue.use({install}),exports.ApplicationCompanyPatientPage=_sfc_main,exports.ConstructorReports=_sfc_main$8,exports.ConstructorReportsQueue=_sfc_main$g,exports.FullLoader=FullLoader,exports.PINIA_KEY=PINIA_KEY,exports.configureApi=configureApi,exports.createBmsComponentsPlugin=createBmsComponentsPlugin,exports.default=index,exports.getApiConfig=getApiConfig,exports.getAxiosConfiguration=getAxiosConfig,exports.getAxiosInstance=getAxiosInstance,exports.install=install,exports.providePinia=providePinia,exports.setupAxios=setupAxios,exports.updateAxiosConfig=updateAxiosConfig,exports.updateAxiosToken=updateToken,exports.updateToken=updateToken$1,exports.useAxios=useAxios,exports.usePatientStore=usePatientStore,exports.usePinia=usePinia,exports.useStockStore=useStockStore,exports.useUserStore=useUserStore,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|