@verdnatura/vn-front-lib 0.0.4 → 0.0.6

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.
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));const l=require("./useValidationsStore-CmGCLBNO.cjs");let u=require("vue-i18n"),d=require("validator");d=c(d,1);function f(){let e=l.t().validations;function t(t){let n=e;if(!n||!t)return;let i=t.split(`.`),a=i[0],o=i[1],s=a.charAt(0).toUpperCase()+a.slice(1);if(!n[s])return;let c=n[s].validations;if(c[o])return c[o].map(e=>r(e)[e.validation])}let{t:n}=(0,u.useI18n)({useScope:`global`}),r=function(e={}){return{format:t=>{let{allowNull:r,with:i,allowBlank:a}=e,o=n(e.message)||e.message;if(!a&&t===``||!r&&t===null||!new RegExp(i).test(t))return o},presence:t=>{let r=n(`globals.valueCantBeEmpty`);return e.message&&(r=n(e.message)||e.message),!d.default.isEmpty(t?String(t):``)||r},required:(e,t)=>e?t===0||!!t||n(`globals.fieldRequired`):null,length:t=>{let n={min:e.min||e.is,max:e.max||e.is};t=String(t),t||=``;let r=`Value should have at most ${n.max} characters`;return e.is&&(r=`Value should be ${e.is} characters long`),e.min&&(r=`Value should have at least ${e.min} characters`),e.min&&e.max&&(r=`Value should have a length between ${e.min} and ${e.max}`),d.default.isLength(t,n)||r},numericality:t=>e.int?d.default.isInt(t)||`Value should be integer`:d.default.isNumeric(t)||`Value should be a number`,min:(e,t)=>{if(t>=0&&Math.floor(e)<t)return n(`inputMin`,{value:t})},custom:t=>Function(`return (${e.bindedFunction})`)()(t)||`Invalid value`}};return{validate:t,validations:r,models:e}}function p(e){let{validations:t}=f(),n=typeof e.required==`boolean`?e.required:Object.keys(e).includes(`required`);return{isRequired:n,requiredFieldRule:e=>t().required(n,e)}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
@@ -1,19 +0,0 @@
1
- import { defineStore as e } from "pinia";
2
- //#region lib/config.js
3
- var t = {}, n = ["axios"], r;
4
- function i(e = {}) {
5
- let i = n.filter((t) => !e[t]);
6
- if (i.length) throw Error(`vn-front-lib: missing required configuration: ${i.join(", ")}. Pass app.use(VnFrontLib, { ${i.join(", ")} })`);
7
- Object.assign(t, e), r = t.axios;
8
- }
9
- //#endregion
10
- //#region lib/stores/useValidationsStore.js
11
- var a = e("validationsStore", {
12
- state: () => ({ validations: null }),
13
- actions: { async fetchModels() {
14
- let { data: e } = await r.get("Schemas/modelinfo");
15
- this.validations = e;
16
- } }
17
- });
18
- //#endregion
19
- export { r as n, i as r, a as t };
@@ -1 +0,0 @@
1
- let e=require("pinia");var t={},n=[`axios`],r;function i(e={}){let i=n.filter(t=>!e[t]);if(i.length)throw Error(`vn-front-lib: missing required configuration: ${i.join(`, `)}. Pass app.use(VnFrontLib, { ${i.join(`, `)} })`);Object.assign(t,e),r=t.axios}var a=(0,e.defineStore)(`validationsStore`,{state:()=>({validations:null}),actions:{async fetchModels(){let{data:e}=await r.get(`Schemas/modelinfo`);this.validations=e}}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
package/lib/config.js DELETED
@@ -1,16 +0,0 @@
1
- // Default library configuration, overridden by whatever is passed to app.use(VnFrontLib, options)
2
- const config = {};
3
- const requiredOptions = ['axios'];
4
- export default config;
5
- export let axios;
6
-
7
- export function setConfig(options = {}) {
8
- const missing = requiredOptions.filter((key) => !options[key]);
9
- if (missing.length) {
10
- throw new Error(
11
- `vn-front-lib: missing required configuration: ${missing.join(', ')}. Pass app.use(VnFrontLib, { ${missing.join(', ')} })`,
12
- );
13
- }
14
- Object.assign(config, options);
15
- axios = config.axios;
16
- }