@qikdev/vue-ui 0.1.68 → 0.1.72

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.
package/dist/lib.es.js CHANGED
@@ -32,7 +32,7 @@ var __objRest = (source, exclude) => {
32
32
  };
33
33
  import { openBlock, createElementBlock, renderSlot, resolveComponent, createBlock, withCtx, createVNode, Fragment, renderList, normalizeClass, toDisplayString, withDirectives, resolveDynamicComponent, vShow, withModifiers, createTextVNode, createCommentVNode, createElementVNode, mergeProps, toHandlers, pushScopeId, popScopeId, normalizeStyle, Teleport, vModelSelect, withKeys, vModelText, TransitionGroup, defineComponent, h, nextTick, vModelDynamic, vModelCheckbox, reactive, watch } from "vue";
34
34
  import { EventDispatcher } from "@qikdev/sdk";
35
- const version$1 = "0.1.68";
35
+ const version$1 = "0.1.72";
36
36
  var flexColumn_vue_vue_type_style_index_0_scoped_true_lang = "";
37
37
  var _export_sfc = (sfc, props2) => {
38
38
  const target = sfc.__vccOpts || sfc;
@@ -6182,7 +6182,7 @@ var InputMixin = {
6182
6182
  mounted() {
6183
6183
  this.checkAutofocus();
6184
6184
  },
6185
- inject: ["form"],
6185
+ inject: ["form", "fieldPath"],
6186
6186
  computed: {
6187
6187
  optionLookup() {
6188
6188
  var self2 = this;
@@ -12836,10 +12836,9 @@ const _sfc_main$p = {
12836
12836
  fileItem.state = "processing";
12837
12837
  var body = new FormData();
12838
12838
  var jsonData = {};
12839
- self2.user ? Object.keys(self2.user.permissions) : [];
12840
12839
  jsonData.attachment = true;
12841
- jsonData.field = self2.field.key;
12842
- console.log("FORM FILE UPLOAD", self2.field, self2.form, jsonData);
12840
+ jsonData.form = self2.$sdk.utils.id(self2.form);
12841
+ jsonData.fieldPath = self2.fieldPath;
12843
12842
  body.append("json", JSON.stringify(jsonData));
12844
12843
  body.append("file", fileItem.file, fileItem.name);
12845
12844
  var config = {
@@ -13036,7 +13035,7 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
13036
13035
  }, 8, ["onFiles"]))
13037
13036
  ], 64);
13038
13037
  }
13039
- var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$p], ["__scopeId", "data-v-214d11c6"]]);
13038
+ var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$p], ["__scopeId", "data-v-397fdaa7"]]);
13040
13039
  var group_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
13041
13040
  const _sfc_main$o = {
13042
13041
  mixins: [InputMixin],
@@ -13048,6 +13047,12 @@ const _sfc_main$o = {
13048
13047
  },
13049
13048
  modelValue: {
13050
13049
  type: [Object, Array]
13050
+ },
13051
+ trail: {
13052
+ type: Array,
13053
+ default() {
13054
+ return [];
13055
+ }
13051
13056
  }
13052
13057
  },
13053
13058
  data() {
@@ -13219,6 +13224,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13219
13224
  }, {
13220
13225
  default: withCtx(() => [
13221
13226
  createVNode(_component_ux_form, {
13227
+ trail: $props.trail,
13222
13228
  ref: "form",
13223
13229
  submission: $props.submission,
13224
13230
  "onForm:state": $options.stateChange,
@@ -13227,7 +13233,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13227
13233
  "onUpdate:modelValue": ($event) => _ctx.model[index2] = $event,
13228
13234
  flex: $options.sameLine,
13229
13235
  fields: _ctx.field.fields
13230
- }, null, 8, ["submission", "onForm:state", "parentModel", "modelValue", "onUpdate:modelValue", "flex", "fields"])
13236
+ }, null, 8, ["trail", "submission", "onForm:state", "parentModel", "modelValue", "onUpdate:modelValue", "flex", "fields"])
13231
13237
  ]),
13232
13238
  _: 2
13233
13239
  }, 1536), [
@@ -13322,6 +13328,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13322
13328
  createVNode(_component_ux_form, {
13323
13329
  ref_for: true,
13324
13330
  ref: "form",
13331
+ trail: $props.trail,
13325
13332
  submission: $props.submission,
13326
13333
  "onForm:state": $options.stateChange,
13327
13334
  parentModel: _ctx.parentModel,
@@ -13329,7 +13336,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13329
13336
  "onUpdate:modelValue": ($event) => _ctx.model[index2] = $event,
13330
13337
  flex: $options.sameLine,
13331
13338
  fields: _ctx.field.fields
13332
- }, null, 8, ["submission", "onForm:state", "parentModel", "modelValue", "onUpdate:modelValue", "flex", "fields"])
13339
+ }, null, 8, ["trail", "submission", "onForm:state", "parentModel", "modelValue", "onUpdate:modelValue", "flex", "fields"])
13333
13340
  ]),
