@nixweb/nixloc-ui 0.0.169 → 0.0.170

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.169",
3
+ "version": "0.0.170",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -22,7 +22,17 @@ import { mapMutations } from "vuex";
22
22
  export default {
23
23
  components: { Tip },
24
24
  name: "options",
25
- props: ["title", "options", "disabled", "value", "stacked", "markFormDirty"],
25
+ props: {
26
+ title: String,
27
+ options: Array,
28
+ disabled: Boolean,
29
+ stacked: Boolean,
30
+ markFormDirty: {
31
+ type: Boolean,
32
+ default: true,
33
+ },
34
+ value: Number,
35
+ },
26
36
  data() {
27
37
  return {
28
38
  selected: this.value,
@@ -37,7 +47,7 @@ export default {
37
47
  },
38
48
  selected() {
39
49
  this.$emit("input", this.selected);
40
- this.updateFormDirty(true);
50
+ if (this.markFormDirty) this.updateFormDirty(true);
41
51
  if (this.changed) this.changed();
42
52
  },
43
53
  },
@@ -124,6 +124,7 @@ export default {
124
124
  type: Boolean,
125
125
  default: true,
126
126
  },
127
+ clickedNewRegister: Function,
127
128
  titleNewRegister: String,
128
129
  widthNewRegister: Number,
129
130
  heightNewRegister: Number,
@@ -158,6 +159,7 @@ export default {
158
159
  loading: true,
159
160
  notifications: [],
160
161
  formDirty: false,
162
+ names: [],
161
163
  };
162
164
  },
163
165
  created() {
@@ -227,14 +229,18 @@ export default {
227
229
  });
228
230
  },
229
231
  addNewRegister() {
230
- this.openVodal(this.nameNewRegister);
231
- this.resetValidation(this.nameNewRegister);
232
- this.removeNotificarions();
233
- this.$refs.multiselect.deactivate();
234
- this.removeLoading(["addNewRegister"]);
232
+ if (this.clickedNewRegister) {
233
+ this.clickedNewRegister();
234
+ } else {
235
+ this.openVodal(this.nameNewRegister);
236
+ this.resetValidation(this.nameNewRegister);
237
+ this.removeNotificarions();
238
+ this.$refs.multiselect.deactivate();
239
+ this.removeLoading(["addNewRegister"]);
240
+ }
235
241
  },
236
242
  hide() {
237
- this.hideVodal();
243
+ this.hideVodal(this.nameNewRegister);
238
244
  },
239
245
  cleanSelect() {
240
246
  let obj = { id: "", conteudo: "" };
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <div>
3
+ <b-sidebar
4
+ id="my-sidebar"
5
+ :title="title"
6
+ width="90%"
7
+ bg-variant="white"
8
+ no-header
9
+ right
10
+ backdrop-variant="dark"
11
+ @hidden="hideSideBar"
12
+ backdrop
13
+ shadow
14
+ >
15
+ <div class="margin-side-bar">
16
+ <div>
17
+ <Messages />
18
+ <b-row>
19
+ <b-col sm="6">
20
+ <div class="title-side-bar">{{ title }}</div>
21
+ </b-col>
22
+ <b-col sm="6">
23
+ <div class="text-right" @click="hideSideBar">
24
+ <i class="fa-solid fa-circle-xmark icon-side-bar"></i>
25
+ </div>
26
+ </b-col>
27
+ </b-row>
28
+ </div>
29
+ <br />
30
+ <slot></slot>
31
+ </div>
32
+ </b-sidebar>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+ import Messages from "@nixweb/nixloc-ui/src/component/shared/Messages";
38
+ import { mapState, mapMutations } from "vuex";
39
+
40
+ export default {
41
+ name: "SideBar",
42
+ components: {
43
+ Messages,
44
+ },
45
+ props: {
46
+ title: String,
47
+ },
48
+ computed: {
49
+ ...mapState("generic", ["sideBar"]),
50
+ },
51
+ methods: {
52
+ ...mapMutations("generic", ["hideSideBar"]),
53
+ hide() {
54
+ this.$root.$emit("bv::toggle::collapse", "my-sidebar");
55
+ this.hideSideBar();
56
+ },
57
+ },
58
+ watch: {
59
+ sideBar: {
60
+ handler(sideBar) {
61
+ this.$root.$emit("bv::toggle::collapse", "my-sidebar");
62
+ },
63
+ deep: true,
64
+ },
65
+ },
66
+ };
67
+ </script>
68
+ <style>
69
+ .b-sidebar {
70
+ border-radius: 15px 15px 0px 0px !important;
71
+ margin-top: 20px !important;
72
+ margin-right: 5% !important;
73
+ }
74
+
75
+ .b-sidebar > .b-sidebar-body {
76
+ overflow: hidden !important;
77
+ }
78
+
79
+ .title-side-bar {
80
+ font-size: 20px;
81
+ }
82
+
83
+ .icon-side-bar {
84
+ font-size: 30px;
85
+ cursor: pointer;
86
+ }
87
+
88
+ .margin-side-bar {
89
+ margin-top: 20px;
90
+ margin-left: 30px;
91
+ margin-right: 20px;
92
+ }
93
+ </style>
@@ -3,10 +3,13 @@
3
3
  <div
4
4
  v-show="!isLoading('panel')"
5
5
  class="bar side-by-side"
6
- :style="'min-height:' + height + 'px; background-color:' + backgroundColor"
6
+ :style="
7
+ 'min-height:' + height + 'px; background-color:' + backgroundColor
8
+ "
7
9
  :class="{
8
10
  top: position == 'top',
9
11
  footer: position == 'footer',
12
+ none: position == 'none',
10
13
  }"
