@bildvitta/quasar-ui-asteroid 3.0.0-beta.13 → 3.0.0-beta.16

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.
@@ -1 +1 @@
1
- @import"https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700;1,400;1,700&display=swap";:root{--qas-background-color: #f5f5f5;--qas-generic-border-radius: 8px}h1{font-size:6rem;font-weight:800;letter-spacing:0;line-height:6rem;margin:0}h2{font-size:3.75rem;font-weight:700;letter-spacing:0;line-height:3.75rem;margin:0}h3{font-size:3rem;font-weight:600;letter-spacing:0;line-height:2.5rem;margin:0}h4{font-size:2.125rem;font-weight:800;letter-spacing:0;line-height:2.5rem;margin:0}h5{font-size:1.5rem;font-weight:700;letter-spacing:0;line-height:2rem;margin:0}h6{font-size:1.25rem;font-weight:600;letter-spacing:0;line-height:2rem;margin:0}body{background-color:var(--qas-background-color)}.q-field--outlined .q-field__inner{background-color:#fff;border-radius:var(--qas-generic-border-radius)}.q-radio__inner::before{color:var(--q-primary)}.q-tabs__arrow{color:var(--q-primary)}.bg-no-repeat{background-repeat:no-repeat !important}.bg-size-contain{background-size:contain !important}.bg-size-cover{background-size:cover !important}.bg-position-bottom{background-position:bottom !important}.bg-position-center{background-position:center !important}.bg-position-left{background-position:left !important}.bg-position-right{background-position:right !important}.bg-position-top{background-position:top !important}.border-secondary-contrast:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-secondary:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-primary-contrast:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-primary:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right){border-width:1px !important}.border-primary{border:0 solid var(--q-primary) !important}.border-primary-contrast{border:0 solid var(--q-primary-contrast) !important}.border-secondary{border:0 solid var(--q-secondary) !important}.border-secondary-contrast{border:0 solid var(--q-secondary-contrast) !important}.border-top{border-top-width:1px !important}.border-left{border-left-width:1px !important}.border-bottom{border-bottom-width:1px !important}.border-right{border-right-width:1px !important}.rounded-borders-sm{border-radius:calc(var(--qas-generic-border-radius) / 2) !important}.rounded-borders-lg{border-radius:calc(var(--qas-generic-border-radius) * 2) !important}.rounded-borders-top{border-bottom-left-radius:0 !important;border-bottom-right-radius:0 !important}.rounded-borders-right{border-bottom-left-radius:0 !important;border-top-left-radius:0 !important}.rounded-borders-bottom{border-top-left-radius:0 !important;border-top-right-radius:0 !important}.rounded-borders-left{border-bottom-right-radius:0 !important;border-top-right-radius:0 !important}.container,.container-xs,.container-sm,.container-md,.container-lg,.container-xl{margin-left:auto;margin-right:auto;max-width:1280px;width:calc(100% - 80px)}.container.spaced,.container-xs.spaced,.container-sm.spaced,.container-md.spaced,.container-lg.spaced,.container-xl.spaced{padding-bottom:20px;padding-top:20px}@media(max-width: 599px){.container,.container-xs,.container-sm,.container-md,.container-lg,.container-xl{width:calc(100% - 20px)}}.container-xs{max-width:599px !important}.container-sm{max-width:1023px !important}.container-md{max-width:1439px !important}.container-lg{max-width:1919px !important}body{font-family:Inter,system-ui,sans-serif}.qs-lh-xs{line-height:.85 !important}.qs-lh-sm{line-height:1 !important}.qs-lh-md{line-height:1.15 !important}.qs-lh-lg{line-height:1.3 !important}.qs-lh-xl{line-height:1.5 !important}.opacity-10{opacity:0.1 !important}.opacity-20{opacity:0.2 !important}.opacity-30{opacity:0.3 !important}.opacity-40{opacity:0.4 !important}.opacity-50{opacity:0.5 !important}.opacity-60{opacity:0.6 !important}.opacity-70{opacity:0.7 !important}.opacity-80{opacity:0.8 !important}.opacity-90{opacity:0.9 !important}.text-baseline{vertical-align:baseline !important}.text-break{word-break:break-all !important}.text-underline{text-decoration:underline !important}.text-no-decoration{text-decoration:none !important}.unset{all:unset}a.unset,button.unset{cursor:pointer}.qas-actions-menu__list{width:265px;z-index:1}.qas-alert{border-style:solid;border-width:0 10px}.qas-app-bar__toolbar{height:70px}.qas-app-bar__brand{height:24px;margin-right:8px;position:relative;top:4px}.qas-app-bar__user{background-color:var(--qas-background-color);transition:background-color .3s cubic-bezier(0.25, 0.8, 0.5, 1)}.qas-app-bar__user:focus,.qas-app-bar__user:hover{background-color:rgba(255,255,255,.2)}.qas-app-bar__user-data{max-width:180px}.qas-app-bar__user-menu{width:260px}@media(max-width: 599px){.qas-app-bar__user-data{display:none}}.q-expansion-item--expanded .q-item:not(.qas-app-menu--active.q-item){background-color:#fafafa}.qas-list-items .q-list>.q-item{padding:24px 16px}.qas-map__draw{height:300px;width:100%}.qas-nested-fields__actions{height:56px}.qas-signature-pad__canvas{border:1px solid rgba(0,0,0,.12)}.qas-table-generator .q-table th{font-weight:bold}.qas-table-generator--mobile{margin:0 -10px}.qas-table-generator--mobile .q-table{margin-left:10px}.qas-transfer__icon{transform:rotate(-90deg)}.qas-uploader__input{display:none}
1
+ @import"https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,700;1,400;1,700&display=swap";:root{--qas-background-color: #f5f5f5;--qas-generic-border-radius: 8px}h1{font-size:6rem;font-weight:800;letter-spacing:0;line-height:6rem;margin:0}h2{font-size:3.75rem;font-weight:700;letter-spacing:0;line-height:3.75rem;margin:0}h3{font-size:3rem;font-weight:600;letter-spacing:0;line-height:2.5rem;margin:0}h4{font-size:2.125rem;font-weight:800;letter-spacing:0;line-height:2.5rem;margin:0}h5{font-size:1.5rem;font-weight:700;letter-spacing:0;line-height:2rem;margin:0}h6{font-size:1.25rem;font-weight:600;letter-spacing:0;line-height:2rem;margin:0}body{background-color:var(--qas-background-color)}.q-field--outlined .q-field__inner{background-color:#fff;border-radius:var(--qas-generic-border-radius)}.q-radio__inner::before{color:var(--q-primary)}.q-tabs__arrow{color:var(--q-primary)}.bg-no-repeat{background-repeat:no-repeat !important}.bg-size-contain{background-size:contain !important}.bg-size-cover{background-size:cover !important}.bg-position-bottom{background-position:bottom !important}.bg-position-center{background-position:center !important}.bg-position-left{background-position:left !important}.bg-position-right{background-position:right !important}.bg-position-top{background-position:top !important}.border-secondary-contrast:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-secondary:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-primary-contrast:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right),.border-primary:not(.border-top):not(.border-left):not(.border-bottom):not(.border-right){border-width:1px !important}.border-primary{border:0 solid var(--q-primary) !important}.border-primary-contrast{border:0 solid var(--q-primary-contrast) !important}.border-secondary{border:0 solid var(--q-secondary) !important}.border-secondary-contrast{border:0 solid var(--q-secondary-contrast) !important}.border-top{border-top-width:1px !important}.border-left{border-left-width:1px !important}.border-bottom{border-bottom-width:1px !important}.border-right{border-right-width:1px !important}.rounded-borders-sm{border-radius:calc(var(--qas-generic-border-radius) / 2) !important}.rounded-borders-lg{border-radius:calc(var(--qas-generic-border-radius) * 2) !important}.rounded-borders-top{border-bottom-left-radius:0 !important;border-bottom-right-radius:0 !important}.rounded-borders-right{border-bottom-left-radius:0 !important;border-top-left-radius:0 !important}.rounded-borders-bottom{border-top-left-radius:0 !important;border-top-right-radius:0 !important}.rounded-borders-left{border-bottom-right-radius:0 !important;border-top-right-radius:0 !important}.container,.container-xs,.container-sm,.container-md,.container-lg,.container-xl{margin-left:auto;margin-right:auto;max-width:1280px;width:calc(100% - 80px)}.container.spaced,.container-xs.spaced,.container-sm.spaced,.container-md.spaced,.container-lg.spaced,.container-xl.spaced{padding-bottom:20px;padding-top:20px}@media(max-width: 599px){.container,.container-xs,.container-sm,.container-md,.container-lg,.container-xl{width:calc(100% - 20px)}}.container-xs{max-width:599px !important}.container-sm{max-width:1023px !important}.container-md{max-width:1439px !important}.container-lg{max-width:1919px !important}body{font-family:Inter,system-ui,sans-serif}.qs-lh-xs{line-height:.85 !important}.qs-lh-sm{line-height:1 !important}.qs-lh-md{line-height:1.15 !important}.qs-lh-lg{line-height:1.3 !important}.qs-lh-xl{line-height:1.5 !important}.opacity-10{opacity:0.1 !important}.opacity-20{opacity:0.2 !important}.opacity-30{opacity:0.3 !important}.opacity-40{opacity:0.4 !important}.opacity-50{opacity:0.5 !important}.opacity-60{opacity:0.6 !important}.opacity-70{opacity:0.7 !important}.opacity-80{opacity:0.8 !important}.opacity-90{opacity:0.9 !important}.text-baseline{vertical-align:baseline !important}.text-break{word-break:break-all !important}.text-underline{text-decoration:underline !important}.text-no-decoration{text-decoration:none !important}.unset{all:unset}a.unset,button.unset{cursor:pointer}.qas-actions-menu__list{width:265px;z-index:1}.qas-alert{border-style:solid;border-width:0 10px}.q-expansion-item--expanded .q-item:not(.qas-app-menu--active.q-item){background-color:#fafafa}.qas-app-bar__toolbar{height:70px}.qas-app-bar__brand{height:24px;margin-right:8px;position:relative;top:4px}.qas-app-bar__user{background-color:var(--qas-background-color);transition:background-color .3s cubic-bezier(0.25, 0.8, 0.5, 1)}.qas-app-bar__user:focus,.qas-app-bar__user:hover{background-color:rgba(255,255,255,.2)}.qas-app-bar__user-data{max-width:180px}.qas-app-bar__user-menu{width:260px}@media(max-width: 599px){.qas-app-bar__user-data{display:none}}.qas-list-items .q-list>.q-item{padding:24px 16px}.qas-map__draw{height:300px;width:100%}.qas-nested-fields__actions{height:56px}.qas-signature-pad__canvas{border:1px solid rgba(0,0,0,.12)}.qas-table-generator .q-table th{font-weight:bold}.qas-table-generator--mobile{margin:0 -10px}.qas-table-generator--mobile .q-table{margin-left:10px}.qas-transfer__icon{transform:rotate(-90deg)}.qas-uploader__input{display:none}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @bildvitta/quasar-ui-asteroid v3.0.0-beta.13
2
+ * @bildvitta/quasar-ui-asteroid v3.0.0-beta.16
3
3
  * (c) 2022 Bild & Vitta <systemteam@bild.com.br>
4
4
  * Released under the MIT License.
5
5
  */
@@ -5327,6 +5327,11 @@
5327
5327
  useBoundary: {
5328
5328
  default: true,
5329
5329
  type: Boolean
5330
+ },
5331
+
5332
+ beforeFetch: {
5333
+ default: null,
5334
+ type: Function
5330
5335
  }
5331
5336
  },
5332
5337
 
@@ -5342,7 +5347,7 @@
5342
5347
  mx_errors: {},
5343
5348
  mx_fields: {},
5344
5349
  mx_metadata: {},
5345
-
5350
+ mx_cancelBeforeFetch: false,
5346
5351
  mx_isFetching: false
5347
5352
  }
