@bildvitta/quasar-ui-asteroid 3.0.0-beta.12 → 3.0.0-beta.15

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.
@@ -4,6 +4,14 @@
4
4
  "desc": "Componente para C.R.U.D. responsável pela pela criação (Create) e edição (Update)."
5
5
  },
6
6
  "props": {
7
+ "before-submit": {
8
+ "desc": "Callback para controlar como funciona o comportamento do submit.",
9
+ "default": null,
10
+ "type": "Function",
11
+ "examples": [
12
+ "beforeSubmit({ payload, resolve })"
13
+ ]
14
+ },
7
15
  "cancel-button-label": {
8
16
  "desc": "Rótulo do botão \"cancelar\".",
9
17
  "default": "Cancelar",
@@ -72,6 +72,16 @@
72
72
  "xl"
73
73
  ]
74
74
  },
75
+ "identifier-item-key": {
76
+ "desc": "Define um identificador para o item. O identificador será utilizado para validar exclusão do item, por exemplo.",
77
+ "default": "uuid",
78
+ "type": "String",
79
+ "examples": [
80
+ "id",
81
+ "uuid",
82
+ "slug"
83
+ ]
84
+ },
75
85
  "model-value": {
76
86
  "desc": "Model do componente",
77
87
  "default": [],
@@ -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}.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-uploader__input{display:none}.qas-transfer__icon{transform:rotate(-90deg)}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @bildvitta/quasar-ui-asteroid v3.0.0-beta.12
2
+ * @bildvitta/quasar-ui-asteroid v3.0.0-beta.15
3
3
  * (c) 2022 Bild & Vitta <systemteam@bild.com.br>
4
4
  * Released under the MIT License.
5
5
  */
@@ -474,6 +474,20 @@ function getGreatestCommonDivisor (first, second) {
474
474
  return first
475
475
  }
476
476
 
477
+ function camelizeFieldsName (fields) {
478
+ for (const field in fields) {
479
+ const currentField = fields[field];
480
+
481
+ currentField.name = humps.camelize(currentField.name);
482
+
483
+ if (Object.keys(currentField.children || {}).length) {
484
+ camelizeFieldsName(currentField.children);
485
+ }
486
+ }
487
+
488
+ return fields
489
+ }
490
+
477
491
  // Private
