@bildvitta/quasar-ui-asteroid 3.0.0-beta.8 → 3.0.0-beta.9

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,7 +4,7 @@
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
- "cancel-button": {
7
+ "cancel-button-label": {
8
8
  "desc": "Rótulo do botão \"cancelar\".",
9
9
  "default": "Cancelar",
10
10
  "type": "String"
@@ -107,10 +107,6 @@
107
107
  ],
108
108
  "model": true
109
109
  },
110
- "read-only": {
111
- "desc": "Controla o slot de actions.",
112
- "type": "Boolean"
113
- },
114
110
  "route": {
115
111
  "desc": "Você pode passar uma configuração de rota customizada.",
116
112
  "default": {},
@@ -121,7 +117,7 @@
121
117
  "default": true,
122
118
  "type": "Boolean"
123
119
  },
124
- "submit-button": {
120
+ "submit-button-label": {
125
121
  "desc": "Rótulo do botão \"salvar\".",
126
122
  "default": "Salvar",
127
123
  "type": "String"
@@ -137,6 +133,21 @@
137
133
  "url": {
138
134
  "desc": "Envia como parâmetro para a action \"fetchSingle\" do modulo correspondente a \"entity\".",
139
135
  "type": "String"
136
+ },
137
+ "use-actions": {
138
+ "desc": "Controla se vai ter ou não o slot de actions.",
139
+ "default": true,
140
+ "type": "Boolean"
141
+ },
142
+ "use-cancel-button": {
143
+ "desc": "Controla se vai ter ou não botão de \"cancelar\".",
144
+ "default": true,
145
+ "type": "Boolean"
146
+ },
147
+ "use-submit-button": {
148
+ "desc": "Controla se vai ter ou não botão de submit.",
149
+ "default": true,
150
+ "type": "Boolean"
140
151
  }
141
152
  },
142
153
  "slots": {
@@ -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-alert{border-style:solid;border-width:0 10px}.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}}.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-nested-fields__actions{height:56px}.qas-map__draw{height:300px;width:100%}.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.8
2
+ * @bildvitta/quasar-ui-asteroid v3.0.0-beta.9
3
3
  * (c) 2022 Bild & Vitta <systemteam@bild.com.br>
4
4
  * Released under the MIT License.
5
5
  */
