@nixweb/nixloc-ui 0.0.292 → 0.0.294

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.
@@ -5,12 +5,7 @@
5
5
  <div class="document-editor__toolbar"></div>
6
6
  <div class="document-editor__editable-container">
7
7
  <div id="template-dev">
8
- <ckeditor
9
- :editor="editor"
10
- v-model="documentHtml"
11
- @ready="onReady"
12
- @focus="changed"
13
- ></ckeditor>
8
+ <ckeditor :editor="editor" v-model="computedDocumentHtml" @ready="onReady" @focus="changed"></ckeditor>
14
9
  </div>
15
10
  </div>
16
11
  </div>
@@ -21,11 +16,11 @@
21
16
 
22
17
  <script>
23
18
  import CKEditor from "ckeditor5-custom-build/build/ckeditor";
24
-
25
19
  import { mapState, mapMutations } from "vuex";
26
20
 
27
21
  export default {
28
22
  name: "DocumentEditor",
23
+ props: ["editMode"],
29
24
  components: {
30
25
  CKEditor,
31
26
  },
@@ -35,22 +30,29 @@ export default {
35
30
  };
36
31
  },
37
32
  computed: {
38
- ...mapState("generic", ["documentHtml"]),
39
- documentHtml: {
33
+ ...mapState("generic", ["documentHtml", "documentHtmlFinal"]),
34
+ computedDocumentHtml: {
40
35
  get() {
41
- return this.$store.state.generic.documentHtml;
36
+ if (this.editMode) {
37
+ return this.documentHtmlFinal
38
+ } else {
39
+ return this.documentHtml;
40
+ }
42
41
  },
43
- set(value) {
44
- this.updateDocumentHtml(value);
42
+ set(newValue) {
43
+ console.log(newValue);
44
+ if (this.editMode) {
45
+ this.updateDocumentHtmlFinal(newValue);
46
+ } else {
47
+ this.updateDocumentHtml(newValue);
48
+ }
45
49
  },
46
50
  },
47
51
  },
48
52
  methods: {
49
- ...mapMutations("generic", ["updateDocumentHtml", "addEvent"]),
53
+ ...mapMutations("generic", ["updateDocumentHtmlFinal", "updateDocumentHtml", "addEvent"]),
50
54
  onReady(editor) {
51
- const toolbarContainer = document.querySelector(
52
- ".document-editor__toolbar"
53
- );
55
+ const toolbarContainer = document.querySelector(".document-editor__toolbar");
54
56
  toolbarContainer.appendChild(editor.ui.view.toolbar.element);
55
57
  },
56
58
  changed() {
@@ -61,6 +63,7 @@ export default {
61
63
  </script>
62
64
 
63
65
  <style scoped>
66
+ /* Estilos do seu componente */
64
67
  .document-editor {
65
68
  border-radius: var(--ck-border-radius);
66
69
  max-height: 700px;
@@ -74,10 +77,6 @@ export default {
74
77
  min-width: 1100px;
75
78
  }
76
79
 
77
- .document-editor__toolbar .ck-toolbar {
78
- border-radius: 0;
79
- }
80
-
81
80
  .document-editor__editable-container {
82
81
  padding: 10px;
83
82
  border: 1px solid #e4e6ec;
@@ -95,56 +94,7 @@ export default {
95
94
  margin: 0 auto;
96
95
  }
97
96
 
98
- .document-editor .ck-content,
99
- .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
97
+ .document-editor .ck-content {
100
98
  font: 16px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
101
99
  }
102
-
103
- .document-editor .ck-heading-dropdown .ck-list .ck-button__label {
104
- line-height: calc(
105
- 1.7 * var(--ck-line-height-base) * var(--ck-font-size-base)
106
- );
107
- min-width: 6em;
108
- }
109
-
110
- .document-editor
111
- .ck-heading-dropdown
112
- .ck-list
113
- .ck-button:not(.ck-heading_paragraph)
114
- .ck-button__label {
115
- transform: scale(0.8);
116
- transform-origin: left;
117
- }
118
-
119
- .document-editor .ck-content h2,
120
- .document-editor .ck-heading-dropdown .ck-heading_heading1 .ck-button__label {
121
- font-size: 2.18em;
122
- font-weight: normal;
123
- }
124
-
125
- .document-editor .ck-content h2 {
126
- line-height: 1.37em;
127
- padding-top: 0.342em;
128
- margin-bottom: 0.142em;
129
- }
130
-
131
- .document-editor .ck-content h3,
132
- .document-editor .ck-heading-dropdown .ck-heading_heading2 .ck-button__label {
133
- font-size: 1.75em;
134
- font-weight: normal;
135
- color: hsl(203, 100%, 50%);
136
- }
137
-
138
- .document-editor
139
- .ck-heading-dropdown
140
- .ck-heading_heading2.ck-on
141
- .ck-button__label {
142
- color: var(--ck-color-list-button-on-text);
143
- }
144
-
145
- .document-editor .ck-content h3 {
146
- line-height: 1.86em;
147
- padding-top: 0.171em;
148
- margin-bottom: 0.357em;
149
- }
150
100
  </style>
@@ -1,11 +1,15 @@
1
1
  <template>
2
- <v-runtime-template :template="`<div>${template}</div>`" />
2
+ <div>
3
+ <div ref='preview'>
4
+ <v-runtime-template :template="`<div>${template}</div>`" />
5
+ </div>
6
+ </div>
3
7
  </template>
4
8
 
5
9
  <script>
6
10
  import VRuntimeTemplate from "v-runtime-template";
7
11
 
8
- import { mapGetters } from "vuex";
12
+ import { mapGetters, mapMutations } from "vuex";
9
13
 
10
14
  export default {
11
15
  name: "DocumentPreview",
@@ -17,6 +21,7 @@ export default {
17
21
  d: Object,
18
22
  },
19
23
  methods: {
24
+ ...mapMutations("generic", ["updateDocumentHtmlFinal"]),
20
25
  periodo(grupo, campo) {
21
26
  var item = this.d.itensLocacao.find(item => item.grupo == grupo);
22
27
  const campoMap = {
@@ -48,14 +53,29 @@ export default {
48
53
  convertToNumber(value) {
49
54
  return parseFloat(value.replace("R$", "").replace(",", "."));
50
55
  },
56
+ getPreviewContent() {
57
+ const previewDiv = this.$refs.preview;
58
+ this.updateDocumentHtmlFinal(previewDiv.innerHTML);
59
+ }
51
60
  },
52
61
  computed: {
53
- ...mapGetters("generic", ["groupBy"]),
62
+ ...mapGetters("generic", ["groupBy", "event"]),
54
63
  produtoAgrupado() {
55
64
  var group = this.groupBy({ array: this.d.itensLocacao, key: "grupo" });
56
65
  return group;
57
66
  },
58
-
59
67
  },
68
+ watch: {
69
+ event: {
70
+ handler(event) {
71
+ if (event.name == "updateDocumentHtml") {
72
+ this.getPreviewContent();
73
+ }
74
+ },
75
+ deep: true,
76
+ },
77
+ },
78
+
79
+
60
80
  };
61
81
  </script>
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <div class="loading-skeleton" :style="'height:' + height + 'px'">
3
+ <div v-for="index in totalLine" :key="index" class="line"
4
+ :style="{ height: getRandomHeight() + 'px', width: '100%' }"></div>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ name: "LoadingCard",
11
+ props: {
12
+ totalLine: {
13
+ type: Number,
14
+ default: 3,
15
+ validator(value) {
16
+ return value >= 1 && value <= 10;
17
+ }
18
+ },
19
+ height: {
20
+ type: Number,
21
+ default: 200,
22
+ validator(value) {
23
+ return value > 0;
24
+ }
25
+ }
26
+ },
27
+ methods: {
28
+ getRandomHeight() {
29
+ const minHeight = 10;
30
+ const maxHeight = 30;
31
+ return Math.floor(Math.random() * (maxHeight - minHeight + 1)) + minHeight;
32
+ }
33
+ }
34
+ };
35
+ </script>
36
+
37
+ <style scoped>
38
+ .loading-skeleton {
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: 12px;
42
+ max-width: 400px;
43
+ margin: 0 auto;
44
+ overflow: hidden;
45
+ }
46
+
47
+ .line {
48
+ width: 100%;
49
+ background: linear-gradient(90deg, #f0f0f0 25%, #d8d8d8 50%, #f0f0f0 75%);
50
+ background-size: 200% 100%;
51
+ animation: shimmer 1.5s infinite linear;
52
+ border-radius: 4px;
53
+ opacity: 0.4;
54
+ }
55
+
56
+ @keyframes shimmer {
57
+ 0% {
58
+ background-position: -200% 0;
59
+ }
60
+
61
+ 100% {
62
+ background-position: 200% 0;
63
+ }
64
+ }
65
+ </style>
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div>
3
- <progress-bar :size="size" :text="text" :val="value" :max="max"></progress-bar>
3
+ <progress-bar :bg-color="bColor" :bar-color="bgColor" :size="size" :text="text" :val="value" :max="max"
4
+ bar-border-radius="10"></progress-bar>
4
5
  </div>
5
6
  </template>
6
7
  <script>
@@ -13,6 +14,8 @@ export default {
13
14
  ProgressBar,
14
15
  },
15
16
  props: {
17
+ bgColor: String,
18
+ bColor: String,
16
19
  text: String,
17
20
  value: Number,
18
21
  max: Number,
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <div>
3
- <table class="table table-responsive-xs">
3
+ <div class="icon-print" v-print="'#printMe'">
4
+ <i title="Imprimir" class="fas fa-print"></i>
5
+ </div>
6
+ <table id="printMe" class="table table-responsive-xs">
4
7
  <thead>
5
8
  <tr>
6
9
  <th class="td-checkbox" v-if="showChecks">
7
- <div>
10
+ <div class="hide-print">
8
11
  <b-form-checkbox v-model="selectAll" @change="select" />
9
12
  </div>
10
13
  </th>
@@ -19,7 +22,7 @@
19
22
  <draggable v-model="data" tag="tbody" @change="checkMove" :options="{ disabled: !dragAndDrop }">
20
23
  <tr v-for="(row, index) in data" :key="index" :style="row.rowCss">
21
24
  <td class="td-checkbox" v-if="showChecks">
22
- <div :class="{ 'center-vertical': row.photo != null }">
25
+ <div class="hide-print" :class="{ 'center-vertical': row.photo != null }">
23
26
  <b-form-checkbox v-model="selected" :value="row.id" />
24
27
  </div>
25
28
  </td>
@@ -41,6 +44,7 @@
41
44
 
42
45
  <script>
43
46
  import TableItem from "@nixweb/nixloc-ui/src/component/shared/TableItem.vue";
47
+ import print from "vue-print-nb";
44
48
 
45
49
  import draggable from "vuedraggable";
46
50
 
@@ -48,6 +52,9 @@ import { mapState, mapMutations, mapActions } from "vuex";
48
52
 
49
53
  export default {
50
54
  components: { draggable, TableItem },
55
+ directives: {
56
+ print,
57
+ },
51
58
  props: {
52
59
  header: Array,
53
60
  data: Array,
@@ -152,4 +159,16 @@ tr:hover {
152
159
  .drag-and-drop {
153
160
  cursor: move;
154
161
  }
162
+
163
+ .icon-print {
164
+ font-size: 16px;
165
+ cursor: pointer;
166
+ margin-bottom: 5px;
167
+ width: 100px;
168
+ }
169
+
170
+ .title-table-print {
171
+ font-size: 13.8px;
172
+ margin-left: 6px;
173
+ }
155
174
  </style>
@@ -39,7 +39,7 @@
39
39
  :class="convertClass(row[obj.fieldComparison], obj.classCssBody)">
40
40
  {{ row[obj.field] | currency }}
41
41
  </div>
42
- <div v-if="obj.type === 'button'" :style="obj.styleBody"
42
+ <div class="hide-print" v-if="obj.type === 'button'" :style="obj.styleBody"
43
43
  :class="convertClass(row[obj.fieldComparison], obj.classCssBody)">
44
44
  <TableButton v-if="obj.ifFieldEqual == row[obj.field]" :obj="obj" :row="row" />
45
45
  </div>
@@ -171,4 +171,6 @@ export default {
171
171
  .period-rent {
172
172
  cursor: pointer;
173
173
  }
174
+
175
+
174
176
  </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="toggle-container">
3
+ <label class="switch">
4
+ <input type="checkbox" v-model="isDarkMode" @change="toggleTheme">
5
+ <span class="slider round">
6
+ <div class="icon-theme-light" v-if="themeLabel == 'Dark'">
7
+ <i class="fa-solid fa-sun"></i>
8
+ </div>
9
+ <div class="icon-theme-dark" v-if="themeLabel == 'Light'">
10
+ <i class="fa-solid fa-moon"></i>
11
+ </div>
12
+ </span>
13
+ </label>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ export default {
19
+ data() {
20
+ return {
21
+ isDarkMode: false,
22
+ };
23
+ },
24
+ computed: {
25
+ themeLabel() {
26
+ return this.isDarkMode ? 'Dark' : 'Light';
27
+ }
28
+ },
29
+ methods: {
30
+ toggleTheme() {
31
+ if (this.isDarkMode) {
32
+ document.body.classList.add('dark-theme');
33
+ document.body.classList.remove('light-theme');
34
+ } else {
35
+ document.body.classList.add('light-theme');
36
+ document.body.classList.remove('dark-theme');
37
+ }
38
+ },
39
+ },
40
+ mounted() {
41
+ if (localStorage.getItem('theme') === 'dark') {
42
+ this.isDarkMode = true;
43
+ document.body.classList.add('dark-theme');
44
+ document.body.classList.remove('light-theme');
45
+ } else {
46
+ this.isDarkMode = false;
47
+ document.body.classList.add('light-theme');
48
+ document.body.classList.remove('dark-theme');
49
+ }
50
+ },
51
+ watch: {
52
+ isDarkMode(newVal) {
53
+ localStorage.setItem('theme', newVal ? 'dark' : 'light');
54
+ }
55
+ }
56
+ };
57
+ </script>
58
+
59
+ <style scoped>
60
+ .icon-theme-dark {
61
+ margin-left: 26px;
62
+ margin-top: -2px;
63
+ }
64
+
65
+ .icon-theme-light {
66
+ margin-left: 6px;
67
+ margin-top: -3px;
68
+ color: white;
69
+ }
70
+
71
+
72
+ .toggle-container {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 10px;
76
+ }
77
+
78
+ .switch {
79
+ position: relative;
80
+ display: inline-block;
81
+ width: 45px;
82
+ height: 22px;
83
+ }
84
+
85
+ .switch input {
86
+ opacity: 0;
87
+ width: 0;
88
+ height: 0;
89
+ }
90
+
91
+ .slider {
92
+ position: absolute;
93
+ cursor: pointer;
94
+ top: 0;
95
+ left: 0;
96
+ right: 0;
97
+ bottom: 0;
98
+ background-color: #ccc;
99
+ transition: 0.4s;
100
+ border-radius: 34px;
101
+ }
102
+
103
+ .slider:before {
104
+ position: absolute;
105
+ content: "";
106
+ height: 14px;
107
+ width: 14px;
108
+ border-radius: 50%;
109
+ left: 4px;
110
+ bottom: 4px;
111
+ background-color: white;
112
+ transition: 0.4s;
113
+ }
114
+
115
+ input:checked+.slider {
116
+ background-color: #ccc;
117
+ }
118
+
119
+ input:checked+.slider:before {
120
+ transform: translateX(20px);
121
+ }
122
+
123
+ .theme-indicator {
124
+ font-size: 12px;
125
+ font-weight: bold;
126
+ color: #333;
127
+ }
128
+ </style>
@@ -17,6 +17,7 @@ export default {
17
17
  name: undefined,
18
18
  open: false
19
19
  },
20
+ menuCollapsed: true,
20
21
  notifications: [],
21
22
  pagination: [],
22
23
  paginations: { currentPage: 1, totalPerPage: 10 },
@@ -35,6 +36,7 @@ export default {
35
36
  ids: undefined,
36
37
  search: { content: "", filter: { content: "Contém", id: "contains" } },
37
38
  documentHtml: "",
39
+ documentHtmlFinal: "",
38
40
  selectStatic: { dateTime: undefined, tag: undefined, fieldTarget: undefined, value: undefined },
39
41
  tags: [],
40
42
  executedSearch: false,
@@ -258,6 +260,9 @@ export default {
258
260
  state.modal.name = name;
259
261
  state.modal.open = true;
260
262
  },
263
+ toggleMenu: (state, data) => {
264
+ state.menuCollapsed = data;
265
+ },
261
266
  hideModal: (state) => {
262
267
  state.modal.open = false;
263
268
  },
@@ -292,6 +297,9 @@ export default {
292
297
  updateTotalPerPage: (state, value) => {
293
298
  state.paginations.totalPerPage = value.id;
294
299
  },
300
+ updateDocumentHtmlFinal: (state, html) => {
301
+ state.documentHtmlFinal = html;
302
+ },
295
303
  addSelected: (state, selected) => {
296
304
  state.selected = selected;
297
305
  },