5348
5353
  },
@@ -5408,6 +5413,22 @@
5408
5413
 
5409
5414
  this.$emit(`update:${key}`, models[key]);
5410
5415
  }
5416
+ },
5417
+
5418
+ mx_fetchHandler (payload, resolve) {
5419
+ const hasBeforeFetch = typeof this.beforeFetch === 'function';
5420
+
5421
+ if (hasBeforeFetch && !this.mx_cancelBeforeFetch) {
5422
+ return this.beforeFetch({
5423
+ payload,
5424
+ resolve: payload => resolve(payload),
5425
+ done: () => {
5426
+ this.mx_cancelBeforeFetch = true;
5427
+ }
5428
+ })
5429
+ }
5430
+
5431
+ resolve();
5411
5432
  }
5412
5433
  }
5413
5434
  };
@@ -5489,6 +5510,11 @@
5489
5510
  useSubmitButton: {
5490
5511
  default: true,
5491
5512
  type: Boolean
5513
+ },
5514
+
5515
+ beforeSubmit: {
5516
+ default: null,
5517
+ type: Function
5492
5518
  }
5493
5519
  },
5494
5520
 
@@ -5582,7 +5608,7 @@
5582
5608
 
5583
5609
  window.addEventListener('delete-success', this.setIgnoreRouterGuard);