11
14
  >
12
15
  <div class="size">
@@ -75,6 +78,11 @@ export default {
75
78
  margin: auto;
76
79
  }
77
80
 
81
+ .none {
82
+ left: 0;
83
+ right: 0;
84
+ }
85
+
78
86
  .top {
79
87
  top: 0;
80
88
  left: 0;
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div>
3
3
  <FixedBar
4
- position="footer"
4
+ :position="positionFixedBar"
5
5
  backgroundColor="#FAFAFC"
6
- v-show="formDirty && !modal.open && on"
6
+ v-show="formDirty && !modal.open && on || showFixed"
7
7
  >
8
- <div class="margin">
8
+ <div class="margin" :style="'margin-bottom:' + marginBottom + 'px'">
9
9
  <Button
10
10
  _key="cancelSaveCancel"
11
11
  eventName="cancelSaveCancel"
@@ -16,7 +16,7 @@
16
16
  />
17
17
  <Button
18
18
  _key="saveSaveCancel"
19
- eventName="saveSaveCancel"
19
+ :eventName="eventName"
20
20
  classIcon="fa-solid fa-floppy-disk"
21
21
  title="Salvar"
22
22
  type="success"
@@ -38,6 +38,22 @@ export default {
38
38
  components: { FixedBar, Button },
39
39
  props: {
40
40
  formName: String,
41
+ showFixed: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ eventName: {
46
+ type: String,
47
+ default: "saveSaveCancel",
48
+ },
49
+ positionFixedBar: {
50
+ type: String,
51
+ default: "footer",
52
+ },
53
+ marginBottom: {
54
+ type: Number,
55
+ default: 0,
56
+ },
41
57
  },
42
58
  data() {
43
59
  return {
@@ -70,10 +86,11 @@ export default {
70
86
  },
71
87
  methods: {
72
88
  ...mapMutations("validation", ["updateFormDirty", "resetValidation"]),
73
- ...mapMutations("generic", ["removeLoading"]),
89
+ ...mapMutations("generic", ["removeLoading", "hideSideBar"]),
74
90
  cancel() {
75
91
  this.updateFormDirty(false);
76
92
  this.removeLoading(["cancelSaveCancel"]);
93
+ this.hideSideBar();
77
94
  },
78
95
  },
79
96
  watch: {
@@ -9,6 +9,7 @@
9
9
  :mask="'#####-###'"
10
10
  :maxLength="9"
11
11
  :required="required"
12
+ :markFormDirty="markFormDirty"
12
13
  v-model="address.zipCode"
13
14
  >
14
15
  <div class="glyphicon margin-button">
@@ -29,6 +30,7 @@
29
30
  :formName="formName"
30
31
  :maxLength="150"
31
32
  :required="required"
33
+ :markFormDirty="markFormDirty"
32
34
  v-model="address.street"
33
35
  />
34
36
  </b-col>
@@ -38,6 +40,7 @@
38
40
  field="number"
39
41
  :formName="formName"
40
42
  :maxLength="20"
43
+ :markFormDirty="markFormDirty"
41
44
  v-model="address.number"
42
45
  />
43
46
  </b-col>
@@ -47,6 +50,7 @@
47
50
  field="complement"
48
51
  :formName="formName"
49
52
  :maxLength="50"
53
+ :markFormDirty="markFormDirty"
50
54
  v-model="address.complement"
51
55
  />
52
56
  </b-col>
@@ -60,6 +64,7 @@
60
64
  :formName="formName"
61
65
  :maxLength="100"
62
66
  :required="required"
67
+ :markFormDirty="markFormDirty"
63
68
  v-model="address.province"
64
69
  /> </b-col
65
70
  ><b-col xs="12" sm="12" md="12" lg="5" xl="5">
@@ -69,6 +74,7 @@
69
74
  :formName="formName"
70
75
  :maxLength="100"
71
76
  :required="required"
77
+ :markFormDirty="markFormDirty"
72
78
  v-model="address.city"
73
79
  />
74
80
  </b-col>
@@ -77,6 +83,7 @@
77
83
  title="UF"
78
84
  fieldTarget="uf"
79
85
  :required="required"
86
+ :markFormDirty="markFormDirty"
80
87
  v-model="address.state"
81
88
  :data="states"
82
89
  /> </b-col
@@ -97,6 +104,10 @@ export default {
97
104
  name: "Address",
98
105
  props: {
99
106
  formName: String,
107
+ markFormDirty: {
108
+ type: Boolean,
109
+ default: true,
110
+ },
100
111
  required: {
101
112
  type: Boolean,
102
113
  default: false,
@@ -146,7 +157,11 @@ export default {
146
157
  ...mapGetters("generic", ["event"]),
147
158
  },
148
159
  methods: {
149
- ...mapMutations("generic", ["addEvent", "addNotifications", "removeLoading"]),
160
+ ...mapMutations("generic", [
161
+ "addEvent",
162
+ "addNotifications",
163
+ "removeLoading",
164
+ ]),
150
165
  searchZipCode() {
151
166
  let zipCode = this.address.zipCode.replace(/\.|\-/g, "");
152
167
  let url = `https://viacep.com.br/ws/${zipCode}/json/`;
@@ -163,7 +178,8 @@ export default {
163
178
  this.address.street = data.logradouro;
164
179
  this.address.number = data.complemento;
165
180
  this.address.province = data.bairro;
166
- this.address.city = data.localidade == undefined ? data.municipio : data.localidade;
181
+ this.address.city =
182
+ data.localidade == undefined ? data.municipio : data.localidade;
167
183
  this.address.state = { id: data.uf, content: data.uf };
168
184
  },
169
185
  },
@@ -10,6 +10,10 @@ export default {
10
10
  open: false
11
11
  },
12
12
  vodal: {
13
+ name: [],
14
+ open: false
15
+ },
16
+ sideBar: {
13
17
  name: undefined,
14
18
  open: false
15
19
  },
@@ -49,8 +53,7 @@ export default {
49
53
  return false;
50
54
  },
51
55
  showVodal: (state) => (name) => {
52
- if (name == state.vodal.name) return true;
53
- return false;
56
+ return state.vodal.name.includes(name);
54
57
  },
55
58
  isLoading: (state) => (key) => {
56
59
  var loading = state.loading.find(value => {
@@ -207,12 +210,20 @@ export default {
207
210
  hideModal: (state) => {
208
211
  state.modal.open = false;
209
212
  },
213
+ openSideBar: (state, name) => {
214
+ state.sideBar.name = name;
215
+ state.sideBar.open = true;
216
+ },
217
+ hideSideBar: (state) => {
218
+ state.sideBar.open = false;
219
+ },
210
220
  openVodal: (state, name) => {
211
- state.vodal.name = name;
221
+ state.vodal.name.push(name);
212
222
  state.vodal.open = true;
213
223
  },
214
- hideVodal: (state) => {
215
- state.vodal.name = "";
224
+ hideVodal: (state, name) => {
225
+ let filter = state.vodal.name.filter(x => x != name);
226
+ state.vodal.name = filter;
216
227
  state.vodal.open = false;
217
228
  },
218
229
  updateSearch: (state, value) => {