@qikdev/vue-ui 0.1.62 → 0.1.63

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.62";
35
+ const version$1 = "0.1.63";
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;
@@ -4633,13 +4633,13 @@ const _hoisted_1$L = { class: "table-date-cell" };
4633
4633
  const _hoisted_2$D = { key: 0 };
4634
4634
  const _hoisted_3$w = { class: "off" };
4635
4635
  const _hoisted_4$s = { class: "on" };
4636
- const _hoisted_5$m = { class: "spacer" };
4636
+ const _hoisted_5$n = { class: "spacer" };
4637
4637
  function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
4638
4638
  return openBlock(), createElementBlock("td", _hoisted_1$L, [
4639
4639
  $options.hasValue ? (openBlock(), createElementBlock("div", _hoisted_2$D, [
4640
4640
  createElementVNode("span", _hoisted_3$w, toDisplayString($options.readable), 1),
4641
4641
  createElementVNode("span", _hoisted_4$s, toDisplayString($options.timeago), 1),
4642
- createElementVNode("span", _hoisted_5$m, toDisplayString($options.readable), 1)
4642
+ createElementVNode("span", _hoisted_5$n, toDisplayString($options.readable), 1)
4643
4643
  ])) : createCommentVNode("", true)
4644
4644
  ]);
4645
4645
  }
@@ -5186,7 +5186,7 @@ const _hoisted_3$u = {
5186
5186
  class: "first table-select shrink"
5187
5187
  };
5188
5188
  const _hoisted_4$r = /* @__PURE__ */ createTextVNode(" Select Page ");
5189
- const _hoisted_5$l = /* @__PURE__ */ createTextVNode(" Deselect Page ");
5189
+ const _hoisted_5$m = /* @__PURE__ */ createTextVNode(" Deselect Page ");
5190
5190
  const _hoisted_6$i = /* @__PURE__ */ createTextVNode(" Deselect All ");
5191
5191
  const _hoisted_7$f = ["onClick"];
5192
5192
  const _hoisted_8$8 = {
@@ -5225,7 +5225,7 @@ function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
5225
5225
  onClick: _cache[1] || (_cache[1] = ($event) => $options.deselectPage())
5226
5226
  }, {
5227
5227
  default: withCtx(() => [
5228
- _hoisted_5$l
5228
+ _hoisted_5$m
5229
5229
  ]),
5230
5230
  _: 1
5231
5231
  })) : createCommentVNode("", true),
@@ -5422,7 +5422,7 @@ function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
5422
5422
  _: 3
5423
5423
  }, 8, ["active", "loading", "to", "href", "target", "style", "class", "disabled"]);
5424
5424
  }
5425
- var UXButton = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["render", _sfc_render$S], ["__scopeId", "data-v-6e53d3d2"]]);
5425
+ var UXButton = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["render", _sfc_render$S], ["__scopeId", "data-v-56c95efc"]]);
5426
5426
  var checkbox_vue_vue_type_style_index_0_scoped_true_lang$1 = "";
5427
5427
  const _sfc_main$R = {
5428
5428
  props: {
@@ -6606,7 +6606,7 @@ const _hoisted_4$q = {
6606
6606
  key: 2,
6607
6607
  class: "ui-select-button"
6608
6608
  };
6609
- const _hoisted_5$k = ["multiple"];
6609
+ const _hoisted_5$l = ["multiple"];
6610
6610
  const _hoisted_6$h = {
6611
6611
  key: 0,
6612
6612
  value: ""
@@ -6643,7 +6643,7 @@ function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
6643
6643
  value: option2.value
6644
6644
  }, toDisplayString(option2.title), 9, _hoisted_7$e);
6645
6645
  }), 256))
6646
- ], 40, _hoisted_5$k), [
6646
+ ], 40, _hoisted_5$l), [
6647
6647
  [vModelSelect, _ctx.model]
6648
6648
  ])
6649
6649
  ], 2);
@@ -6735,7 +6735,7 @@ const _hoisted_3$s = {
6735
6735
  class: "ux-field-description"
6736
6736
  };
6737
6737
  const _hoisted_4$p = { key: 2 };