13334
13341
  _: 2
13335
13342
  }, 1536), [
@@ -13400,6 +13407,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13400
13407
  default: withCtx(() => [
13401
13408
  createVNode(_component_ux_form, {
13402
13409
  ref: "form",
13410
+ trail: $props.trail,
13403
13411
  submission: $props.submission,
13404
13412
  "onForm:state": $options.stateChange,
13405
13413
  parentModel: _ctx.parentModel,
@@ -13407,7 +13415,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13407
13415
  "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.model = $event),
13408
13416
  flex: $options.sameLine,
13409
13417
  fields: _ctx.field.fields
13410
- }, null, 8, ["submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"])
13418
+ }, null, 8, ["trail", "submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"])
13411
13419
  ]),
13412
13420
  _: 1
13413
13421
  })
@@ -13416,6 +13424,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13416
13424
  })) : (openBlock(), createBlock(_component_ux_form, {
13417
13425
  key: 1,
13418
13426
  ref: "form",
13427
+ trail: $props.trail,
13419
13428
  submission: $props.submission,
13420
13429
  "onForm:state": $options.stateChange,
13421
13430
  parentModel: _ctx.parentModel,
@@ -13423,7 +13432,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13423
13432
  "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.model = $event),
13424
13433
  flex: $options.sameLine,
13425
13434
  fields: _ctx.field.fields
13426
- }, null, 8, ["submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"]))
13435
+ }, null, 8, ["trail", "submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"]))
13427
13436
  ], 64)) : (openBlock(), createBlock(_component_ux_button, {
13428
13437
  key: 1,
13429
13438
  onClick: _cache[9] || (_cache[9] = ($event) => $options.createSingleObject())
@@ -13440,6 +13449,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13440
13449
  ], 64)) : (openBlock(), createBlock(_component_ux_form, {
13441
13450
  key: 1,
13442
13451
  ref: "form",
13452
+ trail: $props.trail,
13443
13453
  submission: $props.submission,
13444
13454
  "onForm:state": $options.stateChange,
13445
13455
  parentModel: _ctx.parentModel,
@@ -13447,10 +13457,10 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
13447
13457
  "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.model = $event),
13448
13458
  flex: $options.sameLine,
13449
13459
  fields: _ctx.field.fields
13450
- }, null, 8, ["submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"]))
13460
+ }, null, 8, ["trail", "submission", "onForm:state", "parentModel", "modelValue", "flex", "fields"]))
13451
13461
  ], 64));
13452
13462
  }
