@nixweb/nixloc-ui 0.0.100 → 0.0.103

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.100",
3
+ "version": "0.0.103",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -17,6 +17,7 @@
17
17
  "sass-loader": "^12.4.0",
18
18
  "vodal": "^2.4.0",
19
19
  "v-runtime-template": "^1.10.0",
20
+ "vuejs-ace-editor": "^1.0.1",
20
21
  "vue-color": "^2.7.0",
21
22
  "vue-html2pdf": "^1.8.0",
22
23
  "vue-json-excel": "^0.3.0",
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div>
3
+ <button @click="aplicar()">Aplicar</button>
4
+ <AceEditor
5
+ v-model="codigo"
6
+ lang="html"
7
+ @init="editorInit"
8
+ theme="monokai"
9
+ width="100%"
10
+ height="400px"
11
+ :options="{
12
+ enableBasicAutocompletion: true,
13
+ enableLiveAutocompletion: true,
14
+ fontSize: 15,
15
+ highlightActiveLine: true,
16
+ enableSnippets: false,
17
+ showLineNumbers: true,
18
+ tabSize: 2,
19
+ showPrintMargin: false,
20
+ showGutter: true,
21
+ }"
22
+ />
23
+ </div>
24
+ </template>
25
+
26
+ <script>
27
+ import AceEditor from "vuejs-ace-editor";
28
+
29
+ import { mapMutations } from "vuex";
30
+
31
+ export default {
32
+ name: "CodigoEditor",
33
+ components: {
34
+ AceEditor,
35
+ },
36
+ data() {
37
+ return {
38
+ codigo: "",
39
+ };
40
+ },
41
+ computed: {
42
+ documentoHtml: {
43
+ get() {
44
+ return this.$store.state.generic.documentoHtml;
45
+ },
46
+ set(value) {
47
+ this.atualizaDocumentoHtml(value);
48
+ },
49
+ },
50
+ },
51
+ methods: {
52
+ ...mapMutations("generic", ["atualizaDocumentoHtml"]),
53
+ aplicar() {
54
+ this.atualizaDocumentoHtml(this.codigo);
55
+ },
56
+ dataSumit() {
57
+ //code here
58
+ },
59
+ editorInit: function () {
60
+ require("brace/ext/language_tools"); //language extension prerequsite...
61
+ require("brace/mode/html");
62
+ require("brace/mode/javascript"); //language
63
+ require("brace/mode/less");
64
+ require("brace/theme/monokai");
65
+ require("brace/snippets/javascript"); //snippet
66
+ },
67
+ },
68
+ };
69
+ </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <div class="form-group row">
3
+ <div class="form-group">
4
4
  <div>
5
5
  <div class="document-editor__toolbar"></div>
6
6
  <div class="document-editor__editable-container">
7
- <ckeditor :editor="editor" v-model="template" @ready="onReady"></ckeditor>
7
+ <ckeditor :editor="editor" v-model="documentoHtml" @ready="onReady"></ckeditor>
8
8
  </div>
9
9
  </div>
10
10
  </div>
@@ -15,6 +15,8 @@
15
15
  <script>
16
16
  import CKEditor from "ckeditor5-custom-build/build/ckeditor";
17
17
 