6738
- const _hoisted_5$j = /* @__PURE__ */ createTextVNode(" Country Code ");
6738
+ const _hoisted_5$k = /* @__PURE__ */ createTextVNode(" Country Code ");
6739
6739
  const _hoisted_6$g = { key: 0 };
6740
6740
  const _hoisted_7$d = { key: 1 };
6741
6741
  const _hoisted_8$7 = { class: "ux-text-wrap" };
@@ -6773,7 +6773,7 @@ function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
6773
6773
  }, {
6774
6774
  default: withCtx(() => [
6775
6775
  !entry.countryCode ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6776
- _hoisted_5$j
6776
+ _hoisted_5$k
6777
6777
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
6778
6778
  $data.lookup[entry.countryCode] ? (openBlock(), createElementBlock("div", _hoisted_6$g, toDisplayString($data.lookup[entry.countryCode].emoji) + " - " + toDisplayString($data.lookup[entry.countryCode].alpha2), 1)) : (openBlock(), createElementBlock("div", _hoisted_7$d, "Loading"))
6779
6779
  ], 64))
@@ -7429,7 +7429,7 @@ const _hoisted_4$o = {
7429
7429
  key: 2,
7430
7430
  class: "ui-select-button"
7431
7431
  };
7432
- const _hoisted_5$i = ["multiple"];
7432
+ const _hoisted_5$j = ["multiple"];
7433
7433
  const _hoisted_6$f = {
7434
7434
  key: 0,
7435
7435
  value: ""
@@ -7466,7 +7466,7 @@ function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
7466
7466
  value: option2.value
7467
7467
  }, toDisplayString(option2.title), 9, _hoisted_7$c);
7468
7468
  }), 256))
7469
- ], 40, _hoisted_5$i), [
7469
+ ], 40, _hoisted_5$j), [
7470
7470
  [vModelSelect, _ctx.model]
7471
7471
  ])
7472
7472
  ], 2);
@@ -10199,11 +10199,33 @@ const _sfc_main$D = {
10199
10199
  }
10200
10200
  },
10201
10201
  mixins: [InputMixin],
