@hcd-bsas/list-documents-adapter 0.0.4 → 0.0.5
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/ListDocuments.min.js +20 -20
- package/package.json +4 -3
- package/readme.md +115 -2
- package/src/App.vue +20 -20
- package/src/index.js +2 -1
- package/{exampleJavascript.html → test_javascript.html} +4 -3
- package/webpack.config.js +51 -53
- package/exampleVue2.html +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hcd-bsas/list-documents-adapter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@hcd-bsas/bootstrap5": "^0.0.2",
|
|
12
|
-
"@hcd-bsas/list-documents-plugin": "^0.0.
|
|
12
|
+
"@hcd-bsas/list-documents-plugin": "^0.0.5",
|
|
13
13
|
"babel-loader": "^8.2.5",
|
|
14
14
|
"browserify": "^17.0.0",
|
|
15
15
|
"css-loader": "^6.7.1",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"
|
|
34
|
+
"serve": "webpack --mode=development",
|
|
35
|
+
"build": "webpack --mode=production"
|
|
35
36
|
}
|
|
36
37
|
}
|
package/readme.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
Para crear una nueva distribución se debe correr el comando:
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
# js-plugin
|
|
3
|
+
|
|
4
|
+
## Estructura del proyecto
|
|
5
|
+
|
|
6
|
+
Genera una librería javascript que funciona como "adapter" del plugin generado con vue-cli-plugin, la cual permite que se lo pueda utilizar desde cualquier entorno javascript sin necesidad de que el proyecto sea Vue 3.
|
|
7
|
+
|
|
8
|
+
Internamente la librería exporta una app de Vue 3 que usa el Plugin **list-documents-plugin**.
|
|
9
|
+
|
|
10
|
+
## Pre-requisitos
|
|
11
|
+
|
|
12
|
+
### Es necesario tener instalado
|
|
13
|
+
|
|
14
|
+
* [Node Js LTS](https://nodejs.org/en/) La versión utilizada para el primer desarrollo fue 16.14.0 LTS.
|
|
15
|
+
* [yarn](https://yarnpkg.com/)
|
|
16
|
+
|
|
17
|
+
~~~
|
|
18
|
+
npm install -g yarn
|
|
19
|
+
~~~
|
|
20
|
+
|
|
21
|
+
### Recomendaciones opcionales para instalar
|
|
22
|
+
|
|
23
|
+
* [Visual Studio Code](https://code.visualstudio.com/)
|
|
24
|
+
* [CMDER](https://github.com/cmderdev/cmder) es una consola de comandos sencilla con algunas sintaxis linux
|
|
25
|
+
|
|
26
|
+
## Instalación
|
|
27
|
+
|
|
28
|
+
El proyecto javascript esta armado con [webpack](https://webpack.js.org/concepts/) y algunas librerías adicionales.
|
|
29
|
+
|
|
30
|
+
Su instalación es sencilla ejecutando en la raíz del directorio el comando **install** que agregara todas las dependencias necesarias:
|
|
31
|
+
|
|
32
|
+
~~~
|
|
33
|
+
yarn install
|
|
34
|
+
~~~
|
|
35
|
+
|
|
36
|
+
## Compilación desarrollo
|
|
37
|
+
|
|
38
|
+
El comando **serve** compila el proyecto y se lu puede probar desde el test_javascript.html:
|
|
39
|
+
|
|
40
|
+
~~~
|
|
41
|
+
yarn serve
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
## Compilación productiva y publicación en NPM
|
|
45
|
+
|
|
46
|
+
### Compilación producción
|
|
47
|
+
|
|
48
|
+
El comando **build** compila el proyecto comprimido para luego poder ser distribuido.
|
|
49
|
+
|
|
50
|
+
~~~
|
|
51
|
+
yarn build
|
|
52
|
+
~~~
|
|
53
|
+
|
|
54
|
+
### Publicación NPM
|
|
55
|
+
|
|
56
|
+
Posteriormente para poder publicar la librería en [NPM](https://www.npmjs.com/) se debe:
|
|
57
|
+
|
|
58
|
+
1) Tener un usuario registrado. [Ir al registro...](https://www.npmjs.com/signup)
|
|
59
|
+
|
|
60
|
+
2) Acceder a la cuenta de NPM de la HDC desde el navegador y agregar como administrador al usuario registrado en la organización **@hcd-bsas**. Credenciales:
|
|
61
|
+
|
|
62
|
+
> Usuario: desarrollohcd
|
|
63
|
+
|
|
64
|
+
> Contraseña: "la misma que se utiliza en el correo hcddesarrolladoras@gmail.com"
|
|
65
|
+
|
|
66
|
+
3) Autenticar con el usuario registrado en el paso 1 desde la linea de comandos
|
|
67
|
+
|
|
68
|
+
~~~
|
|
69
|
+
yarn login
|
|
70
|
+
~~~
|
|
71
|
+
|
|
72
|
+
4) Asegurase de previamente haber compilado la librería en modo producción (comando **build**).
|
|
73
|
+
|
|
74
|
+
5) Publicar librería con el comando **publish**, el cual preguntara cual es el nuevo número de versión. En donde "version": *.*.* --> El primer número corresponde a cambios grandes, el segundo nuevas funcionalidades y el tercero corrección de errores o cambios menores.
|
|
75
|
+
|
|
76
|
+
~~~
|
|
77
|
+
yarn publish
|
|
78
|
+
~~~
|
|
79
|
+
|
|
80
|
+
Nota: En ocasiones da el error "You cannot publish over the previously published versions" al no poder cambiar la versión de la librería desde la linea de comandos. Para ello se debe aumentar el número de versión en la opción **version** del package.json
|
|
81
|
+
|
|
82
|
+
### Como hacer uso de la librería con NPM
|
|
83
|
+
|
|
84
|
+
Pero para poder instalar la librería en cualquier otro proyecto se debe correr el comando en el directorio donde el proyecto contenga las librerías javascript.
|
|
85
|
+
|
|
86
|
+
~~~
|
|
87
|
+
yarn add @hcd-bsas/list-documents-adapter
|
|
88
|
+
~~~
|
|
89
|
+
|
|
90
|
+
Luego se debe indicar en el constructor la url base donde se encuentran los endpoint para obtener la información a visualizar.
|
|
91
|
+
|
|
92
|
+
~~~
|
|
93
|
+
var list = new ImagesList({
|
|
94
|
+
base_url: "http://localhost/admin",
|
|
95
|
+
});
|
|
96
|
+
~~~
|
|
97
|
+
|
|
98
|
+
A partir de la instancia creada se puede invocar al método **open** que recibe 2 parámetros, las opciones de configuración de la app y los parámetros a pasar al endpoint que recupera el listado.
|
|
99
|
+
|
|
100
|
+
Por otro lado el método **open** retorna una promesa que indica cuando el plugin finalizo y esta visible.
|
|
101
|
+
|
|
102
|
+
~~~
|
|
103
|
+
list.open({
|
|
104
|
+
title: "Listado de imágenes escaneadas en Rhys"
|
|
105
|
+
},{
|
|
106
|
+
id_tabla: ****,
|
|
107
|
+
id_tabla_reg: ****,
|
|
108
|
+
id_dependen_responsable: ****,
|
|
109
|
+
id_pers_reso: ****,
|
|
110
|
+
campo_escan: ****
|
|
111
|
+
}).then((response) => {
|
|
112
|
+
console.log(response)
|
|
113
|
+
});
|
|
114
|
+
~~~
|
|
115
|
+
|
|
116
|
+
Nota: Se puede ver un ejemplo funcional completo en el archivo test_javascript.html
|
package/src/App.vue
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<list-files ref="list"></list-files>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
name: "App",
|
|
8
|
-
props: {},
|
|
9
|
-
data() {
|
|
10
|
-
return {
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
created() {
|
|
14
|
-
},
|
|
15
|
-
methods: {
|
|
16
|
-
showModal(app_config, params) {
|
|
17
|
-
return this.$refs['list'].show(app_config, params);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
1
|
+
<template>
|
|
2
|
+
<list-files ref="list"></list-files>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: "App",
|
|
8
|
+
props: {},
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
created() {
|
|
14
|
+
},
|
|
15
|
+
methods: {
|
|
16
|
+
showModal(app_config, params) {
|
|
17
|
+
return this.$refs['list'].show(app_config, params);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
21
|
</script>
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createApp } from 'vue'
|
|
2
2
|
import App from './App.vue'
|
|
3
3
|
import hcdListPlugin from '@hcd-bsas/list-documents-plugin'
|
|
4
|
+
import VueSweetalert2 from 'vue-sweetalert2';
|
|
4
5
|
|
|
5
6
|
export default class ImagesList {
|
|
6
7
|
|
|
@@ -10,12 +11,12 @@ export default class ImagesList {
|
|
|
10
11
|
|
|
11
12
|
constructor(config) {
|
|
12
13
|
try {
|
|
14
|
+
config['sweetalert'] = VueSweetalert2;
|
|
13
15
|
this.#render();
|
|
14
16
|
this.#app = createApp(App);
|
|
15
17
|
this.#app.use(hcdListPlugin, config)
|
|
16
18
|
this.#root = this.#app.mount("#"+this.#imagesListId);
|
|
17
19
|
} catch (error) {
|
|
18
|
-
// console.log(error);
|
|
19
20
|
throw error;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>TEST</title>
|
|
8
8
|
<link rel="stylesheet" href="node_modules/@hcd-bsas/bootstrap5/dist/hcd-bootstrap.min.css">
|
|
9
|
+
<link rel="stylesheet" href="node_modules/sweetalert2/dist/sweetalert2.min.css">
|
|
9
10
|
</head>
|
|
10
11
|
<body>
|
|
11
12
|
|
|
@@ -23,12 +24,12 @@
|
|
|
23
24
|
|
|
24
25
|
function prueba(){
|
|
25
26
|
list.open({
|
|
26
|
-
title: "Listado de
|
|
27
|
+
title: "Listado de imágenes escaneadas en Rhys"
|
|
27
28
|
},{
|
|
28
29
|
id_tabla: 1,
|
|
29
|
-
id_tabla_reg:
|
|
30
|
+
id_tabla_reg: 3922,
|
|
30
31
|
id_dependen_responsable: 54,
|
|
31
|
-
id_pers_reso:
|
|
32
|
+
id_pers_reso: 386,
|
|
32
33
|
campo_escan: "INASISTE"
|
|
33
34
|
})
|
|
34
35
|
.then((response) => {
|
package/webpack.config.js
CHANGED
|
@@ -1,54 +1,52 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const Webpack = require('webpack');
|
|
3
|
-
const { VueLoaderPlugin } = require('vue-loader');
|
|
4
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
|
-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
new Webpack.DefinePlugin({ __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false }), // to remove warn in browser console: runtime-core.esm-bundler.js:3607 Feature flags __VUE_OPTIONS_API__, __VUE_PROD_DEVTOOLS__ are not explicitly defined...
|
|
53
|
-
]
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const Webpack = require('webpack');
|
|
3
|
+
const { VueLoaderPlugin } = require('vue-loader');
|
|
4
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
5
|
+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
entry: './src/index.js',
|
|
9
|
+
output: {
|
|
10
|
+
path: path.resolve(__dirname, 'dist'),
|
|
11
|
+
filename: 'ListDocuments.min.js',
|
|
12
|
+
library: {
|
|
13
|
+
name: 'ImagesList',
|
|
14
|
+
type: 'umd',
|
|
15
|
+
export: 'default'
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
module: {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
test: /\.vue$/,
|
|
22
|
+
loader: 'vue-loader',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
test: /\.css$/,
|
|
26
|
+
use: [
|
|
27
|
+
MiniCssExtractPlugin.loader,
|
|
28
|
+
'css-loader',
|
|
29
|
+
'postcss-loader',
|
|
30
|
+
'sass-loader'
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
optimization: {
|
|
36
|
+
minimizer: [
|
|
37
|
+
new UglifyJsPlugin({
|
|
38
|
+
cache: true,
|
|
39
|
+
parallel: true,
|
|
40
|
+
sourceMap: true
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
plugins: [
|
|
45
|
+
// make sure to include the plugin!
|
|
46
|
+
new VueLoaderPlugin(),
|
|
47
|
+
new MiniCssExtractPlugin({
|
|
48
|
+
filename: 'hcd-bootstrap.min.css'
|
|
49
|
+
}),
|
|
50
|
+
new Webpack.DefinePlugin({ __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false }), // to remove warn in browser console: runtime-core.esm-bundler.js:3607 Feature flags __VUE_OPTIONS_API__, __VUE_PROD_DEVTOOLS__ are not explicitly defined...
|
|
51
|
+
]
|
|
54
52
|
};
|
package/exampleVue2.html
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<link rel="stylesheet" href="node_modules/hcd-list/dist/list-files.css">
|
|
8
|
-
<title>TEST</title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
|
|
12
|
-
<div id="test-list-plugin-vue2"></div>
|
|
13
|
-
|
|
14
|
-
<script src="./dist/vue.js"></script>
|
|
15
|
-
<script src="./node_modules/hcd-list/dist/list-files.umd.js"></script>
|
|
16
|
-
<script>
|
|
17
|
-
Vue.use(list-files);
|
|
18
|
-
var vue = new Vue({
|
|
19
|
-
el: '#test-list-plugin-vue2', // <-- Id del componente padre que incluye la aplicacion vue para que se instancie
|
|
20
|
-
data: {
|
|
21
|
-
nombre_atributo: {
|
|
22
|
-
// valores
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
computed: {},
|
|
26
|
-
created() {
|
|
27
|
-
// Se ejecuta al crear la instancia vue
|
|
28
|
-
},
|
|
29
|
-
methods: {
|
|
30
|
-
metodo_de_ejemplo() {}
|
|
31
|
-
},
|
|
32
|
-
watch: {
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</script>
|
|
39
|
-
</body>
|
|
40
|
-
</html>
|