18
+ import { mapMutations } from "vuex";
19
+
18
20
  export default {
19
21
  name: "HtmlEditor",
20
22
  components: {
@@ -26,18 +28,23 @@ export default {
26
28
  data() {
27
29
  return {
28
30
  editor: CKEditor,
29
- template: "",
30
31
  };
31
32
  },
32
33
  methods: {
34
+ ...mapMutations("generic", ["atualizaDocumentoHtml"]),
33
35
  onReady(editor) {
34
36
  const toolbarContainer = document.querySelector(".document-editor__toolbar");
35
37
  toolbarContainer.appendChild(editor.ui.view.toolbar.element);
36
38
  },
37
39
  },
38
- watch: {
39
- template() {
40
- this.$emit("input", this.template);
40
+ computed: {
41
+ documentoHtml: {
42
+ get() {
43
+ return this.$store.state.generic.documentoHtml;
44
+ },
45
+ set(value) {
46
+ this.atualizaDocumentoHtml(value);
47
+ },
41
48
  },
42
49
  },
43
50
  };
@@ -49,6 +56,7 @@ export default {
49
56
  max-height: 700px;
50
57
  display: flex;
51
58
  flex-flow: column nowrap;
59
+ margin: auto !important;
52
60
  }
53
61
 
54
62
  .document-editor__toolbar {
@@ -68,7 +76,7 @@ export default {
68
76
  }
69
77
 
70
78
  .document-editor__editable-container .ck-editor__editable {
71
- width: 20.8cm;
79
+ width: 22cm;
72
80
  min-height: 21cm;
73
81
  padding: 20px;
74
82
  border: 1px hsl(0, 0%, 82.7%) solid;
@@ -1,7 +1,5 @@
1
1
  <template>
2
- <div>
3
- <v-runtime-template :template="template" />
4
- </div>
2
+ <v-runtime-template :template="`<div>${template}</div>`" />
5
3
  </template>
6
4
 
7
5
  <script>
@@ -14,12 +12,7 @@ export default {
14
12
  },
15
13
  props: {
16
14
  template: String,
17
- },
18
- data() {
19
- return {
20
- nome: "Fábio",
21
- sobrenome: "Gomes de Ávila",
22
- };
15
+ dados: Object,
23
16
  },
24
17
  };
25
18
  </script>
@@ -0,0 +1,174 @@
1
+ <template>
2
+ <div>
3
+ <Painel
4
+ :modulo="painel.modulo"
5
+ :titulo="painel.titulo"
6
+ :mostrarFiltro="painel.mostrarFiltro"
7
+ :mostrarPesquisa="painel.mostrarPesquisa"
8
+ :mostrarBotoes="painel.mostrarBotoes"
9
+ >
10
+ <div slot="conteudo-principal">
11
+ <div>
12
+ <div class="div-top">
13
+ <Moldura>
14
+ <b-row>
15
+ <b-col sm="6">
16
+ <div class="lado-a-lado">
17
+ <Botao
18
+ chave="salvarRelatorio"
19
+ tipo="sucesso"
20
+ titulo="Salvar Modelo"
21
+ classeIcone="fas fa-save"
22
+ tamanho="pequeno"
23
+ />
24
+ </div>
25
+ </b-col>
26
+ <b-col class="text-right" sm="6">
27
+ <div class="lado-a-lado">
28
+ <Botao
29
+ chave="abrirCodigo"
30
+ tipo="info"
31
+ titulo="Código Fonte"
32
+ classeIcone="far fa-code"
33
+ tamanho="pequeno"
34
+ :clique="abrirCodigo"
35
+ />
36
+ </div>
37
+ <div class="lado-a-lado">
38
+ <Botao
39
+ chave="abrirVisualizar"
40
+ tipo="info"
41
+ titulo="Visualizar"
42
+ classeIcone="far fa-eye"
43
+ tamanho="pequeno"
44
+ :clique="abrirVisualizar"
45
+ />
46
+ </div>
47
+ </b-col>
48
+ </b-row>
49
+ </Moldura>
50
+ </div>
51
+ <Modal titulo="Editor de Código" :largura="900" v-if="mostrarModal('codigo')">
52
+ <BarraRolagem :alturaMinima="200" :alturaMaxima="400">
53
+ <CodigoEditor v-if="modal.abrir" />
54
+ </BarraRolagem>
55
+ </Modal>
56
+ <Modal titulo="Visualizar" :largura="1100" v-if="mostrarModal('visualizar')">
57
+ <div v-if="modal.abrir">
58
+ <b-row>
59
+ <b-col class="text-center">
60
+ <Botao
61
+ v-print="'#printMe'"
62
+ chave="imprimir"
63
+ tipo="editar"
64
+ titulo="Imprimir"
65
+ classeIcone="fas fa-print"
66
+ tamanho="pequeno"
67
+ :clique="imprimir"
68
+ />
69
+ </b-col>
70
+ </b-row>
71
+ <br />
72
+ <BarraRolagem :alturaMinima="300" :alturaMaxima="500">
73
+ <div class="a4">
74
+ <div id="printMe">
75
+ <DocumentoPreview :template="documentoHtml" :dados="dados" />
76
+ </div>
77
+ </div>
78
+ </BarraRolagem>
79
+ </div>
80
+ </Modal>
81
+ <div class="div-editor">
82
+ <DocumentoEditor />
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </Painel>
87
+ </div>
88
+ </template>
89
+
90
+ <script>
91
+ import Painel from "@nixweb/nixloc-ui/src/component/layout/Painel";
92
+
93
+ import DocumentoEditor from "@nixweb/nixloc-ui/src/component/shared/DocumentoEditor.vue";
94
+ import DocumentoPreview from "@nixweb/nixloc-ui/src/component/shared/DocumentoPreview.vue";
95
+ import CodigoEditor from "@nixweb/nixloc-ui/src/component/shared/CodigoEditor.vue";
96
+ import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
97
+ import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
98
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
99
+ import BarraRolagem from "@nixweb/nixloc-ui/src/component/layout/BarraRolagem.vue";
100
+
101
+ import print from "vue-print-nb";
102
+
103
+ import { mapState, mapGetters, mapMutations } from "vuex";
104
+
105
+ export default {
106
+ name: "DocumentoAdicionarModificarView",
107
+ directives: {
108
+ print,
109
+ },
110
+ components: {
111
+ Painel,
112
+ DocumentoEditor,
113
+ DocumentoPreview,
114
+ CodigoEditor,
115
+ Moldura,
116
+ Botao,
117
+ Modal,
118
+ BarraRolagem,
119
+ },
120
+ props: {
121
+ painel: Object,
122
+ dados: Object,
123
+ },
124
+ computed: {
125
+ ...mapState("generic", ["modal"]),
126
+ ...mapGetters("generic", ["mostrarModal", "evento"]),
127
+ documentoHtml: {
128
+ get() {
129
+ return this.$store.state.generic.documentoHtml;
130
+ },
131
+ set(value) {
132
+ this.atualizaDocumentoHtml(value);
133
+ },
134
+ },
135
+ },
136
+ methods: {
137
+ ...mapMutations("generic", [
138
+ "abrirModal",
139
+ "fecharModal",
140
+ "removeCarregando",
141
+ "atualizaDocumentoHtml",
142
+ ]),
143
+ abrirCodigo() {
144
+ this.abrirModal("codigo");
145
+ this.removeCarregando(["abrirCodigo"]);
146
+ },
147
+ abrirVisualizar() {
148
+ this.abrirModal("visualizar");
149
+ this.removeCarregando(["abrirVisualizar"]);
150
+ },
151
+ imprimir() {
152
+ this.removeCarregando(["imprimir"]);
153
+ },
154
+ },
155
+ };
156
+ </script>
157
+ <style scoped>
158
+ .div-top {
159
+ margin-top: 30px;
160
+ }
161
+ .div-editor {
162
+ margin-top: 25px;
163
+ }
164
+ .a4 {
165
+ width: 22cm;
166
+ min-height: 21cm;
167
+ padding: 20px;
168
+ border: 1px hsl(0, 0%, 82.7%) solid;
169
+ border-radius: var(--ck-border-radius);
170
+ background: white;
171
+ box-shadow: 0 0 5px hsl(0deg 0% 0% / 10%);
172
+ margin: 0 auto;
173
+ }
174
+ </style>
@@ -41,7 +41,7 @@
41
41
  v-if="!invalido"
42
42
  chave="salvarRelatorio"
43
43
  tipo="sucesso"
44
- titulo="Salvar"
44
+ titulo="Salvar Modelo"
45
45
  classeIcone="fas fa-save"
46
46
  :desabilitado="carregando || invalido"
47
47
  tamanho="pequeno"
@@ -29,6 +29,7 @@ export default {
29
29
  },
30
30
  ids: undefined,
31
31
  pesquisa: { conteudo: "", filtro: { conteudo: "contem", id: "contem" } },
32
+ documentoHtml: "",
32
33
  EscolherEstatico: { dataHora: undefined, campoAlvo: undefined, valor: undefined },
33
34
  buscouPesquisa: false,
34
35
  limpouPesquisa: false,
@@ -123,6 +124,10 @@ export default {
123
124
  obj.totalPorPagina = paginacao.totalPorPagina;
124
125
  });
125
126
  },
127
+ atualizaDocumentoHtml: (state, value) => {
128
+ state.documentoHtml = value;
129
+
130
+ },
126
131
  insereEvento: (state, obj) => {
127
132
  state.evento.dataHora = new Date();
128
133
  state.evento.nome = obj.nome;