10202
- created() {
10202
+ async created() {
10203
+ this.glossary = await this.$sdk.content.glossary({ hash: true });
10203
10204
  this.value = this.cleanInput(this.value, true);
10204
10205
  this.dispatch();
10205
10206
  },
10207
+ data() {
10208
+ return {
10209
+ glossary: {}
10210
+ };
10211
+ },
10206
10212
  methods: {
10213
+ async create() {
10214
+ var _a;
10215
+ const self2 = this;
10216
+ if (!((_a = self2.$sdk.global) == null ? void 0 : _a.create)) {
10217
+ return;
10218
+ }
10219
+ const item = await self2.$sdk.global.create(self2.field.referenceType);
10220
+ if (self2.multiValue) {
10221
+ if (!self2.model) {
10222
+ self2.model = [];
10223
+ }
10224
+ self2.model.push(item);
10225
+ } else {
10226
+ self2.model = item;
10227
+ }
10228
+ },
10207
10229
  clear() {
10208
10230
  this.model = void 0;
10209
10231
  this.touch();
@@ -10264,6 +10286,27 @@ const _sfc_main$D = {
10264
10286
  }
10265
10287
  },
10266
10288
  computed: {
10289
+ canAdd() {
10290
+ const self2 = this;
10291
+ if (!self2.maximum) {
10292
+ return true;
10293
+ }
10294
+ return self2.multiValue ? self2.model.length < self2.maximum : !self2.model;
10295
+ },
10296
+ canCreate() {
10297
+ var _a;
10298
+ if (!((_a = this.$sdk.global) == null ? void 0 : _a.create)) {
10299
+ return;
10300
+ }
10301
+ var basicType = this.field.referenceType;
10302
+ var definedType = basicType;
10303
+ var match2 = this.glossary[this.field.referenceType];
10304
+ if (match2) {
10305
+ basicType = match2.definesType || match2.key;
10306
+ definedType = match2.key || match2.definesType;
10307
+ }
10308
+ return this.user && this.$sdk.access.canCreate(this.user, definedType, basicType);
10309
+ },
10267
10310
  summary() {
10268
10311
  if (this.multiValue) {
10269
10312
  if (this.model && this.model.length) {
@@ -10277,6 +10320,9 @@ const _sfc_main$D = {
10277
10320
  if (difference) {
10278
10321
  summary = `${summary}... +${difference} more...`;
10279
10322
  }
10323
+ if (!summary) {
10324
+ return `Click to select`;
10325
+ }
10280
10326
  return summary;
10281
10327
  } else {
10282
10328
  return `Click to select`;
@@ -10307,11 +10353,15 @@ const _hoisted_4$n = {
10307
10353
  key: 3,
10308
10354
  class: "items"
10309
10355
  };
10356
+ const _hoisted_5$i = /* @__PURE__ */ createTextVNode(" Create ");
10310
10357
  function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
10311
10358
  const _component_ux_icon = resolveComponent("ux-icon");
10312
10359
  const _component_ux_button = resolveComponent("ux-button");
10313
10360
  const _component_item = resolveComponent("item");
10314
10361
  const _component_draggable = resolveComponent("draggable");
10362
+ const _component_flex_cell = resolveComponent("flex-cell");
10363
+ const _component_flex_spacer = resolveComponent("flex-spacer");
10364
+ const _component_flex_row = resolveComponent("flex-row");
10315
10365
  return openBlock(), createElementBlock(Fragment, null, [
10316
10366
  _ctx.showLabel ? (openBlock(), createElementBlock("label", _hoisted_1$x, [
10317
10367
  createTextVNode(toDisplayString(_ctx.label) + " ", 1),
@@ -10382,15 +10432,50 @@ function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
10382
10432
  _: 1
10383
10433
  }, 8, ["item"])
10384
10434
  ])) : createCommentVNode("", true),
10385
- createVNode(_component_ux_button, { onClick: $options.open }, {
10435
+ $options.canAdd ? (openBlock(), createBlock(_component_flex_row, {
10436
+ key: 4,
10437
+ gap: ""
10438
+ }, {
10386
10439
  default: withCtx(() => [
10387
- createTextVNode(toDisplayString($options.summary), 1)
10440
+ createVNode(_component_flex_cell, { shrink: "" }, {
10441
+ default: withCtx(() => [
10442
+ createVNode(_component_ux_button, { onClick: $options.open }, {
10443
+ default: withCtx(() => [
10444
+ createTextVNode(toDisplayString($options.summary), 1)
10445
+ ]),
10446
+ _: 1
10447
+ }, 8, ["onClick"])
10448
+ ]),
10449
+ _: 1
10450
+ }),
10451
+ $options.canCreate ? (openBlock(), createBlock(_component_flex_cell, {
10452
+ key: 0,
10453
+ shrink: ""
10454
+ }, {
10455
+ default: withCtx(() => [
10456
+ createVNode(_component_ux_button, {
10457
+ color: "primary",
10458
+ onClick: $options.create
10459
+ }, {
10460
+ default: withCtx(() => [
10461
+ _hoisted_5$i,
10462
+ createVNode(_component_ux_icon, {
10463
+ right: "",
10464
+ icon: "fa-plus"
10465
+ })
10466
+ ]),
10467
+ _: 1
10468
+ }, 8, ["onClick"])
10469
+ ]),
10470
+ _: 1
10471
+ })) : createCommentVNode("", true),
10472
+ createVNode(_component_flex_spacer)
10388
10473
  ]),
10389
10474
  _: 1
10390
- }, 8, ["onClick"])
10475
+ })) : createCommentVNode("", true)
10391
10476
  ], 64);
10392
10477
  }
10393
- var ContentSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$D], ["__scopeId", "data-v-49f2d443"]]);
10478
+ var ContentSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$D], ["__scopeId", "data-v-60b312d0"]]);
10394
10479
  var typeSelect_vue_vue_type_style_index_0_scoped_true_lang = "";
10395
10480
  function isUndefined$3(entry) {
10396
10481
  return entry === void 0 || typeof entry === "undefined" || entry === null || String(entry) === "null" || String(entry) === "undefined";