@bildvitta/quasar-ui-asteroid 3.0.0-beta.11 → 3.0.0-beta.14

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",
@@ -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-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}}.qas-actions-menu__list{width:265px;z-index:1}.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-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-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-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.11
2
+ * @bildvitta/quasar-ui-asteroid v3.0.0-beta.14
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) {
@@ -2454,7 +2468,7 @@ var Logger = () => {
2454
2468
  group (message, payload = [], { error } = {}) {
2455
2469
  if (!isDebugEnabled) return
2456
2470
 
2457
- console.group(normalizeMessage(message), getStyle(error));
2471
+ console.groupCollapsed(normalizeMessage(message), getStyle(error));
2458
2472
 
2459
2473
  for (const item of payload) {
2460
2474
  if (typeof item === 'string') {
@@ -2943,7 +2957,7 @@ var script$u = {
2943
2957
 
2944
2958
  watch: {
2945
2959
  mask () {
2946
- const input = this.inputReference.$el?.querySelector('input');
2960
+ const input = this.getInput();
2947
2961
 
2948
2962
  requestAnimationFrame(() => {
2949
2963
  input.selectionStart = input.value ? input.value.length : '';
@@ -2977,12 +2991,30 @@ var script$u = {
2977
2991
  },
2978
2992
 
2979
2993
  toggleMask (first, second) {
2994
+ if (!this.modelValue.length) return
2995
+
2980
2996
  const length = first.split('#').length - 2;
2981
2997
  return this.modelValue?.length > length ? second : first
2982
2998
  },
2983
2999
 
2984
3000
  validate (value) {
2985
3001
  return this.inputReference.validate(value)
3002
+ },
3003
+
3004
+ onPaste (event) {
3005
+ if (!this.mask) return
3006
+
3007
+ const value = event.clipboardData.getData('text');
3008
+ const input = this.getInput();
3009
+
3010
+ requestAnimationFrame(() => {
3011
+ this.$emit('update:modelValue', value);
3012
+ input.selectionStart = input.value ? input.value.length : '';
3013
+ });
3014
+ },
3015
+
3016
+ getInput () {
3017
+ return this.inputReference.$el?.querySelector('input')
2986
3018
  }
2987
3019
  }
2988
3020
  };
@@ -3001,7 +3033,8 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
3001
3033
  "error-message": _ctx.errorMessageData,
3002
3034
  mask: $options.mask,
3003
3035
  outlined: $props.outlined,
3004
- "unmasked-value": $props.unmaskedValue
3036
+ "unmasked-value": $props.unmaskedValue,
3037
+ onPaste: $options.onPaste
3005
3038
  }), vue.createSlots({ _: 2 /* DYNAMIC */ }, [
3006
3039
  vue.renderList(_ctx.$slots, (_, name) => {
3007
3040
  return {
@@ -3011,7 +3044,7 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) {
3011
3044
  ])
3012
3045
  }
3013
3046
  })
3014
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "error", "error-message", "mask", "outlined", "unmasked-value"])
3047
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["modelValue", "error", "error-message", "mask", "outlined", "unmasked-value", "onPaste"])
3015
3048
  ]))
3016
3049
  }
3017
3050
 
@@ -4935,6 +4968,8 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4935
4968
  ($options.hasSearch)