478
492
  function __format (value, token, options = {}) {
479
493
  if (!value) {
@@ -4954,6 +4968,8 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4954
4968
  ($options.hasSearch)
4955
4969
  ? (vue.openBlock(), vue.createBlock(_component_qas_btn, {
4956
4970
  key: 0,
4971
+ color: "grey-9",
4972
+ flat: "",
4957
4973
  icon: "o_clear",
4958
4974
  unelevated: "",
4959
4975
  onClick: $options.clearSearch
@@ -4962,6 +4978,8 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4962
4978
  (!$options.debounce)
4963
4979
  ? (vue.openBlock(), vue.createBlock(_component_qas_btn, {
4964
4980
  key: 1,
4981
+ color: "grey-9",
4982
+ flat: "",
4965
4983
  icon: "o_search",
4966
4984
  type: "submit",
4967
4985
  unelevated: "",
@@ -5387,11 +5405,9 @@ var viewMixin = {
5387
5405
  },
5388
5406
 
5389
5407
  mx_setFields (fields = {}) {
5390
- for (const field in fields) {
5391
- fields[field].name = humps.camelize(fields[field].name);
5392
- }
5408
+ const camelizedFields = camelizeFieldsName(fields);
5393
5409
 
5394
- this.mx_fields = vue.markRaw(fields);
5410
+ this.mx_fields = vue.markRaw(camelizedFields);
5395
5411
  },
5396
5412
 
5397
5413
  mx_setMetadata (metadata = {}) {
@@ -5485,6 +5501,11 @@ var script$k = {
5485
5501
  useSubmitButton: {
5486
5502
  default: true,
5487
5503
  type: Boolean
5504
+ },
5505
+
5506
+ beforeSubmit: {
5507
+ default: null,
5508
+ type: Function
5488
5509
  }
5489
5510
  },
5490
5511
 
@@ -5732,17 +5753,35 @@ var script$k = {
5732
5753
  });
5733
5754
  },
5734
5755
 
5735
- async submit (event) {
5736
- if (this.disable) return null
5737
-
5756
+ /**
5757
+ * Se existe a propriedade com callback "beforeSubmit", então o controle de quando e como chamar o método "submit"
5758
+ * está sendo controlado fora do QasFormView, se não existir a propriedade "beforeSubmit", então o controle do método
5759
+ * submit é feito pelo próprio QasFormView, chamado pelo evento @submit.
5760
+ */
5761
+ submitHandler (event) {
5738
5762
  if (event) {
5739
5763
  event.preventDefault();
5740
5764
  }
5741
5765
 
5766
+ const hasBeforeSubmit = typeof this.beforeSubmit === 'function';
5767
+
5768
+ if (hasBeforeSubmit) {
5769
+ return this.beforeSubmit({
5770
+ payload: { id: this.id, payload: this.modelValue, url: this.url },
5771
+ resolve: payload => this.submit(payload)
5772
+ })
5773
+ }
5774
+
5775
+ this.submit();
5776
+ },
5777
+
5778
+ async submit (externalPayload = {}) {
5779
+ if (this.disable) return null
5780
+
5742
5781
  this.isSubmitting = true;
5743
5782
 
5744
5783
  try {
5745
- const payload = { id: this.id, payload: this.modelValue, url: this.url };
5784
+ const payload = { id: this.id, payload: this.modelValue, url: this.url, ...externalPayload };
5746
5785
 
5747
5786
  this.$qas.logger.group(
5748
5787
  `QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
@@ -5816,7 +5855,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5816
5855
  : vue.createCommentVNode("v-if", true),
5817
5856
  vue.createVNode(_component_q_form, {
5818
5857
  ref: "form",
5819
- onSubmit: $options.submit
5858
+ onSubmit: $options.submitHandler
5820
5859
  }, {
5821
5860
  default: vue.withCtx(() => [
5822
5861
  vue.renderSlot(_ctx.$slots, "default"),
@@ -6975,6 +7014,11 @@ var script$c = {
6975
7014
  }
6976
7015
  },
6977
7016
 
7017
+ identifierItemKey: {
7018
+ type: String,
7019
+ default: 'uuid'
7020
+ },
7021
+
6978
7022
  rowLabel: {
6979
7023
  type: String,
6980
7024
  default: ''
@@ -7040,13 +7084,7 @@ var script$c = {
7040
7084
  },
7041
7085
 
7042
7086
  children () {
7043
- const field = quasar.extend(true, {}, this.field);
7044
-
7045
- for (const key in field?.children) {
7046
- field.children[key].name = humps.camelize(field?.children[key].name);
7047
- }
7048
-
7049
- return field?.children
7087
+ return this.field?.children
7050
7088
  },
7051
7089
 
7052
7090
  showDestroyBtn () {
@@ -7083,13 +7121,8 @@ var script$c = {
7083
7121
  modelValue: {
7084
7122
  handler (value) {
7085
7123
  this.nested = quasar.extend(true, [], value);
7086
- },
7087
- immediate: true
7088
- },
7089
7124
 
7090
- field: {
7091
- handler () {
7092
- !this.modelValue.length && this.setDefaultNestedValue();
7125
+ if (!this.nested.length) return this.setDefaultNestedValue()
7093
7126
  },
7094
7127
  immediate: true
7095
7128
  }
@@ -7098,6 +7131,11 @@ var script$c = {
7098
7131
  methods: {
7099
7132
  add (row = {}) {
7100
7133
  const payload = { ...this.rowObject, ...row };
7134
+ const hasIdentifierKey = payload[this.identifierItemKey];
7135
+
7136
+ if (hasIdentifierKey) {
7137
+ delete payload[this.identifierItemKey];
7138
+ }
7101
7139
 
7102
7140
  this.nested.push(payload);
7103
7141
 
@@ -7123,7 +7161,7 @@ var script$c = {
7123
7161
  },
7124
7162
 
7125
7163
  destroy (index, row) {
7126
- this.useRemoveOnDestroy
7164
+ !row[this.identifierItemKey] || this.useRemoveOnDestroy
7127
7165
  ? this.nested.splice(index, 1)
7128
7166
  : this.nested.splice(index, 1, { [this.destroyKey]: true, ...row });
7129
7167
 
@@ -9482,7 +9520,7 @@ script.__file = "src/components/transfer/QasTransfer.vue";
9482
9520
 
9483
9521
  var name = "@bildvitta/quasar-ui-asteroid";
9484
9522
  var description = "Asteroid";
9485
- var version$1 = "3.0.0-beta.12";
9523
+ var version$1 = "3.0.0-beta.15";
9486
9524
  var author = "Bild & Vitta <systemteam@bild.com.br>";
9487
9525
  var license = "MIT";
9488
9526
  var main = "dist/asteroid.cjs.min.js";