@@ -5293,7 +5293,7 @@ var script$k = {
5293
5293
  mixins: [viewMixin],
5294
5294
 
5295
5295
  props: {
5296
- cancelButton: {
5296
+ cancelButtonLabel: {
5297
5297
  default: 'Cancelar',
5298
5298
  type: String
5299
5299
  },
@@ -5317,10 +5317,6 @@ var script$k = {
5317
5317
  type: String
5318
5318
  },
5319
5319
 
5320
- readOnly: {
5321
- type: Boolean
5322
- },
5323
-
5324
5320
  route: {
5325
5321
  default: () => ({}),
5326
5322
  type: Object
@@ -5336,7 +5332,7 @@ var script$k = {
5336
5332
  type: Array
5337
5333
  },
5338
5334
 
5339
- submitButton: {
5335
+ submitButtonLabel: {
5340
5336
  default: 'Salvar',
5341
5337
  type: String
5342
5338
  },
@@ -5348,6 +5344,21 @@ var script$k = {
5348
5344
 
5349
5345
  submitting: {
5350
5346
  type: Boolean
5347
+ },
5348
+
5349
+ useActions: {
5350
+ default: true,
5351
+ type: Boolean
5352
+ },
5353
+
5354
+ useCancelButton: {
5355
+ default: true,
5356
+ type: Boolean
5357
+ },
5358
+
5359
+ useSubmitButton: {
5360
+ default: true,
5361
+ type: Boolean
5351
5362
  }
5352
5363
  },
5353
5364
 
@@ -5392,7 +5403,7 @@ var script$k = {
5392
5403
  },
5393
5404
 
5394
5405
  hasCancelButton () {
5395
- return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute)
5406
+ return !(typeof this.cancelRoute === 'boolean' && !this.cancelRoute) && this.useCancelButton
5396
5407
  },
5397
5408
 
5398
5409
  id () {
@@ -5411,16 +5422,12 @@ var script$k = {
5411
5422
  return this.$route
5412
5423
  },
5413
5424
 
5414
- saveButtonClass () {
5425
+ submitButtonClass () {
5415
5426
  return this.$qas.screen.isSmall && 'order-first'
5416
5427
  },
5417
5428
 
5418
5429
  isCancelButtonDisabled () {
5419
5430
  return this.disable || this.isSubmitting
5420
- },
5421
-
5422
- fieldsNameWithDefaultValue () {
5423
- return Object.keys(this.fields).filter(field => 'default' in this.fields[field])
5424
5431
  }
5425
5432
  },
5426
5433
 
@@ -5428,6 +5435,8 @@ var script$k = {
5428
5435
  mx_fields (fields) {
5429
5436
  const models = { ...this.getModelsByFields(fields), ...this.modelValue };
5430
5437
 
5438
+ this.$emit('update:modelValue', models);
5439
+
5431
5440
  if (!this.hasResult && this.showDialogOnUnsavedChanges) {
5432
5441
  this.cachedResult = quasar.extend(true, {}, models);
5433
5442
  }
@@ -5450,10 +5459,23 @@ var script$k = {
5450
5459
 
5451
5460
  methods: {
5452
5461
  beforeRouteLeave (to, from, next) {
5462
+ const clonedModelValue = quasar.extend(true, {}, this.modelValue);
5463
+ const clonedCachedResult = quasar.extend(true, {}, this.cachedResult);
5464
+
5465
+ /**
5466
+ * Se a propriedade "showDialogOnUnsavedChanges" for false ou a variável
5467
+ * "ignoreRouterGuard" for true, então **não** iremos checar se o usuário
5468
+ * alterou algum campo antes de sair da pagina, senão iremos validar pela função isEqualWith
5469
+ * e mostrar um dialog antes do usuário sair da página.
5470
+ */
5453
5471
  if (
5454
5472
  !this.showDialogOnUnsavedChanges ||
5455
5473
  this.ignoreRouterGuard ||
5456
- lodashEs.isEqualWith(this.modelValue, this.cachedResult, this.handleIgnoreKeysInUnsavedChanges)
5474
+ lodashEs.isEqualWith(
5475
+ clonedModelValue,
5476
+ clonedCachedResult,
5477
+ this.handleIgnoreKeysInUnsavedChanges
5478
+ )
5457
5479
  ) {
5458
5480
  return next()
5459
5481
  }
@@ -5492,7 +5514,11 @@ var script$k = {
5492
5514
 
5493
5515
  if (result) {
5494
5516
  this.hasResult = true;
5495
- this.$emit('update:modelValue', { ...this.modelValue, ...result });
5517
+
5518
+ this.$nextTick(() => {
5519
+ this.$emit('update:modelValue', { ...this.modelValue, ...result });
5520
+ });
5521
+
5496
5522
  this.cachedResult = this.showDialogOnUnsavedChanges && quasar.extend(true, {}, result);
5497
5523
  }
5498
5524
 
@@ -5545,28 +5571,23 @@ var script$k = {
5545
5571
 
5546
5572
  // ignora chaves na hora de validar quando usuário está saindo da página
5547
5573
  handleIgnoreKeysInUnsavedChanges (firstValue, secondValue) {
5548
- const toIgnore = [
5549
- ...this.fieldsNameWithDefaultValue,
5550
- ...this.ignoreKeysInUnsavedChanges
5551
- ];
5574
+ if (!this.ignoreKeysInUnsavedChanges.length) return
5552
5575
 
5553
- if (!toIgnore.length) return
5576
+ this.ignoreKeysInUnsavedChanges.forEach(key => {
5577
+ if (!firstValue) return
5554
5578
 
5555
- toIgnore.forEach(key => {
5556
5579
  delete firstValue[key];
5557
5580
  delete secondValue[key];
5558
5581
  });
5559
5582
  },
5560
5583
 
5561
5584
  async submit (event) {
5585
+ if (this.disable) return null
5586
+
5562
5587
  if (event) {
5563
5588
  event.preventDefault();
5564
5589
  }
5565
5590
 
5566
- if (this.disable || this.readyOnly) {
5567
- return null
5568
- }
5569
-
5570
5591
  this.isSubmitting = true;
5571
5592
 
5572
5593
  try {
@@ -5632,7 +5653,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5632
5653
  }, {
5633
5654
  default: vue.withCtx(() => [
5634
5655
  vue.renderSlot(_ctx.$slots, "default"),
5635
- (!$props.readOnly)
5656
+ ($props.useActions)
5636
5657
  ? vue.renderSlot(_ctx.$slots, "actions", { key: 0 }, () => [
5637
5658
  vue.createElementVNode("div", _hoisted_2$9, [
5638
5659
  ($options.hasCancelButton)
@@ -5644,7 +5665,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5644
5665
  class: "full-width",
5645
5666
  "data-cy": `btnCancel-${_ctx.entity}`,
5646
5667
  disable: $options.isCancelButtonDisabled,
5647
- label: $props.cancelButton,
5668
+ label: $props.cancelButtonLabel,
5648
5669
  outline: "",
5649
5670
  type: "button",
5650
5671
  onClick: $options.cancel
@@ -5653,18 +5674,21 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) {
5653
5674
  ])
5654
5675
  ], 2 /* CLASS */))
5655
5676
  : vue.createCommentVNode("v-if", true),
5656
- vue.createElementVNode("div", {
5657
- class: vue.normalizeClass(["col-12 col-sm-2", $options.saveButtonClass])
5658
- }, [
5659
- vue.createVNode(_component_qas_btn, {
5660
- class: "full-width",
5661
- "data-cy": `btnSave-${_ctx.entity}`,
5662
- disable: $props.disable,
5663
- label: $props.submitButton,
5664
- loading: $data.isSubmitting,
5665
- type: "submit"
5666
- }, null, 8 /* PROPS */, ["data-cy", "disable", "label", "loading"])
5667
- ], 2 /* CLASS */)
5677
+ ($props.useSubmitButton)
5678
+ ? (vue.openBlock(), vue.createElementBlock("div", {
5679
+ key: 1,
5680
+ class: vue.normalizeClass(["col-12 col-sm-2", $options.submitButtonClass])
5681
+ }, [
5682
+ vue.createVNode(_component_qas_btn, {
5683
+ class: "full-width",
5684
+ "data-cy": `btnSave-${_ctx.entity}`,
5685
+ disable: $props.disable,
5686
+ label: $props.submitButtonLabel,
5687
+ loading: $data.isSubmitting,
5688
+ type: "submit"
5689
+ }, null, 8 /* PROPS */, ["data-cy", "disable", "label", "loading"])
5690
+ ], 2 /* CLASS */))
5691
+ : vue.createCommentVNode("v-if", true)
5668
5692
  ])
5669
5693
  ])
5670
5694
  : vue.createCommentVNode("v-if", true)
@@ -9254,7 +9278,7 @@ script.__file = "src/components/transfer/QasTransfer.vue";
9254
9278
 
9255
9279
  var name = "@bildvitta/quasar-ui-asteroid";
9256
9280
  var description = "Asteroid";
9257
- var version$1 = "3.0.0-beta.8";
9281
+ var version$1 = "3.0.0-beta.9";
9258
9282
  var author = "Bild & Vitta <systemteam@bild.com.br>";
9259
9283
  var license = "MIT";
9260
9284
  var main = "dist/asteroid.cjs.min.js";