@bildvitta/quasar-ui-asteroid 3.0.0-beta.7 → 3.0.0

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 (106) hide show
  1. package/dist/api/QasAppBar.json +0 -4
  2. package/dist/api/QasBtn.json +2 -1
  3. package/dist/api/QasCard.json +13 -9
  4. package/dist/api/QasDateTimeInput.json +12 -12
  5. package/dist/api/QasDialog.json +6 -2
  6. package/dist/api/QasFilters.json +4 -4
  7. package/dist/api/QasFormGenerator.json +33 -2
  8. package/dist/api/QasFormView.json +43 -15
  9. package/dist/api/QasGridGenerator.json +5 -4
  10. package/dist/api/QasInput.json +1 -1
  11. package/dist/api/QasListItems.json +18 -17
  12. package/dist/api/QasListView.json +21 -7
  13. package/dist/api/QasNestedFields.json +13 -3
  14. package/dist/api/QasNumericInput.json +10 -10
  15. package/dist/api/QasPasswordInput.json +1 -1
  16. package/dist/api/QasSearchBox.json +85 -3
  17. package/dist/api/QasSelect.json +81 -14
  18. package/dist/api/QasSelectList.json +16 -14
  19. package/dist/api/QasSignaturePad.json +1 -1
  20. package/dist/api/QasSingleView.json +13 -4
  21. package/dist/api/QasTabsGenerator.json +5 -2
  22. package/dist/api/QasUploader.json +5 -0
  23. package/dist/asteroid.cjs.css +1 -1
  24. package/dist/asteroid.cjs.js +1522 -706
  25. package/dist/asteroid.cjs.min.js +2 -2
  26. package/dist/asteroid.esm.css +1 -1
  27. package/dist/asteroid.esm.js +1525 -709
  28. package/dist/asteroid.esm.min.js +2 -2
  29. package/dist/asteroid.umd.css +1 -1
  30. package/dist/asteroid.umd.js +1525 -710
  31. package/dist/asteroid.umd.min.js +2 -2
  32. package/dist/vetur/asteroid-attributes.json +176 -100
  33. package/dist/vetur/asteroid-tags.json +60 -41
  34. package/package.json +1 -1
  35. package/src/components/actions-menu/QasActionsMenu.vue +2 -8
  36. package/src/components/app-bar/QasAppBar.vue +16 -12
  37. package/src/components/app-bar/QasAppBar.yml +0 -4
  38. package/src/components/avatar/QasAvatar.vue +0 -4
  39. package/src/components/btn/QasBtn.vue +5 -8
  40. package/src/components/btn/QasBtn.yml +2 -1
  41. package/src/components/card/QasCard.vue +18 -9
  42. package/src/components/card/QasCard.yml +13 -9
  43. package/src/components/date-time-input/QasDateTimeInput.vue +39 -41
  44. package/src/components/date-time-input/QasDateTimeInput.yml +11 -12
  45. package/src/components/delete/QasDelete.vue +15 -1
  46. package/src/components/dialog/QasDialog.vue +26 -3
  47. package/src/components/dialog/QasDialog.yml +6 -3
  48. package/src/components/dialog-router/QasDialogRouter.vue +1 -1
  49. package/src/components/field/QasField.vue +15 -14
  50. package/src/components/filters/QasFilters.vue +27 -10
  51. package/src/components/filters/QasFilters.yml +4 -4
  52. package/src/components/form-generator/QasFormGenerator.vue +87 -12
  53. package/src/components/form-generator/QasFormGenerator.yml +16 -2
  54. package/src/components/form-view/QasFormView.vue +138 -56
  55. package/src/components/form-view/QasFormView.yml +39 -15
  56. package/src/components/grid-generator/QasGridGenerator.vue +23 -7
  57. package/src/components/grid-generator/QasGridGenerator.yml +5 -4
  58. package/src/components/input/QasInput.vue +37 -21
  59. package/src/components/input/QasInput.yml +1 -1
  60. package/src/components/layout/QasLayout.vue +4 -0
  61. package/src/components/list-items/QasListItems.vue +15 -23
  62. package/src/components/list-items/QasListItems.yml +14 -15
  63. package/src/components/list-view/QasListView.vue +45 -24
  64. package/src/components/list-view/QasListView.yml +19 -7
  65. package/src/components/map/QasMap.vue +5 -5
  66. package/src/components/nested-fields/QasNestedFields.vue +29 -21
  67. package/src/components/nested-fields/QasNestedFields.yml +9 -3
  68. package/src/components/numeric-input/QasNumericInput.vue +14 -14
  69. package/src/components/numeric-input/QasNumericInput.yml +10 -10
  70. package/src/components/page-header/QasPageHeader.vue +14 -11
  71. package/src/components/password-input/QasPasswordInput.vue +17 -16
  72. package/src/components/password-input/QasPasswordInput.yml +1 -1
  73. package/src/components/profile/QasProfile.vue +1 -1
  74. package/src/components/search-box/QasSearchBox.vue +138 -42
  75. package/src/components/search-box/QasSearchBox.yml +69 -2
  76. package/src/components/select/QasSelect.vue +63 -53
  77. package/src/components/select/QasSelect.yml +64 -13
  78. package/src/components/select-list/QasSelectList.vue +11 -27
  79. package/src/components/select-list/QasSelectList.yml +13 -14
  80. package/src/components/signature-pad/QasSignaturePad.yml +1 -1
  81. package/src/components/signature-uploader/QasSignatureUploader.vue +7 -5
  82. package/src/components/single-view/QasSingleView.vue +22 -6
  83. package/src/components/single-view/QasSingleView.yml +11 -4
  84. package/src/components/table-generator/QasTableGenerator.vue +13 -2
  85. package/src/components/tabs-generator/QasTabsGenerator.vue +2 -2
  86. package/src/components/tabs-generator/QasTabsGenerator.yml +2 -2
  87. package/src/components/text-truncate/QasTextTruncate.vue +1 -1
  88. package/src/components/uploader/QasUploader.vue +62 -15
  89. package/src/components/uploader/QasUploader.yml +5 -0
  90. package/src/helpers/camelize-fields-name.js +15 -0
  91. package/src/helpers/filters.js +2 -0
  92. package/src/helpers/get-normalized-options.js +20 -0
  93. package/src/helpers/handle-process.js +13 -0
  94. package/src/helpers/index.js +3 -0
  95. package/src/mixins/generator.js +10 -2
  96. package/src/mixins/index.js +2 -0
  97. package/src/mixins/search-filter.js +227 -0
  98. package/src/mixins/view.js +35 -13
  99. package/src/pages/Forbidden.vue +3 -1
  100. package/src/pages/NotFound.vue +3 -1
  101. package/src/pages/ServerError.vue +3 -1
  102. package/src/pages/Unauthorized.vue +28 -0
  103. package/src/plugins/index.js +4 -2
  104. package/src/plugins/logger/Logger.js +44 -0
  105. package/src/plugins/logger/Logger.yml +9 -0
  106. package/src/vue-plugin.js +6 -3
@@ -1,18 +1,19 @@
1
1
  /*!
2
- * @bildvitta/quasar-ui-asteroid v3.0.0-beta.7
2
+ * @bildvitta/quasar-ui-asteroid v3.0.0
3
3
  * (c) 2022 Bild & Vitta <systemteam@bild.com.br>
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, resolveComponent, createBlock, mergeProps, createSlots, withCtx, renderList, normalizeProps, guardReactiveProps, createVNode, Fragment, toDisplayString, createCommentVNode, resolveDynamicComponent, createTextVNode, resolveDirective, withDirectives, reactive, computed, markRaw, vShow, normalizeStyle, withModifiers, TransitionGroup } from 'vue';
7
- import { camelize, camelizeKeys } from 'humps';
7
+ import { camelize, camelizeKeys, decamelize } from 'humps';
8
8
  import { parseISO, format, isMatch } from 'date-fns';
9
9
  import { ptBR } from 'date-fns/locale';
10
- import { copyToClipboard, date as date$1, Dialog as Dialog$1, Notify, Screen as Screen$1, Platform, Loading, extend, uid, Quasar } from 'quasar';
10
+ import { copyToClipboard, date as date$1, Dialog as Dialog$1, Notify, Screen as Screen$1, Platform, Loading, extend, uid, createMetaMixin, QInfiniteScroll, Quasar } from 'quasar';
11
11
  import { findLastIndex, isEqual, isEqualWith, isObject, castArray, sortBy } from 'lodash-es';
12
12
  import AutoNumeric from 'autonumeric';
13
13
  import Pica from 'pica';
14
14
  import SignaturePad from 'signature_pad';
15
15
  import { onBeforeRouteLeave } from 'vue-router';
16
+ import { isEqual as isEqual$1 } from 'lodash';
16
17
  import Fuse from 'fuse.js';
17
18
  import Sortable from 'sortablejs';
18
19
  import VueGoogleMaps from '@fawmi/vue-google-maps';
@@ -45,14 +46,14 @@ var script$L = {
45
46
  }
46
47
  };
47
48
 
48
- const _hoisted_1$s = { class: "col-12 col-sm-auto" };
49
+ const _hoisted_1$t = { class: "col-12 col-sm-auto" };
49
50
  const _hoisted_2$l = { class: "col-12 col-sm-auto" };
50
51
 
51
52
  function render$L(_ctx, _cache, $props, $setup, $data, $options) {
52
53
  return (openBlock(), createElementBlock("div", {
53
54
  class: normalizeClass($options.classes)
54
55
  }, [
55
- createElementVNode("div", _hoisted_1$s, [
56
+ createElementVNode("div", _hoisted_1$t, [
56
57
  renderSlot(_ctx.$slots, "secondary")
57
58
  ]),
58
59
  createElementVNode("div", _hoisted_2$l, [
@@ -68,13 +69,14 @@ var script$K = {
68
69
  name: 'QasBtn',
69
70
 
70
71
  props: {
71
- hideLabelOnSmallScreen: {
72
+ useLabelOnSmallScreen: {
73
+ default: true,
72
74
  type: Boolean
73
75
  },
74
76
 
75
77
  label: {
76
- type: String,
77
- default: ''
78
+ default: '',
79
+ type: String
78
80
  }
79
81
  },
80
82
 
@@ -86,12 +88,8 @@ var script$K = {
86
88
  }
87
89
  },
88
90
 
89
- hasLabel () {
90
- return !!this.label
91
- },
92
-
93
91
  showLabel () {
94
- return this.hasLabel && !(this.hideLabelOnSmallScreen && this.$qas.screen.isSmall)
92
+ return this.useLabelOnSmallScreen || !this.$qas.screen.isSmall
95
93
  },
96
94
 
97
95
  slots () {
@@ -167,8 +165,6 @@ var script$J = {
167
165
  }
168
166
  },
169
167
 
170
- emits: ['delete-success'],
171
-
172
168
  computed: {
173
169
  hasDelete () {
174
170
  return !!Object.keys(this.deleteProps).length
@@ -181,15 +177,11 @@ var script$J = {
181
177
  const { handler, ...filtered } = item;
182
178
  item.handler(filtered);
183
179
  }
184
- },
185
-
186
- onDeleteSuccess () {
187
- this.$emit('delete-success');
188
180
  }
189
181
  }
190
182
  };
191
183
 
192
- const _hoisted_1$r = { class: "flex items-center justify-center q-gutter-x-md" };
184
+ const _hoisted_1$s = { class: "flex items-center justify-center q-gutter-x-md" };
193
185
  const _hoisted_2$k = { class: "flex items-center justify-center q-gutter-x-sm" };
194
186
 
195
187
  function render$J(_ctx, _cache, $props, $setup, $data, $options) {
@@ -204,11 +196,11 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
204
196
  return (openBlock(), createBlock(_component_qas_btn, {
205
197
  class: "qas-actions-menu",
206
198
  color: "primary",
207
- "hide-label-on-small-screen": "",
208
199
  icon: $props.icon,
209
200
  label: $props.label,
210
201
  outline: "",
211
- padding: "md"
202
+ padding: "md",
203
+ "use-label-on-small-screen": ""
212
204
  }, {
213
205
  default: withCtx(() => [
214
206
  createVNode(_component_q_menu, { class: "qas-actions-menu__menu" }, {
@@ -230,7 +222,7 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
230
222
  default: withCtx(() => [
231
223
  createVNode(_component_q_item_section, null, {
232
224
  default: withCtx(() => [
233
- createElementVNode("div", _hoisted_1$r, [
225
+ createElementVNode("div", _hoisted_1$s, [
234
226
  createVNode(_component_q_icon, {
235
227
  name: item.icon,
236
228
  size: "sm"
@@ -249,8 +241,7 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
249
241
  ? (openBlock(), createBlock(_component_qas_delete, mergeProps({ key: 0 }, $props.deleteProps, {
250
242
  class: "text-negative",
251
243
  clickable: "",
252
- tag: "q-item",
253
- onSuccess: $options.onDeleteSuccess
244
+ tag: "q-item"
254
245
  }), {
255
246
  default: withCtx(() => [
256
247
  createVNode(_component_q_item_section, null, {
@@ -267,7 +258,7 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) {
267
258
  })
268
259
  ]),
269
260
  _: 1 /* STABLE */
270
- }, 16 /* FULL_PROPS */, ["onSuccess"]))
261
+ }, 16 /* FULL_PROPS */))
271
262
  : createCommentVNode("v-if", true)
272
263
  ]),
273
264
  _: 3 /* FORWARDED */
@@ -471,6 +462,41 @@ function getGreatestCommonDivisor (first, second) {
471
462
  return first
472
463
  }
473
464
 
465
+ function camelizeFieldsName (fields) {
466
+ for (const field in fields) {
467
+ const currentField = fields[field];
468
+
469
+ currentField.name = camelize(currentField.name);
470
+
471
+ if (Object.keys(currentField.children || {}).length) {
472
+ camelizeFieldsName(currentField.children);
473
+ }
474
+ }
475
+
476
+ return fields
477
+ }
478
+
479
+ /**
480
+ * param {options: object[], label: string, value: string} object
481
+ *
482
+ * @example getNormalizedOptions({
483
+ * options: [{ name: 'Test 1', uuid: '1' }, { name: 'Test 2', uuid: '2' }],
484
+ * label: 'name'
485
+ * value: 'uuid'
486
+ * }) // retorna [{ label: 'Test 1', value: '1' }, { label: 'Test 2', value: '2' }]
487
+ */
488
+ var getNormalizedOptions = ({ options = [], label, value }) => {
489
+ return options.map(option => {
490
+ const { [label]: labelKey, [value]: valueKey, ...payload } = option;
491
+
492
+ return {
493
+ label: option[label],
494
+ value: option[value],
495
+ ...payload
496
+ }
497
+ })
498
+ };
499
+
474
500
  // Private
475
501
  function __format (value, token, options = {}) {
476
502
  if (!value) {
@@ -568,6 +594,8 @@ function humanize (field = {}, value) {
568
594
  case 'time': return time(value)
569
595
  case 'radio': return selectLabel(field.options, value)
570
596
  case 'percent': return formatPercent(value)
597
+ case 'money': return money(value)
598
+ case 'decimal': return decimal(value)
571
599
  default: return value
572
600
  }
573
601
  }
@@ -721,7 +749,7 @@ var script$H = {
721
749
  }
722
750
  };
723
751
 
724
- const _hoisted_1$q = { class: "q-gutter-md q-mr-lg" };
752
+ const _hoisted_1$r = { class: "q-gutter-md q-mr-lg" };
725
753
  const _hoisted_2$j = {
726
754
  key: 0,
727
755
  class: "text-bold text-h5"
@@ -745,7 +773,7 @@ function render$H(_ctx, _cache, $props, $setup, $data, $options) {
745
773
  rounded: "",
746
774
  onClick: $options.close
747
775
  }, null, 8 /* PROPS */, ["color", "onClick"]),