13453
- var FieldGroup$1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$o], ["__scopeId", "data-v-53c1ace8"]]);
13463
+ var FieldGroup$1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$o], ["__scopeId", "data-v-71c41d3a"]]);
13454
13464
  const _sfc_main$n = {
13455
13465
  props: {
13456
13466
  option: {
@@ -15661,6 +15671,12 @@ const _sfc_main$d = {
15661
15671
  RichTextField
15662
15672
  },
15663
15673
  props: {
15674
+ trail: {
15675
+ type: Array,
15676
+ default() {
15677
+ return [];
15678
+ }
15679
+ },
15664
15680
  submission: {
15665
15681
  type: Boolean,
15666
15682
  default: false
@@ -15692,6 +15708,11 @@ const _sfc_main$d = {
15692
15708
  };
15693
15709
  },
15694
15710
  inject: ["parentFormElement"],
15711
+ provide() {
15712
+ return {
15713
+ fieldPath: this.fieldPath
15714
+ };
15715
+ },
15695
15716
  created() {
15696
15717
  this.checkDirtyState();
15697
15718
  },
@@ -15854,6 +15875,14 @@ const _sfc_main$d = {
15854
15875
  }
15855
15876
  },
15856
15877
  computed: {
15878
+ fieldPath() {
15879
+ return this.currentTrail.join(".");
15880
+ },
15881
+ currentTrail() {
15882
+ var trail = this.trail.slice();
15883
+ trail.push(this.field.key);
15884
+ return trail;
15885
+ },
15857
15886
  title() {
15858
15887
  return this.field.title;
15859
15888
  },
@@ -16153,6 +16182,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16153
16182
  $options.widget == "group" ? (openBlock(), createElementBlock(Fragment, { key: 8 }, [
16154
16183
  $options.asObject ? (openBlock(), createBlock(_component_field_group, {
16155
16184
  key: 0,
16185
+ trail: $options.currentTrail,
16156
16186
  submission: $props.submission,
16157
16187
  "onForm:state": $options.groupStateAltered,
16158
16188
  ref: "group",
@@ -16161,8 +16191,9 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16161
16191
  parentModel: $props.parentModel,
16162
16192
  modelValue: $options.fieldModel,
16163
16193
  "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $options.fieldModel = $event)
16164
- }, null, 8, ["submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"])) : (openBlock(), createBlock(_component_field_group, {
16194
+ }, null, 8, ["trail", "submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"])) : (openBlock(), createBlock(_component_field_group, {
16165
16195
  key: 1,
16196
+ trail: $props.trail,
16166
16197
  submission: $props.submission,
16167
16198
  "onForm:state": $options.groupStateAltered,
16168
16199
  ref: "group",
@@ -16171,10 +16202,11 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16171
16202
  parentModel: $props.parentModel,
16172
16203
  modelValue: $options.sourceModel,
16173
16204
  "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $options.sourceModel = $event)
16174
- }, null, 8, ["submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"]))
16205
+ }, null, 8, ["trail", "submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"]))
16175
16206
  ], 64)) : createCommentVNode("", true),
16176
16207
  $options.widget == "form" ? (openBlock(), createBlock(_component_field_group, {
16177
16208
  key: 9,
16209
+ trail: $options.currentTrail,
16178
16210
  submission: $props.submission,
16179
16211
  "onForm:state": $options.groupStateAltered,
16180
16212
  ref: "group",
@@ -16183,7 +16215,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16183
16215
  parentModel: $props.parentModel,
16184
16216
  modelValue: $options.fieldModel,
16185
16217
  "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $options.fieldModel = $event)
16186
- }, null, 8, ["submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"])) : createCommentVNode("", true),
16218
+ }, null, 8, ["trail", "submission", "onForm:state", "onTouched", "field", "parentModel", "modelValue"])) : createCommentVNode("", true),
16187
16219
  $options.widget == "select" ? (openBlock(), createBlock(_component_native_select, {
16188
16220
  key: 10,
16189
16221
  onTouched: $options.touch,
@@ -16293,7 +16325,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
16293
16325
  $options.error && $data.validateResults.message ? (openBlock(), createElementBlock("div", _hoisted_1$a, toDisplayString($data.validateResults.message), 1)) : createCommentVNode("", true)
16294
16326
  ], 34)) : createCommentVNode("", true);
16295
16327
  }
16296
- var UXFormField = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-6c49b812"]]);
16328
+ var UXFormField = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d], ["__scopeId", "data-v-77633d3c"]]);
16297
16329
  var form_vue_vue_type_style_index_0_scoped_true_lang = "";
16298
16330
  const _sfc_main$c = {
16299
16331
  props: {
@@ -16303,6 +16335,12 @@ const _sfc_main$c = {
16303
16335
  parentForm: {
16304
16336
  type: Object
16305
16337
  },
16338
+ trail: {
16339
+ type: Array,
16340
+ default() {
16341
+ return [];
16342
+ }
16343
+ },
16306
16344
  fields: {
16307
16345
  type: Array,
16308
16346
  default() {
@@ -16324,7 +16362,7 @@ const _sfc_main$c = {
16324
16362
  default: false
16325
16363
  }
16326
16364
  },
16327
- inject: ["form"],
16365
+ inject: ["form", "parentFormElement"],
16328
16366
  watch: {
16329
16367
  modelValue(val, old) {
16330
16368
  this.model = val;
@@ -16348,7 +16386,6 @@ const _sfc_main$c = {
16348
16386
  parentFormElement
16349
16387
  };
16350
16388
  },
16351
- inject: ["parentFormElement"],
16352
16389
  mounted() {
16353
16390
  const self2 = this;
16354
16391
  self2.mounted = true;
@@ -16465,6 +16502,9 @@ const _sfc_main$c = {
16465
16502
  UxField: UXFormField
16466
16503
  },
16467
16504
  computed: {
16505
+ currentTrail() {
16506
+ return this.trail;
16507
+ },
16468
16508
  fieldHash() {
16469
16509
  return this.renderFields.reduce(function(set, field) {
16470
16510
  if (!field) {
@@ -16518,6 +16558,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
16518
16558
  return openBlock(), createBlock(_component_ux_field, {
16519
16559
  ref_for: true,
16520
16560
  ref: "field",
16561
+ trail: $options.currentTrail,
16521
16562
  submission: $props.submission,
16522
16563
  "onField:mount": $options.fieldMounted,
16523
16564
  "onField:unmount": $options.fieldUnmounted,
@@ -16534,12 +16575,12 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
16534
16575
  parentModel: $props.parentModel || $options.formModel,
16535
16576
  class: normalizeClass($options.fieldClass),
16536
16577
  key: `ux-form-field-${field.key}-${index2}`
16537
- }, null, 8, ["submission", "onField:mount", "onField:unmount", "onField:dirty", "onField:invalid", "onField:valid", "onField:error", "onField:focus", "onField:blur", "onField:touched", "field", "modelValue", "parentModel", "class"]);
16578
+ }, null, 8, ["trail", "submission", "onField:mount", "onField:unmount", "onField:dirty", "onField:invalid", "onField:valid", "onField:error", "onField:focus", "onField:blur", "onField:touched", "field", "modelValue", "parentModel", "class"]);
16538
16579
  }), 128))
16539
16580
  ], true)
16540
16581
  ], 2);
16541
16582
  }