4936
4969
  ? (vue.openBlock(), vue.createBlock(_component_qas_btn, {
4937
4970
  key: 0,
4971
+ color: "grey-9",
4972
+ flat: "",
4938
4973
  icon: "o_clear",
4939
4974
  unelevated: "",
4940
4975
  onClick: $options.clearSearch
@@ -4943,6 +4978,8 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) {
4943
4978
  (!$options.debounce)
4944
4979
  ? (vue.openBlock(), vue.createBlock(_component_qas_btn, {
4945
4980
  key: 1,
4981
+ color: "grey-9",
4982
+ flat: "",
4946
4983
  icon: "o_search",
4947
4984
  type: "submit",
4948
4985
  unelevated: "",
@@ -5368,11 +5405,9 @@ var viewMixin = {
5368
5405
  },
5369
5406
 
5370
5407
  mx_setFields (fields = {}) {
5371
- for (const field in fields) {
5372
- fields[field].name = humps.camelize(fields[field].name);
5373
- }
5408
+ const camelizedFields = camelizeFieldsName(fields);
5374
5409
 
5375
- this.mx_fields = vue.markRaw(fields);
5410
+ this.mx_fields = vue.markRaw(camelizedFields);
5376
5411
  },
5377
5412
 
5378
5413
  mx_setMetadata (metadata = {}) {
@@ -5466,6 +5501,11 @@ var script$k = {
5466
5501
  useSubmitButton: {
5467
5502
  default: true,
5468
5503
  type: Boolean
5504
+ },
5505
+
5506
+ beforeSubmit: {
5507
+ default: null,
5508
+ type: Function
5469
5509
  }
5470
5510
  },
5471
5511
 
@@ -5713,17 +5753,35 @@ var script$k = {
5713
5753
  });
5714
5754
  },
5715
5755
 
5716
- async submit (event) {
5717
- if (this.disable) return null
5718
-
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) {
5719
5762
  if (event) {
5720
5763
  event.preventDefault();
5721
5764
  }
5722
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
+
5723
5781
  this.isSubmitting = true;
5724
5782
 
5725
5783
  try {
5726
- const payload = { id: this.id, payload: this.modelValue, url: this.url };
5784
+ const payload = { id: this.id, payload: this.modelValue, url: this.url, ...externalPayload };
5727
5785
 
5728
5786
  this.$qas.logger.group(
5729
5787
  `QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
@@ -5797,7 +5855,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5797
5855
  : vue.createCommentVNode("v-if", true),
5798
5856
  vue.createVNode(_component_q_form, {
5799
5857
  ref: "form",
5800
- onSubmit: $options.submit
5858
+ onSubmit: $options.submitHandler
5801
5859
  }, {
5802
5860
  default: vue.withCtx(() => [
5803
5861
  vue.renderSlot(_ctx.$slots, "default"),
@@ -7021,13 +7079,7 @@ var script$c = {
7021
7079
  },
7022
7080
 
7023
7081
  children () {
7024
- const field = quasar.extend(true, {}, this.field);
7025
-
7026
- for (const key in field?.children) {
7027
- field.children[key].name = humps.camelize(field?.children[key].name);
7028
- }
7029
-
7030
- return field?.children
7082
+ return this.field?.children
7031
7083
  },
7032
7084
 
7033
7085
  showDestroyBtn () {
@@ -7064,13 +7116,8 @@ var script$c = {
7064
7116
  modelValue: {
7065
7117
  handler (value) {
7066
7118
  this.nested = quasar.extend(true, [], value);
7067
- },
7068
- immediate: true
7069
- },
7070
7119
 
7071
- field: {
7072
- handler () {
7073
- !this.modelValue.length && this.setDefaultNestedValue();
7120
+ if (!this.nested.length) return this.setDefaultNestedValue()
7074
7121
  },
7075
7122
  immediate: true
7076
7123
  }
@@ -7355,6 +7402,14 @@ const { hasPreviousRoute, history: history$1, getPreviousRoute } = useHistory();
7355
7402
  var script$b = {
7356
7403
  name: 'QasPageHeader',
7357
7404
 
7405
+ mixins: [
7406
+ quasar.createMetaMixin(function () {
7407
+ return {
7408
+ title: this.title
7409
+ }
7410
+ })
7411
+ ],
7412
+
7358
7413
  props: {
7359
7414
  breadcrumbs: {
7360
7415
  default: '',
@@ -7417,12 +7472,6 @@ var script$b = {
7417
7472
 
7418
7473
  return lastIndex === index ? 'text-grey-7' : 'text-primary'
7419
7474
  }
7420
- },
7421
-
7422
- meta () {
7423
- return {
7424
- title: this.title
7425
- }
7426
7475
  }
7427
7476
  };
7428
7477
 
@@ -9461,7 +9510,7 @@ script.__file = "src/components/transfer/QasTransfer.vue";
9461
9510
 
9462
9511
  var name = "@bildvitta/quasar-ui-asteroid";
9463
9512
  var description = "Asteroid";
9464
- var version$1 = "3.0.0-beta.11";
9513
+ var version$1 = "3.0.0-beta.14";
9465
9514
  var author = "Bild & Vitta <systemteam@bild.com.br>";
9466
9515
  var license = "MIT";
9467
9516
  var main = "dist/asteroid.cjs.min.js";