748
- createElementVNode("div", _hoisted_1$q, [
776
+ createElementVNode("div", _hoisted_1$r, [
749
777
  renderSlot(_ctx.$slots, "header", {}, () => [
750
778
  ($props.title)
751
779
  ? (openBlock(), createElementBlock("h5", _hoisted_2$j, toDisplayString($props.title), 1 /* TEXT */))
@@ -812,20 +840,16 @@ var script$G = {
812
840
  }
813
841
 
814
842
  const contrastColor = this.color ? this.color : this.contrastColor;
815
- // const contrastColor = this.textColor ? this.textColor : this.contrastColor
816
843
 
817
844
  return [
818
845
  this.dark
819
846
  ? `bg-${this.textColor} text-${contrastColor}`
820
847
  : `bg-${contrastColor} text-${this.textColor}`
821
- // ? `bg-${this.color} text-${contrastColor}`
822
- // : `bg-${contrastColor} text-${this.color}`
823
848
  ]
824
849
  },
825
850
 
826
851
  contrastColor () {
827
852
  return `${this.textColor}-contrast`
828
- // return `${this.color}-contrast`
829
853
  },
830
854
 
831
855
  firstLetter () {
@@ -904,10 +928,6 @@ var script$F = {
904
928
  type: String
905
929
  },
906
930
 
907
- isAuth: {
908
- type: Boolean
909
- },
910
-
911
931
  title: {
912
932
  type: String,
913
933
  default: ''
@@ -962,6 +982,14 @@ var script$F = {
962
982
 
963
983
  showTitle () {
964
984
  return this.title && !this.brand
985
+ },
986
+
987
+ hasUser () {
988
+ return !!Object.keys(this.user).length
989
+ },
990
+
991
+ userName () {
992
+ return this.user.name || this.user.givenName
965
993
  }
966
994
  },
967
995
 
@@ -984,7 +1012,7 @@ var script$F = {
984
1012
  }
985
1013
  };
986
1014
 
987
- const _hoisted_1$p = ["alt", "src"];
1015
+ const _hoisted_1$q = ["alt", "src"];
988
1016
  const _hoisted_2$i = {
989
1017
  key: 1,
990
1018
  class: "text-bold text-grey-9 text-subtitle1 text-uppercase"
@@ -1007,11 +1035,10 @@ const _hoisted_14$1 = { class: "q-mt-sm" };
1007
1035
 
1008
1036
  function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1009
1037
  const _component_q_ajax_bar = resolveComponent("q-ajax-bar");
1010
- const _component_q_btn = resolveComponent("q-btn");
1038
+ const _component_qas_btn = resolveComponent("qas-btn");
1011
1039
  const _component_q_badge = resolveComponent("q-badge");
1012
1040
  const _component_q_toolbar_title = resolveComponent("q-toolbar-title");
1013
1041
  const _component_qas_avatar = resolveComponent("qas-avatar");
1014
- const _component_qas_btn = resolveComponent("qas-btn");
1015
1042
  const _component_q_menu = resolveComponent("q-menu");
1016
1043
  const _component_q_toolbar = resolveComponent("q-toolbar");
1017
1044
  const _component_q_header = resolveComponent("q-header");
@@ -1032,7 +1059,7 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1032
1059
  position: "top",
1033
1060
  size: "2px"
1034
1061
  }),
1035
- createVNode(_component_q_btn, {
1062
+ createVNode(_component_qas_btn, {
1036
1063
  color: "grey-7",
1037
1064
  dense: "",
1038
1065
  flat: "",
@@ -1052,7 +1079,7 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1052
1079
  alt: $props.title,
1053
1080
  class: "q-mr-sm qas-app-bar__brand",
1054
1081
  src: $props.brand
1055
- }, null, 8 /* PROPS */, _hoisted_1$p))
1082
+ }, null, 8 /* PROPS */, _hoisted_1$q))
1056
1083
  : createCommentVNode("v-if", true),
1057
1084
  ($options.showTitle)
1058
1085
  ? (openBlock(), createElementBlock("span", _hoisted_2$i, toDisplayString($props.title), 1 /* TEXT */))
@@ -1072,7 +1099,7 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1072
1099
  }),
1073
1100
  ($options.hasNotifications)
1074
1101
  ? (openBlock(), createElementBlock("div", _hoisted_3$e, [
1075
- createVNode(_component_q_btn, {
1102
+ createVNode(_component_qas_btn, {
1076
1103
  class: "q-mr-md",
1077
1104
  dense: "",
1078
1105
  icon: "o_notifications",
@@ -1099,11 +1126,11 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1099
1126
  : createCommentVNode("v-if", true),
1100
1127
  createElementVNode("div", _hoisted_4$a, [
1101
1128
  renderSlot(_ctx.$slots, "tools"),
1102
- ($props.isAuth)
1129
+ ($options.hasUser)
1103
1130
  ? (openBlock(), createElementBlock("div", {
1104
1131
  key: 0,
1105
1132
  class: "cursor-pointer items-center q-mr-sm qas-app-bar__user rounded-borders row text-grey-9",
1106
- title: $props.user.name || $props.user.givenName
1133
+ title: $options.userName
1107
1134
  }, [
1108
1135
  createVNode(_component_qas_avatar, {
1109
1136
  class: "rounded-borders-left",
@@ -1113,10 +1140,10 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1113
1140
  rounded: "",
1114
1141
  size: "42px",
1115
1142
  "text-color": "primary",
1116
- title: $props.user.name || $props.user.givenName
1143
+ title: $options.userName
1117
1144
  }, null, 8 /* PROPS */, ["image", "title"]),
1118
1145
  createElementVNode("div", _hoisted_6$4, [
1119
- createElementVNode("div", _hoisted_7$4, toDisplayString($props.user.name || $props.user.givenName), 1 /* TEXT */),
1146
+ createElementVNode("div", _hoisted_7$4, toDisplayString($options.userName), 1 /* TEXT */),
1120
1147
  createElementVNode("div", _hoisted_8$3, toDisplayString($props.user.email), 1 /* TEXT */)
1121
1148
  ]),
1122
1149
  createVNode(_component_q_menu, {
@@ -1136,10 +1163,10 @@ function render$F(_ctx, _cache, $props, $setup, $data, $options) {
1136
1163
  createVNode(_component_qas_avatar, {
1137
1164
  image: $props.user.photo,
1138
1165
  size: "145px",
1139
- title: $props.user.name || $props.user.givenName
1166
+ title: $options.userName
1140
1167
  }, null, 8 /* PROPS */, ["image", "title"])
1141
1168
  ]),
1142
- createElementVNode("div", _hoisted_11$1, toDisplayString($props.user.name || $props.user.givenName), 1 /* TEXT */),
1169
+ createElementVNode("div", _hoisted_11$1, toDisplayString($options.userName), 1 /* TEXT */),
1143
1170
  createElementVNode("div", _hoisted_12$1, toDisplayString($props.user.email), 1 /* TEXT */),
1144
1171
  createElementVNode("div", _hoisted_13$1, [
1145
1172
  createVNode(_component_qas_btn, {
@@ -1318,7 +1345,7 @@ var script$E = {
1318
1345
  }
1319
1346
  };
1320
1347
 
1321
- const _hoisted_1$o = { class: "column flex full-height justify-between no-wrap overflow-x-hidden" };
1348
+ const _hoisted_1$p = { class: "column flex full-height justify-between no-wrap overflow-x-hidden" };
1322
1349
  const _hoisted_2$h = {
1323
1350
  key: 0,
1324
1351
  class: "q-ma-md"
@@ -1351,7 +1378,7 @@ function render$E(_ctx, _cache, $props, $setup, $data, $options) {
1351
1378
  onMiniState: $options.setMiniState
1352
1379
  }, {
1353
1380
  default: withCtx(() => [
1354
- createElementVNode("div", _hoisted_1$o, [
1381
+ createElementVNode("div", _hoisted_1$p, [
1355
1382
  createElementVNode("div", null, [
1356
1383
  ($options.displayModuleSection)
1357
1384
  ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
@@ -1528,15 +1555,11 @@ var script$C = {
1528
1555
  name: 'QasCard',
1529
1556
 
1530
1557
  props: {
1531
- bgImagePosition: {
1558
+ imagePosition: {
1532
1559
  type: String,
1533
1560
  default: 'center'
1534
1561
  },
1535
1562
 
1536
- formMode: {
1537
- type: Boolean
1538
- },
1539
-
1540
1563
  gutter: {
1541
1564
  type: String,
1542
1565
  default: 'sm'
@@ -1547,6 +1570,14 @@ var script$C = {
1547
1570
  type: Array
1548
1571
  },
1549
1572
 
1573
+ outlined: {
1574
+ type: Boolean
1575
+ },
1576
+
1577
+ unelevated: {
1578
+ type: Boolean
1579
+ },
1580
+
1550
1581
  useHeader: {
1551
1582
  type: Boolean
1552
1583
  }
@@ -1559,12 +1590,17 @@ var script$C = {
1559
1590
  },
1560
1591
 
1561
1592
  computed: {
1562
- bgImagePositionClass () {
1563
- return `bg-position-${this.bgImagePosition}`
1593
+ imagePositionClass () {
1594
+ return `bg-position-${this.imagePosition}`
1564
1595
  },
1565
1596
 
1566
1597
  cardClasses () {
1567
- return this.formMode ? 'bg-white border-primary no-shadow' : 'shadow-14'
1598
+ return {
1599
+ 'shadow-14': !this.unelevated,
1600
+ 'border-primary': this.outlined,
1601
+ 'no-shadow': this.outlined,
1602
+ 'bg-white': this.outlined
1603
+ }
1568
1604
  },
1569
1605
 
1570
1606
  gutterClass () {
@@ -1595,7 +1631,7 @@ var script$C = {
1595
1631
  }
1596
1632
  };
1597
1633
 
1598
- const _hoisted_1$n = { class: "col-12 col-lg-3 col-md-4 col-sm-6" };
1634
+ const _hoisted_1$o = { class: "col-12 col-lg-3 col-md-4 col-sm-6" };
1599
1635
  const _hoisted_2$g = {
1600
1636
  key: 0,
1601
1637
  class: "overflow-hidden relative-position w-full"
@@ -1613,7 +1649,7 @@ function render$C(_ctx, _cache, $props, $setup, $data, $options) {
1613
1649
  const _component_q_card_section = resolveComponent("q-card-section");
1614
1650
  const _component_q_card = resolveComponent("q-card");
1615
1651
 
1616
- return (openBlock(), createElementBlock("div", _hoisted_1$n, [
1652
+ return (openBlock(), createElementBlock("div", _hoisted_1$o, [
1617
1653
  createVNode(_component_q_card, {
1618
1654
  class: normalizeClass(["border-radius-lg column full-height overflow-hidden", $options.cardClasses])
1619
1655
  }, {
@@ -1647,7 +1683,7 @@ function render$C(_ctx, _cache, $props, $setup, $data, $options) {
1647
1683
  (openBlock(true), createElementBlock(Fragment, null, renderList($options.imagesList, (item, index) => {
1648
1684
  return (openBlock(), createBlock(_component_q_carousel_slide, {
1649
1685
  key: index,
1650
- class: normalizeClass(["bg-no-repeat", $options.bgImagePositionClass]),
1686
+ class: normalizeClass(["bg-no-repeat", $options.imagePositionClass]),
1651
1687
  "img-src": item,
1652
1688
  name: index
1653
1689
  }, null, 8 /* PROPS */, ["class", "img-src", "name"]))
@@ -1876,7 +1912,7 @@ var script$A = {
1876
1912
  }
1877
1913
  };
1878
1914
 
1879
- const _hoisted_1$m = /*#__PURE__*/createTextVNode("Copiar");
1915
+ const _hoisted_1$n = /*#__PURE__*/createTextVNode("Copiar");
1880
1916
 
1881
1917
  function render$A(_ctx, _cache, $props, $setup, $data, $options) {
1882
1918
  const _component_q_tooltip = resolveComponent("q-tooltip");
@@ -1899,7 +1935,7 @@ function render$A(_ctx, _cache, $props, $setup, $data, $options) {
1899
1935
  default: withCtx(() => [
1900
1936
  createVNode(_component_q_tooltip, null, {
1901
1937
  default: withCtx(() => [
1902
- _hoisted_1$m
1938
+ _hoisted_1$n
1903
1939
  ]),
1904
1940
  _: 1 /* STABLE */
1905
1941
  })
@@ -1923,33 +1959,33 @@ var script$z = {
1923
1959
  type: String
1924
1960
  },
1925
1961
 
1926
- dateOnly: {
1927
- type: Boolean
1928
- },
1929
-
1930
1962
  dateProps: {
1931
1963
  default: () => ({}),
1932
1964
  type: Object
1933
1965
  },
1934
1966
 
1935
- gmt: {
1936
- type: Boolean
1937
- },
1938
-
1939
1967
  timeMask: {
1940
1968
  default: 'HH:mm',
1941
1969
  type: String
1942
1970
  },
1943
1971
 
1944
- timeOnly: {
1945
- type: Boolean
1946
- },
1947
-
1948
1972
  timeProps: {
1949
1973
  default: () => ({}),
1950
1974
  type: Object
1951
1975
  },
1952
1976
 
1977
+ useIso: {
1978
+ type: Boolean
1979
+ },
1980
+
1981
+ useTimeOnly: {
1982
+ type: Boolean
1983
+ },
1984
+
1985
+ useDateOnly: {
1986
+ type: Boolean
1987
+ },
1988
+
1953
1989
  modelValue: {
1954
1990
  default: '',
1955
1991
  type: String
@@ -1986,16 +2022,16 @@ var script$z = {
1986
2022
  maskDate () {
1987
2023
  const mask = [];
1988
2024
 
1989
- if (!this.timeOnly) { mask.push(this.dateMask); }
1990
- if (!this.dateOnly) { mask.push(this.timeMask); }
2025
+ if (!this.useTimeOnly) { mask.push(this.dateMask); }
2026
+ if (!this.useDateOnly) { mask.push(this.timeMask); }
1991
2027
 
1992
2028
  return mask.join(' ')
1993
2029
  }
1994
2030
  },
1995
2031
 
1996
2032
  watch: {
1997
- value (current, original) {
1998
- if (!current || this.timeOnly) {
2033
+ modelValue (current, original) {
2034
+ if (!current || this.useTimeOnly) {
1999
2035
  this.currentValue = current;
2000
2036
  return
2001
2037
  }
@@ -2021,18 +2057,18 @@ var script$z = {
2021
2057
 
2022
2058
  updateModelValue (value) {
2023
2059
  this.currentValue = value;
2024
- const valueLength = value.replace(/_/g, '').length;
2060
+ const valueLength = value?.replace?.(/_/g, '')?.length;
2025
2061
 
2026
2062
  if (value === '' || valueLength === this.mask.length) {
2027
- this.lastValue = this.timeOnly ? value : this.toISOString(value);
2063
+ this.lastValue = this.useTimeOnly ? value : this.toISOString(value);
2028
2064
  this.$emit('update:modelValue', this.lastValue);
2029
2065
  }
2030
2066
 
2031
- if (this.dateOnly) {
2067
+ if (this.useDateOnly) {
2032
2068
  this.$refs.dateProxy.hide();
2033
2069
  }
2034
2070
 
2035
- if (this.timeOnly) {
2071
+ if (this.useTimeOnly) {
2036
2072
  this.$refs.timeProxy.hide();
2037
2073
  }
2038
2074
  },
@@ -2042,11 +2078,11 @@ var script$z = {
2042
2078
  return ''
2043
2079
  }
2044
2080
 
2045
- if (this.dateOnly && !this.gmt) {
2081
+ if (this.useDateOnly && !this.useIso) {
2046
2082
  return date(date$1.extractDate(value, this.maskDate), 'yyyy-MM-dd')
2047
2083
  }
2048
2084
 
2049
- if (this.timeOnly && !this.gmt) {
2085
+ if (this.useTimeOnly && !this.useIso) {
2050
2086
  return date$1.extractDate(value, 'HH:MM')
2051
2087
  }
2052
2088
 
@@ -2054,14 +2090,14 @@ var script$z = {
2054
2090
  },
2055
2091
 
2056
2092
  toMask (value) {
2057
- if (!value || this.timeOnly) {
2093
+ if (!value || this.useTimeOnly) {
2058
2094
  return value || ''
2059
2095
  }
2060
2096
 
2061
2097
  const newDate = new Date(value).toISOString();
2062
2098
 
2063
2099
  return date$1.formatDate(
2064
- this.dateOnly ? newDate.slice(0, 23) : newDate,
2100
+ this.useDateOnly ? newDate.slice(0, 23) : newDate,
2065
2101
  this.maskDate
2066
2102
  )
2067
2103
  }
@@ -2075,75 +2111,73 @@ function render$z(_ctx, _cache, $props, $setup, $data, $options) {
2075
2111
  const _component_q_time = resolveComponent("q-time");
2076
2112
  const _component_qas_input = resolveComponent("qas-input");
2077
2113
 
2078
- return (openBlock(), createElementBlock("div", null, [
2079
- createVNode(_component_qas_input, mergeProps({ ref: "input" }, $options.attributes, {
2080
- modelValue: $data.currentValue,
2081
- "onUpdate:modelValue": [
2082
- _cache[2] || (_cache[2] = $event => (($data.currentValue) = $event)),
2083
- $options.updateModelValue
2084
- ],
2085
- "unmasked-value": false
2086
- }), {
2087
- append: withCtx(() => [
2088
- (!$props.timeOnly)
2089
- ? (openBlock(), createBlock(_component_q_icon, {
2090
- key: 0,
2091
- class: "cursor-pointer",
2092
- name: "o_event"
2093
- }, {
2094
- default: withCtx(() => [
2095
- createVNode(_component_q_popup_proxy, {
2096
- ref: "dateProxy",
2097
- "transition-hide": "scale",
2098
- "transition-show": "scale"
2099
- }, {
2100
- default: withCtx(() => [
2101
- createVNode(_component_q_date, mergeProps({
2102
- modelValue: $data.currentValue,
2103
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.currentValue) = $event))
2104
- }, $props.dateProps, {
2105
- mask: $options.maskDate,
2106
- "onUpdate:modelValue": $options.updateModelValue
2107
- }), null, 16 /* FULL_PROPS */, ["modelValue", "mask", "onUpdate:modelValue"])
2108
- ]),
2109
- _: 1 /* STABLE */
2110
- }, 512 /* NEED_PATCH */)
2111
- ]),
2112
- _: 1 /* STABLE */
2113
- }))
2114
- : createCommentVNode("v-if", true),
2115
- (!$props.dateOnly)
2116
- ? (openBlock(), createBlock(_component_q_icon, {
2117
- key: 1,
2118
- class: "cursor-pointer q-ml-md",
2119
- name: "o_access_time"
2120
- }, {
2121
- default: withCtx(() => [
2122
- createVNode(_component_q_popup_proxy, {
2123
- ref: "timeProxy",
2124
- "transition-hide": "scale",
2125
- "transition-show": "scale"
2126
- }, {
2127
- default: withCtx(() => [
2128
- createVNode(_component_q_time, mergeProps({
2129
- modelValue: $data.currentValue,
2130
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.currentValue) = $event))
2131
- }, $props.timeProps, {
2132
- format24h: "",
2133
- mask: $options.maskDate,
2134
- "onUpdate:modelValue": $options.updateModelValue
2135
- }), null, 16 /* FULL_PROPS */, ["modelValue", "mask", "onUpdate:modelValue"])
2136
- ]),
2137
- _: 1 /* STABLE */
2138
- }, 512 /* NEED_PATCH */)
2139
- ]),
2140
- _: 1 /* STABLE */
2141
- }))
2142
- : createCommentVNode("v-if", true)
2143
- ]),
2144
- _: 1 /* STABLE */
2145
- }, 16 /* FULL_PROPS */, ["modelValue", "onUpdate:modelValue"])
2146
- ]))
2114
+ return (openBlock(), createBlock(_component_qas_input, mergeProps({ ref: "input" }, $options.attributes, {
2115
+ modelValue: $data.currentValue,
2116
+ "onUpdate:modelValue": [
2117
+ _cache[2] || (_cache[2] = $event => (($data.currentValue) = $event)),
2118
+ $options.updateModelValue
2119
+ ],
2120
+ "unmasked-value": false
2121
+ }), {
2122
+ append: withCtx(() => [
2123
+ (!$props.useTimeOnly)
2124
+ ? (openBlock(), createBlock(_component_q_icon, {
2125
+ key: 0,
2126
+ class: "cursor-pointer",
2127
+ name: "o_event"
2128
+ }, {
2129
+ default: withCtx(() => [
2130
+ createVNode(_component_q_popup_proxy, {
2131
+ ref: "dateProxy",
2132
+ "transition-hide": "scale",
2133
+ "transition-show": "scale"
2134
+ }, {
2135
+ default: withCtx(() => [
2136
+ createVNode(_component_q_date, mergeProps({
2137
+ modelValue: $data.currentValue,
2138
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.currentValue) = $event))
2139
+ }, $props.dateProps, {
2140
+ mask: $options.maskDate,
2141
+ "onUpdate:modelValue": $options.updateModelValue
2142
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "mask", "onUpdate:modelValue"])
2143
+ ]),
2144
+ _: 1 /* STABLE */
2145
+ }, 512 /* NEED_PATCH */)
2146
+ ]),
2147
+ _: 1 /* STABLE */
2148
+ }))
2149
+ : createCommentVNode("v-if", true),
2150
+ (!$props.useDateOnly)
2151
+ ? (openBlock(), createBlock(_component_q_icon, {
2152
+ key: 1,
2153
+ class: "cursor-pointer q-ml-md",
2154
+ name: "o_access_time"
2155
+ }, {
2156
+ default: withCtx(() => [
2157
+ createVNode(_component_q_popup_proxy, {
2158
+ ref: "timeProxy",
2159
+ "transition-hide": "scale",
2160
+ "transition-show": "scale"
2161
+ }, {
2162
+ default: withCtx(() => [
2163
+ createVNode(_component_q_time, mergeProps({
2164
+ modelValue: $data.currentValue,
2165
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.currentValue) = $event))
2166
+ }, $props.timeProps, {
2167
+ format24h: "",
2168
+ mask: $options.maskDate,
2169
+ "onUpdate:modelValue": $options.updateModelValue
2170
+ }), null, 16 /* FULL_PROPS */, ["modelValue", "mask", "onUpdate:modelValue"])
2171
+ ]),
2172
+ _: 1 /* STABLE */
2173
+ }, 512 /* NEED_PATCH */)
2174
+ ]),
2175
+ _: 1 /* STABLE */
2176
+ }))
2177
+ : createCommentVNode("v-if", true)
2178
+ ]),
2179
+ _: 1 /* STABLE */
2180
+ }, 16 /* FULL_PROPS */, ["modelValue", "onUpdate:modelValue"]))
2147
2181
  }
2148
2182
 
2149
2183
  script$z.render = render$z;
@@ -2161,12 +2195,12 @@ var script$y = {
2161
2195
  }
2162
2196
  };
2163
2197
 
2164
- const _hoisted_1$l = { class: "bg-grey-3 q-my-md q-pa-md rounded-borders" };
2198
+ const _hoisted_1$m = { class: "bg-grey-3 q-my-md q-pa-md rounded-borders" };
2165
2199
  const _hoisted_2$f = /*#__PURE__*/createElementVNode("summary", null, "Debugger", -1 /* HOISTED */);
2166
2200
  const _hoisted_3$b = { class: "row" };
2167
2201
 
2168
2202
  function render$y(_ctx, _cache, $props, $setup, $data, $options) {
2169
- return (openBlock(), createElementBlock("details", _hoisted_1$l, [
2203
+ return (openBlock(), createElementBlock("details", _hoisted_1$m, [
2170
2204
  _hoisted_2$f,
2171
2205
  createElementVNode("div", _hoisted_3$b, [
2172
2206
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.inspect, (item, index) => {
@@ -2244,7 +2278,11 @@ var script$x = {
2244
2278
  type: Boolean
2245
2279
  },
2246
2280
 
2247
- useCloseIcon: {
2281
+ useCloseButton: {
2282
+ type: Boolean
2283
+ },
2284
+
2285
+ useValidationAllAtOnce: {
2248
2286
  type: Boolean
2249
2287
  }
2250
2288
  },
@@ -2292,7 +2330,26 @@ var script$x = {
2292
2330
 
2293
2331
  methods: {
2294
2332
  async submitHandler () {
2295
- this.useForm && this.$emit('validate', await this.$refs.form.validate());
2333
+ if (!this.useForm) return
2334
+
2335
+ if (this.useValidationAllAtOnce) {
2336
+ let isAllComponentValid = true;
2337
+ const components = this.$refs.form.getValidationComponents() || [];
2338
+
2339
+ for (const component of components) {
2340
+ const isValid = component?.validate?.();
2341
+
2342
+ if (!isValid) {
2343
+ isAllComponentValid = false;
2344
+ }
2345
+ }
2346
+
2347
+ this.$emit('validate', isAllComponentValid);
2348
+
2349
+ return
2350
+ }
2351
+
2352
+ this.$emit('validate', await this.$refs.form.validate());
2296
2353
  },
2297
2354
 
2298
2355
  // método para funcionar como plugin
@@ -2311,7 +2368,7 @@ var script$x = {
2311
2368
  }
2312
2369
  };
2313
2370
 
2314
- const _hoisted_1$k = { class: "justify-between row" };
2371
+ const _hoisted_1$l = { class: "justify-between row" };
2315
2372
  const _hoisted_2$e = { class: "text-bold text-h6" };
2316
2373
  const _hoisted_3$a = { key: 0 };
2317
2374
 
@@ -2336,9 +2393,9 @@ function render$x(_ctx, _cache, $props, $setup, $data, $options) {
2336
2393
  createVNode(_component_q_card_section, null, {
2337
2394
  default: withCtx(() => [
2338
2395
  renderSlot(_ctx.$slots, "header", {}, () => [
2339
- createElementVNode("div", _hoisted_1$k, [
2396
+ createElementVNode("div", _hoisted_1$l, [
2340
2397
  createElementVNode("div", _hoisted_2$e, toDisplayString($props.card.title), 1 /* TEXT */),
2341
- ($props.useCloseIcon)
2398
+ ($props.useCloseButton)
2342
2399
  ? withDirectives((openBlock(), createBlock(_component_qas_btn, {
2343
2400
  key: 0,
2344
2401
  dense: "",
@@ -2422,6 +2479,51 @@ var Dialog = (componentProps = {}) => {
2422
2479
  });
2423
2480
  };
2424
2481
 
2482
+ var Logger = () => {
2483
+ const isDebugEnabled = process.env.DEBUGGING;
2484
+
2485
+ const normalizeMessage = msg => `%c ${msg}`;
2486
+ const getStyle = isError => (
2487
+ `
2488
+ background: ${isError ? '#C10015 ' : '#1976d2'};
2489
+ font-weight: bold;
2490
+ color: white;
2491
+ padding: 6px 20px;
2492
+ border-radius: 4px;
2493
+ display: block;
2494
+ width: 100%;
2495
+ font-size: 12px;
2496
+ `
2497
+ );
2498
+
2499
+ return {
2500
+ group (message, payload = [], { error } = {}) {
2501
+ if (!isDebugEnabled) return
2502
+
2503
+ console.groupCollapsed(normalizeMessage(message), getStyle(error));
2504
+
2505
+ for (const item of payload) {
2506
+ if (typeof item === 'string') {
2507
+ console.info(normalizeMessage(item), getStyle(error));
2508
+ continue
2509
+ }
2510
+
2511
+ console.table(item);
2512
+ }
2513
+
2514
+ console.groupEnd();
2515
+ },
2516
+
2517
+ info (message) {
2518
+ isDebugEnabled && console.info(normalizeMessage(message), getStyle());
2519
+ },
2520
+
2521
+ error (message) {
2522
+ isDebugEnabled && console.info(normalizeMessage(message), getStyle(true));
2523
+ }
2524
+ }
2525
+ };
2526
+
2425
2527
  Notify.registerType('error', {
2426
2528
  color: 'negative',
2427
2529
  progress: true
@@ -2608,7 +2710,13 @@ var script$w = {
2608
2710
  try {
2609
2711
  const { destroyRoutes, history } = useHistory();
2610
2712
 
2611
- await this.$store.dispatch(`${this.entity}/destroy`, { id: this.id, url: this.url });
2713
+ const payload = { id: this.id, url: this.url };
2714
+
2715
+ this.$qas.logger.group(
2716
+ `QasDelete - destroy -> Payload do parâmetro do ${this.entity}/destroy`, [payload]
2717
+ );
2718
+
2719
+ await this.$store.dispatch(`${this.entity}/destroy`, payload);
2612
2720
 
2613
2721
  NotifySuccess('Item deletado com sucesso!');
2614
2722
 
@@ -2622,9 +2730,17 @@ var script$w = {
2622
2730
  this.createDeleteSuccessEvent();
2623
2731
 
2624
2732
  this.$emit('success');
2733
+
2734
+ this.$qas.logger.info('QasDelete - destroy -> item deletado com sucesso!');
2625
2735
  } catch (error) {
2626
2736
  NotifyError('Ops! Não foi possível deletar o item.');
2627
2737
  this.$emit('error', error);
2738
+
2739
+ this.$qas.logger.group(
2740
+ `QasDelete - destroy -> exceção da action ${this.entity}/destroy`,
2741
+ [error],
2742
+ { error: true }
2743
+ );
2628
2744
  } finally {
2629
2745
  Loading.hide();
2630
2746
  this.$emit('update:deleting', false);
@@ -2766,8 +2882,8 @@ function render$v(_ctx, _cache, $props, $setup, $data, $options) {
2766
2882
  ($data.component)
2767
2883
  ? (openBlock(), createBlock(resolveDynamicComponent($data.component), {
2768
2884
  key: 0,
2769
- dialog: "",
2770
2885
  route: $data.route,
2886
+ "use-boundary": false,
2771
2887
  onHide: $options.hide
2772
2888
  }, null, 8 /* PROPS */, ["route", "onHide"]))
2773
2889
  : createCommentVNode("v-if", true)
@@ -2791,32 +2907,32 @@ var script$u = {
2791
2907
  inheritAttrs: false,
2792
2908
 
2793
2909
  props: {
2910
+ error: {
2911
+ type: Boolean
2912
+ },
2913
+
2914
+ errorMessage: {
2915
+ type: String,
2916
+ default: ''
2917
+ },
2918
+
2794
2919
  modelValue: {
2795
2920
  default: '',
2796
2921
  type: [String, Number]
2797
2922
  },
2798
2923
 
2799
- unmaskedValue: {
2800
- default: true,
2801
- type: Boolean
2802
- },
2803
-
2804
2924
  outlined: {
2805
2925
  default: true,
2806
2926
  type: Boolean
2807
2927
  },
2808
2928
 
2809
- removeErrorOnType: {
2929
+ unmaskedValue: {
2930
+ default: true,
2810
2931
  type: Boolean
2811
2932
  },
2812
2933
 
2813
- error: {
2934
+ useRemoveErrorOnType: {
2814
2935
  type: Boolean
2815
- },
2816
-
2817
- errorMessage: {
2818
- type: String,
2819
- default: ''
2820
2936
  }
2821
2937
  },
2822
2938
 
@@ -2861,7 +2977,7 @@ var script$u = {
2861
2977
  },
2862
2978
 
2863
2979
  set (value) {
2864
- if (this.removeErrorOnType && this.error) {
2980
+ if (this.useRemoveErrorOnType && this.error) {
2865
2981
  this.errorData = false;
2866
2982
  this.errorMessageData = '';
2867
2983
  }
@@ -2873,7 +2989,7 @@ var script$u = {
2873
2989
 
2874
2990
  watch: {
2875
2991
  mask () {
2876
- const input = this.inputReference.$el?.querySelector('input');
2992
+ const input = this.getInput();
2877
2993
 
2878
2994
  requestAnimationFrame(() => {
2879
2995
  input.selectionStart = input.value ? input.value.length : '';
@@ -2907,12 +3023,30 @@ var script$u = {
2907
3023
  },
2908
3024
 
2909
3025
  toggleMask (first, second) {
3026
+ if (!this.modelValue?.length) return
3027
+
2910
3028
  const length = first.split('#').length - 2;
2911
3029
  return this.modelValue?.length > length ? second : first
2912
3030
  },
2913
3031
 
2914
3032
  validate (value) {
2915
3033
  return this.inputReference.validate(value)
3034
+ },
3035
+
3036
+ onPaste (event) {
3037
+ if (!this.mask) return
3038
+
3039
+ const value = event.clipboardData.getData('text');
3040
+ const input = this.getInput();
3041
+
3042
+ requestAnimationFrame(() => {
3043
+ this.$emit('update:modelValue', value);
3044
+ input.selectionStart = input.value ? input.value.length : '';
3045
+ });
3046
+ },
3047
+
3048
+ getInput () {
3049
+ return this.inputReference.$el?.querySelector('input')
2916
3050
  }
2917
3051
  }
2918
3052
  };
@@ -2920,29 +3054,28 @@ var script$u = {
2920
3054
  function render$u(_ctx, _cache, $props, $setup, $data, $options) {
2921
3055
  const _component_q_input = resolveComponent("q-input");
2922
3056
 
2923
- return (openBlock(), createElementBlock("div", null, [
2924
- createVNode(_component_q_input, mergeProps({
2925
- ref: "input",
2926
- modelValue: $options.model,
2927
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.model) = $event)),
2928
- "bottom-slots": "",
2929
- error: $data.errorData
2930
- }, _ctx.$attrs, {
2931
- "error-message": _ctx.errorMessageData,
2932
- mask: $options.mask,
2933
- outlined: $props.outlined,
2934
- "unmasked-value": $props.unmaskedValue
2935
- }), createSlots({ _: 2 /* DYNAMIC */ }, [
2936
- renderList(_ctx.$slots, (_, name) => {
2937
- return {
2938
- name: name,
2939
- fn: withCtx((context) => [
2940
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
2941
- ])
2942
- }
2943
- })
2944
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "error", "error-message", "mask", "outlined", "unmasked-value"])
2945
- ]))
3057
+ return (openBlock(), createBlock(_component_q_input, mergeProps({
3058
+ ref: "input",
3059
+ modelValue: $options.model,
3060
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.model) = $event)),
3061
+ "bottom-slots": "",
3062
+ error: $data.errorData
3063
+ }, _ctx.$attrs, {
3064
+ "error-message": _ctx.errorMessageData,
3065
+ mask: $options.mask,
3066
+ outlined: $props.outlined,
3067
+ "unmasked-value": $props.unmaskedValue,
3068
+ onPaste: $options.onPaste
3069
+ }), createSlots({ _: 2 /* DYNAMIC */ }, [
3070
+ renderList(_ctx.$slots, (_, name) => {
3071
+ return {
3072
+ name: name,
3073
+ fn: withCtx((context) => [
3074
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
3075
+ ])
3076
+ }
3077
+ })
3078
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "error", "error-message", "mask", "outlined", "unmasked-value", "onPaste"]))
2946
3079
  }
2947
3080
 
2948
3081
  script$u.render = render$u;
@@ -2959,17 +3092,7 @@ var script$t = {
2959
3092
  name: 'QasNumericInput',
2960
3093
 
2961
3094
  props: {
2962
- allowNegative: {
2963
- default: true,
2964
- type: Boolean
2965
- },
2966
-
2967
- allowPositive: {
2968
- default: true,
2969
- type: Boolean
2970
- },
2971
-
2972
- autonumericProps: {
3095
+ autonumericOptions: {
2973
3096
  default: () => ({}),
2974
3097
  type: Object
2975
3098
  },
@@ -3001,6 +3124,16 @@ var script$t = {
3001
3124
  preset: {
3002
3125
  default: false,
3003
3126
  type: [Boolean, String]
3127
+ },
3128
+
3129
+ useNegative: {
3130
+ default: true,
3131
+ type: Boolean
3132
+ },
3133
+
3134
+ usePositive: {
3135
+ default: true,
3136
+ type: Boolean
3004
3137
  }
3005
3138
  },
3006
3139
 
@@ -3044,11 +3177,11 @@ var script$t = {
3044
3177
  Object.assign(options, autoNumericPredefinedOptions[value]);
3045
3178
  }
3046
3179
 
3047
- if (!this.allowNegative) {
3180
+ if (!this.useNegative) {
3048
3181
  options.minimumValue = 0;
3049
3182
  }
3050
3183
 
3051
- if (!this.allowPositive) {
3184
+ if (!this.usePositive) {
3052
3185
  options.maximumValue = 0;
3053
3186
  }
3054
3187
 
@@ -3056,7 +3189,7 @@ var script$t = {
3056
3189
  options.decimalPlaces = this.decimalPlaces;
3057
3190
  }
3058
3191
 
3059
- Object.assign(options, this.autonumericProps);
3192
+ Object.assign(options, this.autonumericOptions);
3060
3193
 
3061
3194
  this.$nextTick(() => {
3062
3195
  this.autoNumeric = new AutoNumeric(this.$refs.input, options);
@@ -3086,7 +3219,7 @@ var script$t = {
3086
3219
  }
3087
3220
  };
3088
3221
 
3089
- const _hoisted_1$j = ["id"];
3222
+ const _hoisted_1$k = ["id"];
3090
3223
 
3091
3224
  function render$t(_ctx, _cache, $props, $setup, $data, $options) {
3092
3225
  const _component_q_field = resolveComponent("q-field");
@@ -3103,7 +3236,7 @@ function render$t(_ctx, _cache, $props, $setup, $data, $options) {
3103
3236
  onBlur: _cache[0] || (_cache[0] = (...args) => ($options.emitValue && $options.emitValue(...args))),
3104
3237
  onClick: _cache[1] || (_cache[1] = (...args) => ($options.setSelect && $options.setSelect(...args))),
3105
3238
  onInput: _cache[2] || (_cache[2] = $event => ($options.emitUpdateModel($event.target.value)))
3106
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$j), [
3239
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$k), [
3107
3240
  [vShow, floatingLabel]
3108
3241
  ])
3109
3242
  ]),
@@ -3266,13 +3399,13 @@ var script$s = {
3266
3399
  }
3267
3400
  };
3268
3401
 
3269
- const _hoisted_1$i = { key: 0 };
3402
+ const _hoisted_1$j = { key: 0 };
3270
3403
 
3271
3404
  function render$s(_ctx, _cache, $props, $setup, $data, $options) {
3272
3405
  const _component_q_linear_progress = resolveComponent("q-linear-progress");
3273
3406
 
3274
3407
  return ($options.length)
3275
- ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
3408
+ ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
3276
3409
  renderSlot(_ctx.$slots, "default", { level: $options.level }, () => [
3277
3410
  createVNode(_component_q_linear_progress, {
3278
3411
  color: $options.level.color,
@@ -3299,8 +3432,11 @@ var script$r = {
3299
3432
 
3300
3433
  mixins: [passwordMixin],
3301
3434
 
3435
+ inheritAttrs: false,
3436
+
3302
3437
  props: {
3303
- hideStrengthChecker: {
3438
+ useStrengthChecker: {
3439
+ default: true,
3304
3440
  type: Boolean
3305
3441
  },
3306
3442
 
@@ -3360,44 +3496,41 @@ function render$r(_ctx, _cache, $props, $setup, $data, $options) {
3360
3496
  const _component_qas_password_strength_checker = resolveComponent("qas-password-strength-checker");
3361
3497
  const _component_qas_input = resolveComponent("qas-input");
3362
3498
 
3363
- return (openBlock(), createElementBlock("div", null, [
3364
- createVNode(_component_qas_input, mergeProps({
3365
- modelValue: $options.model,
3366
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.model) = $event)),
3367
- "bottom-slots": false,
3368
- color: "negative"
3369
- }, _ctx.$attrs, {
3370
- "remove-error-on-type": "",
3371
- type: $options.type
3372
- }), createSlots({
3373
- append: withCtx(() => [
3374
- createVNode(_component_q_icon, {
3375
- class: "cursor-pointer",
3376
- color: $props.iconColor,
3377
- name: $options.icon,
3378
- onClick: $options.toggle
3379
- }, null, 8 /* PROPS */, ["color", "name", "onClick"])
3380
- ]),
3381
- _: 2 /* DYNAMIC */
3382
- }, [
3383
- renderList(_ctx.$slots, (_, name) => {
3384
- return {
3385
- name: name,
3386
- fn: withCtx((context) => [
3387
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
3499
+ return (openBlock(), createBlock(_component_qas_input, mergeProps({
3500
+ modelValue: $options.model,
3501
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.model) = $event)),
3502
+ "bottom-slots": false
3503
+ }, _ctx.$attrs, {
3504
+ type: $options.type,
3505
+ "use-remove-error-on-type": ""
3506
+ }), createSlots({
3507
+ append: withCtx(() => [
3508
+ createVNode(_component_q_icon, {
3509
+ class: "cursor-pointer",
3510
+ color: $props.iconColor,
3511
+ name: $options.icon,
3512
+ onClick: $options.toggle
3513
+ }, null, 8 /* PROPS */, ["color", "name", "onClick"])
3514
+ ]),
3515
+ _: 2 /* DYNAMIC */
3516
+ }, [
3517
+ renderList(_ctx.$slots, (_, name) => {
3518
+ return {
3519
+ name: name,
3520
+ fn: withCtx((context) => [
3521
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
3522
+ ])
3523
+ }
3524
+ }),
3525
+ ($props.useStrengthChecker)
3526
+ ? {
3527
+ name: "hint",
3528
+ fn: withCtx(() => [
3529
+ createVNode(_component_qas_password_strength_checker, mergeProps($options.strengthCheckerProps, { password: $options.model }), null, 16 /* FULL_PROPS */, ["password"])
3388
3530
  ])
3389
3531
  }
3390
- }),
3391
- (!$props.hideStrengthChecker)
3392
- ? {
3393
- name: "hint",
3394
- fn: withCtx(() => [
3395
- createVNode(_component_qas_password_strength_checker, mergeProps($options.strengthCheckerProps, { password: $options.model }), null, 16 /* FULL_PROPS */, ["password"])
3396
- ])
3397
- }
3398
- : undefined
3399
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "type"])
3400
- ]))
3532
+ : undefined
3533
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "type"]))
3401
3534
  }
3402
3535
 
3403
3536
  script$r.render = render$r;
@@ -3471,7 +3604,11 @@ var script$q = {
3471
3604
 
3472
3605
  uploading: {
3473
3606
  type: Boolean
3474
- }
3607
+ },
3608
+
3609
+ useObjectModel: {
3610
+ type: Boolean
3611
+ }
3475
3612
  },
3476
3613
 
3477
3614
  emits: ['update:modelValue', 'update:uploading'],
@@ -3584,12 +3721,19 @@ var script$q = {
3584
3721
  uploaded (response) {
3585
3722
  const fullPath = response.xhr.responseURL.split('?').shift();
3586
3723
 
3587
- this.$emit(
3588
- 'update:modelValue',
3589
- this.isMultiple ? [...this.modelValue, fullPath] : fullPath || ''
3590
- );
3724
+ const objectValue = {
3725
+ format: response.files[0].type,
3726
+ url: fullPath,
3727
+ name: response.files[0].name
3728
+ };
3729
+
3730
+ const model = this.useObjectModel ? objectValue : fullPath;
3731
+
3732
+ this.$emit('update:modelValue', this.isMultiple ? [...this.modelValue, model] : model || '');
3591
3733
 
3592
3734
  this.updateUploading(false);
3735
+
3736
+ this.$qas.logger.group('QasUploader - uploaded', [this.modelValue]);
3593
3737
  },
3594
3738
 
3595
3739
  async fetchCredentials (filename) {
@@ -3600,6 +3744,12 @@ var script$q = {
3600
3744
  entity: this.entity,
3601
3745
  filename
3602
3746
  });
3747
+
3748
+ this.$qas.logger.group(
3749
+ 'QasUploader - fetchCredentials -> resposta de /upload-credentials/',
3750
+ [data]
3751
+ );
3752
+
3603
3753
  return data
3604
3754
  } finally {
3605
3755
  this.isFetching = false;
@@ -3618,8 +3768,16 @@ var script$q = {
3618
3768
  }
3619
3769
 
3620
3770
  const clonedValue = extend(true, [], this.modelValue);
3621
- const numberIndex = this.modelValue.findIndex(file => this.getFileName(file) === index);
3771
+ const numberIndex = this.modelValue.findIndex(file => {
3772
+ if (this.useObjectModel) {
3773
+ return file.uuid === index || file.url.includes(index)
3774
+ }
3775
+
3776
+ return this.getFileName(file) === index
3777
+ });
3778
+
3622
3779
  clonedValue.splice(numberIndex, 1);
3780
+
3623
3781
  this.$emit('update:modelValue', clonedValue);
3624
3782
  },
3625
3783
 
@@ -3628,12 +3786,10 @@ var script$q = {
3628
3786
  },
3629
3787
 
3630
3788
  getFilesList (uploadedFiles) {
3631
- const pathsList = Array.isArray(this.modelValue) ? this.modelValue : (this.modelValue ? [this.modelValue] : []);
3632
-
3633
3789
  uploadedFiles = uploadedFiles.map((file, indexToDelete) => {
3634
3790
  return {
3635
3791
  isUploaded: true,
3636
- image: file.xhr ? file.xhr.responseURL.split('?').shift() : '',
3792
+ url: file.xhr ? file.xhr.responseURL.split('?').shift() : '',
3637
3793
  name: file.name,
3638
3794
  progressLabel: file.__progressLabel,
3639
3795
  sizeLabel: file.__sizeLabel,
@@ -3642,11 +3798,20 @@ var script$q = {
3642
3798
  }
3643
3799
  });
3644
3800
 
3801
+ const pathsList = Array.isArray(this.modelValue)
3802
+ ? this.modelValue
3803
+ : (this.modelValue ? [this.modelValue] : []);
3804
+
3645
3805
  const mergedList = [...pathsList, ...uploadedFiles];
3646
3806
 
3647
3807
  const files = {};
3648
3808
 
3649
3809
  mergedList.forEach(file => {
3810
+ if (this.useObjectModel && file.uuid) {
3811
+ files[file.uuid] = file;
3812
+ return
3813
+ }
3814
+
3650
3815
  if (file.isFailed) {
3651
3816
  files[file.name] = file;
3652
3817
  return
@@ -3654,16 +3819,18 @@ var script$q = {
3654
3819
 
3655
3820
  if (typeof file === 'string') {
3656
3821
  const fileName = this.getFileName(file);
3657
- files[fileName] = { image: file, isUploaded: false, name: fileName };
3822
+ files[fileName] = { url: file, isUploaded: false, name: fileName };
3658
3823
  return
3659
3824
  }
3660
3825
 
3661
- if (file.image) {
3662
- const fileName = this.getFileName(file.image);
3826
+ if (file.url) {
3827
+ const fileName = this.getFileName(file.url);
3663
3828
  files[fileName] = file;
3664
3829
  }
3665
3830
  });
3666
3831
 
3832
+ this.$qas.logger.group('QasUploader - getFilesList', [files]);
3833
+
3667
3834
  return files
3668
3835
  },
3669
3836
 
@@ -3683,6 +3850,8 @@ var script$q = {
3683
3850
  const filesList = Array.from(this.hiddenInputElement.files);
3684
3851
  const processedFiles = [];
3685
3852
 
3853
+ this.$refs.hiddenInput.value = '';
3854
+
3686
3855
  filesList.forEach(file => processedFiles.push(this.resizeImage(file)));
3687
3856
  this.uploader.addFiles(await Promise.all(processedFiles));
3688
3857
  },
@@ -3702,7 +3871,14 @@ var script$q = {
3702
3871
  // Retorna largura e altura da original da imagem
3703
3872
  const { width, height } = await getImageSize(image);
3704
3873
 
3705
- if (width <= this.sizeLimit) return file
3874
+ if (width <= this.sizeLimit) {
3875
+ this.$qas.logger.info(`
3876
+ QasUploader - resizeImage -> Tamanho da imagem menor que o tamanho limite,
3877
+ sendo assim, não faz o resize
3878
+ `);
3879
+
3880
+ return file
3881
+ }
3706
3882
 
3707
3883
  // Retorna os novos tamanhos redimensionados
3708
3884
  const resizedDimensions = getResizeDimensions(this.sizeLimit, width, height);
@@ -3720,7 +3896,11 @@ var script$q = {
3720
3896
  const resizedImage = await pica.resize(image, canvas, this.defaultPicaResizeOptions);
3721
3897
  const blob = await pica.toBlob(resizedImage, type, 0.90);
3722
3898
 
3723
- return new File([blob], file.name, { type })
3899
+ const newFile = new File([blob], file.name, { type });
3900
+
3901
+ this.$qas.logger.group('QasUploader - resizeImage -> nova imagem', [newFile]);
3902
+
3903
+ return newFile
3724
3904
  } catch {
3725
3905
  // Caso não consiga redimensionar retorna o arquivo original
3726
3906
  return file
@@ -3733,7 +3913,7 @@ var script$q = {
3733
3913
  }
3734
3914
  };
3735
3915
 
3736
- const _hoisted_1$h = { class: "flex flex-center full-width justify-between no-border no-wrap q-gutter-xs q-pa-sm text-white transparent" };
3916
+ const _hoisted_1$i = { class: "flex flex-center full-width justify-between no-border no-wrap q-gutter-xs q-pa-sm text-white transparent" };
3737
3917
  const _hoisted_2$d = { class: "col column items-start justify-center" };
3738
3918
  const _hoisted_3$9 = {
3739
3919
  key: 0,
@@ -3743,7 +3923,7 @@ const _hoisted_4$7 = {
3743
3923
  key: 1,
3744
3924
  class: "q-uploader__subtitle"
3745
3925
  };
3746
- const _hoisted_5$5 = ["multiple"];
3926
+ const _hoisted_5$5 = ["accept", "multiple"];
3747
3927
  const _hoisted_6$3 = { class: "col-12 q-col-gutter-md row" };
3748
3928
  const _hoisted_7$3 = { class: "col items-center no-wrap row" };
3749
3929
  const _hoisted_8$2 = {
@@ -3786,7 +3966,7 @@ function render$q(_ctx, _cache, $props, $setup, $data, $options) {
3786
3966
  }), {
3787
3967
  header: withCtx((scope) => [
3788
3968
  renderSlot(_ctx.$slots, "header", { scope: scope }, () => [
3789
- createElementVNode("div", _hoisted_1$h, [
3969
+ createElementVNode("div", _hoisted_1$i, [
3790
3970
  (scope.isUploading)
3791
3971
  ? (openBlock(), createBlock(_component_q_spinner, {
3792
3972
  key: 0,
@@ -3815,6 +3995,7 @@ function render$q(_ctx, _cache, $props, $setup, $data, $options) {
3815
3995
  : createCommentVNode("v-if", true),
3816
3996
  createElementVNode("input", {
3817
3997
  ref: "hiddenInput",
3998
+ accept: $options.attributes.accept,
3818
3999
  class: "qas-uploader__input",
3819
4000
  multiple: $options.isMultiple,
3820
4001
  type: "file"
@@ -3862,7 +4043,7 @@ function render$q(_ctx, _cache, $props, $setup, $data, $options) {
3862
4043
  class: "q-mr-sm",
3863
4044
  color: "contrast-primary",
3864
4045
  icon: "o_attach_file",
3865
- image: file.image,
4046
+ image: file.url,
3866
4047
  rounded: "",
3867
4048
  "text-color": $options.getColorFileIcon(file)
3868
4049
  }, null, 8 /* PROPS */, ["image", "text-color"]),
@@ -4023,7 +4204,7 @@ var script$p = {
4023
4204
  }
4024
4205
  };
4025
4206
 
4026
- const _hoisted_1$g = {
4207
+ const _hoisted_1$h = {
4027
4208
  ref: "signatureContainer",
4028
4209
  class: "qas-signature-pad relative-position"
4029
4210
  };
@@ -4033,7 +4214,7 @@ function render$p(_ctx, _cache, $props, $setup, $data, $options) {
4033
4214
  const _component_qas_btn = resolveComponent("qas-btn");
4034
4215
 
4035
4216
  return (openBlock(), createElementBlock(Fragment, null, [
4036
- createElementVNode("div", _hoisted_1$g, [
4217
+ createElementVNode("div", _hoisted_1$h, [
4037
4218
  createElementVNode("canvas", {
4038
4219
  id: $data.canvasId,
4039
4220
  ref: _ctx.$attrs.ref,
@@ -4068,6 +4249,7 @@ var script$o = {
4068
4249
  name: 'QasSignatureUploader',
4069
4250
 
4070
4251
  components: {
4252
+ QasBtn: script$K,
4071
4253
  QasDialog: script$x,
4072
4254
  QasUploader: script$q,
4073
4255
  QasSignaturePad: script$p
@@ -4196,7 +4378,7 @@ var script$o = {
4196
4378
  }
4197
4379
  };
4198
4380
 
4199
- const _hoisted_1$f = { class: "col column items-start justify-center" };
4381
+ const _hoisted_1$g = { class: "col column items-start justify-center" };
4200
4382
  const _hoisted_2$b = {
4201
4383
  key: 0,
4202
4384
  class: "q-uploader__title"
@@ -4204,7 +4386,7 @@ const _hoisted_2$b = {
4204
4386
  const _hoisted_3$8 = /*#__PURE__*/createElementVNode("div", { class: "text-bold text-center" }, "Insira sua assinatura digital no campo abaixo", -1 /* HOISTED */);
4205
4387
 
4206
4388
  function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4207
- const _component_q_btn = resolveComponent("q-btn");
4389
+ const _component_qas_btn = resolveComponent("qas-btn");
4208
4390
  const _component_qas_uploader = resolveComponent("qas-uploader");
4209
4391
  const _component_qas_signature_pad = resolveComponent("qas-signature-pad");
4210
4392
  const _component_qas_dialog = resolveComponent("qas-dialog");
@@ -4223,14 +4405,15 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4223
4405
  class: normalizeClass(["cursor-pointer flex flex-center full-width justify-between no-border no-wrap q-gutter-xs text-white transparent", $options.headerClass]),
4224
4406
  onClick: _cache[0] || (_cache[0] = (...args) => ($options.openDialog && $options.openDialog(...args)))
4225
4407
  }, [
4226
- createElementVNode("div", _hoisted_1$f, [
4408
+ createElementVNode("div", _hoisted_1$g, [
4227
4409
  ($props.uploadLabel)
4228
4410
  ? (openBlock(), createElementBlock("div", _hoisted_2$b, toDisplayString($props.uploadLabel), 1 /* TEXT */))
4229
4411
  : createCommentVNode("v-if", true)
4230
4412
  ]),
4231
4413
  (!$props.readonly)
4232
- ? (openBlock(), createBlock(_component_q_btn, {
4414
+ ? (openBlock(), createBlock(_component_qas_btn, {
4233
4415
  key: 0,
4416
+ color: "white",
4234
4417
  dense: "",
4235
4418
  flat: "",
4236
4419
  icon: "o_add",
@@ -4238,12 +4421,12 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4238
4421
  onClick: $options.openDialog
4239
4422
  }, null, 8 /* PROPS */, ["onClick"]))
4240
4423
  : createCommentVNode("v-if", true),
4241
- createVNode(_component_q_btn, {
4424
+ createVNode(_component_qas_btn, {
4242
4425
  ref: "forceUpload",
4243
4426
  class: "hidden",
4244
4427
  onClick: $event => ($options.upload(scope))
4245
4428
  }, null, 8 /* PROPS */, ["onClick"]),
4246
- createVNode(_component_q_btn, {
4429
+ createVNode(_component_qas_btn, {
4247
4430
  ref: "buttonCleanFiles",
4248
4431
  class: "hidden",
4249
4432
  onClick: scope.removeUploadedFiles
@@ -4272,7 +4455,7 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4272
4455
  ], 4 /* STYLE */)
4273
4456
  ]),
4274
4457
  actions: withCtx(() => [
4275
- createVNode(_component_q_btn, {
4458
+ createVNode(_component_qas_btn, {
4276
4459
  class: "full-width",
4277
4460
  color: "primary",
4278
4461
  disable: $data.isEmpty,
@@ -4280,7 +4463,7 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) {
4280
4463
  "no-caps": "",
4281
4464
  onClick: $options.getSignatureData
4282
4465
  }, null, 8 /* PROPS */, ["disable", "onClick"]),
4283
- createVNode(_component_q_btn, {
4466
+ createVNode(_component_qas_btn, {
4284
4467
  class: "full-width q-mt-sm",
4285
4468
  color: "primary",
4286
4469
  flat: "",
@@ -4316,6 +4499,8 @@ var script$n = {
4316
4499
  QasSignatureUploader: script$o
4317
4500
  },
4318
4501
 
4502
+ inheritAttrs: false,
4503
+
4319
4504
  props: {
4320
4505
  error: {
4321
4506
  default: '',
@@ -4355,8 +4540,9 @@ var script$n = {
4355
4540
  type,
4356
4541
  mask,
4357
4542
  maxFiles,
4358
- searchable,
4359
- gmt
4543
+ useIso,
4544
+ useSearch,
4545
+ useLazyLoading
4360
4546
  } = this.formattedField;
4361
4547
 
4362
4548
  // Default error attributes for Quasar.
@@ -4378,11 +4564,11 @@ var script$n = {
4378
4564
  minlength,
4379
4565
  suffix,
4380
4566
  prefix,
4381
- gmt
4567
+ useIso
4382
4568
  };
4383
4569
 
4384
4570
  const numericInput = { is: 'qas-numeric-input', ...input };
4385
- const datetimeInput = { is: 'qas-date-time-input', gmt, ...input };
4571
+ const datetimeInput = { is: 'qas-date-time-input', useIso, ...input };
4386
4572
 
4387
4573
  // It'll generate a list of acceptable files extensions.
4388
4574
  const accept = extensions && extensions.length ? extensions.map(extension => `.${extension}`).join(',') : '';
@@ -4410,9 +4596,9 @@ var script$n = {
4410
4596
  money: { ...numericInput, mode: 'money' },
4411
4597
  percent: { ...numericInput, mode: 'percent' },
4412
4598
 
4413
- date: { ...datetimeInput, dateOnly: true },
4599
+ date: { ...datetimeInput, useDateOnly: true },
4414
4600
  datetime: { ...datetimeInput },
4415
- time: { ...datetimeInput, timeOnly: true },
4601
+ time: { ...datetimeInput, useTimeOnly: true },
4416
4602
 
4417
4603
  boolean: { is: 'q-toggle', label, ...error },
4418
4604
  checkbox: { is: 'qas-checkbox-group', label, options, ...error },
@@ -4423,7 +4609,7 @@ var script$n = {
4423
4609
 
4424
4610
  'signature-uploader': { is: 'qas-signature-uploader', entity, uploadLabel: label, ...error },
4425
4611
 
4426
- select: { is: 'qas-select', multiple, options, searchable, ...input }
4612
+ select: { is: 'qas-select', entity, name, multiple, options, useSearch, useLazyLoading, ...input }
4427
4613
  };
4428
4614
 
4429
4615
  return { ...(profiles[type] || profiles.default), ...this.$attrs }
@@ -4485,22 +4671,20 @@ var script$n = {
4485
4671
  };
4486
4672
 
4487
4673
  function render$n(_ctx, _cache, $props, $setup, $data, $options) {
4488
- return (openBlock(), createElementBlock("div", null, [
4489
- (openBlock(), createBlock(resolveDynamicComponent($options.component.is), mergeProps($options.component, {
4490
- "data-cy": $props.field.name,
4491
- "model-value": $options.formattedValue,
4492
- "onUpdate:modelValue": $options.updateModel
4493
- }), createSlots({ _: 2 /* DYNAMIC */ }, [
4494
- renderList(_ctx.$slots, (_, name) => {
4495
- return {
4496
- name: name,
4497
- fn: withCtx((context) => [
4498
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
4499
- ])
4500
- }
4501
- })
4502
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["data-cy", "model-value", "onUpdate:modelValue"]))
4503
- ]))
4674
+ return (openBlock(), createBlock(resolveDynamicComponent($options.component.is), mergeProps($options.component, {
4675
+ "data-cy": $props.field.name,
4676
+ "model-value": $options.formattedValue,
4677
+ "onUpdate:modelValue": $options.updateModel
4678
+ }), createSlots({ _: 2 /* DYNAMIC */ }, [
4679
+ renderList(_ctx.$slots, (_, name) => {
4680
+ return {
4681
+ name: name,
4682
+ fn: withCtx((context) => [
4683
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(context || {})))
4684
+ ])
4685
+ }
4686
+ })
4687
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["data-cy", "model-value", "onUpdate:modelValue"]))
4504
4688
  }
4505
4689
 
4506
4690
  script$n.render = render$n;
@@ -4519,6 +4703,7 @@ var script$m = {
4519
4703
  name: 'QasFilters',
4520
4704
 
4521
4705
  components: {
4706
+ QasBtn: script$K,
4522
4707
  QasField: script$n
4523
4708
  },
4524
4709
 
@@ -4560,7 +4745,7 @@ var script$m = {
4560
4745
  type: String
4561
4746
  },
4562
4747
 
4563
- forceRefetch: {
4748
+ useForceRefetch: {
4564
4749
  type: Boolean
4565
4750
  }
4566
4751
  },
@@ -4691,7 +4876,7 @@ var script$m = {
4691
4876
  },
4692
4877
 
4693
4878
  async fetchFilters () {
4694
- if (!this.forceRefetch && (this.hasFields || !this.useFilterButton)) {
4879
+ if (!this.useForceRefetch && (this.hasFields || !this.useFilterButton)) {
4695
4880
  return null
4696
4881
  }
4697
4882
 
@@ -4699,11 +4884,26 @@ var script$m = {
4699
4884
  this.isFetching = true;
4700
4885
 
4701
4886
  try {
4887
+ this.$qas.logger.group(
4888
+ `QasFilters - fetchFilters -> Payload do parâmetro do ${this.entity}/fetchFilters`,
4889
+ [{ url: this.url }]
4890
+ );
4891
+
4702
4892
  const response = await this.$store.dispatch(`${this.entity}/fetchFilters`, { url: this.url });
4703
4893
  this.$emit('fetch-success', response);
4894
+
4895
+ this.$qas.logger.group(
4896
+ `QasFilters - fetchFilters -> resposta da action ${this.entity}/fetchFilters`, [response]
4897
+ );
4704
4898
  } catch (error) {
4705
4899
  this.hasFetchError = true;
4706
4900
  this.$emit('fetch-error', error);
4901
+
4902
+ this.$qas.logger.group(
4903
+ `QasFilters - fetchFilters -> exceção da action ${this.entity}/fetchFilters`,
4904
+ [error],
4905
+ { error: true }
4906
+ );
4707
4907
  } finally {
4708
4908
  this.isFetching = false;
4709
4909
  }
@@ -4762,7 +4962,7 @@ var script$m = {
4762
4962
  }
4763
4963
  };
4764
4964
 
4765
- const _hoisted_1$e = { class: "q-mb-lg" };
4965
+ const _hoisted_1$f = { class: "q-mb-lg" };
4766
4966
  const _hoisted_2$a = {
4767
4967
  key: 0,
4768
4968
  class: "q-gutter-x-md row"
@@ -4786,8 +4986,8 @@ const _hoisted_7$2 = {
4786
4986
  };
4787
4987
 
4788
4988
  function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4789
- const _component_q_btn = resolveComponent("q-btn");
4790
- const _component_q_input = resolveComponent("q-input");
4989
+ const _component_qas_btn = resolveComponent("qas-btn");
4990
+ const _component_qas_input = resolveComponent("qas-input");
4791
4991
  const _component_q_form = resolveComponent("q-form");
4792
4992
  const _component_q_spinner = resolveComponent("q-spinner");
4793
4993
  const _component_q_icon = resolveComponent("q-icon");
@@ -4795,7 +4995,7 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4795
4995
  const _component_q_menu = resolveComponent("q-menu");
4796
4996
  const _component_q_chip = resolveComponent("q-chip");
4797
4997
 
4798
- return (openBlock(), createElementBlock("section", _hoisted_1$e, [
4998
+ return (openBlock(), createElementBlock("section", _hoisted_1$f, [
4799
4999
  ($options.showFilters)
4800
5000
  ? (openBlock(), createElementBlock("div", _hoisted_2$a, [
4801
5001
  ($options.showSearch)
@@ -4807,26 +5007,32 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4807
5007
  onSubmit: _cache[2] || (_cache[2] = withModifiers($event => ($options.filter()), ["prevent"]))
4808
5008
  }, {
4809
5009
  default: withCtx(() => [
4810
- createVNode(_component_q_input, {
5010
+ createVNode(_component_qas_input, {
4811
5011
  modelValue: $data.search,
4812
5012
  "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.search) = $event)),
4813
5013
  debounce: $options.debounce,
4814
5014
  dense: "",
5015
+ "hide-bottom-space": "",
5016
+ outlined: false,
4815
5017
  placeholder: $props.searchPlaceholder,
4816
5018
  type: "search"
4817
5019
  }, {
4818
5020
  append: withCtx(() => [
4819
5021
  ($options.hasSearch)
4820
- ? (openBlock(), createBlock(_component_q_btn, {
5022
+ ? (openBlock(), createBlock(_component_qas_btn, {
4821
5023
  key: 0,
5024
+ color: "grey-9",
5025
+ flat: "",
4822
5026
  icon: "o_clear",
4823
5027
  unelevated: "",
4824
5028
  onClick: $options.clearSearch
4825
5029
  }, null, 8 /* PROPS */, ["onClick"]))
4826
5030
  : createCommentVNode("v-if", true),
4827
5031
  (!$options.debounce)
4828
- ? (openBlock(), createBlock(_component_q_btn, {
5032
+ ? (openBlock(), createBlock(_component_qas_btn, {
4829
5033
  key: 1,
5034
+ color: "grey-9",
5035
+ flat: "",
4830
5036
  icon: "o_search",
4831
5037
  type: "submit",
4832
5038
  unelevated: "",
@@ -4849,7 +5055,7 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4849
5055
  filter: $options.filter
4850
5056
  }, () => [
4851
5057
  ($props.useFilterButton)
4852
- ? (openBlock(), createBlock(_component_q_btn, {
5058
+ ? (openBlock(), createBlock(_component_qas_btn, {
4853
5059
  key: 0,
4854
5060
  color: $options.filterButtonColor,
4855
5061
  flat: "",
@@ -4894,16 +5100,19 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4894
5100
  ]))
4895
5101
  }), 128 /* KEYED_FRAGMENT */)),
4896
5102
  createElementVNode("div", _hoisted_6$2, [
4897
- createVNode(_component_q_btn, {
5103
+ createVNode(_component_qas_btn, {
4898
5104
  class: "q-mr-sm",
5105
+ flat: "",
4899
5106
  label: "Limpar",
5107
+ "no-caps": false,
4900
5108
  size: "12px",
4901
5109
  unelevated: "",
4902
5110
  onClick: $options.clearFilters
4903
5111
  }, null, 8 /* PROPS */, ["onClick"]),
4904
- createVNode(_component_q_btn, {
5112
+ createVNode(_component_qas_btn, {
4905
5113
  color: "primary",
4906
5114
  label: "Filtrar",
5115
+ "no-caps": false,
4907
5116
  size: "12px",
4908
5117
  type: "submit",
4909
5118
  unelevated: ""
@@ -4972,7 +5181,9 @@ var generatorMixin = {
4972
5181
  gutter: {
4973
5182
  default: 'md',
4974
5183
  type: [String, Boolean],
4975
- validator: value => ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
5184
+ validator: value => {
5185
+ return typeof value === 'boolean' || ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
5186
+ }
4976
5187
  }
4977
5188
  },
4978
5189
 
@@ -5021,7 +5232,13 @@ var generatorMixin = {
5021
5232
  },
5022
5233
 
5023
5234
  mx_handleColumnsByIndex (index, isGridGenerator) {
5024
- const fields = isGridGenerator ? this.fields : this.groupedFields.visible;
5235
+ const fields = isGridGenerator ? this.fields : {};
5236
+
5237
+ if (!isGridGenerator) {
5238
+ for (const key in this.normalizedFields) {
5239
+ Object.assign(fields, this.normalizedFields[key].fields.visible);
5240
+ }
5241
+ }
5025
5242
 
5026
5243
  if (!Array.isArray(fields)) {
5027
5244
  index = Object.keys(fields).findIndex(field => field === index);
@@ -5071,6 +5288,19 @@ var script$l = {
5071
5288
  default: () => ({}),
5072
5289
  required: true,
5073
5290
  type: Object
5291
+ },
5292
+
5293
+ fieldset: {
5294
+ default: () => ({}),
5295
+ type: Object
5296
+ },
5297
+
5298
+ fieldsetGutter: {
5299
+ default: 'lg',
5300
+ type: [String, Boolean],
5301
+ validator: value => {
5302
+ return typeof value === 'boolean' || ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
5303
+ }
5074
5304
  }
5075
5305
  },
5076
5306
 
@@ -5080,6 +5310,8 @@ var script$l = {
5080
5310
  groupedFields () {
5081
5311
  const fields = { hidden: {}, visible: {} };
5082
5312
 
5313
+ if (this.hasFieldset) return fields
5314
+
5083
5315
  for (const key in this.fields) {
5084
5316
  const field = this.fields[key];
5085
5317
  fields[field.type === 'hidden' ? 'hidden' : 'visible'][key] = field;
@@ -5096,6 +5328,58 @@ var script$l = {
5096
5328
  }
5097
5329
 
5098
5330
  return fields
5331
+ },
5332
+
5333
+ normalizedFields () {
5334
+ if (!this.hasFieldset) {
5335
+ return {
5336
+ default: {
5337
+ fields: this.groupedFields
5338
+ }
5339
+ }
5340
+ }
5341
+
5342
+ const fields = {};
5343
+
5344
+ for (const fieldsetKey in this.fieldset) {
5345
+ const fieldsetItem = this.fieldset[fieldsetKey];
5346
+
5347
+ fields[fieldsetKey] = {
5348
+ label: fieldsetItem.label,
5349
+ fields: { hidden: {}, visible: {} }
5350
+ };
5351
+
5352
+ for (const fieldName of fieldsetItem.fields) {
5353
+ const field = this.fields[fieldName];
5354
+
5355
+ if (!field) continue
5356
+
5357
+ Object.assign(
5358
+ fields[fieldsetKey].fields[
5359
+ field.type === 'hidden' ? 'hidden' : 'visible'
5360
+ ],
5361
+ {
5362
+ [fieldName]: field
5363
+ }
5364
+ );
5365
+ }
5366
+ }
5367
+
5368
+ return fields
5369
+ },
5370
+
5371
+ hasFieldset () {
5372
+ return !!Object.keys(this.fieldset).length
5373
+ },
5374
+
5375
+ fieldsetClasses () {
5376
+ const classes = ['row'];
5377
+
5378
+ if (this.fieldsetGutter) {
5379
+ classes.push(`q-col-gutter-y-${this.fieldsetGutter}`);
5380
+ }
5381
+
5382
+ return classes
5099
5383
  }
5100
5384
  },
5101
5385
 
@@ -5110,51 +5394,290 @@ var script$l = {
5110
5394
  };
5111
5395
 
5112
5396
  function render$l(_ctx, _cache, $props, $setup, $data, $options) {
5397
+ const _component_qas_label = resolveComponent("qas-label");
5113
5398
  const _component_qas_field = resolveComponent("qas-field");
5114
5399
 
5115
- return (openBlock(), createElementBlock("div", null, [
5116
- createElementVNode("div", {
5117
- class: normalizeClass(_ctx.mx_classes)
5118
- }, [
5119
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.groupedFields.visible, (field, key) => {
5120
- return (openBlock(), createElementBlock("div", {
5121
- key: key,
5122
- class: normalizeClass(_ctx.mx_getFieldClass(key))
5123
- }, [
5124
- renderSlot(_ctx.$slots, `field-${field.name}`, { field: field }, () => [
5125
- createVNode(_component_qas_field, mergeProps($props.fieldsProps[field.name], {
5126
- error: $props.errors[key],
5127
- field: field,
5128
- "model-value": $props.modelValue[field.name],
5129
- "onUpdate:modelValue": $event => ($options.updateModelValue(field.name, $event))
5130
- }), null, 16 /* FULL_PROPS */, ["error", "field", "model-value", "onUpdate:modelValue"])
5131
- ])
5132
- ], 2 /* CLASS */))
5133
- }), 128 /* KEYED_FRAGMENT */))
5134
- ], 2 /* CLASS */),
5135
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.groupedFields.hidden, (field, key) => {
5136
- return (openBlock(), createElementBlock("div", { key: key }, [
5137
- renderSlot(_ctx.$slots, `field-${field.name}`, { field: field }, () => [
5138
- createVNode(_component_qas_field, mergeProps($props.fieldsProps[field.name], {
5139
- field: field,
5140
- "model-value": $props.modelValue[field.name],
5141
- "onUpdate:modelValue": $event => ($options.updateModelValue(field.name, $event))
5142
- }), null, 16 /* FULL_PROPS */, ["field", "model-value", "onUpdate:modelValue"])
5400
+ return (openBlock(), createElementBlock("div", {
5401
+ class: normalizeClass($options.fieldsetClasses)
5402
+ }, [
5403
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.normalizedFields, (fieldsetItem, fieldsetItemKey) => {
5404
+ return (openBlock(), createElementBlock("div", {
5405
+ key: fieldsetItemKey,
5406
+ class: "full-width"
5407
+ }, [
5408
+ (fieldsetItem.label)
5409
+ ? renderSlot(_ctx.$slots, `legend-${fieldsetItemKey}`, { key: 0 }, () => [
5410
+ createVNode(_component_qas_label, {
5411
+ label: fieldsetItem.label
5412
+ }, null, 8 /* PROPS */, ["label"])
5413
+ ])
5414
+ : createCommentVNode("v-if", true),
5415
+ createElementVNode("div", null, [
5416
+ createElementVNode("div", {
5417
+ class: normalizeClass(_ctx.mx_classes)
5418
+ }, [
5419
+ (openBlock(true), createElementBlock(Fragment, null, renderList(fieldsetItem.fields.visible, (field, key) => {
5420
+ return (openBlock(), createElementBlock("div", {
5421
+ key: key,
5422
+ class: normalizeClass(_ctx.mx_getFieldClass(key))
5423
+ }, [
5424
+ renderSlot(_ctx.$slots, `field-${field.name}`, { field: field }, () => [
5425
+ createVNode(_component_qas_field, mergeProps($props.fieldsProps[field.name], {
5426
+ error: $props.errors[key],
5427
+ field: field,
5428
+ "model-value": $props.modelValue[field.name],
5429
+ "onUpdate:modelValue": $event => ($options.updateModelValue(field.name, $event))
5430
+ }), null, 16 /* FULL_PROPS */, ["error", "field", "model-value", "onUpdate:modelValue"])
5431
+ ])
5432
+ ], 2 /* CLASS */))
5433
+ }), 128 /* KEYED_FRAGMENT */))
5434
+ ], 2 /* CLASS */),
5435
+ (openBlock(true), createElementBlock(Fragment, null, renderList(fieldsetItem.fields.hidden, (field, key) => {
5436
+ return (openBlock(), createElementBlock("div", { key: key }, [
5437
+ renderSlot(_ctx.$slots, `field-${field.name}`, { field: field }, () => [
5438
+ createVNode(_component_qas_field, mergeProps($props.fieldsProps[field.name], {
5439
+ field: field,
5440
+ "model-value": $props.modelValue[field.name],
5441
+ "onUpdate:modelValue": $event => ($options.updateModelValue(field.name, $event))
5442
+ }), null, 16 /* FULL_PROPS */, ["field", "model-value", "onUpdate:modelValue"])
5443
+ ])
5444
+ ]))
5445
+ }), 128 /* KEYED_FRAGMENT */))
5143
5446
  ])
5144
5447
  ]))
5145
5448
  }), 128 /* KEYED_FRAGMENT */))
5146
- ]))
5449
+ ], 2 /* CLASS */))
5147
5450
  }
5148
5451
 
5149
5452
  script$l.render = render$l;
5150
5453
  script$l.__file = "src/components/form-generator/QasFormGenerator.vue";
5151
5454
 
5152
- var viewMixin = {
5455
+ var searchFilterMixin = {
5153
5456
  props: {
5154
- dialog: {
5457
+ entity: {
5458
+ default: '',
5459
+ type: String
5460
+ },
5461
+
5462
+ lazyLoadingProps: {
5463
+ default: () => ({}),
5464
+ type: Object
5465
+ },
5466
+
5467
+ name: {
5468
+ default: '',
5469
+ type: String
5470
+ },
5471
+
5472
+ useLazyLoading: {
5473
+ type: Boolean
5474
+ },
5475
+
5476
+ fetching: {
5155
5477
  type: Boolean
5478
+ }
5479
+ },
5480
+
5481
+ emits: [
5482
+ 'update:modelValue',
5483
+ 'update:fetching',
5484
+ 'fetch-options-success',
5485
+ 'fetch-options-error'
5486
+ ],
5487
+
5488
+ data () {
5489
+ return {
5490
+ mx_filteredOptions: [],
5491
+ mx_hasFetchError: false,
5492
+ mx_isFetching: false,
5493
+ mx_isScrolling: false,
5494
+ mx_search: '',
5495
+ mx_fetchCount: 0,
5496
+ mx_pagination: {
5497
+ page: 1,
5498
+ lastPage: null,
5499
+ hasCount: true,
5500
+ hasNextPage: false
5501
+ }
5502
+ }
5503
+ },
5504
+
5505
+ computed: {
5506
+ mx_defaultLazyLoadingProps () {
5507
+ const {
5508
+ url,
5509
+ params,
5510
+ decamelizeFieldName
5511
+ } = this.lazyLoadingProps;
5512
+
5513
+ const defaultParams = { limit: 48 };
5514
+
5515
+ return {
5516
+ url: url || '',
5517
+ params: {
5518
+ ...defaultParams,
5519
+ ...params
5520
+ },
5521
+ decamelizeFieldName: decamelizeFieldName === undefined ? true : decamelizeFieldName
5522
+ }
5523
+ },
5524
+
5525
+ mx_hasFilteredOptions () {
5526
+ return !!this.mx_filteredOptions.length
5527
+ },
5528
+
5529
+ mx_isFilterByFuse () {
5530
+ return !this.useLazyLoading
5531
+ }
5532
+ },
5533
+
5534
+ watch: {
5535
+ lazyLoadingProps: {
5536
+ handler (value, oldValue) {
5537
+ if (isEqual$1(value, oldValue)) return
5538
+
5539
+ this.mx_filterOptionsByStore('');
5540
+ this.$emit('update:modelValue', '');
5541
+ }
5542
+ }
5543
+ },
5544
+
5545
+ methods: {
5546
+ async mx_filterOptionsByStore (search) {
5547
+ this.mx_resetFilter(search);
5548
+ await this.mx_setFetchOptions();
5549
+ },
5550
+
5551
+ mx_resetFilter (search) {
5552
+ this.mx_filteredOptions = [];
5553
+ this.mx_search = search;
5554
+ this.mx_pagination = {
5555
+ page: 1,
5556
+ lastPage: null,
5557
+ hasCount: true,
5558
+ hasNextPage: false
5559
+ };
5156
5560
  },
5157
5561
 
5562
+ async mx_onVirtualScroll ({ index, ref }) {
5563
+ const lastIndex = this.mx_filteredOptions.length - 1;
5564
+
5565
+ if (index === lastIndex && this.mx_canFetchOptions()) {
5566
+ await this.mx_loadMoreOptions();
5567
+
5568
+ this.$nextTick(() => {
5569
+ ref.reset();
5570
+ ref.refresh(lastIndex);
5571
+ });
5572
+ }
5573
+ },
5574
+
5575
+ async mx_loadMoreOptions () {
5576
+ this.mx_isScrolling = true;
5577
+
5578
+ const options = await this.mx_fetchOptions();
5579
+ this.mx_filteredOptions.push(...options);
5580
+
5581
+ // this is to prevent the virtual-scroll event to be fired again
5582
+ this.$nextTick(() => {
5583
+ this.mx_isScrolling = false;
5584
+ });
5585
+ },
5586
+
5587
+ async mx_fetchOptions () {
5588
+ this.mx_fetchCount++;
5589
+
5590
+ try {
5591
+ if (!this.entity) this.mx_setMissingPropsMessage('entity');
5592
+ if (!this.name) this.mx_setMissingPropsMessage('name');
5593
+
5594
+ this.mx_hasFetchError = false;
5595
+ this.mx_isFetching = true;
5596
+
5597
+ this.$emit('update:fetching', true);
5598
+
5599
+ const { url, params, decamelizeFieldName } = this.mx_defaultLazyLoadingProps;
5600
+
5601
+ const { data } = await this.$store.dispatch(`${this.entity}/fetchFieldOptions`, {
5602
+ url,
5603
+ field: decamelizeFieldName ? decamelize(this.name, { separator: '-' }) : this.name,
5604
+ params: {
5605
+ ...params,
5606
+ search: this.mx_search,
5607
+ offset: (this.mx_pagination.page - 1) * params.limit
5608
+ }
5609
+ });
5610
+
5611
+ const { results, count, hasNextPage } = data;
5612
+ const hasCount = count !== undefined;
5613
+
5614
+ this.mx_pagination = {
5615
+ page: this.mx_pagination.page + 1,
5616
+ lastPage: hasCount ? Math.ceil(count / params.limit) : null,
5617
+ hasCount,
5618
+ hasNextPage
5619
+ };
5620
+
5621
+ this.$emit('fetch-options-success', data);
5622
+
5623
+ return this.mx_handleOptions(results)
5624
+ } catch (error) {
5625
+ this.$qas.logger.group(
5626
+ `Mixin: searchFilterMixin - mx_fetchOptions -> exceção da action ${this.entity}/fetchFieldOptions`,
5627
+ [error],
5628
+ { error: true }
5629
+ );
5630
+
5631
+ this.mx_hasFetchError = true;
5632
+ this.$emit('fetch-options-error', error);
5633
+
5634
+ return []
5635
+ } finally {
5636
+ this.mx_isFetching = false;
5637
+ this.$emit('update:fetching', false);
5638
+ }
5639
+ },
5640
+
5641
+ async mx_setFetchOptions () {
5642
+ this.mx_filteredOptions = await this.mx_fetchOptions();
5643
+ },
5644
+
5645
+ mx_canFetchOptions () {
5646
+ const { lastPage, page, hasCount, hasNextPage } = this.mx_pagination;
5647
+
5648
+ const hasMorePages = hasCount ? lastPage && page <= lastPage : hasNextPage;
5649
+
5650
+ return hasMorePages && !this.mx_isFetching && !this.mx_isScrolling && this.useLazyLoading
5651
+ },
5652
+
5653
+ mx_handleOptions (options) {
5654
+ if (this.labelKey && this.valueKey) {
5655
+ return getNormalizedOptions({
5656
+ options,
5657
+ label: this.labelKey,
5658
+ value: this.valueKey
5659
+ })
5660
+ }
5661
+
5662
+ return options
5663
+ },
5664
+
5665
+ mx_getMissingPropsMessage (prop) {
5666
+ return `A propriedade "${prop}" é obrigatória quando a propriedade "useLazyLoading" está ativa.`
5667
+ },
5668
+
5669
+ mx_setMissingPropsMessage (prop) {
5670
+ throw new Error(this.mx_getMissingPropsMessage(prop))
5671
+ },
5672
+
5673
+ mx_getNormalizedFuseResults (results = []) {
5674
+ return results.map(({ item }) => item)
5675
+ }
5676
+ }
5677
+ };
5678
+
5679
+ var viewMixin = {
5680
+ props: {
5158
5681
  entity: {
5159
5682
  required: true,
5160
5683
  type: String
@@ -5182,6 +5705,16 @@ var viewMixin = {
5182
5705
 
5183
5706
  fetching: {
5184
5707
  type: Boolean
5708
+ },
5709
+
5710
+ useBoundary: {
5711
+ default: true,
5712
+ type: Boolean
5713
+ },
5714
+
5715
+ beforeFetch: {
5716
+ default: null,
5717
+ type: Function
5185
5718
  }
5186
5719
  },
5187
5720
 
@@ -5197,7 +5730,7 @@ var viewMixin = {
5197
5730
  mx_errors: {},
5198
5731
  mx_fields: {},
5199
5732
  mx_metadata: {},
5200
-
5733
+ mx_cancelBeforeFetch: false,
5201
5734
  mx_isFetching: false
5202
5735
  }
5203
5736
  },
@@ -5210,11 +5743,11 @@ var viewMixin = {
5210
5743
 
5211
5744
  computed: {
5212
5745
  mx_componentTag () {
5213
- return this.dialog ? 'div' : 'q-page'
5746
+ return this.useBoundary ? 'q-page' : 'div'
5214
5747
  },
5215
5748
 
5216
5749
  mx_componentClass () {
5217
- return !this.dialog && 'container spaced'
5750
+ return this.useBoundary && 'container spaced'
5218
5751
  },
5219
5752
 
5220
5753
  mx_hasFooterSlot () {
@@ -5234,7 +5767,9 @@ var viewMixin = {
5234
5767
  this.$qas.error('Ops! Erro ao obter os dados.', exception);
5235
5768
 
5236
5769
  const status = response?.status;
5237
- const redirect = ({ 403: 'Forbidden', 404: 'NotFound' })[status];
5770
+ const redirect = status >= 500
5771
+ ? 'ServerError'
5772
+ : ({ 401: 'Unauthorized', 403: 'Forbidden', 404: 'NotFound' })[status];
5238
5773
 
5239
5774
  if (redirect) {
5240
5775
  this.$router.replace({ name: redirect });
@@ -5246,11 +5781,9 @@ var viewMixin = {
5246
5781
  },
5247
5782
 
5248
5783
  mx_setFields (fields = {}) {
5249
- for (const field in fields) {
5250
- fields[field].name = camelize(fields[field].name);
5251
- }
5784
+ const camelizedFields = camelizeFieldsName(fields);
5252
5785
 
5253
- this.mx_fields = markRaw(fields);
5786
+ this.mx_fields = markRaw(camelizedFields);
5254
5787
  },
5255
5788
 
5256
5789
  mx_setMetadata (metadata = {}) {
@@ -5263,6 +5796,22 @@ var viewMixin = {
5263
5796
 
5264
5797
  this.$emit(`update:${key}`, models[key]);
5265
5798
  }
5799
+ },
5800
+
5801
+ mx_fetchHandler (payload, resolve) {
5802
+ const hasBeforeFetch = typeof this.beforeFetch === 'function';
5803
+
5804
+ if (hasBeforeFetch && !this.mx_cancelBeforeFetch) {
5805
+ return this.beforeFetch({
5806
+ payload,
5807
+ resolve: payload => resolve(payload),
5808
+ done: () => {
5809
+ this.mx_cancelBeforeFetch = true;
5810
+ }
5811
+ })
5812
+ }
5813
+
5814
+ resolve();
5266
5815
  }
5267
5816
  }
5268
5817
  };
@@ -5278,7 +5827,7 @@ var script$k = {
5278
5827
  mixins: [viewMixin],
5279
5828
 
5280
5829
  props: {
5281
- cancelButton: {
5830
+ cancelButtonLabel: {
5282
5831
  default: 'Cancelar',
5283
5832
  type: String
5284
5833
  },
@@ -5302,16 +5851,12 @@ var script$k = {
5302
5851
  type: String
5303
5852
  },
5304
5853
 
5305
- readOnly: {
5306
- type: Boolean
5307
- },
5308
-
5309
5854
  route: {
5310
5855
  default: () => ({}),
5311
5856
  type: Object
5312
5857
  },
5313
5858
 
5314
- showDialogOnUnsavedChanges: {
5859
+ useDialogOnUnsavedChanges: {
5315
5860
  default: true,
5316
5861
  type: Boolean
5317
5862
  },
@@ -5321,7 +5866,7 @@ var script$k = {
5321
5866
  type: Array
5322
5867
  },
5323
5868
 
5324
- submitButton: {
5869
+ submitButtonLabel: {
5325
5870
  default: 'Salvar',
5326
5871
  type: String
5327
5872
  },
@@ -5333,6 +5878,26 @@ var script$k = {
5333
5878
 
5334
5879
  submitting: {
5335
5880
  type: Boolean
5881
+ },
5882
+
5883
+ useActions: {
5884
+ default: true,
5885
+ type: Boolean
5886
+ },
5887
+
5888
+ useCancelButton: {
5889
+ default: true,
5890
+ type: Boolean
5891
+ },
5892
+
5893
+ useSubmitButton: {
5894
+ default: true,
5895
+ type: Boolean
5896
+ },
5897
+
5898
+ beforeSubmit: {
5899
+ default: null,
5900
+ type: Function
5336
5901
  }
5337
5902
  },
5338
5903
 
@@ -5349,7 +5914,6 @@ var script$k = {
5349
5914
  data () {
5350
5915
  return {
5351
5916
  cachedResult: {},
5352
- hasResult: false,
5353
5917
  isSubmitting: false,
5354
5918
  showDialog: false,
5355
5919
  ignoreRouterGuard: false,
@@ -5377,7 +5941,7 @@ var script$k = {
5377
5941
  },
5378
5942
 
5379
5943
  hasCancelButton () {
5380
- return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute)
5944
+ return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute) && this.useCancelButton
5381
5945
  },
5382
5946
 
5383
5947
  id () {
@@ -5396,37 +5960,27 @@ var script$k = {
5396
5960
  return this.$route
5397
5961
  },
5398
5962
 
5399
- saveButtonClass () {
5963
+ submitButtonClass () {
5400
5964
  return this.$qas.screen.isSmall && 'order-first'
5401
5965
  },
5402
5966
 
5403
5967
  isCancelButtonDisabled () {
5404
5968
  return this.disable || this.isSubmitting
5405
- },
5406
-
5407
- fieldsNameWithDefaultValue () {
5408
- return Object.keys(this.fields).filter(field => 'default' in this.fields[field])
5409
5969
  }
5410
5970
  },
5411
5971
 
5412
5972
  watch: {
5413
- mx_fields (fields) {
5414
- const models = { ...this.getModelsByFields(fields), ...this.modelValue };
5415
-
5416
- if (!this.hasResult && this.showDialogOnUnsavedChanges) {
5417
- this.cachedResult = extend(true, {}, models);
5418
- }
5419
- },
5420
-
5421
5973
  isSubmitting (value) {
5422
5974
  this.$emit('update:submitting', value);
5423
5975
  }
5424
5976
  },
5425
5977
 
5426
5978
  created () {
5427
- onBeforeRouteLeave(this.beforeRouteLeave);
5979
+ this.useDialogOnUnsavedChanges && onBeforeRouteLeave(this.beforeRouteLeave);
5980
+
5428
5981
  window.addEventListener('delete-success', this.setIgnoreRouterGuard);
5429
- this.fetch();
5982
+
5983
+ this.mx_fetchHandler({ form: true, id: this.id, url: this.fetchURL }, this.fetchSingle);
5430
5984
  },
5431
5985
 
5432
5986
  onUnmounted () {
@@ -5435,14 +5989,32 @@ var script$k = {
5435
5989
 
5436
5990
  methods: {
5437
5991
  beforeRouteLeave (to, from, next) {
5992
+ const clonedModelValue = extend(true, {}, this.modelValue);
5993
+ const clonedCachedResult = extend(true, {}, this.cachedResult);
5994
+
5995
+ /**
5996
+ * Se a propriedade "useDialogOnUnsavedChanges" for false ou a variável
5997
+ * "ignoreRouterGuard" for true, então **não** iremos checar se o usuário
5998
+ * alterou algum campo antes de sair da pagina, senão iremos validar pela função isEqualWith
5999
+ * e mostrar um dialog antes do usuário sair da página.
6000
+ */
5438
6001
  if (
5439
- !this.showDialogOnUnsavedChanges ||
6002
+ !this.useDialogOnUnsavedChanges ||
5440
6003
  this.ignoreRouterGuard ||
5441
- isEqualWith(this.modelValue, this.cachedResult, this.handleIgnoreKeysInUnsavedChanges)
6004
+ isEqualWith(
6005
+ clonedModelValue,
6006
+ clonedCachedResult,
6007
+ this.handleIgnoreKeysInUnsavedChanges
6008
+ )
5442
6009
  ) {
5443
6010
  return next()
5444
6011
  }
5445
6012
 
6013
+ this.$qas.logger.group(
6014
+ 'QasFormView - beforeRouteLeave -> dialog chamado, modelValue diferente do cachedResult',
6015
+ [{ modelValue: clonedModelValue, cachedResult: clonedCachedResult }]
6016
+ );
6017
+
5446
6018
  this.handleDialog(() => {
5447
6019
  this.ignoreRouterGuard = true;
5448
6020
  next();
@@ -5450,41 +6022,64 @@ var script$k = {
5450
6022
  },
5451
6023
 
5452
6024
  cancel () {
5453
- if (!this.dialog) {
5454
- this.handleCancelRoute();
5455
- }
6025
+ this.handleCancelRoute();
5456
6026
  },
5457
6027
 
5458
- async fetch (params) {
6028
+ async fetchSingle (externalPayload = {}) {
5459
6029
  this.mx_isFetching = true;
5460
6030
 
5461
6031
  try {
5462
- const response = await this.$store.dispatch(
5463
- `${this.entity}/fetchSingle`, { form: true, id: this.id, params, url: this.fetchURL }
6032
+ const payload = {
6033
+ form: true,
6034
+ id: this.id,
6035
+ url: this.fetchURL,
6036
+ ...externalPayload
6037
+ };
6038
+
6039
+ this.$qas.logger.group(
6040
+ `QasFormView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`, [payload]
5464
6041
  );
5465
6042
 
6043
+ const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload);
6044
+
5466
6045
  const { errors, fields, metadata, result } = response.data;
5467
6046
 
6047
+ const modelValue = { ...this.getModelsByFields(fields), ...this.modelValue };
6048
+
5468
6049
  this.mx_setErrors(errors);
5469
6050
  this.mx_setFields(fields);
5470
6051
  this.mx_setMetadata(metadata);
5471
6052
 
5472
6053
  this.mx_updateModels({
5473
- errors: errors,
6054
+ errors,
5474
6055
  fields: this.mx_fields,
5475
6056
  metadata
5476
6057
  });
5477
6058
 
5478
- if (result) {
5479
- this.hasResult = true;
5480
- this.$emit('update:modelValue', { ...this.modelValue, ...result });
5481
- this.cachedResult = this.showDialogOnUnsavedChanges && extend(true, {}, result);
6059
+ result && Object.assign(modelValue, result);
6060
+
6061
+ this.$qas.logger.group(
6062
+ `QasFormView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
6063
+ );
6064
+
6065
+ if (this.useDialogOnUnsavedChanges) {
6066
+ this.cachedResult = extend(true, {}, result || modelValue);
6067
+ this.$qas.logger.group('QasFormView - fetchSingle -> cachedResult', [this.cachedResult]);
5482
6068
  }
5483
6069
 
6070
+ this.$emit('update:modelValue', modelValue);
5484
6071
  this.$emit('fetch-success', response, this.modelValue);
6072
+
6073
+ this.$qas.logger.group('QasFormView - fetchSingle -> modelValue', [modelValue]);
5485
6074
  } catch (error) {
5486
6075
  this.mx_fetchError(error);
5487
6076
  this.$emit('fetch-error', error);
6077
+
6078
+ this.$qas.logger.group(
6079
+ `QasFormView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
6080
+ [error],
6081
+ { error: true }
6082
+ );
5488
6083
  } finally {
5489
6084
  this.mx_isFetching = false;
5490
6085
  }
@@ -5521,6 +6116,7 @@ var script$k = {
5521
6116
  const { addRoute } = useHistory();
5522
6117
 
5523
6118
  this.defaultDialogProps.ok.onClick = () => addRoute(this.$route);
6119
+
5524
6120
  this.defaultDialogProps.cancel.onClick = next;
5525
6121
  },
5526
6122
 
@@ -5530,48 +6126,76 @@ var script$k = {
5530
6126
 
5531
6127
  // ignora chaves na hora de validar quando usuário está saindo da página
5532
6128
  handleIgnoreKeysInUnsavedChanges (firstValue, secondValue) {
5533
- const toIgnore = [
5534
- ...this.fieldsNameWithDefaultValue,
5535
- ...this.ignoreKeysInUnsavedChanges
5536
- ];
6129
+ if (!this.ignoreKeysInUnsavedChanges.length) return
5537
6130
 
5538
- if (!toIgnore.length) return
6131
+ this.ignoreKeysInUnsavedChanges.forEach(key => {
6132
+ if (!firstValue) return
5539
6133
 
5540
- toIgnore.forEach(key => {
5541
6134
  delete firstValue[key];
5542
6135
  delete secondValue[key];
5543
6136
  });
5544
6137
  },
5545
6138
 
5546
- async submit (event) {
6139
+ /**
6140
+ * Se existe a propriedade com callback "beforeSubmit", então o controle de quando e como chamar o método "submit"
6141
+ * está sendo controlado fora do QasFormView, se não existir a propriedade "beforeSubmit", então o controle do método
6142
+ * submit é feito pelo próprio QasFormView, chamado pelo evento @submit.
6143
+ */
6144
+ submitHandler (event) {
5547
6145
  if (event) {
5548
6146
  event.preventDefault();
5549
6147
  }
5550
6148
 
5551
- if (this.disable || this.readyOnly) {
5552
- return null
6149
+ const hasBeforeSubmit = typeof this.beforeSubmit === 'function';
6150
+
6151
+ if (hasBeforeSubmit) {
6152
+ return this.beforeSubmit({
6153
+ payload: { id: this.id, payload: this.modelValue, url: this.url },
6154
+ resolve: payload => this.submit(payload)
6155
+ })
5553
6156
  }
5554
6157
 
6158
+ this.submit();
6159
+ },
6160
+
6161
+ async submit (externalPayload = {}) {
6162
+ if (this.disable) return null
6163
+
5555
6164
  this.isSubmitting = true;
5556
6165
 
5557
6166
  try {
5558
- const response = await this.$store.dispatch(
5559
- `${this.entity}/${this.mode}`,
5560
- { id: this.id, payload: this.modelValue, url: this.url }
6167
+ const payload = {
6168
+ id: this.id,
6169
+ payload: this.modelValue,
6170
+ url: this.url,
6171
+ ...externalPayload
6172
+ };
6173
+
6174
+ this.$qas.logger.group(
6175
+ `QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
5561
6176
  );
5562
6177
 
5563
- if (this.showDialogOnUnsavedChanges) {
6178
+ const response = await this.$store.dispatch(`${this.entity}/${this.mode}`, payload);
6179
+
6180
+ if (this.useDialogOnUnsavedChanges) {
5564
6181
  this.cachedResult = extend(true, {}, this.modelValue);
5565
6182
  }
5566
6183
 
5567
6184
  this.mx_setErrors();
5568
6185
  NotifySuccess(response.data.status.text || 'Item salvo com sucesso!');
5569
6186
  this.$emit('submit-success', response, this.modelValue);
6187
+
6188
+ this.$qas.logger.group(
6189
+ `QasFormView - submit -> resposta da action ${this.entity}/${this.mode}`, [response]
6190
+ );
5570
6191
  } catch (error) {
5571
6192
  const errors = error?.response?.data?.errors;
5572
6193
  const message = error?.response?.data?.status?.text;
5573
6194
  const exceptionResponse = error?.response?.data?.exception;
5574
- const exception = errors ? 'Existem erros de validação no formulário.' : exceptionResponse || error.message;
6195
+
6196
+ const exception = errors
6197
+ ? 'Existem erros de validação no formulário.'
6198
+ : exceptionResponse || error.message;
5575
6199
 
5576
6200
  this.mx_setErrors(errors);
5577
6201
  this.$emit('update:errors', this.mx_errors);
@@ -5579,6 +6203,12 @@ var script$k = {
5579
6203
  NotifyError(message || 'Ops! Erro ao salvar item.', exception);
5580
6204
 
5581
6205
  this.$emit('submit-error', error);
6206
+
6207
+ this.$qas.logger.group(
6208
+ `QasFormView - submit -> exceção da action ${this.entity}/${this.mode}`,
6209
+ [error],
6210
+ { error: true }
6211
+ );
5582
6212
  } finally {
5583
6213
  this.isSubmitting = false;
5584
6214
  }
@@ -5590,7 +6220,7 @@ var script$k = {
5590
6220
  }
5591
6221
  };
5592
6222
 
5593
- const _hoisted_1$d = { key: 0 };
6223
+ const _hoisted_1$e = { key: 0 };
5594
6224
  const _hoisted_2$9 = { class: "justify-end q-col-gutter-md q-my-lg row" };
5595
6225
  const _hoisted_3$6 = { key: 1 };
5596
6226
 
@@ -5607,17 +6237,17 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5607
6237
  }, {
5608
6238
  default: withCtx(() => [
5609
6239
  (_ctx.mx_hasHeaderSlot)
5610
- ? (openBlock(), createElementBlock("header", _hoisted_1$d, [
6240
+ ? (openBlock(), createElementBlock("header", _hoisted_1$e, [
5611
6241
  renderSlot(_ctx.$slots, "header")
5612
6242
  ]))
5613
6243
  : createCommentVNode("v-if", true),
5614
6244
  createVNode(_component_q_form, {
5615
6245
  ref: "form",
5616
- onSubmit: $options.submit
6246
+ onSubmit: $options.submitHandler
5617
6247
  }, {
5618
6248
  default: withCtx(() => [
5619
6249
  renderSlot(_ctx.$slots, "default"),
5620
- (!$props.readOnly)
6250
+ ($props.useActions)
5621
6251
  ? renderSlot(_ctx.$slots, "actions", { key: 0 }, () => [
5622
6252
  createElementVNode("div", _hoisted_2$9, [
5623
6253
  ($options.hasCancelButton)
@@ -5629,27 +6259,30 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5629
6259
  class: "full-width",
5630
6260
  "data-cy": `btnCancel-${_ctx.entity}`,
5631
6261
  disable: $options.isCancelButtonDisabled,
5632
- label: $props.cancelButton,
6262
+ label: $props.cancelButtonLabel,
5633
6263
  outline: "",
5634
6264
  type: "button",
5635
6265
  onClick: $options.cancel
5636
6266
  }, null, 8 /* PROPS */, ["data-cy", "disable", "label", "onClick"]), [
5637
- [_directive_close_popup, _ctx.dialog]
6267
+ [_directive_close_popup]
5638
6268
  ])
5639
6269
  ], 2 /* CLASS */))
5640
6270
  : createCommentVNode("v-if", true),
5641
- createElementVNode("div", {
5642
- class: normalizeClass(["col-12 col-sm-2", $options.saveButtonClass])
5643
- }, [
5644
- createVNode(_component_qas_btn, {
5645
- class: "full-width",
5646
- "data-cy": `btnSave-${_ctx.entity}`,
5647
- disable: $props.disable,
5648
- label: $props.submitButton,
5649
- loading: $data.isSubmitting,
5650
- type: "submit"
5651
- }, null, 8 /* PROPS */, ["data-cy", "disable", "label", "loading"])
5652
- ], 2 /* CLASS */)
6271
+ ($props.useSubmitButton)
6272
+ ? (openBlock(), createElementBlock("div", {
6273
+ key: 1,
6274
+ class: normalizeClass(["col-12 col-sm-2", $options.submitButtonClass])
6275
+ }, [
6276
+ createVNode(_component_qas_btn, {
6277
+ class: "full-width",
6278
+ "data-cy": `btnSave-${_ctx.entity}`,
6279
+ disable: $props.disable,
6280
+ label: $props.submitButtonLabel,
6281
+ loading: $data.isSubmitting,
6282
+ type: "submit"
6283
+ }, null, 8 /* PROPS */, ["data-cy", "disable", "label", "loading"])
6284
+ ], 2 /* CLASS */))
6285
+ : createCommentVNode("v-if", true)
5653
6286
  ])
5654
6287
  ])
5655
6288
  : createCommentVNode("v-if", true)
@@ -5801,7 +6434,7 @@ var script$j = {
5801
6434
  }
5802
6435
  };
5803
6436
 
5804
- const _hoisted_1$c = { class: "q-col-gutter-md row" };
6437
+ const _hoisted_1$d = { class: "q-col-gutter-md row" };
5805
6438
  const _hoisted_2$8 = {
5806
6439
  key: 0,
5807
6440
  class: "full-width text-center"
@@ -5823,7 +6456,7 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) {
5823
6456
 
5824
6457
  return (openBlock(), createBlock(_component_qas_box, { class: "gallery" }, {
5825
6458
  default: withCtx(() => [
5826
- createElementVNode("div", _hoisted_1$c, [
6459
+ createElementVNode("div", _hoisted_1$d, [
5827
6460
  (openBlock(true), createElementBlock(Fragment, null, renderList($options.initialImages(), (image, index) => {
5828
6461
  return (openBlock(), createElementBlock("div", {
5829
6462
  key: index,
@@ -5945,10 +6578,6 @@ var script$i = {
5945
6578
  type: [Array, Object, String]
5946
6579
  },
5947
6580
 
5948
- hideEmptyResult: {
5949
- type: Boolean
5950
- },
5951
-
5952
6581
  emptyResultText: {
5953
6582
  default: '-',
5954
6583
  type: String
@@ -5957,6 +6586,11 @@ var script$i = {
5957
6586
  result: {
5958
6587
  default: () => ({}),
5959
6588
  type: Object
6589
+ },
6590
+
6591
+ useEmptyResult: {
6592
+ default: true,
6593
+ type: Boolean
5960
6594
  }
5961
6595
  },
5962
6596
 
@@ -5968,7 +6602,12 @@ var script$i = {
5968
6602
 
5969
6603
  computed: {
5970
6604
  formattedFields () {
5971
- if (!this.hideEmptyResult) {
6605
+ if (this.useEmptyResult) {
6606
+ this.$qas.logger.group(
6607
+ 'QasGridGenerator - formattedFields -> this.useEmptyResult tem valor "true"',
6608
+ [this.fields]
6609
+ );
6610
+
5972
6611
  return this.fields
5973
6612
  }
5974
6613
 
@@ -5986,6 +6625,8 @@ var script$i = {
5986
6625
  }
5987
6626
  }
5988
6627
 
6628
+ this.$qas.logger.group('QasGridGenerator - formattedFields', [fields]);
6629
+
5989
6630
  return fields
5990
6631
  },
5991
6632
 
@@ -6001,11 +6642,19 @@ var script$i = {
6001
6642
 
6002
6643
  for (const key in result) {
6003
6644
  if (this.formattedFields[key]?.type) {
6004
- formattedResult[key] = humanize(this.formattedFields[key], result[key]) || this.emptyResultText;
6005
- this.slotValue[key] = { ...this.formattedFields[key], formattedResult: formattedResult[key] };
6645
+ formattedResult[key] = (
6646
+ humanize(this.formattedFields[key], result[key]) || this.emptyResultText
6647
+ );
6648
+
6649
+ this.slotValue[key] = {
6650
+ ...this.formattedFields[key],
6651
+ formattedResult: formattedResult[key]
6652
+ };
6006
6653
  }
6007
6654
  }
6008
6655
 
6656
+ this.$qas.logger.group('QasGridGenerator - getResultsByFields', [formattedResult]);
6657
+
6009
6658
  return formattedResult
6010
6659
  }
6011
6660
  }
@@ -6141,6 +6790,10 @@ var script$g = {
6141
6790
  }
6142
6791
  },
6143
6792
 
6793
+ mounted () {
6794
+ this.menuDrawer = !this.$qas.screen.untilMedium;
6795
+ },
6796
+
6144
6797
  methods: {
6145
6798
  toggleMenuDrawer () {
6146
6799
  this.menuDrawer = !this.menuDrawer;
@@ -6201,42 +6854,34 @@ var script$f = {
6201
6854
  type: Array
6202
6855
  },
6203
6856
 
6204
- redirectKey: {
6205
- default: 'uuid',
6206
- type: String
6207
- },
6208
-
6209
- redirectOnIcon: {
6210
- default: true,
6857
+ useClickableItem: {
6211
6858
  type: Boolean
6212
6859
  },
6213
6860
 
6214
- to: {
6215
- default: () => ({}),
6216
- type: Object
6217
- },
6218
-
6219
6861
  useSectionActions: {
6220
6862
  default: true,
6221
6863
  type: Boolean
6222
6864
  }
6223
6865
  },
6224
6866
 
6867
+ emits: ['click-item'],
6868
+
6225
6869
  methods: {
6226
- getRedirectPayload (item) {
6227
- return {
6228
- params: { [this.redirectKey]: item[this.redirectKey] },
6229
- ...this.to
6230
- }
6231
- },
6870
+ onClick ({ item, index }, fromItem) {
6871
+ /**
6872
+ * se o click veio do q-item e "useClickableItem" for "false", ou
6873
+ * se o click não veio do q-item e "useClickableItem" for "true", então retorna sem emitir.
6874
+ */
6875
+ if (
6876
+ (fromItem && !this.useClickableItem) || (!fromItem && this.useClickableItem)
6877
+ ) return
6232
6878
 
6233
- redirect (item) {
6234
- return this.redirectOnIcon ? undefined : this.getRedirectPayload(item)
6879
+ this.$emit('click-item', { item, index });
6235
6880
  }
6236
6881
  }
6237
6882
  };
6238
6883
 
6239
- const _hoisted_1$b = { class: "qas-list-items shadow-14" };
6884
+ const _hoisted_1$c = { class: "qas-list-items shadow-14" };
6240
6885
 
6241
6886
  function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6242
6887
  const _component_q_item_section = resolveComponent("q-item-section");
@@ -6246,7 +6891,7 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6246
6891
  const _component_q_list = resolveComponent("q-list");
6247
6892
  const _directive_ripple = resolveDirective("ripple");
6248
6893
 
6249
- return (openBlock(), createElementBlock("div", _hoisted_1$b, [
6894
+ return (openBlock(), createElementBlock("div", _hoisted_1$c, [
6250
6895
  createVNode(_component_q_list, {
6251
6896
  bordered: "",
6252
6897
  class: "rounded-borders",
@@ -6256,8 +6901,8 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6256
6901
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.list, (item, index) => {
6257
6902
  return withDirectives((openBlock(), createBlock(_component_q_item, {
6258
6903
  key: index,
6259
- clickable: !$props.redirectOnIcon,
6260
- to: $options.redirect(item)
6904
+ clickable: $props.useClickableItem,
6905
+ onClick: $event => ($options.onClick({ item, index }, true))
6261
6906
  }, {
6262
6907
  default: withCtx(() => [
6263
6908
  renderSlot(_ctx.$slots, "item", {
@@ -6266,7 +6911,7 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6266
6911
  }, () => [
6267
6912
  createVNode(_component_q_item_section, null, {
6268
6913
  default: withCtx(() => [
6269
- renderSlot(_ctx.$slots, "item-section-left", {
6914
+ renderSlot(_ctx.$slots, "item-section", {
6270
6915
  index: index,
6271
6916
  item: item
6272
6917
  })
@@ -6286,13 +6931,13 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6286
6931
  createVNode(_component_qas_btn, {
6287
6932
  flat: "",
6288
6933
  round: "",
6289
- to: $options.getRedirectPayload(item)
6934
+ onClick: $event => ($options.onClick({ item, index }))
6290
6935
  }, {
6291
6936
  default: withCtx(() => [
6292
6937
  createVNode(_component_q_icon, normalizeProps(guardReactiveProps($props.iconProps)), null, 16 /* FULL_PROPS */)
6293
6938
  ]),
6294
6939
  _: 2 /* DYNAMIC */
6295
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to"])
6940
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick"])
6296
6941
  ])
6297
6942
  ]),
6298
6943
  _: 2 /* DYNAMIC */
@@ -6301,7 +6946,7 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) {
6301
6946
  ])
6302
6947
  ]),
6303
6948
  _: 2 /* DYNAMIC */
6304
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["clickable", "to"])), [
6949
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["clickable", "onClick"])), [
6305
6950
  [_directive_ripple]
6306
6951
  ])
6307
6952
  }), 128 /* KEYED_FRAGMENT */))
@@ -6322,15 +6967,6 @@ var script$e = {
6322
6967
  mixins: [contextMixin, viewMixin],
6323
6968
 
6324
6969
  props: {
6325
- disableRefresh: {
6326
- type: Boolean
6327
- },
6328
-
6329
- useFilter: {
6330
- default: true,
6331
- type: Boolean
6332
- },
6333
-
6334
6970
  filtersProps: {
6335
6971
  default: () => ({}),
6336
6972
  type: Object
@@ -6339,6 +6975,20 @@ var script$e = {
6339
6975
  results: {
6340
6976
  default: () => [],
6341
6977
  type: Array
6978
+ },
6979
+
6980
+ useRefresh: {
6981
+ default: true,
6982
+ type: Boolean
6983
+ },
6984
+
6985
+ useFilter: {
6986
+ default: true,
6987
+ type: Boolean
6988
+ },
6989
+
6990
+ useResultsAreaOnly: {
6991
+ type: Boolean
6342
6992
  }
6343
6993
  },
6344
6994
 
@@ -6374,13 +7024,17 @@ var script$e = {
6374
7024
 
6375
7025
  totalPages () {
6376
7026
  return this.$store.getters[`${this.entity}/totalPages`]
7027
+ },
7028
+
7029
+ showResults () {
7030
+ return this.hasResults || this.useResultsAreaOnly
6377
7031
  }
6378
7032
  },
6379
7033
 
6380
7034
  watch: {
6381
7035
  $route (to, from) {
6382
7036
  if (to.name === from.name) {
6383
- this.fetchList();
7037
+ this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList);
6384
7038
  this.setCurrentPage();
6385
7039
  }
6386
7040
  },
@@ -6395,7 +7049,8 @@ var script$e = {
6395
7049
  },
6396
7050
 
6397
7051
  created () {
6398
- this.fetchList();
7052
+ this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList);
7053
+
6399
7054
  this.setCurrentPage();
6400
7055
  },
6401
7056
 
@@ -6405,21 +7060,22 @@ var script$e = {
6405
7060
  this.$router.push({ query });
6406
7061
  },
6407
7062
 
6408
- async fetchList (filters = {}) {
7063
+ async fetchList (externalPayload = {}) {
6409
7064
  this.mx_isFetching = true;
6410
7065
 
6411
- const hasFilters = !!Object.keys(filters).length;
6412
-
6413
7066
  try {
6414
- const response = await this.$store.dispatch(
6415
- `${this.entity}/fetchList`,
6416
- {
6417
- ...this.mx_context,
6418
- url: this.url,
6419
- ...(hasFilters && { filters })
6420
- }
7067
+ const payload = {
7068
+ ...this.mx_context,
7069
+ url: this.url,
7070
+ ...externalPayload
7071
+ };
7072
+
7073
+ this.$qas.logger.group(
7074
+ `QasListView - fetchList -> Payload do parâmetro do ${this.entity}/fetchList`, [payload]
6421
7075
  );
6422
7076
 
7077
+ const response = await this.$store.dispatch(`${this.entity}/fetchList`, payload);
7078
+
6423
7079
  const { errors, fields, metadata } = response.data;
6424
7080
 
6425
7081
  this.mx_setErrors(errors);
@@ -6433,17 +7089,27 @@ var script$e = {
6433
7089
  });
6434
7090
 
6435
7091
  this.$emit('fetch-success', response);
7092
+
7093
+ this.$qas.logger.group(
7094
+ `QasListView - fetchList -> resposta da action ${this.entity}/fetchList`, [response]
7095
+ );
6436
7096
  } catch (error) {
6437
7097
  this.mx_fetchError(error);
6438
7098
  this.$emit('update:errors', error);
6439
7099
  this.$emit('fetch-error', error);
7100
+
7101
+ this.$qas.logger.group(
7102
+ `QasListView - fetchSingle -> exceção da action ${this.entity}/fetchList`,
7103
+ [error],
7104
+ { error: true }
7105
+ );
6440
7106
  } finally {
6441
7107
  this.mx_isFetching = false;
6442
7108
  }
6443
7109
  },
6444
7110
 
6445
7111
  async refresh (done) {
6446
- await this.fetchList();
7112
+ await this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList);
6447
7113
 
6448
7114
  if (typeof done === 'function') {
6449
7115
  done();
@@ -6456,7 +7122,7 @@ var script$e = {
6456
7122
  }
6457
7123
  };
6458
7124
 
6459
- const _hoisted_1$a = { key: 0 };
7125
+ const _hoisted_1$b = { key: 0 };
6460
7126
  const _hoisted_2$7 = { class: "relative-position" };
6461
7127
  const _hoisted_3$4 = { key: 0 };
6462
7128
  const _hoisted_4$4 = { key: 1 };
@@ -6484,12 +7150,12 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) {
6484
7150
  }, {
6485
7151
  default: withCtx(() => [
6486
7152
  createVNode(_component_q_pull_to_refresh, {
6487
- disable: $props.disableRefresh,
7153
+ disable: !$props.useRefresh,
6488
7154
  onRefresh: $options.refresh
6489
7155
  }, {
6490
7156
  default: withCtx(() => [
6491
7157
  ($options.hasHeaderSlot)
6492
- ? (openBlock(), createElementBlock("header", _hoisted_1$a, [
7158
+ ? (openBlock(), createElementBlock("header", _hoisted_1$b, [
6493
7159
  renderSlot(_ctx.$slots, "header")
6494
7160
  ]))
6495
7161
  : createCommentVNode("v-if", true),
@@ -6499,7 +7165,7 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) {
6499
7165
  ])
6500
7166
  : createCommentVNode("v-if", true),
6501
7167
  createElementVNode("main", _hoisted_2$7, [
6502
- ($options.hasResults)
7168
+ ($options.showResults)
6503
7169
  ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
6504
7170
  renderSlot(_ctx.$slots, "default")
6505
7171
  ]))
@@ -6576,13 +7242,13 @@ var script$d = {
6576
7242
  default: () => []
6577
7243
  },
6578
7244
 
6579
- usePopup: {
6580
- type: Boolean
6581
- },
6582
-
6583
7245
  zoom: {
6584
7246
  type: Number,
6585
7247
  default: 17
7248
+ },
7249
+
7250
+ usePopup: {
7251
+ type: Boolean
6586
7252
  }
6587
7253
  },
6588
7254
 
@@ -6616,7 +7282,7 @@ var script$d = {
6616
7282
  }
6617
7283
  };
6618
7284
 
6619
- const _hoisted_1$9 = { class: "qas-map" };
7285
+ const _hoisted_1$a = { class: "qas-map" };
6620
7286
  const _hoisted_2$6 = { class: "text-weight-bold" };
6621
7287
 
6622
7288
  function render$d(_ctx, _cache, $props, $setup, $data, $options) {
@@ -6624,7 +7290,7 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) {
6624
7290
  const _component_g_map_marker = resolveComponent("g-map-marker");
6625
7291
  const _component_g_map_map = resolveComponent("g-map-map");
6626
7292
 
6627
- return (openBlock(), createElementBlock("div", _hoisted_1$9, [
7293
+ return (openBlock(), createElementBlock("div", _hoisted_1$a, [
6628
7294
  createVNode(_component_g_map_map, {
6629
7295
  center: $props.centerPosition,
6630
7296
  class: "qas-map__draw",
@@ -6683,7 +7349,7 @@ var script$c = {
6683
7349
  default: 'Inserir novo campo'
6684
7350
  },
6685
7351
 
6686
- btnDestroyProps: {
7352
+ buttonDestroyProps: {
6687
7353
  type: Object,
6688
7354
  default: () => {
6689
7355
  return {
@@ -6695,14 +7361,14 @@ var script$c = {
6695
7361
  }
6696
7362
  },
6697
7363
 
6698
- btnDuplicateProps: {
7364
+ buttonDuplicateProps: {
6699
7365
  type: Object,
6700
7366
  default: () => {
6701
7367
  return {
6702
7368
  label: 'Duplicar',
6703
7369
  icon: 'o_content_copy',
6704
7370
  flat: true,
6705
- hideMobileLabel: true,
7371
+ useLabelOnSmallScreen: false,
6706
7372
  dense: true
6707
7373
  }
6708
7374
  }
@@ -6747,6 +7413,11 @@ var script$c = {
6747
7413
  }
6748
7414
  },
6749
7415
 
7416
+ identifierItemKey: {
7417
+ type: String,
7418
+ default: 'uuid'
7419
+ },
7420
+
6750
7421
  rowLabel: {
6751
7422
  type: String,
6752
7423
  default: ''
@@ -6812,13 +7483,7 @@ var script$c = {
6812
7483
  },
6813
7484
 
6814
7485
  children () {
6815
- const field = extend(true, {}, this.field);
6816
-
6817
- for (const key in field?.children) {
6818
- field.children[key].name = camelize(field?.children[key].name);
6819
- }
6820
-
6821
- return field?.children
7486
+ return this.field?.children
6822
7487
  },
6823
7488
 
6824
7489
  showDestroyBtn () {
@@ -6845,8 +7510,7 @@ var script$c = {
6845
7510
 
6846
7511
  return {
6847
7512
  tag: 'div',
6848
- enterActiveClass: 'animated slideInDown',
6849
- leaveActiveClass: 'animated slideOutUp'
7513
+ enterActiveClass: 'animated slideInDown'
6850
7514
  }
6851
7515
  }
6852
7516
  },
@@ -6859,9 +7523,9 @@ var script$c = {
6859
7523
  immediate: true
6860
7524
  },
6861
7525
 
6862
- field: {
7526
+ rowObject: {
6863
7527
  handler () {
6864
- !this.modelValue.length && this.setDefaultNestedValue();
7528
+ if (!this.nested.length) return this.setDefaultNestedValue()
6865
7529
  },
6866
7530
  immediate: true
6867
7531
  }
@@ -6869,13 +7533,22 @@ var script$c = {
6869
7533
 
6870
7534
  methods: {
6871
7535
  add (row = {}) {
6872
- this.nested.push({ ...this.rowObject, ...row });
7536
+ const payload = { ...this.rowObject, ...row };
7537
+ const hasIdentifierKey = payload[this.identifierItemKey];
7538
+
7539
+ if (hasIdentifierKey) {
7540
+ delete payload[this.identifierItemKey];
7541
+ }
7542
+
7543
+ this.nested.push(payload);
6873
7544
 
6874
7545
  this.$nextTick(() => {
6875
7546
  this.useAnimation && this.setScroll();
6876
7547
  this.setFocus();
6877
7548
  });
6878
7549
 
7550
+ this.$qas.logger.group('QasNestedFields - add', [payload]);
7551
+
6879
7552
  return this.updateModelValue()
6880
7553
  },
6881
7554
 
@@ -6891,10 +7564,12 @@ var script$c = {
6891
7564
  },
6892
7565
 
6893
7566
  destroy (index, row) {
6894
- this.useRemoveOnDestroy
7567
+ !row[this.identifierItemKey] && this.useRemoveOnDestroy
6895
7568
  ? this.nested.splice(index, 1)
6896
7569
  : this.nested.splice(index, 1, { [this.destroyKey]: true, ...row });
6897
7570
 
7571
+ this.$qas.logger.group('QasNestedFields - destroy', [{ index, row }]);
7572
+
6898
7573
  return this.updateModelValue()
6899
7574
  },
6900
7575
 
@@ -6920,7 +7595,7 @@ var script$c = {
6920
7595
  });
6921
7596
  },
6922
7597
 
6923
- setRowLabel (rowKey) {
7598
+ getRowLabel (rowKey) {
6924
7599
  if (this.rowLabel) {
6925
7600
  return this.useIndexLabel ? `${this.rowLabel} ${rowKey + 1}` : this.rowLabel
6926
7601
  }
@@ -6930,7 +7605,7 @@ var script$c = {
6930
7605
  }
6931
7606
  };
6932
7607
 
6933
- const _hoisted_1$8 = ["id"];
7608
+ const _hoisted_1$9 = ["id"];
6934
7609
  const _hoisted_2$5 = { class: "text-left" };
6935
7610
  const _hoisted_3$3 = { ref: "inputContent" };
6936
7611
  const _hoisted_4$3 = ["id"];
@@ -6991,18 +7666,18 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) {
6991
7666
  (!$props.useSingleLabel)
6992
7667
  ? (openBlock(), createBlock(_component_qas_label, {
6993
7668
  key: 0,
6994
- label: $options.setRowLabel(index)
7669
+ label: $options.getRowLabel(index)
6995
7670
  }, null, 8 /* PROPS */, ["label"]))
6996
7671
  : createCommentVNode("v-if", true),
6997
7672
  (!$props.useInlineActions)
6998
7673
  ? (openBlock(), createElementBlock("div", _hoisted_6, [
6999
7674
  ($props.useDuplicate)
7000
- ? (openBlock(), createBlock(_component_qas_btn, mergeProps({ key: 0 }, $props.btnDuplicateProps, {
7675
+ ? (openBlock(), createBlock(_component_qas_btn, mergeProps({ key: 0 }, $props.buttonDuplicateProps, {
7001
7676
  onClick: $event => ($options.add(row))
7002
7677
  }), null, 16 /* FULL_PROPS */, ["onClick"]))
7003
7678
  : createCommentVNode("v-if", true),
7004
7679
  ($options.showDestroyBtn)
7005
- ? (openBlock(), createBlock(_component_qas_btn, mergeProps({ key: 1 }, $props.btnDestroyProps, {
7680
+ ? (openBlock(), createBlock(_component_qas_btn, mergeProps({ key: 1 }, $props.buttonDestroyProps, {
7006
7681
  onClick: $event => ($options.destroy(index, row))
7007
7682
  }), null, 16 /* FULL_PROPS */, ["onClick"]))
7008
7683
  : createCommentVNode("v-if", true)
@@ -7129,7 +7804,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) {
7129
7804
  ])
7130
7805
  ])
7131
7806
  ], 512 /* NEED_PATCH */)
7132
- ], 8 /* PROPS */, _hoisted_1$8))
7807
+ ], 8 /* PROPS */, _hoisted_1$9))
7133
7808
  }
7134
7809
 
7135
7810
  script$c.render = render$c;
@@ -7140,17 +7815,20 @@ const { hasPreviousRoute, history: history$1, getPreviousRoute } = useHistory();
7140
7815
  var script$b = {
7141
7816
  name: 'QasPageHeader',
7142
7817
 
7818
+ mixins: [
7819
+ createMetaMixin(function () {
7820
+ return {
7821
+ title: this.title
7822
+ }
7823
+ })
7824
+ ],
7825
+
7143
7826
  props: {
7144
7827
  breadcrumbs: {
7145
7828
  default: '',
7146
7829
  type: [Array, String]
7147
7830
  },
7148
7831
 
7149
- useBreadcrumbs: {
7150
- default: true,
7151
- type: Boolean
7152
- },
7153
-
7154
7832
  root: {
7155
7833
  default: '',
7156
7834
  type: [Object, String]
@@ -7159,6 +7837,11 @@ var script$b = {
7159
7837
  title: {
7160
7838
  default: '',
7161
7839
  type: String
7840
+ },
7841
+
7842
+ useBreadcrumbs: {
7843
+ default: true,
7844
+ type: Boolean
7162
7845
  }
7163
7846
  },
7164
7847
 
@@ -7202,16 +7885,10 @@ var script$b = {
7202
7885
 
7203
7886
  return lastIndex === index ? 'text-grey-7' : 'text-primary'
7204
7887
  }
7205
- },
7206
-
7207
- meta () {
7208
- return {
7209
- title: this.title
7210
- }
7211
7888
  }
7212
7889
  };
7213
7890
 
7214
- const _hoisted_1$7 = { class: "ellipsis" };
7891
+ const _hoisted_1$8 = { class: "ellipsis" };
7215
7892
 
7216
7893
  function render$b(_ctx, _cache, $props, $setup, $data, $options) {
7217
7894
  const _component_q_icon = resolveComponent("q-icon");
@@ -7222,7 +7899,7 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
7222
7899
 
7223
7900
  return (openBlock(), createBlock(_component_q_toolbar, { class: "justify-between q-mb-lg q-px-none" }, {
7224
7901
  default: withCtx(() => [
7225
- createElementVNode("div", _hoisted_1$7, [
7902
+ createElementVNode("div", _hoisted_1$8, [
7226
7903
  ($props.title)
7227
7904
  ? (openBlock(), createBlock(_component_q_toolbar_title, {
7228
7905
  key: 0,
@@ -7338,7 +8015,7 @@ var script$a = {
7338
8015
  }
7339
8016
  };
7340
8017
 
7341
- const _hoisted_1$6 = { class: "q-col-gutter-md row" };
8018
+ const _hoisted_1$7 = { class: "q-col-gutter-md row" };
7342
8019
  const _hoisted_2$4 = { class: "col-lg-5 col-xs-12" };
7343
8020
  const _hoisted_3$2 = { class: "justify-center lg:q-mb-none md:q-mr-lg row xs:q-mb-md" };
7344
8021
  const _hoisted_4$2 = { class: "text-bold text-h6" };
@@ -7350,7 +8027,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
7350
8027
 
7351
8028
  return (openBlock(), createBlock(resolveDynamicComponent($props.tag), null, {
7352
8029
  default: withCtx(() => [
7353
- createElementVNode("div", _hoisted_1$6, [
8030
+ createElementVNode("div", _hoisted_1$7, [
7354
8031
  createElementVNode("div", _hoisted_2$4, [
7355
8032
  createElementVNode("div", {
7356
8033
  class: normalizeClass(["no-wrap q-col-gutter-md", $options.directionClasses])
@@ -7375,8 +8052,8 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
7375
8052
  class: "col-lg-7 col-xs-12 items-center",
7376
8053
  columns: $props.columns,
7377
8054
  fields: $options.filterObject($props.fields, $props.list),
7378
- "hide-empty-result": "",
7379
- result: $props.result
8055
+ result: $props.result,
8056
+ "use-empty-result": false
7380
8057
  }, createSlots({ _: 2 /* DYNAMIC */ }, [
7381
8058
  renderList(_ctx.$slots, (_, name) => {
7382
8059
  return {
@@ -7476,7 +8153,7 @@ var script$9 = {
7476
8153
  }
7477
8154
  };
7478
8155
 
7479
- const _hoisted_1$5 = /*#__PURE__*/createElementVNode("div", { class: "absolute-full bg-grey-2 flex flex-center text-grey" }, "⚠︎", -1 /* HOISTED */);
8156
+ const _hoisted_1$6 = /*#__PURE__*/createElementVNode("div", { class: "absolute-full bg-grey-2 flex flex-center text-grey" }, "⚠︎", -1 /* HOISTED */);
7480
8157
 
7481
8158
  function render$9(_ctx, _cache, $props, $setup, $data, $options) {
7482
8159
  const _component_q_img = resolveComponent("q-img");
@@ -7487,7 +8164,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
7487
8164
  src: $options.imageSource
7488
8165
  }, {
7489
8166
  error: withCtx(() => [
7490
- _hoisted_1$5
8167
+ _hoisted_1$6
7491
8168
  ]),
7492
8169
  _: 1 /* STABLE */
7493
8170
  }, 8 /* PROPS */, ["ratio", "src"]))
@@ -7500,15 +8177,23 @@ var script$8 = {
7500
8177
  name: 'QasSearchBox',
7501
8178
 
7502
8179
  components: {
7503
- QasBox: script$D
8180
+ QasBox: script$D,
8181
+ QInfiniteScroll
7504
8182
  },
7505
8183
 
8184
+ mixins: [searchFilterMixin],
8185
+
7506
8186
  props: {
7507
8187
  emptyListHeight: {
7508
8188
  default: '100px',
7509
8189
  type: String
7510
8190
  },
7511
8191
 
8192
+ emptyResultText: {
8193
+ default: 'Não há resultados disponíveis.',
8194
+ type: String
8195
+ },
8196
+
7512
8197
  fuseOptions: {
7513
8198
  default: () => ({}),
7514
8199
  type: Object
@@ -7553,110 +8238,184 @@ var script$8 = {
7553
8238
 
7554
8239
  data () {
7555
8240
  return {
7556
- fuse: null,
7557
- searchResults: this.list,
7558
- search: ''
8241
+ fuse: null
7559
8242
  }
7560
8243
  },
7561
8244
 
7562
8245
  computed: {
7563
- contentStyle () {
7564
- return { height: this.list.length ? this.height : this.emptyListHeight }
8246
+ attributes () {
8247
+ return {
8248
+ clearable: true,
8249
+ disable: this.isDisabled,
8250
+ debounce: this.useLazyLoading ? 500 : 0,
8251
+ outlined: true,
8252
+ placeholder: this.placeholder,
8253
+ hideBottomSpace: true,
8254
+ error: this.mx_hasFetchError,
8255
+ loading: this.mx_isFetching
8256
+ }
8257
+ },
8258
+
8259
+ containerStyle () {
8260
+ return { height: this.containerHeight }
8261
+ },
8262
+
8263
+ hasNoOptionsOnFirstFetch () {
8264
+ return this.mx_fetchCount === 1 && !this.mx_hasFilteredOptions
8265
+ },
8266
+
8267
+ containerHeight () {
8268
+ const hasEmptyList = (!this.list.length && !this.useLazyLoading) || this.hasNoOptionsOnFirstFetch;
8269
+
8270
+ return hasEmptyList ? this.emptyListHeight : this.height
8271
+ },
8272
+
8273
+ component () {
8274
+ const infiniteScrollProps = {
8275
+ offset: 100,
8276
+ scrollTarget: this.$refs.scrollContainer,
8277
+ ref: 'infiniteScrollRef'
8278
+ };
8279
+
8280
+ return {
8281
+ is: this.useLazyLoading ? 'q-infinite-scroll' : 'div',
8282
+ props: {
8283
+ ...(this.useLazyLoading && infiniteScrollProps),
8284
+ ...(this.useLazyLoading && { onLoad: this.onInfiniteScroll })
8285
+ }
8286
+ }
7565
8287
  },
7566
8288
 
7567
8289
  defaultFuseOptions () {
7568
8290
  return {
7569
- distance: 100,
7570
- location: 0,
7571
- maxPatternLength: 32,
7572
- minMatchCharLength: 1,
7573
- shouldSort: true,
7574
8291
  threshold: 0.1,
7575
- tokenize: true,
8292
+ ignoreLocation: true,
7576
8293
 
7577
8294
  ...this.fuseOptions
7578
8295
  }
7579
8296
  },
7580
8297
 
7581
- hasResults () {
7582
- return !!this.searchResults.length
8298
+ isDisabled () {
8299
+ return (!this.useLazyLoading && !this.list.length) || this.mx_isFetching || this.hasNoOptionsOnFirstFetch
8300
+ },
8301
+
8302
+ showEmptyResult () {
8303
+ return this.useEmptySlot && !this.mx_hasFilteredOptions && !this.mx_isFetching
8304
+ },
8305
+
8306
+ showSpinnerDots () {
8307
+ return this.mx_hasFilteredOptions && this.mx_isFetching
8308
+ },
8309
+
8310
+ showInnerLoading () {
8311
+ return !this.mx_hasFilteredOptions && this.mx_isFetching
7583
8312
  }
7584
8313
  },
7585
8314
 
7586
8315
  watch: {
7587
8316
  defaultFuseOptions (value) {
8317
+ if (this.useLazyLoading) return
8318
+
7588
8319
  this.fuse.options = { ...this.fuse.options, ...value };
7589
8320
  },
7590
8321
 
7591
- hasResults (value) {
8322
+ mx_hasFilteredOptions (value) {
7592
8323
  !value && this.$emit('empty-result');
7593
8324
  },
7594
8325
 
7595
- list: {
7596
- handler (value) {
7597
- this.fuse = new Fuse(value, this.defaultFuseOptions);
8326
+ mx_search: {
8327
+ async handler (value) {
8328
+ this.$emit('update:modelValue', value);
7598
8329
 
7599
- this.setResults(this.search);
7600
- this.updateResultsModel(value);
7601
- },
8330
+ if (this.useLazyLoading) {
8331
+ await this.mx_filterOptionsByStore(value);
8332
+
8333
+ this.$refs.infiniteScrollRef.resume();
8334
+ this.$refs.search.focus();
8335
+
8336
+ return
8337
+ }
7602
8338
 
7603
- deep: true
8339
+ this.filterOptionsByFuse(value);
8340
+ }
7604
8341
  },
7605
8342
 
7606
- search: {
8343
+ modelValue: {
7607
8344
  handler (value) {
7608
- this.setResults(value);
7609
- this.$emit('update:modelValue', value);
8345
+ this.mx_search = value;
7610
8346
  },
7611
8347
 
7612
8348
  immediate: true
7613
8349
  },
7614
8350
 
7615
- searchResults: {
7616
- handler (value) {
7617
- this.updateResultsModel(value);
8351
+ mx_filteredOptions: {
8352
+ handler (options) {
8353
+ this.$emit('update:results', options);
7618
8354
  },
8355
+
7619
8356
  immediate: true
7620
8357
  }
7621
8358
  },
7622
8359
 
7623
8360
  created () {
7624
- this.search = this.modelValue;
8361
+ if (this.useLazyLoading) return
8362
+
8363
+ this.mx_filteredOptions = this.list;
7625
8364
  this.fuse = new Fuse(this.list, this.defaultFuseOptions);
7626
- this.setResults();
8365
+
8366
+ this.setListWatcher();
7627
8367
  },
7628
8368
 
7629
8369
  methods: {
7630
- setResults (value) {
7631
- this.searchResults = value
7632
- ? this.fuse.search(value)
7633
- : this.list;
8370
+ filterOptionsByFuse (value) {
8371
+ this.mx_filteredOptions = value ? this.mx_getNormalizedFuseResults(this.fuse.search(value)) : this.list;
8372
+ },
8373
+
8374
+ async onInfiniteScroll (_, done) {
8375
+ // Se tiver erro no primeiro fetch, retorna o "done" na proxima.
8376
+ if (((this.mx_hasFetchError && !this.mx_hasFilteredOptions) || this.hasNoOptionsOnFirstFetch)) return done()
8377
+
8378
+ if (!this.mx_hasFilteredOptions && !this.mx_search) {
8379
+ await this.mx_setFetchOptions();
8380
+ return done()
8381
+ }
8382
+
8383
+ if (this.mx_canFetchOptions()) {
8384
+ await this.mx_loadMoreOptions();
8385
+ return done()
8386
+ }
8387
+
8388
+ done(true);
7634
8389
  },
7635
8390
 
7636
- updateResultsModel (value) {
7637
- this.$emit('update:results', value.map(result => result.item || result));
8391
+ setListWatcher () {
8392
+ this.$watch('list', value => {
8393
+ this.fuse = new Fuse(value, this.defaultFuseOptions);
8394
+
8395
+ this.filterOptionsByFuse(this.mx_search);
8396
+ }, { deep: true });
7638
8397
  }
7639
8398
  }
7640
8399
  };
7641
8400
 
7642
- const _hoisted_1$4 = { class: "absolute-center text-center" };
7643
- const _hoisted_2$3 = /*#__PURE__*/createElementVNode("div", null, "Não há resultados disponíveis.", -1 /* HOISTED */);
8401
+ const _hoisted_1$5 = { class: "flex justify-center q-pb-sm" };
8402
+ const _hoisted_2$3 = { class: "absolute-center text-center" };
7644
8403
 
7645
8404
  function render$8(_ctx, _cache, $props, $setup, $data, $options) {
7646
8405
  const _component_q_icon = resolveComponent("q-icon");
7647
- const _component_q_input = resolveComponent("q-input");
8406
+ const _component_qas_input = resolveComponent("qas-input");
8407
+ const _component_q_spinner_dots = resolveComponent("q-spinner-dots");
8408
+ const _component_q_spinner = resolveComponent("q-spinner");
8409
+ const _component_q_inner_loading = resolveComponent("q-inner-loading");
7648
8410
  const _component_qas_box = resolveComponent("qas-box");
7649
8411
 
7650
8412
  return (openBlock(), createBlock(_component_qas_box, null, {
7651
8413
  default: withCtx(() => [
7652
- createVNode(_component_q_input, {
7653
- modelValue: $data.search,
7654
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.search) = $event)),
7655
- clearable: "",
7656
- disable: !$props.list.length,
7657
- outlined: "",
7658
- placeholder: $props.placeholder
7659
- }, {
8414
+ createVNode(_component_qas_input, mergeProps($options.attributes, {
8415
+ ref: "search",
8416
+ modelValue: _ctx.mx_search,
8417
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((_ctx.mx_search) = $event))
8418
+ }), {
7660
8419
  append: withCtx(() => [
7661
8420
  createVNode(_component_q_icon, {
7662
8421
  color: "primary",
@@ -7664,26 +8423,52 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
7664
8423
  })
7665
8424
  ]),
7666
8425
  _: 1 /* STABLE */
7667
- }, 8 /* PROPS */, ["modelValue", "disable", "placeholder"]),
8426
+ }, 16 /* FULL_PROPS */, ["modelValue"]),
7668
8427
  createElementVNode("div", {
8428
+ ref: "scrollContainer",
7669
8429
  class: "overflow-auto q-mt-xs relative-position",
7670
- style: normalizeStyle($options.contentStyle)
8430
+ style: normalizeStyle($options.containerStyle)
7671
8431
  }, [
7672
- ($options.hasResults)
7673
- ? renderSlot(_ctx.$slots, "default", { key: 0 })
7674
- : ($props.useEmptySlot)
7675
- ? renderSlot(_ctx.$slots, "empty-result", { key: 1 }, () => [
7676
- createElementVNode("div", _hoisted_1$4, [
7677
- createVNode(_component_q_icon, {
7678
- class: "q-mb-sm text-center",
7679
- color: "primary",
7680
- name: "o_search",
7681
- size: "38px"
7682
- }),
7683
- _hoisted_2$3
7684
- ])
8432
+ (openBlock(), createBlock(resolveDynamicComponent($options.component.is), normalizeProps(guardReactiveProps($options.component.props)), {
8433
+ default: withCtx(() => [
8434
+ (_ctx.mx_hasFilteredOptions)
8435
+ ? renderSlot(_ctx.$slots, "default", { key: 0 })
8436
+ : createCommentVNode("v-if", true)
8437
+ ]),
8438
+ _: 3 /* FORWARDED */
8439
+ }, 16 /* FULL_PROPS */)),
8440
+ ($options.showSpinnerDots)
8441
+ ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
8442
+ createElementVNode("div", _hoisted_1$5, [
8443
+ createVNode(_component_q_spinner_dots, {
8444
+ color: "primary",
8445
+ size: "20px"
8446
+ })
7685
8447
  ])
7686
- : createCommentVNode("v-if", true)
8448
+ ])
8449
+ : createCommentVNode("v-if", true),
8450
+ ($options.showEmptyResult)
8451
+ ? renderSlot(_ctx.$slots, "empty-result", { key: 1 }, () => [
8452
+ createElementVNode("div", _hoisted_2$3, [
8453
+ createVNode(_component_q_icon, {
8454
+ class: "q-mb-sm text-center",
8455
+ color: "primary",
8456
+ name: "o_search",
8457
+ size: "38px"
8458
+ }),
8459
+ createElementVNode("div", null, toDisplayString($props.emptyResultText), 1 /* TEXT */)
8460
+ ])
8461
+ ])
8462
+ : createCommentVNode("v-if", true),
8463
+ createVNode(_component_q_inner_loading, { showing: $options.showInnerLoading }, {
8464
+ default: withCtx(() => [
8465
+ createVNode(_component_q_spinner, {
8466
+ color: "grey",
8467
+ size: "3em"
8468
+ })
8469
+ ]),
8470
+ _: 1 /* STABLE */
8471
+ }, 8 /* PROPS */, ["showing"])
7687
8472
  ], 4 /* STYLE */)
7688
8473
  ]),
7689
8474
  _: 3 /* FORWARDED */
@@ -7696,6 +8481,8 @@ script$8.__file = "src/components/search-box/QasSearchBox.vue";
7696
8481
  var script$7 = {
7697
8482
  name: 'QasSelect',
7698
8483
 
8484
+ mixins: [searchFilterMixin],
8485
+
7699
8486
  props: {
7700
8487
  fuseOptions: {
7701
8488
  default: () => ({}),
@@ -7709,7 +8496,7 @@ var script$7 = {
7709
8496
 
7710
8497
  modelValue: {
7711
8498
  default: () => [],
7712
- type: [Array, Object, String, Number]
8499
+ type: [Array, Object, String, Number, Boolean]
7713
8500
  },
7714
8501
 
7715
8502
  noOptionLabel: {
@@ -7722,13 +8509,13 @@ var script$7 = {
7722
8509
  type: Array
7723
8510
  },
7724
8511
 
7725
- searchable: {
7726
- type: Boolean
7727
- },
7728
-
7729
8512
  valueKey: {
7730
8513
  default: '',
7731
8514
  type: String
8515
+ },
8516
+
8517
+ useSearch: {
8518
+ type: Boolean
7732
8519
  }
7733
8520
  },
7734
8521
 
@@ -7736,7 +8523,6 @@ var script$7 = {
7736
8523
 
7737
8524
  data () {
7738
8525
  return {
7739
- filteredOptions: [],
7740
8526
  fuse: null
7741
8527
  }
7742
8528
  },
@@ -7744,40 +8530,45 @@ var script$7 = {
7744
8530
  computed: {
7745
8531
  attributes () {
7746
8532
  return {
7747
- clearable: this.searchable,
8533
+ clearable: this.isSearchable,
7748
8534
  emitValue: true,
7749
8535
  mapOptions: true,
7750
8536
  outlined: true,
7751
-
7752
8537
  ...this.$attrs,
7753
8538
 
7754
- options: this.filteredOptions,
7755
- useInput: this.searchable
8539
+ options: this.mx_filteredOptions,
8540
+ useInput: this.isSearchable,
8541
+ error: this.hasError,
8542
+ loading: this.hasLoading,
8543
+ ...(this.useLazyLoading && { onVirtualScroll: this.mx_onVirtualScroll }),
8544
+ ...(this.isSearchable && { onFilter: this.onFilter })
7756
8545
  }
7757
8546
  },
7758
8547
 
7759
8548
  defaultFuseOptions () {
7760
8549
  return {
7761
- distance: 100,
7762
- includeScore: true,
8550
+ ignoreLocation: true,
7763
8551
  keys: ['label', 'value'],
7764
- location: 0,
7765
- maxPatternLength: 32,
7766
- minMatchCharLength: 1,
7767
- shouldSort: true,
7768
8552
  threshold: 0.1,
7769
- tokenize: true,
7770
8553
 
7771
8554
  ...this.fuseOptions
7772
8555
  }
7773
8556
  },
7774
8557
 
7775
- formattedResult () {
7776
- if (!this.labelKey && !this.valueKey) {
7777
- return this.options
7778
- }
8558
+ isSearchable () {
8559
+ return this.useSearch || this.useLazyLoading
8560
+ },
8561
+
8562
+ defaultOptions () {
8563
+ return this.mx_handleOptions(this.options)
8564
+ },
8565
+
8566
+ hasError () {
8567
+ return this.mx_hasFetchError || this.$attrs.error
8568
+ },
7779
8569
 
7780
- return this.options.map(item => this.renameKey(item))
8570
+ hasLoading () {
8571
+ return this.mx_isFetching || this.$attrs.loading
7781
8572
  },
7782
8573
 
7783
8574
  model: {
@@ -7798,11 +8589,11 @@ var script$7 = {
7798
8589
 
7799
8590
  options: {
7800
8591
  handler () {
7801
- if (this.fuse) {
7802
- this.fuse.list = this.formattedResult;
7803
- }
8592
+ if (this.useLazyLoading && this.mx_hasFilteredOptions) return
8593
+
8594
+ if (this.fuse) this.setFuse();
7804
8595
 
7805
- this.filteredOptions = this.formattedResult;
8596
+ this.mx_filteredOptions = this.defaultOptions;
7806
8597
  },
7807
8598
 
7808
8599
  immediate: true
@@ -7811,59 +8602,57 @@ var script$7 = {
7811
8602
 
7812
8603
  created () {
7813
8604
  this.setFuse();
8605
+ this.useLazyLoading && this.mx_setFetchOptions('');
7814
8606
  },
7815
8607
 
7816
8608
  methods: {
7817
- filterOptions (value, update) {
7818
- update(() => {
7819
- if (!this.searchable) return
7820
-
7821
- if (value === '') {
7822
- this.filteredOptions = this.formattedResult;
7823
- } else {
7824
- const results = this.fuse.search(value);
7825
- this.filteredOptions = results.map(item => item.item);
7826
- }
7827
- });
8609
+ setFuse () {
8610
+ if (this.useSearch) {
8611
+ this.fuse = new Fuse(this.defaultOptions, this.defaultFuseOptions);
8612
+ }
7828
8613
  },
7829
8614
 
7830
- renameKey (item) {
7831
- const mapKeys = {
7832
- label: this.labelKey,
7833
- value: this.valueKey
7834
- };
8615
+ async onFilter (value, update) {
8616
+ if (this.useLazyLoading && value !== this.mx_search) {
8617
+ await this.mx_filterOptionsByStore(value);
8618
+ }
7835
8619
 
7836
- for (const newKey in mapKeys) {
7837
- if (!item.hasOwnProperty.call(newKey)) {
7838
- item[newKey] = item[mapKeys[newKey]];
7839
- delete item[mapKeys[newKey]];
7840
- }
8620
+ if (!this.useLazyLoading && this.useSearch) {
8621
+ this.filterOptionsByFuse(value);
7841
8622
  }
7842
8623
 
7843
- return item
8624
+ update();
7844
8625
  },
7845
8626
 
7846
- setFuse () {
7847
- if (this.searchable) {
7848
- this.fuse = new Fuse(this.options, this.defaultFuseOptions);
8627
+ filterOptionsByFuse (value) {
8628
+ if (value === '') {
8629
+ this.mx_filteredOptions = this.defaultOptions;
8630
+ return
7849
8631
  }
8632
+
8633
+ const results = this.fuse.search(value);
8634
+
8635
+ this.mx_filteredOptions = this.mx_getNormalizedFuseResults(results);
7850
8636
  }
7851
8637
  }
7852
8638
  };
7853
8639
 
8640
+ const _hoisted_1$4 = { class: "flex justify-center q-pb-sm" };
8641
+
7854
8642
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
7855
8643
  const _component_q_icon = resolveComponent("q-icon");
7856
8644
  const _component_q_item_section = resolveComponent("q-item-section");
7857
8645
  const _component_q_item = resolveComponent("q-item");
8646
+ const _component_q_spinner_dots = resolveComponent("q-spinner-dots");
7858
8647
  const _component_q_select = resolveComponent("q-select");
7859
8648
 
7860
8649
  return (openBlock(), createBlock(_component_q_select, mergeProps({
7861
8650
  modelValue: $options.model,
7862
8651
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($options.model) = $event))
7863
- }, $options.attributes, { onFilter: $options.filterOptions }), createSlots({
8652
+ }, $options.attributes), createSlots({
7864
8653
  append: withCtx(() => [
7865
8654
  renderSlot(_ctx.$slots, "append", {}, () => [
7866
- ($props.searchable)
8655
+ ($options.isSearchable)
7867
8656
  ? (openBlock(), createBlock(_component_q_icon, {
7868
8657
  key: 0,
7869
8658
  name: "o_search"
@@ -7872,19 +8661,33 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
7872
8661
  ])
7873
8662
  ]),
7874
8663
  "no-option": withCtx(() => [
7875
- renderSlot(_ctx.$slots, "no-option", {}, () => [
7876
- createVNode(_component_q_item, null, {
7877
- default: withCtx(() => [
7878
- createVNode(_component_q_item_section, { class: "text-grey" }, {
8664
+ (!_ctx.mx_isFetching)
8665
+ ? renderSlot(_ctx.$slots, "no-option", { key: 0 }, () => [
8666
+ createVNode(_component_q_item, null, {
7879
8667
  default: withCtx(() => [
7880
- createTextVNode(toDisplayString($props.noOptionLabel), 1 /* TEXT */)
8668
+ createVNode(_component_q_item_section, { class: "text-grey" }, {
8669
+ default: withCtx(() => [
8670
+ createTextVNode(toDisplayString($props.noOptionLabel), 1 /* TEXT */)
8671
+ ]),
8672
+ _: 1 /* STABLE */
8673
+ })
7881
8674
  ]),
7882
8675
  _: 1 /* STABLE */
7883
8676
  })
7884
- ]),
7885
- _: 1 /* STABLE */
7886
- })
7887
- ])
8677
+ ])
8678
+ : createCommentVNode("v-if", true)
8679
+ ]),
8680
+ "after-options": withCtx(() => [
8681
+ (_ctx.mx_isFetching)
8682
+ ? renderSlot(_ctx.$slots, "after-options", { key: 0 }, () => [
8683
+ createElementVNode("div", _hoisted_1$4, [
8684
+ createVNode(_component_q_spinner_dots, {
8685
+ color: "primary",
8686
+ size: "20px"
8687
+ })
8688
+ ])
8689
+ ])
8690
+ : createCommentVNode("v-if", true)
7888
8691
  ]),
7889
8692
  _: 2 /* DYNAMIC */
7890
8693
  }, [
@@ -7896,7 +8699,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
7896
8699
  ])
7897
8700
  }
7898
8701
  })
7899
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "onFilter"]))
8702
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue"]))
7900
8703
  }
7901
8704
 
7902
8705
  script$7.render = render$7;
@@ -7930,26 +8733,16 @@ var script$6 = {
7930
8733
  default: () => []
7931
8734
  },
7932
8735
 
7933
- to: {
7934
- default: () => ({}),
7935
- type: Object
7936
- },
7937
-
7938
- redirectKey: {
7939
- default: 'uuid',
7940
- type: String
7941
- },
7942
-
7943
- paramKey: {
7944
- default: 'id',
7945
- type: String
8736
+ useClickableLabel: {
8737
+ type: Boolean
7946
8738
  }
7947
8739
  },
7948
8740
 
7949
8741
  emits: [
7950
8742
  'added',
7951
- 'update:modelValue',
7952
- 'removed'
8743
+ 'click-label',
8744
+ 'removed',
8745
+ 'update:modelValue'
7953
8746
  ],
7954
8747
 
7955
8748
  data () {
@@ -7961,12 +8754,8 @@ var script$6 = {
7961
8754
  },
7962
8755
 
7963
8756
  computed: {
7964
- isRedirectEnabled () {
7965
- return Object.keys(this.to).length
7966
- },
7967
-
7968
8757
  labelClass () {
7969
- return this.isRedirectEnabled ? 'cursor-pointer' : ''
8758
+ return this.useClickableLabel && 'cursor-pointer'
7970
8759
  },
7971
8760
 
7972
8761
  slotData () {
@@ -7995,6 +8784,7 @@ var script$6 = {
7995
8784
  this.values = [...value];
7996
8785
  },
7997
8786
 
8787
+ deep: true,
7998
8788
  immediate: true
7999
8789
  }
8000
8790
  },
@@ -8016,7 +8806,7 @@ var script$6 = {
8016
8806
 
8017
8807
  return {
8018
8808
  dense: this.$qas.screen.isSmall,
8019
- hideLabelOnSmallScreen: true,
8809
+ useLabelOnSmallScreen: false,
8020
8810
  icon: !this.$qas.screen.isSmall ? undefined : isSelected ? 'o_close' : 'o_add',
8021
8811
  label: isSelected ? 'Remover' : 'Adicionar',
8022
8812
  outline: isSelected,
@@ -8041,11 +8831,8 @@ var script$6 = {
8041
8831
  });
8042
8832
  },
8043
8833
 
8044
- redirectRoute (item) {
8045
- return this.isRedirectEnabled && this.$router.push({
8046
- params: { [this.paramKey]: item[this.redirectKey] },
8047
- ...this.to
8048
- })
8834
+ onClickLabel ({ item, index }) {
8835
+ this.useClickableLabel && this.$emit('click-label', { item, index });
8049
8836
  },
8050
8837
 
8051
8838
  remove (item) {
@@ -8099,7 +8886,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
8099
8886
  default: withCtx(() => [
8100
8887
  createElementVNode("div", {
8101
8888
  class: normalizeClass($options.labelClass),
8102
- onClick: $event => ($options.redirectRoute(result))
8889
+ onClick: $event => ($options.onClickLabel({ item: result, index: _ctx.index }))
8103
8890
  }, toDisplayString(result.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_1$3)
8104
8891
  ]),
8105
8892
  _: 2 /* DYNAMIC */
@@ -8170,7 +8957,9 @@ var script$5 = {
8170
8957
 
8171
8958
  watch: {
8172
8959
  $route (to, from) {
8173
- to.name === from.name && this.fetchSingle();
8960
+ if (to.name === from.name) {
8961
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle);
8962
+ }
8174
8963
  },
8175
8964
 
8176
8965
  resultModel (value) {
@@ -8179,19 +8968,23 @@ var script$5 = {
8179
8968
  },
8180
8969
 
8181
8970
  created () {
8182
- this.fetchSingle();
8971
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle);
8183
8972
  },
8184
8973
 
8185
8974
  methods: {
8186
- async fetchSingle (params = {}) {
8975
+ async fetchSingle (externalPayload = {}) {
8187
8976
  this.mx_isFetching = true;
8188
8977
 
8189
8978
  try {
8190
- const response = await this.$store.dispatch(
8191
- `${this.entity}/fetchSingle`,
8192
- { id: this.id, url: this.url, params }
8979
+ const payload = { id: this.id, url: this.url, ...externalPayload };
8980
+
8981
+ this.$qas.logger.group(
8982
+ `QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
8983
+ [payload]
8193
8984
  );
8194
8985
 
8986
+ const response = await this.$store.dispatch(`${this.entity}/fetchSingle`, payload);
8987
+
8195
8988
  const { errors, fields, metadata } = response.data;
8196
8989
 
8197
8990
  this.mx_setErrors(errors);
@@ -8204,10 +8997,20 @@ var script$5 = {
8204
8997
  metadata: this.mx_metadata
8205
8998
  });
8206
8999
 
9000
+ this.$qas.logger.group(
9001
+ `QasSingleView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
9002
+ );
9003
+
8207
9004
  this.$emit('fetch-success', response);
8208
9005
  } catch (error) {
8209
9006
  this.mx_fetchError(error);
8210
9007
  this.$emit('fetch-error', error);
9008
+
9009
+ this.$qas.logger.group(
9010
+ `QasSingleView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
9011
+ [error],
9012
+ { error: true }
9013
+ );
8211
9014
  } finally {
8212
9015
  this.mx_isFetching = false;
8213
9016
  }
@@ -8499,6 +9302,8 @@ var script$3 = {
8499
9302
  columnByField(this.fields[index]);
8500
9303
  }
8501
9304
 
9305
+ this.$qas.logger.group('QasTableGenerator - Automatic columns', [columns]);
9306
+
8502
9307
  return columns
8503
9308
  }
8504
9309
 
@@ -8511,6 +9316,8 @@ var script$3 = {
8511
9316
  }
8512
9317
  });
8513
9318
 
9319
+ this.$qas.logger.group('QasTableGenerator - columns', [columns]);
9320
+
8514
9321
  return columns
8515
9322
  },
8516
9323
 
@@ -8527,16 +9334,22 @@ var script$3 = {
8527
9334
  },
8528
9335
 
8529
9336
  resultsByFields () {
9337
+ if (!Object.keys(this.fields).length) return []
9338
+
8530
9339
  const results = extend(true, [], this.results);
8531
9340
 
8532
- return results.map((result, index) => {
9341
+ const mappedResults = results.map((result, index) => {
8533
9342
  for (const key in result) {
8534
9343
  result.default = this.results[index];
8535
9344
  result[key] = humanize(this.fields[key], result[key]) || this.emptyResultText;
8536
9345
  }
8537
9346
 
8538
9347
  return result
8539
- })
9348
+ });
9349
+
9350
+ this.$qas.logger.group('QasTableGenerator - resultsByFields', [mappedResults]);
9351
+
9352
+ return mappedResults
8540
9353
  },
8541
9354
 
8542
9355
  rowsPerPage () {
@@ -8597,10 +9410,11 @@ var script$3 = {
8597
9410
  handleScrollOnGrab () {
8598
9411
  const fullTableWidth = this.getFullTableWidth();
8599
9412
  const containerTableWidth = this.getContainerTableWidth();
9413
+ const hasScrollOnGrab = !!Object.keys(this.scrollOnGrab).length;
8600
9414
 
8601
9415
  if (fullTableWidth > containerTableWidth) {
8602
9416
  this.initializeScrollOnGrab();
8603
- } else if (this.hasScrollOnGrab) {
9417
+ } else if (hasScrollOnGrab) {
8604
9418
  this.scrollOnGrab.destroyEvents();
8605
9419
  this.scrollOnGrab.element.style.cursor = 'auto';
8606
9420
  this.scrollOnGrab = {};
@@ -8697,7 +9511,7 @@ var script$2 = {
8697
9511
  tabs: {
8698
9512
  default: () => ({}),
8699
9513
  required: true,
8700
- type: Object
9514
+ type: [Object, Array]
8701
9515
  }
8702
9516
  },
8703
9517
 
@@ -8754,7 +9568,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
8754
9568
  (openBlock(), createBlock(_component_q_tab, mergeProps({ key: key }, tab, {
8755
9569
  class: $props.tabClass,
8756
9570
  label: tab.label,
8757
- name: key
9571
+ name: tab.value
8758
9572
  }), {
8759
9573
  default: withCtx(() => [
8760
9574
  renderSlot(_ctx.$slots, `tab-after-${tab.value}`, { item: tab }, () => [
@@ -8839,7 +9653,7 @@ var script$1 = {
8839
9653
  return {
8840
9654
  cancel: false,
8841
9655
  ok: false,
8842
- useCloseIcon: true,
9656
+ useCloseButton: true,
8843
9657
  ...this.dialogProps,
8844
9658
  card: {
8845
9659
  title: this.dialogTitle,
@@ -9249,7 +10063,7 @@ script.__file = "src/components/transfer/QasTransfer.vue";
9249
10063
 
9250
10064
  var name = "@bildvitta/quasar-ui-asteroid";
9251
10065
  var description = "Asteroid";
9252
- var version$1 = "3.0.0-beta.7";
10066
+ var version$1 = "3.0.0";
9253
10067
  var author = "Bild & Vitta <systemteam@bild.com.br>";
9254
10068
  var license = "MIT";
9255
10069
  var main = "dist/asteroid.cjs.min.js";
@@ -9405,8 +10219,9 @@ function install (app) {
9405
10219
  app.config.globalProperties.$qas = {
9406
10220
  dialog: Dialog,
9407
10221
  error: NotifyError,
9408
- success: NotifySuccess,
9409
- screen: Screen()
10222
+ logger: Logger(),
10223
+ screen: Screen(),
10224
+ success: NotifySuccess
9410
10225
  };
9411
10226
 
9412
10227
  app.directive(Test.name, Test);
@@ -9464,10 +10279,11 @@ var VuePlugin = /*#__PURE__*/Object.freeze({
9464
10279
  QasTransfer: script,
9465
10280
  QasUploader: script$q,
9466
10281
  Dialog: Dialog,
10282
+ Logger: Logger,
9467
10283
  NotifyError: NotifyError,
9468
10284
  NotifySuccess: NotifySuccess,
9469
10285
  Screen: Screen,
9470
10286
  install: install
9471
10287
  });
9472
10288
 
9473
- export { Dialog, NotifyError, NotifySuccess, script$L as QasActions, script$J as QasActionsMenu, script$H as QasAlert, script$F as QasAppBar, script$E as QasAppMenu, script$G as QasAvatar, script$D as QasBox, script$I as QasBreakline, script$K as QasBtn, script$C as QasCard, script$B as QasCheckboxGroup, script$A as QasCopy, script$z as QasDateTimeInput, script$y as QasDebugger, script$w as QasDelete, script$x as QasDialog, script$v as QasDialogRouter, script$n as QasField, script$m as QasFilters, script$l as QasFormGenerator, script$k as QasFormView, script$j as QasGallery, script$i as QasGridGenerator, script$u as QasInput, script$h as QasLabel, script$g as QasLayout, script$f as QasListItems, script$e as QasListView, script$d as QasMap, script$c as QasNestedFields, script$t as QasNumericInput, script$b as QasPageHeader, script$r as QasPasswordInput, script$s as QasPasswordStrengthChecker, script$a as QasProfile, script$9 as QasResizer, script$8 as QasSearchBox, script$7 as QasSelect, script$6 as QasSelectList, script$p as QasSignaturePad, script$o as QasSignatureUploader, script$5 as QasSingleView, script$4 as QasSortable, script$3 as QasTableGenerator, script$2 as QasTabsGenerator, script$1 as QasTextTruncate, script as QasTransfer, script$q as QasUploader, Screen, VuePlugin as default, install, version };
10289
+ export { Dialog, Logger, NotifyError, NotifySuccess, script$L as QasActions, script$J as QasActionsMenu, script$H as QasAlert, script$F as QasAppBar, script$E as QasAppMenu, script$G as QasAvatar, script$D as QasBox, script$I as QasBreakline, script$K as QasBtn, script$C as QasCard, script$B as QasCheckboxGroup, script$A as QasCopy, script$z as QasDateTimeInput, script$y as QasDebugger, script$w as QasDelete, script$x as QasDialog, script$v as QasDialogRouter, script$n as QasField, script$m as QasFilters, script$l as QasFormGenerator, script$k as QasFormView, script$j as QasGallery, script$i as QasGridGenerator, script$u as QasInput, script$h as QasLabel, script$g as QasLayout, script$f as QasListItems, script$e as QasListView, script$d as QasMap, script$c as QasNestedFields, script$t as QasNumericInput, script$b as QasPageHeader, script$r as QasPasswordInput, script$s as QasPasswordStrengthChecker, script$a as QasProfile, script$9 as QasResizer, script$8 as QasSearchBox, script$7 as QasSelect, script$6 as QasSelectList, script$p as QasSignaturePad, script$o as QasSignatureUploader, script$5 as QasSingleView, script$4 as QasSortable, script$3 as QasTableGenerator, script$2 as QasTabsGenerator, script$1 as QasTextTruncate, script as QasTransfer, script$q as QasUploader, Screen, VuePlugin as default, install, version };