16542
- var UXForm = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-24ce6bd4"]]);
16583
+ var UXForm = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-f463bb0c"]]);
16543
16584
  var submissionform_vue_vue_type_style_index_0_scoped_true_lang = "";
16544
16585
  const STATE_READY = "form.ready";
16545
16586
  const STATE_PROCESSING = "form.processing";
@@ -16571,6 +16612,7 @@ const _sfc_main$b = {
16571
16612
  this.state = STATE_READY;
16572
16613
  this.error = null;
16573
16614
  this.submitAttempted = false;
16615
+ this.$emit("reset");
16574
16616
  },
16575
16617
  async submit() {
16576
16618
  const self2 = this;
@@ -16584,18 +16626,21 @@ const _sfc_main$b = {
16584
16626
  return;
16585
16627
  }
16586
16628
  self2.state = STATE_PROCESSING;
16629
+ self2.$emit("processing");
16587
16630
  await self2.preSubmit();
16588
16631
  const submission = JSON.parse(JSON.stringify(self2.model));
16589
16632
  self2.$sdk.api.post(`/form/${self2.formID}`, submission).then(submissionComplete, submissionFailed);
16590
16633
  async function submissionComplete(res) {
16591
16634
  await self2.postSubmit();
16592
16635
  self2.state = STATE_COMPLETE;
16636
+ self2.$emit("success", res.data);
16593
16637
  }
16594
16638
  async function submissionFailed(err) {
16595
16639
  var _a;
16596
16640
  err = ((_a = err.response) == null ? void 0 : _a.data) || err;
16597
16641
  self2.error = err;
16598
16642
  self2.state = STATE_ERROR;
16643
+ self2.$emit("error", err);
16599
16644
  }
16600
16645
  },
16601
16646
  async preSubmit() {
@@ -16626,6 +16671,9 @@ const _sfc_main$b = {
16626
16671
  watch: {
16627
16672
  modelValue(val, old) {
16628
16673
  this.model = val;
16674
+ },
16675
+ model(m) {
16676
+ this.$emit("update:modelValue", m);
16629
16677
  }
16630
16678
  },
16631
16679
  data() {
@@ -16663,7 +16711,7 @@ const _sfc_main$b = {
16663
16711
  }
16664
16712
  }
16665
16713
  };
16666
- const _withScopeId$1 = (n2) => (pushScopeId("data-v-428ba5ea"), n2 = n2(), popScopeId(), n2);
16714
+ const _withScopeId$1 = (n2) => (pushScopeId("data-v-5d5b3222"), n2 = n2(), popScopeId(), n2);
16667
16715
  const _hoisted_1$9 = { class: "ux-submission-form" };
16668
16716
  const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("h3", null, "An error occurred", -1));
16669
16717
  const _hoisted_3$5 = { key: 0 };
@@ -16736,7 +16784,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
16736
16784
  ], 64))
16737
16785
  ]);
16738
16786
  }
16739
- var UXSubmissionForm = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-428ba5ea"]]);
16787
+ var UXSubmissionForm = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__scopeId", "data-v-5d5b3222"]]);
16740
16788
  var search_vue_vue_type_style_index_0_scoped_true_lang = "";
16741
16789
  const _sfc_main$a = {
16742
16790
  props: {