5584
5610
 
5585
- this.fetch();
5611
+ this.mx_fetchHandler({ form: true, id: this.id, url: this.fetchURL }, this.fetch);
5586
5612
  },
5587
5613
 
5588
5614
  onUnmounted () {
@@ -5717,6 +5743,7 @@
5717
5743
  const { addRoute } = useHistory();
5718
5744
 
5719
5745
  this.defaultDialogProps.ok.onClick = () => addRoute(this.$route);
5746
+
5720
5747
  this.defaultDialogProps.cancel.onClick = next;
5721
5748
  },
5722
5749
 
@@ -5736,17 +5763,35 @@
5736
5763
  });
5737
5764
  },
5738
5765
 
5739
- async submit (event) {
5740
- if (this.disable) return null
5741
-
5766
+ /**
5767
+ * Se existe a propriedade com callback "beforeSubmit", então o controle de quando e como chamar o método "submit"
5768
+ * está sendo controlado fora do QasFormView, se não existir a propriedade "beforeSubmit", então o controle do método
5769
+ * submit é feito pelo próprio QasFormView, chamado pelo evento @submit.
5770
+ */
5771
+ submitHandler (event) {
5742
5772
  if (event) {
5743
5773
  event.preventDefault();
5744
5774
  }
5745
5775
 
5776
+ const hasBeforeSubmit = typeof this.beforeSubmit === 'function';
5777
+
5778
+ if (hasBeforeSubmit) {
5779
+ return this.beforeSubmit({
5780
+ payload: { id: this.id, payload: this.modelValue, url: this.url },
5781
+ resolve: payload => this.submit(payload)
5782
+ })
5783
+ }
5784
+
5785
+ this.submit();
5786
+ },
5787
+
5788
+ async submit (externalPayload = {}) {
5789
+ if (this.disable) return null
5790
+
5746
5791
  this.isSubmitting = true;
5747
5792
 
5748
5793
  try {
5749
- const payload = { id: this.id, payload: this.modelValue, url: this.url };
5794
+ const payload = { id: this.id, payload: this.modelValue, url: this.url, ...externalPayload };
5750
5795
 
5751
5796
  this.$qas.logger.group(
5752
5797
  `QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
@@ -5820,7 +5865,7 @@
5820
5865
  : vue.createCommentVNode("v-if", true),
5821
5866
  vue.createVNode(_component_q_form, {
5822
5867
  ref: "form",
5823
- onSubmit: $options.submit
5868
+ onSubmit: $options.submitHandler
5824
5869
  }, {
5825
5870
  default: vue.withCtx(() => [
5826
5871
  vue.renderSlot(_ctx.$slots, "default"),
@@ -6558,6 +6603,10 @@
6558
6603
  useFilter: {
6559
6604
  default: true,
6560
6605
  type: Boolean
6606
+ },
6607
+
6608
+ useResultsAreaOnly: {
6609
+ type: Boolean
6561
6610
  }
6562
6611
  },
6563
6612
 
@@ -6593,13 +6642,17 @@
6593
6642
 
6594
6643
  totalPages () {
6595
6644
  return this.$store.getters[`${this.entity}/totalPages`]
6645
+ },
6646
+
6647
+ showResults () {
6648
+ return this.hasResults || this.useResultsAreaOnly
6596
6649
  }
6597
6650
  },
6598
6651
 
6599
6652
  watch: {
6600
6653
  $route (to, from) {
6601
6654
  if (to.name === from.name) {
6602
- this.fetchList();
6655
+ this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList);
6603
6656
  this.setCurrentPage();
6604
6657
  }
6605
6658
  },
@@ -6614,7 +6667,8 @@
6614
6667
  },
6615
6668
 
6616
6669
  created () {
6617
- this.fetchList();
6670
+ this.mx_fetchHandler({ ...this.mx_context, url: this.url }, this.fetchList);
6671
+
6618
6672
  this.setCurrentPage();
6619
6673
  },
6620
6674
 
@@ -6624,16 +6678,14 @@
6624
6678
  this.$router.push({ query });
6625
6679
  },
6626
6680
 
6627
- async fetchList (filters = {}) {
6681
+ async fetchList (externalPayload = {}) {
6628
6682
  this.mx_isFetching = true;
6629
6683
 
6630
- const hasFilters = !!Object.keys(filters).length;
6631
-
6632
6684
  try {
6633
6685
  const payload = {
6634
6686
  ...this.mx_context,
6635
6687
  url: this.url,
6636
- ...(hasFilters && { filters })
6688
+ ...externalPayload
6637
6689
  };
6638
6690
 
6639
6691
  this.$qas.logger.group(
@@ -6657,7 +6709,7 @@
6657
6709
  this.$emit('fetch-success', response);
6658
6710
 
6659
6711
  this.$qas.logger.group(
6660
- `QasListView - fetchSingle -> resposta da action ${this.entity}/fetchList`, [response]
6712
+ `QasListView - fetchList -> resposta da action ${this.entity}/fetchList`, [response]
6661
6713
  );
6662
6714
  } catch (error) {
6663
6715
  this.mx_fetchError(error);
@@ -6731,7 +6783,7 @@
6731
6783
  ])
6732
6784
  : vue.createCommentVNode("v-if", true),
6733
6785
  vue.createElementVNode("main", _hoisted_2$7, [
6734
- ($options.hasResults)
6786
+ ($options.showResults)
6735
6787
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, [
6736
6788
  vue.renderSlot(_ctx.$slots, "default")
6737
6789
  ]))
@@ -6979,6 +7031,11 @@
6979
7031
  }
6980
7032
  },
6981
7033
 
7034
+ identifierItemKey: {
7035
+ type: String,
7036
+ default: 'uuid'
7037
+ },
7038
+
6982
7039
  rowLabel: {
6983
7040
  type: String,
6984
7041
  default: ''
@@ -7081,13 +7138,8 @@
7081
7138
  modelValue: {
7082
7139
  handler (value) {
7083
7140
  this.nested = quasar.extend(true, [], value);
7084
- },
7085
- immediate: true
7086
- },
7087
7141
 
7088
- field: {
7089
- handler () {
7090
- !this.modelValue.length && this.setDefaultNestedValue();
7142
+ if (!this.nested.length) return this.setDefaultNestedValue()
7091
7143
  },
7092
7144
  immediate: true
7093
7145
  }
@@ -7096,6 +7148,11 @@
7096
7148
  methods: {
7097
7149
  add (row = {}) {
7098
7150
  const payload = { ...this.rowObject, ...row };
7151
+ const hasIdentifierKey = payload[this.identifierItemKey];
7152
+
7153
+ if (hasIdentifierKey) {
7154
+ delete payload[this.identifierItemKey];
7155
+ }
7099
7156
 
7100
7157
  this.nested.push(payload);
7101
7158
 
@@ -7121,7 +7178,7 @@
7121
7178
  },
7122
7179
 
7123
7180
  destroy (index, row) {
7124
- this.useRemoveOnDestroy
7181
+ !row[this.identifierItemKey] || this.useRemoveOnDestroy
7125
7182
  ? this.nested.splice(index, 1)
7126
7183
  : this.nested.splice(index, 1, { [this.destroyKey]: true, ...row });
7127
7184
 
@@ -8376,7 +8433,9 @@
8376
8433
 
8377
8434
  watch: {
8378
8435
  $route (to, from) {
8379
- to.name === from.name && this.fetchSingle();
8436
+ if (to.name === from.name) {
8437
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle);
8438
+ }
8380
8439
  },
8381
8440
 
8382
8441
  resultModel (value) {
@@ -8385,15 +8444,15 @@
8385
8444
  },
8386
8445
 
8387
8446
  created () {
8388
- this.fetchSingle();
8447
+ this.mx_fetchHandler({ id: this.id, url: this.url }, this.fetchSingle);
8389
8448
  },
8390
8449
 
8391
8450
  methods: {
8392
- async fetchSingle (params = {}) {
8451
+ async fetchSingle (externalPayload = {}) {
8393
8452
  this.mx_isFetching = true;
8394
8453
 
8395
8454
  try {
8396
- const payload = { id: this.id, url: this.url, params };
8455
+ const payload = { id: this.id, url: this.url, ...externalPayload };
8397
8456
 
8398
8457
  this.$qas.logger.group(
8399
8458
  `QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
@@ -9480,7 +9539,7 @@
9480
9539
 
9481
9540
  var name = "@bildvitta/quasar-ui-asteroid";
9482
9541
  var description = "Asteroid";
9483
- var version$1 = "3.0.0-beta.13";
9542
+ var version$1 = "3.0.0-beta.16";
9484
9543
  var author = "Bild & Vitta <systemteam@bild.com.br>";
9485
9544
  var license = "MIT";
9486
9545
  var main = "dist/asteroid.cjs.min.js";