@nixweb/nixloc-ui 0.0.101 → 0.0.104

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.
Files changed (79) hide show
  1. package/ckeditor5/README.md +1 -1
  2. package/ckeditor5/build/ckeditor.js +2 -2
  3. package/ckeditor5/build/ckeditor.js.map +1 -1
  4. package/ckeditor5/build/translations/af.js +1 -1
  5. package/ckeditor5/build/translations/ar.js +1 -1
  6. package/ckeditor5/build/translations/ast.js +1 -1
  7. package/ckeditor5/build/translations/az.js +1 -1
  8. package/ckeditor5/build/translations/bg.js +1 -1
  9. package/ckeditor5/build/translations/bs.js +1 -1
  10. package/ckeditor5/build/translations/ca.js +1 -1
  11. package/ckeditor5/build/translations/cs.js +1 -1
  12. package/ckeditor5/build/translations/da.js +1 -1
  13. package/ckeditor5/build/translations/de-ch.js +1 -1
  14. package/ckeditor5/build/translations/de.js +1 -1
  15. package/ckeditor5/build/translations/el.js +1 -1
  16. package/ckeditor5/build/translations/en-au.js +1 -1
  17. package/ckeditor5/build/translations/en-gb.js +1 -1
  18. package/ckeditor5/build/translations/en.js +1 -1
  19. package/ckeditor5/build/translations/eo.js +1 -1
  20. package/ckeditor5/build/translations/es.js +1 -1
  21. package/ckeditor5/build/translations/et.js +1 -1
  22. package/ckeditor5/build/translations/eu.js +1 -1
  23. package/ckeditor5/build/translations/fa.js +1 -1
  24. package/ckeditor5/build/translations/fi.js +1 -1
  25. package/ckeditor5/build/translations/fr.js +1 -1
  26. package/ckeditor5/build/translations/gl.js +1 -1
  27. package/ckeditor5/build/translations/gu.js +1 -1
  28. package/ckeditor5/build/translations/he.js +1 -1
  29. package/ckeditor5/build/translations/hi.js +1 -1
  30. package/ckeditor5/build/translations/hr.js +1 -1
  31. package/ckeditor5/build/translations/hu.js +1 -1
  32. package/ckeditor5/build/translations/id.js +1 -1
  33. package/ckeditor5/build/translations/it.js +1 -1
  34. package/ckeditor5/build/translations/ja.js +1 -1
  35. package/ckeditor5/build/translations/jv.js +1 -0
  36. package/ckeditor5/build/translations/km.js +1 -1
  37. package/ckeditor5/build/translations/kn.js +1 -1
  38. package/ckeditor5/build/translations/ko.js +1 -1
  39. package/ckeditor5/build/translations/ku.js +1 -1
  40. package/ckeditor5/build/translations/lt.js +1 -1
  41. package/ckeditor5/build/translations/lv.js +1 -1
  42. package/ckeditor5/build/translations/nb.js +1 -1
  43. package/ckeditor5/build/translations/ne.js +1 -1
  44. package/ckeditor5/build/translations/nl.js +1 -1
  45. package/ckeditor5/build/translations/no.js +1 -1
  46. package/ckeditor5/build/translations/oc.js +1 -1
  47. package/ckeditor5/build/translations/pl.js +1 -1
  48. package/ckeditor5/build/translations/pt.js +1 -1
  49. package/ckeditor5/build/translations/ro.js +1 -1
  50. package/ckeditor5/build/translations/ru.js +1 -1
  51. package/ckeditor5/build/translations/si.js +1 -1
  52. package/ckeditor5/build/translations/sk.js +1 -1
  53. package/ckeditor5/build/translations/sl.js +1 -1
  54. package/ckeditor5/build/translations/sq.js +1 -1
  55. package/ckeditor5/build/translations/sr-latn.js +1 -1
  56. package/ckeditor5/build/translations/sr.js +1 -1
  57. package/ckeditor5/build/translations/sv.js +1 -1
  58. package/ckeditor5/build/translations/th.js +1 -1
  59. package/ckeditor5/build/translations/tk.js +1 -1
  60. package/ckeditor5/build/translations/tr.js +1 -1
  61. package/ckeditor5/build/translations/tt.js +1 -1
  62. package/ckeditor5/build/translations/ug.js +1 -1
  63. package/ckeditor5/build/translations/uk.js +1 -1
  64. package/ckeditor5/build/translations/uz.js +1 -1
  65. package/ckeditor5/build/translations/vi.js +1 -1
  66. package/ckeditor5/build/translations/zh-cn.js +1 -1
  67. package/ckeditor5/build/translations/zh.js +1 -1
  68. package/ckeditor5/package.json +23 -20
  69. package/ckeditor5/sample/index.html +1 -1
  70. package/ckeditor5/src/ckeditor.js +20 -10
  71. package/package.json +3 -3
  72. package/src/component/forms/Modal.vue +5 -1
  73. package/src/component/shared/CodigoEditor.vue +72 -0
  74. package/src/component/shared/ConfiguracaoTabela.vue +54 -0
  75. package/src/component/shared/DocumentoEditor.vue +26 -12
  76. package/src/component/shared/DocumentoPreview.vue +26 -8
  77. package/src/component/template/ModeloDocumentoView.vue +227 -0
  78. package/src/component/template/ModeloRelatorioView.vue +1 -1
  79. package/src/store/modulos/generic.js +84 -0
