@nano-app/frontend 0.3.5 → 0.4.0
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/LICENSE +21 -0
- package/README.md +187 -0
- package/build/core/const.d.ts +4 -0
- package/build/core/const.js +9 -0
- package/build/core/loader/FileLoader.js +38 -0
- package/build/core/loader/FileReader.js +30 -0
- package/build/core/loader/Validator.js +70 -0
- package/build/core/types/objects.d.ts +4 -0
- package/build/core/utils/Formatter.js +14 -0
- package/build/creators/createController.d.ts +6 -0
- package/build/creators/createController.js +21 -0
- package/build/creators/createStores.js +15 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +3 -0
- package/build/next.d.ts +8 -0
- package/build/next.js +21 -0
- package/build/proxy.d.ts +5 -0
- package/build/proxy.js +25 -0
- package/build/react/NanoAppProvider.d.ts +7 -0
- package/build/react/NanoAppProvider.js +25 -0
- package/build/stores/ApiStore.js +76 -0
- package/build/stores/Store.d.ts +15 -0
- package/build/stores/Store.js +33 -0
- package/build/types/component.d.ts +19 -0
- package/build/types/store.d.ts +9 -0
- package/package.json +53 -32
- package/bin/generate-stores.mjs +0 -128
- package/dist/auto-register.mjs +0 -327
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -34
- package/dist/store/ApiStore.d.ts +0 -13
- package/dist/store/ApiStore.js +0 -51
- package/dist/store/AppStore.d.ts +0 -25
- package/dist/store/AppStore.js +0 -59
- package/dist/store/RenderManager.d.ts +0 -47
- package/dist/store/RenderManager.js +0 -78
- package/dist/store/StoreManager.d.ts +0 -15
- package/dist/store/StoreManager.js +0 -30
- package/dist/ui/Controller.d.ts +0 -20
- package/dist/ui/Controller.js +0 -49
- package/dist/ui/createComponent.d.ts +0 -17
- package/dist/ui/createComponent.js +0 -32
- package/dist/utils/QueryBuilder.d.ts +0 -19
- package/dist/utils/QueryBuilder.js +0 -31
- package/dist/utils/Toast.d.ts +0 -12
- package/dist/utils/Toast.js +0 -28
- package/dist/utils/TokenHelper.d.ts +0 -5
- package/dist/utils/TokenHelper.js +0 -17
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { observable, runInAction } from "mobx";
|
|
2
|
+
//#region src/stores/Store.ts
|
|
3
|
+
/** State of one store, read and written by path (`/drawer/isOpen`) */
|
|
4
|
+
var Store = class Store {
|
|
5
|
+
oState;
|
|
6
|
+
/** Makes the store's initial data observable, so reads are tracked and writes notify them */
|
|
7
|
+
constructor(oData = {}) {
|
|
8
|
+
this.oState = observable(oData);
|
|
9
|
+
}
|
|
10
|
+
/** Value at a path: an object comes back observable, so reading its fields stays tracked */
|
|
11
|
+
get(sPath) {
|
|
12
|
+
return Store.keys(sPath).reduce((oValue, sKey) => oValue?.[sKey], this.oState);
|
|
13
|
+
}
|
|
14
|
+
/** Writes a value at a path, creating the levels that are missing */
|
|
15
|
+
set(sPath, oValue) {
|
|
16
|
+
const aKeys = Store.keys(sPath);
|
|
17
|
+
const sLast = aKeys.pop();
|
|
18
|
+
if (!sLast) return;
|
|
19
|
+
runInAction(() => {
|
|
20
|
+
const oParent = aKeys.reduce((oLevel, sKey) => {
|
|
21
|
+
oLevel[sKey] ??= {};
|
|
22
|
+
return oLevel[sKey];
|
|
23
|
+
}, this.oState);
|
|
24
|
+
oParent[sLast] = oValue;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Keys of a path, with or without the leading slash */
|
|
28
|
+
static keys(sPath) {
|
|
29
|
+
return sPath.split("/").filter(Boolean);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Store as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NanoObject } from "../core/types/objects.js";
|
|
2
|
+
import { Stores } from "./store.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/types/component.d.ts
|
|
5
|
+
/** Props a component receives from its parent */
|
|
6
|
+
export type ComponentProps = NanoObject<any>;
|
|
7
|
+
/** What a controller and its views receive: the props and the stores */
|
|
8
|
+
export type ComponentContext = {
|
|
9
|
+
props: ComponentProps;
|
|
10
|
+
stores: Stores;
|
|
11
|
+
};
|
|
12
|
+
/** Renders a component with the controller's methods; the context wins over a method's name */
|
|
13
|
+
export type View<M extends NanoObject> = (params: Omit<M, keyof ComponentContext> & ComponentContext) => ReactNode;
|
|
14
|
+
/** Returned by `createController`: binds views to its methods */
|
|
15
|
+
export type Controller<M extends NanoObject> = {
|
|
16
|
+
/** Creates a component that renders the view with the controller's methods */
|
|
17
|
+
bindView(view: View<M>): (props: ComponentProps) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { APP_NAME } from "../core/const.js";
|
|
2
|
+
import { NanoObject } from "../core/types/objects.js";
|
|
3
|
+
import Store from "../stores/Store.js";
|
|
4
|
+
//#region src/types/store.d.ts
|
|
5
|
+
/** Stores of a React tree by name: a `Store` per `app` file, an `ApiStore` per `api` file */
|
|
6
|
+
export type Stores = NanoObject<any> & {
|
|
7
|
+
[APP_NAME]: Store;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,52 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nano-app/frontend",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "React provider for Next.js apps on top of @nano-app/backend",
|
|
5
|
+
"type": "module",
|
|
7
6
|
"exports": {
|
|
8
7
|
".": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
8
|
+
"types": "./build/index.d.ts",
|
|
9
|
+
"import": "./build/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./next": {
|
|
12
|
+
"types": "./build/next.d.ts",
|
|
13
|
+
"import": "./build/next.js",
|
|
14
|
+
"default": "./build/next.js"
|
|
15
|
+
},
|
|
16
|
+
"./proxy": {
|
|
17
|
+
"types": "./build/proxy.d.ts",
|
|
18
|
+
"import": "./build/proxy.js"
|
|
12
19
|
}
|
|
13
20
|
},
|
|
14
|
-
"bin":{
|
|
15
|
-
"generate-stores": "./bin/generate-stores.mjs"
|
|
16
|
-
},
|
|
17
21
|
"files": [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
22
|
+
"build",
|
|
23
|
+
"LICENSE"
|
|
20
24
|
],
|
|
21
25
|
"scripts": {
|
|
22
|
-
"build": "
|
|
23
|
-
"
|
|
26
|
+
"build": "tsdown",
|
|
27
|
+
"prepublishOnly": "pnpm run build",
|
|
28
|
+
"test": "tsx --test tests/*.test.ts tests/*.test.tsx ../core/tests/*.test.ts"
|
|
24
29
|
},
|
|
25
30
|
"keywords": [
|
|
26
|
-
"
|
|
27
|
-
"typescript",
|
|
28
|
-
"react",
|
|
31
|
+
"nano-app",
|
|
29
32
|
"next",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
33
|
+
"react",
|
|
34
|
+
"store"
|
|
32
35
|
],
|
|
33
36
|
"author": "Cristian Serrano",
|
|
34
37
|
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/Nano-Nathan/nano-app.git",
|
|
41
|
+
"directory": "frontend"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22"
|
|
48
|
+
},
|
|
35
49
|
"peerDependencies": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
50
|
+
"next": ">=16.3.0",
|
|
51
|
+
"react": ">=19.0.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"glob": "^13.0.6",
|
|
55
|
+
"jiti": "^2.7.0",
|
|
56
|
+
"mobx": "^7.1.0",
|
|
57
|
+
"mobx-react-lite": "^5.1.0"
|
|
42
58
|
},
|
|
43
59
|
"devDependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"react
|
|
49
|
-
"
|
|
50
|
-
"
|
|
60
|
+
"@happy-dom/global-registrator": "^21.0.3",
|
|
61
|
+
"@testing-library/dom": "^10.4.2",
|
|
62
|
+
"@testing-library/react": "^16.3.3",
|
|
63
|
+
"@types/node": "^26.6.5",
|
|
64
|
+
"@types/react": "^19.3.0",
|
|
65
|
+
"happy-dom": "^21.0.3",
|
|
66
|
+
"next": "^16.4.2",
|
|
67
|
+
"react": "^19.3.1",
|
|
68
|
+
"react-dom": "^19.3.1",
|
|
69
|
+
"tsdown": "^0.23.1",
|
|
70
|
+
"tsx": "^4.23.15",
|
|
71
|
+
"typescript": "^7.0.2"
|
|
51
72
|
}
|
|
52
73
|
}
|
package/bin/generate-stores.mjs
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { createRequire } from "module";
|
|
4
|
-
import { readdirSync, mkdirSync, writeFileSync, existsSync } from "fs";
|
|
5
|
-
import { resolve, join } from "path";
|
|
6
|
-
|
|
7
|
-
const cwd = process.cwd();
|
|
8
|
-
const srcDir = join(cwd, "src");
|
|
9
|
-
const outDir = join(cwd, "node_modules", "@nano-app", "frontend", "dist");
|
|
10
|
-
const outFile = join(outDir, "auto-register.mjs");
|
|
11
|
-
|
|
12
|
-
// Busca recursivamente archivos *.store.ts
|
|
13
|
-
function findStoreFiles(dir) {
|
|
14
|
-
const results = [];
|
|
15
|
-
if (!existsSync(dir)) return results;
|
|
16
|
-
|
|
17
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
18
|
-
const fullPath = join(dir, entry.name);
|
|
19
|
-
if (entry.isDirectory()) {
|
|
20
|
-
results.push(...findStoreFiles(fullPath));
|
|
21
|
-
} else if (entry.isFile() && entry.name.endsWith(".store.ts")) {
|
|
22
|
-
results.push(fullPath);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return results;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Importa un archivo .ts usando jiti (transpilador de Next.js)
|
|
29
|
-
function loadStoreFile(filePath) {
|
|
30
|
-
try {
|
|
31
|
-
const jitiPath = resolve(cwd, "node_modules", "jiti", "lib", "jiti.cjs");
|
|
32
|
-
const require = createRequire(import.meta.url);
|
|
33
|
-
const jiti = require(jitiPath);
|
|
34
|
-
const load = jiti(filePath, { interopDefault: true });
|
|
35
|
-
const mod = load(filePath);
|
|
36
|
-
return mod?.default ?? mod;
|
|
37
|
-
} catch (err) {
|
|
38
|
-
console.error(` [ERROR] No se pudo cargar ${filePath}: ${err.message}`);
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Valida que el objeto tenga la forma correcta
|
|
44
|
-
function validateEntry(entry, filePath) {
|
|
45
|
-
if (!entry || typeof entry !== "object") {
|
|
46
|
-
console.warn(` [WARN] ${filePath}: el export default no es un objeto, se ignora.`);
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
if (entry.type !== "app" && entry.type !== "api") {
|
|
50
|
-
console.warn(` [WARN] ${filePath}: type debe ser "app" o "api", se ignora.`);
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (entry.type === "api" && !entry.path) {
|
|
54
|
-
console.warn(` [WARN] ${filePath}: type "api" requiere un campo "path", se ignora.`);
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Serializa el objeto de datos a string JS (soporta funciones)
|
|
61
|
-
function serialize(value, indent = 0) {
|
|
62
|
-
const pad = " ".repeat(indent);
|
|
63
|
-
const padInner = " ".repeat(indent + 1);
|
|
64
|
-
|
|
65
|
-
if (value === null) return "null";
|
|
66
|
-
if (value === undefined) return "undefined";
|
|
67
|
-
if (typeof value === "function") return value.toString();
|
|
68
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
69
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
70
|
-
|
|
71
|
-
if (Array.isArray(value)) {
|
|
72
|
-
if (value.length === 0) return "[]";
|
|
73
|
-
const items = value.map((v) => `${padInner}${serialize(v, indent + 1)}`).join(",\n");
|
|
74
|
-
return `[\n${items}\n${pad}]`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (typeof value === "object") {
|
|
78
|
-
const entries = Object.entries(value);
|
|
79
|
-
if (entries.length === 0) return "{}";
|
|
80
|
-
const lines = entries
|
|
81
|
-
.map(([k, v]) => `${padInner}${JSON.stringify(k)}: ${serialize(v, indent + 1)}`)
|
|
82
|
-
.join(",\n");
|
|
83
|
-
return `{\n${lines}\n${pad}}`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return String(value);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ─── Main ────────────────────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
const storeFiles = findStoreFiles(srcDir);
|
|
92
|
-
console.log(`\n[nano-app] Buscando archivos *.store.ts en ${srcDir}`);
|
|
93
|
-
console.log(`[nano-app] Encontrados: ${storeFiles.length}\n`);
|
|
94
|
-
|
|
95
|
-
const entries = [];
|
|
96
|
-
|
|
97
|
-
for (const filePath of storeFiles) {
|
|
98
|
-
console.log(` Procesando: ${filePath.replace(cwd, ".")}`);
|
|
99
|
-
const mod = loadStoreFile(filePath);
|
|
100
|
-
if (mod && validateEntry(mod, filePath)) {
|
|
101
|
-
const name = filePath
|
|
102
|
-
.replace(srcDir, "")
|
|
103
|
-
.replace(/\\/g, "/")
|
|
104
|
-
.replace(/^\//, "")
|
|
105
|
-
.replace(/\.store\.ts$/, "")
|
|
106
|
-
.split("/")
|
|
107
|
-
.pop();
|
|
108
|
-
|
|
109
|
-
entries.push({ name, ...mod });
|
|
110
|
-
console.log(` ✓ Store "${name}" (${mod.type})`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Genera el archivo de salida
|
|
115
|
-
mkdirSync(outDir, { recursive: true });
|
|
116
|
-
|
|
117
|
-
const serializedEntries = entries
|
|
118
|
-
.map((entry) => ` ${serialize(entry, 1)}`)
|
|
119
|
-
.join(",\n");
|
|
120
|
-
|
|
121
|
-
const output = `// Auto-generado por @nano-app
|
|
122
|
-
// No editar manualmente.
|
|
123
|
-
export default [\n${serializedEntries}\n];\n`;
|
|
124
|
-
|
|
125
|
-
writeFileSync(outFile, output, "utf-8");
|
|
126
|
-
|
|
127
|
-
console.log(`\n[nano-app] Archivo generado: ${outFile.replace(cwd, ".")}`);
|
|
128
|
-
console.log(`[nano-app] Stores registrados: ${entries.map((e) => `"${e.name}"`).join(", ") || "(ninguno — se usará store app vacío)"}\n`);
|
package/dist/auto-register.mjs
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
// Auto-generado por @nano-app
|
|
2
|
-
// No editar manualmente.
|
|
3
|
-
export default [
|
|
4
|
-
{
|
|
5
|
-
"name": "api",
|
|
6
|
-
"type": "api",
|
|
7
|
-
"path": "/api",
|
|
8
|
-
"data": {
|
|
9
|
-
"busy": true,
|
|
10
|
-
"DefaultItems": [],
|
|
11
|
-
"UserStatusItems": [
|
|
12
|
-
{
|
|
13
|
-
"key": "SUSPENDED",
|
|
14
|
-
"text": "Suspendido"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"key": "PENDING",
|
|
18
|
-
"text": "Pendiente"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"key": "ACTIVE",
|
|
22
|
-
"text": "Activo"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "app",
|
|
29
|
-
"type": "app",
|
|
30
|
-
"data": {
|
|
31
|
-
"login": {
|
|
32
|
-
"isRegister": false
|
|
33
|
-
},
|
|
34
|
-
"navbar": {
|
|
35
|
-
"tabs": [],
|
|
36
|
-
"selectedTabKey": "home",
|
|
37
|
-
"selectedTab": {},
|
|
38
|
-
"isMenuOpen": false
|
|
39
|
-
},
|
|
40
|
-
"form": {
|
|
41
|
-
"data": {},
|
|
42
|
-
"validate": []
|
|
43
|
-
},
|
|
44
|
-
"drawer": {
|
|
45
|
-
"isOpen": false,
|
|
46
|
-
"formType": "",
|
|
47
|
-
"title": ""
|
|
48
|
-
},
|
|
49
|
-
"config": {
|
|
50
|
-
"theme": "dark"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"name": "const",
|
|
56
|
-
"type": "app",
|
|
57
|
-
"data": {
|
|
58
|
-
"alias": "42974117.prex",
|
|
59
|
-
"stepSkipTop": 20,
|
|
60
|
-
"tabs": (rolId = 0) => [
|
|
61
|
-
{ key: "home", href: "/", label: "Home", minRole: -1 },
|
|
62
|
-
{ key: "resumen", href: "/resumen", label: "Resumen", minRole: -1 },
|
|
63
|
-
{ key: "admin", href: "/admin", label: "Administración", minRole: -1 },
|
|
64
|
-
{ key: "uli", href: "/", label: "Uli :v", minRole: -1 },
|
|
65
|
-
{ key: "luka", href: "/", label: "Lucas :v", minRole: -1 }].
|
|
66
|
-
filter((tab) => tab.minRole <= rolId),
|
|
67
|
-
"initialForms": {
|
|
68
|
-
"User": {
|
|
69
|
-
"rolId": 1,
|
|
70
|
-
"status": "PENDING"
|
|
71
|
-
},
|
|
72
|
-
"Collection": {
|
|
73
|
-
"total_months": 1,
|
|
74
|
-
"start_date": "2026-03-01T00:00:00.000Z"
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"tableColumns": {
|
|
78
|
-
"Users": [
|
|
79
|
-
"name",
|
|
80
|
-
"phone",
|
|
81
|
-
"mail",
|
|
82
|
-
"pending",
|
|
83
|
-
"favor",
|
|
84
|
-
"rol.name",
|
|
85
|
-
"status"
|
|
86
|
-
],
|
|
87
|
-
"Collections": [
|
|
88
|
-
"user.name",
|
|
89
|
-
"price",
|
|
90
|
-
"description",
|
|
91
|
-
"start_date",
|
|
92
|
-
"total_months",
|
|
93
|
-
"subscription.description"
|
|
94
|
-
],
|
|
95
|
-
"Subscriptions": [
|
|
96
|
-
"description",
|
|
97
|
-
"price"
|
|
98
|
-
]
|
|
99
|
-
},
|
|
100
|
-
"formField": {
|
|
101
|
-
"pay": [
|
|
102
|
-
{
|
|
103
|
-
"fieldName": "total",
|
|
104
|
-
"valueType": "price",
|
|
105
|
-
"isRequired": true
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
"login": [
|
|
109
|
-
{
|
|
110
|
-
"fieldName": "mail",
|
|
111
|
-
"inputType": "email",
|
|
112
|
-
"isRequired": true
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"fieldName": "password",
|
|
116
|
-
"inputType": "password",
|
|
117
|
-
"isRequired": true,
|
|
118
|
-
"validateFn": (oForm) =>
|
|
119
|
-
(oForm.password?.length || 0) < 4 ?
|
|
120
|
-
"La contraseña debe tener al menos 4 caracteres" :
|
|
121
|
-
""
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
"register": [
|
|
125
|
-
{
|
|
126
|
-
"fieldName": "name",
|
|
127
|
-
"isRequired": true
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"fieldName": "phone",
|
|
131
|
-
"isRequired": true
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"fieldName": "mail",
|
|
135
|
-
"inputType": "email",
|
|
136
|
-
"isRequired": true
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"fieldName": "password",
|
|
140
|
-
"inputType": "password",
|
|
141
|
-
"isRequired": true,
|
|
142
|
-
"validateFn": (oForm) =>
|
|
143
|
-
(oForm.password?.length || 0) < 4 ?
|
|
144
|
-
"La contraseña debe tener al menos 4 caracteres" :
|
|
145
|
-
""
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"fieldName": "confirmPassword",
|
|
149
|
-
"inputType": "password",
|
|
150
|
-
"isRequired": true,
|
|
151
|
-
"validateFn": (oForm) =>
|
|
152
|
-
oForm.confirmPassword != oForm.password ?
|
|
153
|
-
'Las contraseñas no coinciden' :
|
|
154
|
-
''
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
"Users": [
|
|
158
|
-
{
|
|
159
|
-
"fieldName": "name",
|
|
160
|
-
"isRequired": true
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"fieldName": "mail",
|
|
164
|
-
"inputType": "email",
|
|
165
|
-
"isRequired": true
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"fieldName": "rolId",
|
|
169
|
-
"valueType": "number",
|
|
170
|
-
"isRequired": true,
|
|
171
|
-
"inputType": "select",
|
|
172
|
-
"select": {
|
|
173
|
-
"items": "/Roles",
|
|
174
|
-
"itemKey": "id",
|
|
175
|
-
"showValues": [
|
|
176
|
-
"name"
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"fieldName": "status",
|
|
182
|
-
"inputType": "select",
|
|
183
|
-
"isRequired": true,
|
|
184
|
-
"select": {
|
|
185
|
-
"items": "/UserStatusItems",
|
|
186
|
-
"itemKey": "key",
|
|
187
|
-
"showValues": [
|
|
188
|
-
"text"
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"fieldName": "pending",
|
|
194
|
-
"valueType": "price"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"fieldName": "favor",
|
|
198
|
-
"valueType": "price"
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
"Collections": [
|
|
202
|
-
{
|
|
203
|
-
"fieldName": "userId",
|
|
204
|
-
"valueType": "number",
|
|
205
|
-
"inputType": "select",
|
|
206
|
-
"isRequired": true,
|
|
207
|
-
"select": {
|
|
208
|
-
"items": "Users",
|
|
209
|
-
"itemKey": "id",
|
|
210
|
-
"showValues": [
|
|
211
|
-
"name"
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
"fieldName": "price",
|
|
217
|
-
"valueType": "price",
|
|
218
|
-
"isRequired": true
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
"fieldName": "description",
|
|
222
|
-
"isRequired": true
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"fieldName": "total_months",
|
|
226
|
-
"valueType": "number",
|
|
227
|
-
"isRequired": true
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"fieldName": "start_date",
|
|
231
|
-
"valueType": "date",
|
|
232
|
-
"inputType": "date",
|
|
233
|
-
"isRequired": true
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"fieldName": "subscriptionId",
|
|
237
|
-
"valueType": "number",
|
|
238
|
-
"inputType": "select",
|
|
239
|
-
"select": {
|
|
240
|
-
"items": "Subscriptions",
|
|
241
|
-
"itemKey": "id",
|
|
242
|
-
"showValues": [
|
|
243
|
-
"description"
|
|
244
|
-
]
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
"Subscriptions": [
|
|
249
|
-
{
|
|
250
|
-
"fieldName": "description",
|
|
251
|
-
"isRequired": true
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"fieldName": "price",
|
|
255
|
-
"valueType": "price",
|
|
256
|
-
"isRequired": true
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
},
|
|
260
|
-
"expandFields": {
|
|
261
|
-
"Users": "rol",
|
|
262
|
-
"Collections": "user,subscription"
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"name": "i18n",
|
|
268
|
-
"type": "app",
|
|
269
|
-
"data": {
|
|
270
|
-
"loginTexts": (isRegister) => ({
|
|
271
|
-
headerText: isRegister ? "REGISTRARSE" : "INICIAR SESIÓN",
|
|
272
|
-
footerText: isRegister ? "o iniciar sesión" : "o registrarse",
|
|
273
|
-
buttonText: isRegister ? "Crear" : "Ingresar",
|
|
274
|
-
formType: isRegister ? "register" : "login"
|
|
275
|
-
}),
|
|
276
|
-
"button": {
|
|
277
|
-
"confirm": "Confirmar"
|
|
278
|
-
},
|
|
279
|
-
"create": (entity) => `Crear ${entity}`,
|
|
280
|
-
"edit": (entity) => `Editar ${entity}`,
|
|
281
|
-
"mapping": {
|
|
282
|
-
"name": "Nombre",
|
|
283
|
-
"phone": "Teléfono",
|
|
284
|
-
"mail": "Mail",
|
|
285
|
-
"pending": "Pendiente",
|
|
286
|
-
"favor": "A favor",
|
|
287
|
-
"rolId": "Rol",
|
|
288
|
-
"rol.name": "Rol",
|
|
289
|
-
"status": "Estado",
|
|
290
|
-
"password": "Contraseña",
|
|
291
|
-
"confirmPassword": "Repetir contraseña",
|
|
292
|
-
"user.name": "Usuario",
|
|
293
|
-
"userId": "Usuario",
|
|
294
|
-
"price": "Precio",
|
|
295
|
-
"description": "Descripción",
|
|
296
|
-
"start_date": "Fecha de inicio",
|
|
297
|
-
"total_months": "Meses totales",
|
|
298
|
-
"subscription.description": "Subscripción",
|
|
299
|
-
"subscriptionId": "Subscripción",
|
|
300
|
-
"last_pay": "Último pago",
|
|
301
|
-
"first_month": "Mes de inicio",
|
|
302
|
-
"current_month": "Último mes pagado",
|
|
303
|
-
"payed_months": "Meses pagados",
|
|
304
|
-
"actions": "Acciones",
|
|
305
|
-
"created_at": "Creado",
|
|
306
|
-
"Users": "Usuarios",
|
|
307
|
-
"Collections": "Cuotas",
|
|
308
|
-
"Subscriptions": "Subscripciones",
|
|
309
|
-
"total": "TOTAL"
|
|
310
|
-
},
|
|
311
|
-
"months": {
|
|
312
|
-
"1": "Enero",
|
|
313
|
-
"2": "Febrero",
|
|
314
|
-
"3": "Marzo",
|
|
315
|
-
"4": "Abril",
|
|
316
|
-
"5": "Mayo",
|
|
317
|
-
"6": "Junio",
|
|
318
|
-
"7": "Julio",
|
|
319
|
-
"8": "Agosto",
|
|
320
|
-
"9": "Septiembre",
|
|
321
|
-
"10": "Octubre",
|
|
322
|
-
"11": "Noviembre",
|
|
323
|
-
"12": "Diciembre"
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
];
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./store/ApiStore";
|
|
2
|
-
export * from "./store/AppStore";
|
|
3
|
-
export * from "./store/StoreManager";
|
|
4
|
-
export * from "./store/RenderManager";
|
|
5
|
-
export * from "./ui/Controller";
|
|
6
|
-
export * from "./ui/createComponent";
|
|
7
|
-
export * from "./utils/QueryBuilder";
|
|
8
|
-
export * from "./utils/Toast";
|
|
9
|
-
export * from "./utils/TokenHelper";
|
|
10
|
-
export type { ApiResponse } from "@nano-app/backend";
|
package/dist/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const StoreManager_1 = __importDefault(require("./store/StoreManager"));
|
|
21
|
-
__exportStar(require("./store/ApiStore"), exports);
|
|
22
|
-
__exportStar(require("./store/AppStore"), exports);
|
|
23
|
-
__exportStar(require("./store/StoreManager"), exports);
|
|
24
|
-
__exportStar(require("./store/RenderManager"), exports);
|
|
25
|
-
__exportStar(require("./ui/Controller"), exports);
|
|
26
|
-
__exportStar(require("./ui/createComponent"), exports);
|
|
27
|
-
__exportStar(require("./utils/QueryBuilder"), exports);
|
|
28
|
-
__exportStar(require("./utils/Toast"), exports);
|
|
29
|
-
__exportStar(require("./utils/TokenHelper"), exports);
|
|
30
|
-
// Inicializa los stores si existen
|
|
31
|
-
try {
|
|
32
|
-
StoreManager_1.default.init(require('./auto-register.mjs').default);
|
|
33
|
-
}
|
|
34
|
-
catch (e) { }
|
package/dist/store/ApiStore.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ApiResponse } from "@nano-app/backend";
|
|
2
|
-
import { AppStore, StoreData } from "./AppStore";
|
|
3
|
-
export type ApiRequest = (query: string, body?: unknown) => Promise<ApiResponse>;
|
|
4
|
-
export declare class ApiStore extends AppStore {
|
|
5
|
-
private baseUrl;
|
|
6
|
-
private busyCount;
|
|
7
|
-
constructor(initialData?: StoreData, storeName?: string, baseUrl?: string);
|
|
8
|
-
create: ApiRequest;
|
|
9
|
-
read: ApiRequest;
|
|
10
|
-
update: ApiRequest;
|
|
11
|
-
delete: ApiRequest;
|
|
12
|
-
private request;
|
|
13
|
-
}
|