@@ -1,10 +1,15 @@
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
8
+ :editor="editor"
9
+ v-model="documentoHtml"
10
+ @ready="onReady"
11
+ @focus="modificou"
12
+ ></ckeditor>
8
13
  </div>
9
14
  </div>
10
15
  </div>
@@ -15,29 +20,37 @@
15
20
  <script>
16
21
  import CKEditor from "ckeditor5-custom-build/build/ckeditor";
17
22
 
23
+ import { mapState, mapMutations } from "vuex";
24
+
18
25
  export default {
19
- name: "HtmlEditor",
26
+ name: "DocumentoEditor",
20
27
  components: {
21
28
  CKEditor,
22
29
  },
23
- props: {
24
- value: String,
25
- },
26
30
  data() {
27
31
  return {
28
32
  editor: CKEditor,
29
- template: "",
30
33
  };
31
34
  },
35
+ computed: {
36
+ ...mapState("generic", ["documentoHtml"]),
37
+ documentoHtml: {
38
+ get() {
39
+ return this.$store.state.generic.documentoHtml;
40
+ },
41
+ set(value) {
42
+ this.atualizaDocumentoHtml(value);
43
+ },
44
+ },
45
+ },
32
46
  methods: {
47
+ ...mapMutations("generic", ["atualizaDocumentoHtml", "insereEvento"]),
33
48
  onReady(editor) {
34
49
  const toolbarContainer = document.querySelector(".document-editor__toolbar");
35
50
  toolbarContainer.appendChild(editor.ui.view.toolbar.element);
36
51
  },
37
- },
38
- watch: {
39
- template() {
40
- this.$emit("input", this.template);
52
+ modificou() {
53
+ this.insereEvento({ nome: "documentoEditoFocus" });
41
54
  },
42
55
  },
43
56
  };
@@ -49,6 +62,7 @@ export default {
49
62
  max-height: 700px;
50
63
  display: flex;
51
64
  flex-flow: column nowrap;
65
+ margin: auto !important;
52
66
  }
53
67
 
54
68
  .document-editor__toolbar {
@@ -68,7 +82,7 @@ export default {
68
82
  }
69
83
 
70
84
  .document-editor__editable-container .ck-editor__editable {
71
- width: 20.8cm;
85
+ width: 22cm;
72
86
  min-height: 21cm;
73
87
  padding: 20px;
74
88
  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,32 @@ export default {
14
12
  },
15
13
  props: {
16
14
  template: String,
15
+ dados: Object,
17
16
  },
18
- data() {
19
- return {
20
- nome: "Fábio",
21
- sobrenome: "Gomes de Ávila",
22
- };
17
+ methods: {
18
+ agruparPor(array, key) {
19
+ const result = {};
20
+ array.forEach((item) => {
21
+ if (!result[item[key]]) {
22
+ result[item[key]] = [];
23
+ }
24
+ result[item[key]].push(item);
25
+ });
26
+ return result;
27
+ },
28
+ somaGrupo(grupoNome) {
29
+ let total = "";
30
+ this.dados.produto.forEach((x) => {
31
+ if (x.grupoNome === grupoNome) return (total = x.grupoTotal);
32
+ });
33
+ return total;
34
+ },
35
+ },
36
+ computed: {
37
+ produtoAgrupado() {
38
+ return this.agruparPor(this.dados.produto, "grupoNome");
39
+ },
23
40
  },
24
41
  };
25
42
  </script>
43
+
@@ -0,0 +1,227 @@
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="salvarDocumento"
19
+ tipo="sucesso"
20
+ titulo="Salvar"
21
+ classeIcone="fas fa-save"
22
+ :desabilitado="salvarDesabilitado"
23
+ tamanho="pequeno"
24
+ :clique="salvarDocumento"
25
+ />
26
+ </div>
27
+ <div class="lado-a-lado">
28
+ <Botao
29
+ v-if="id"
30
+ chave="fazerCopia"
31
+ tipo="sucesso"
32
+ titulo="Fazer uma cópia"
33
+ classeIcone="fas fa-clone"
34
+ tamanho="pequeno"
35
+ :clique="fazerCopia"
36
+ />
37
+ </div>
38
+ </b-col>
39
+ <b-col class="text-right" sm="6">
40
+ <div class="lado-a-lado">
41
+ <Botao
42
+ chave="abrirConfiguracao"
43
+ tipo="info"
44
+ classeIcone="fas fa-tools"
45
+ tamanho="pequeno"
46
+ :clique="abrirConfiguracao"
47
+ />
48
+ </div>
49
+ <div class="lado-a-lado">
50
+ <Botao
51
+ chave="abrirCodigo"
52
+ tipo="info"
53
+ classeIcone="far fa-code"
54
+ tamanho="pequeno"
55
+ :clique="abrirCodigo"
56
+ />
57
+ </div>
58
+ <div class="lado-a-lado">
59
+ <Botao
60
+ chave="abrirVisualizar"
61
+ tipo="info"
62
+ titulo="Visualizar"
63
+ classeIcone="far fa-eye"
64
+ tamanho="pequeno"
65
+ :clique="abrirVisualizar"
66
+ />
67
+ </div>
68
+ </b-col>
69
+ </b-row>
70
+ </Moldura>
71
+ </div>
72
+ <Modal titulo="Salvar" :largura="500" v-show="mostrarModal('salvarDocumento')">
73
+ <slot></slot>
74
+ </Modal>
75
+ <Modal titulo="Configuração" :largura="700" v-if="mostrarModal('configuracao')">
76
+ <BarraRolagem :alturaMinima="200" :alturaMaxima="400">
77
+ <ConfiguracaoTabela />
78
+ </BarraRolagem>
79
+ </Modal>
80
+ <Modal titulo="Editor de Código" :largura="900" v-if="mostrarModal('codigo')">
81
+ <BarraRolagem :alturaMinima="200" :alturaMaxima="400">
82
+ <CodigoEditor v-if="modal.abrir" />
83
+ </BarraRolagem>
84
+ </Modal>
85
+ <Modal titulo="Visualizar" :largura="1100" v-if="mostrarModal('visualizar')">
86
+ <div v-if="modal.abrir">
87
+ <b-row>
88
+ <b-col class="text-center">
89
+ <Botao
90
+ v-print="'#printMe'"
91
+ chave="imprimir"
92
+ tipo="editar"
93
+ titulo="Imprimir"
94
+ classeIcone="fas fa-print"
95
+ tamanho="pequeno"
96
+ :clique="imprimir"
97
+ />
98
+ </b-col>
99
+ </b-row>
100
+ <br />
101
+ <BarraRolagem :alturaMinima="300" :alturaMaxima="500">
102
+ <div class="a4">
103
+ <div id="printMe">
104
+ <DocumentoPreview :template="documentoPreview" :dados="dados" />
105
+ </div>
106
+ </div>
107
+ </BarraRolagem>
108
+ </div>
109
+ </Modal>
110
+ <div class="div-editor">
111
+ <DocumentoEditor />
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </Painel>
116
+ </div>
117
+ </template>
118
+
119
+ <script>
120
+ import Painel from "@nixweb/nixloc-ui/src/component/layout/Painel";
121
+
122
+ import DocumentoEditor from "@nixweb/nixloc-ui/src/component/shared/DocumentoEditor.vue";
123
+ import DocumentoPreview from "@nixweb/nixloc-ui/src/component/shared/DocumentoPreview.vue";
124
+ import CodigoEditor from "@nixweb/nixloc-ui/src/component/shared/CodigoEditor.vue";
125
+ import ConfiguracaoTabela from "@nixweb/nixloc-ui/src/component/shared/ConfiguracaoTabela.vue";
126
+ import Moldura from "@nixweb/nixloc-ui/src/component/layout/Moldura";
127
+ import Botao from "@nixweb/nixloc-ui/src/component/forms/Botao";
128
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
129
+ import BarraRolagem from "@nixweb/nixloc-ui/src/component/layout/BarraRolagem.vue";
130
+
131
+ import print from "vue-print-nb";
132
+
133
+ import { mapState, mapGetters, mapMutations } from "vuex";
134
+
135
+ export default {
136
+ name: "DocumentoAdicionarModificarView",
137
+ directives: {
138
+ print,
139
+ },
140
+ components: {
141
+ Painel,
142
+ DocumentoEditor,
143
+ DocumentoPreview,
144
+ CodigoEditor,
145
+ ConfiguracaoTabela,
146
+ Moldura,
147
+ Botao,
148
+ Modal,
149
+ BarraRolagem,
150
+ },
151
+ props: {
152
+ painel: Object,
153
+ dados: Object,
154
+ },
155
+ data() {
156
+ return {
157
+ id: this.$route.params.id,
158
+ salvarDesabilitado: true,
159
+ };
160
+ },
161
+ computed: {
162
+ ...mapState("generic", ["modal", "documentoHtml"]),
163
+ ...mapGetters("generic", ["mostrarModal", "evento", "documentoPreview"]),
164
+ },
165
+ methods: {
166
+ ...mapMutations("generic", [
167
+ "abrirModal",
168
+ "fecharModal",
169
+ "removeCarregando",
170
+ "insereEvento",
171
+ ]),
172
+ salvarDocumento() {
173
+ if (this.id) {
174
+ this.insereEvento({ nome: "salvarDocumento" });
175
+ } else {
176
+ this.abrirModal("salvarDocumento");
177
+ this.removeCarregando(["salvarDocumento"]);
178
+ }
179
+ },
180
+ fazerCopia() {
181
+ this.insereEvento({ nome: "fazerCopia" });
182
+ },
183
+ abrirConfiguracao() {
184
+ this.abrirModal("configuracao");
185
+ this.removeCarregando(["abrirConfiguracao"]);
186
+ },
187
+ abrirCodigo() {
188
+ this.abrirModal("codigo");
189
+ this.removeCarregando(["abrirCodigo"]);
190
+ },
191
+ abrirVisualizar() {
192
+ this.abrirModal("visualizar");
193
+ this.removeCarregando(["abrirVisualizar"]);
194
+ },
195
+ imprimir() {
196
+ this.removeCarregando(["imprimir"]);
197
+ },
198
+ },
199
+ watch: {
200
+ evento: {
201
+ handler(evento) {
202
+ if (evento.nome == "documentoEditorModificado") this.salvarDesabilitado = true;
203
+ if (evento.nome == "documentoEditoFocus") this.salvarDesabilitado = false;
204
+ },
205
+ deep: true,
206
+ },
207
+ },
208
+ };
209
+ </script>
210
+ <style scoped>
211
+ .div-top {
212
+ margin-top: 30px;
213
+ }
214
+ .div-editor {
215
+ margin-top: 25px;
216
+ }
217
+ .a4 {
218
+ width: 22cm;
219
+ min-height: 21cm;
220
+ padding: 20px;
221
+ border: 1px hsl(0, 0%, 82.7%) solid;
222
+ border-radius: var(--ck-border-radius);
223
+ background: white;
224
+ box-shadow: 0 0 5px hsl(0deg 0% 0% / 10%);
225
+ margin: 0 auto;
226
+ }
227
+ </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,
@@ -64,6 +65,86 @@ export default {
64
65
  evento: (state) => {
65
66
  return state.evento;
66
67
  },
68
+ documentoPreview: (state) => {
69
+ let documentoHtml = state.documentoHtml
70
+ let retorno = documentoHtml;
71
+
72
+ var tabelas = document.getElementsByTagName("table");
73
+ let total = tabelas.length;
74
+
75
+ let config = [];
76
+
77
+ let sequencial = 0;
78
+ while (sequencial <= total - 1) {
79
+
80
+ let tabela = document.getElementsByTagName("table")[sequencial];
81
+ let th = tabela.getElementsByTagName("th")[0];
82
+
83
+ let obj = {
84
+ vForAgrupado: "",
85
+ vForSimples: "",
86
+ nomeGrupo: "",
87
+ nomeGrupoReplace: ""
88
+ };
89
+
90
+ if (th) {
91
+ let ehProdutoAgrupado = th.innerText.includes("n.grupo");
92
+ let ehProduto = th.innerText.includes("n.produto");
93
+ let ehPeriodo = th.innerText.includes("n.periodo");
94
+ let ehPagamento = th.innerText.includes("n.pagamento");
95
+
96
+ if (ehProduto) {
97
+ obj.vForSimples = "v-for='n in dados.produto'";
98
+ config.push(obj);
99
+ } else if (ehPeriodo) {
100
+ obj.vForSimples = "v-for='n in dados.periodo'";
101
+ config.push(obj);
102
+ } else if (ehPagamento) {
103
+ obj.vForSimples = "v-for='n in dados.pagamento'";
104
+ config.push(obj);
105
+ } else if (ehProdutoAgrupado) {
106
+ obj.vForAgrupado = "v-for='(produto, grupoNome) in produtoAgrupado'";
107
+ obj.vForSimples = "v-for='n in produto'";
108
+
109
+ var posicaoInicio = documentoHtml.split("<tbody>", sequencial + 1).join("<tbody>").length;
110
+ var posicaoFim = documentoHtml.split("</tbody>", sequencial + 1).join("</tbody>").length;
111
+
112
+ let tbody = documentoHtml.substring(documentoHtml.indexOf("<tbody>", posicaoInicio), documentoHtml.lastIndexOf("</tbody>", posicaoFim));
113
+
114
+ let tr = tbody.substring(tbody.indexOf("<tr>"), tbody.lastIndexOf("</tr>"));
115
+
116
+ obj.nomeGrupo = tr.substring(0, tr.indexOf('</tr>')) + "</tr>";
117
+ obj.nomeGrupo = obj.nomeGrupo.replaceAll("\"", "'");
118
+ obj.nomeGrupoReplace = obj.nomeGrupo.replace("<tr>", "").replace("</tr>", "");
119
+ config.push(obj);
120
+
121
+ } else {
122
+ config.push(obj);
123
+ }
124
+ } else {
125
+ config.push(obj);
126
+ }
127
+ sequencial++;
128
+ }
129
+
130
+ let replace = "";
131
+ config.forEach(x => {
132
+ replace += `.replace("<tbody>${x.nomeGrupo}<tr>", "<tbody ${x.vForAgrupado}>${x.nomeGrupoReplace}<tr ${x.vForSimples}>")`;
133
+ });
134
+
135
+ var ret = retorno.replaceAll("\"", "'");
136
+ ret = eval(`ret${replace}`);
137
+
138
+ var classeImportant = ret
139
+ .replaceAll("n.grupo", "")
140
+ .replaceAll("n.produto", "")
141
+ .replaceAll("n.periodo", "")
142
+ .replaceAll("n.pagamento", "")
143
+ .replaceAll(";", "!important;")
144
+ .replaceAll("<p>&nbsp!important;</p>", "<p>&nbsp</p>");
145
+
146
+ return classeImportant;
147
+ }
67
148
  },
68
149
  mutations: {
69
150
  abrirModal: (state, nome) => {
@@ -123,6 +204,9 @@ export default {
123
204
  obj.totalPorPagina = paginacao.totalPorPagina;
124
205
  });
125
206
  },
207
+ atualizaDocumentoHtml: (state, value) => {
208
+ state.documentoHtml = value;
209
+ },
126
210
  insereEvento: (state, obj) => {
127
211
  state.evento.dataHora = new Date();
128
212
  state.evento.nome = obj.nome;