@qikdev/vue-ui 0.1.81 → 0.1.84

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, vModelText, vModelSelect, withKeys, TransitionGroup, defineComponent, h, nextTick, vModelDynamic, vModelCheckbox, reactive, watch } from "vue";
34
34
  import { EventDispatcher } from "@qikdev/sdk";
35
- const version$1 = "0.1.81";
35
+ const version$1 = "0.1.84";
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;
@@ -762,6 +762,7 @@ function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
762
762
  const _component_ux_button = resolveComponent("ux-button");
763
763
  return openBlock(), createElementBlock("td", _hoisted_1$P, [
764
764
  createVNode(_component_ux_button, {
765
+ color: $options.button.color,
765
766
  size: $options.button.size,
766
767
  loading: $data.processing,
767
768
  onClick: withModifiers($options.clicked, ["stop", "prevent"])
@@ -777,10 +778,10 @@ function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
777
778
  }, null, 8, ["icon"])) : createCommentVNode("", true)
778
779
  ]),
779
780
  _: 1
780
- }, 8, ["size", "loading", "onClick"])
781
+ }, 8, ["color", "size", "loading", "onClick"])
781
782
  ]);
782
783
  }
783
- var ButtonCell = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$12], ["__scopeId", "data-v-3cbecb7e"]]);
784
+ var ButtonCell = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$12], ["__scopeId", "data-v-1c498011"]]);
784
785
  class LuxonError extends Error {
785
786
  }
786
787
  class InvalidDateTimeError extends LuxonError {
@@ -5076,6 +5077,12 @@ const _sfc_main$W = {
5076
5077
  top: 0,
5077
5078
  left: 0
5078
5079
  });
5080
+ },
5081
+ sort(s2) {
5082
+ this.sorting = s2;
5083
+ },
5084
+ sorting(s2) {
5085
+ this.$emit("update:sort", s2);
5079
5086
  }
5080
5087
  },
5081
5088
  props: {
@@ -5112,6 +5119,16 @@ const _sfc_main$W = {
5112
5119
  return true;
5113
5120
  }
5114
5121
  },
5122
+ sort: {
5123
+ type: Object,
5124
+ default() {
5125
+ return {
5126
+ key: "title",
5127
+ type: "string",
5128
+ direction: "asc"
5129
+ };
5130
+ }
5131
+ },
5115
5132
  selection: {
5116
5133
  type: Array,
5117
5134
  default() {
@@ -5125,7 +5142,16 @@ const _sfc_main$W = {
5125
5142
  type: Function
5126
5143
  }
5127
5144
  },
5145
+ data() {
5146
+ return {
5147
+ sorting: this.sort
5148
+ };
5149
+ },
5128
5150
  computed: {
5151
+ currentSortDirection() {
5152
+ var _a;
5153
+ return ((_a = this.sorting) == null ? void 0 : _a.direction) || "asc";
5154
+ },
5129
5155
  selectionHash() {
5130
5156
  var self2 = this;
5131
5157
  return self2.selection.reduce(function(set, row) {
@@ -5193,6 +5219,18 @@ const _sfc_main$W = {
5193
5219
  return array;
5194
5220
  },
5195
5221
  toggleSort(column) {
5222
+ var _a, _b;
5223
+ const currentKey = (_a = this.sorting) == null ? void 0 : _a.key;
5224
+ const currentDirection = ((_b = this.sorting) == null ? void 0 : _b.direction) || "asc";
5225
+ let { key, direction } = column;
5226
+ if (key === currentKey) {
5227
+ direction = currentDirection === "dsc" ? "asc" : "dsc";
5228
+ }
5229
+ this.sorting = {
5230
+ key,
5231
+ direction,
5232
+ type: column.type
5233
+ };
5196
5234
  },
5197
5235
  clickRow(row) {
5198
5236
  this.$emit("click:row", row);
@@ -5230,6 +5268,8 @@ function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
5230
5268
  const _component_ux_list_item = resolveComponent("ux-list-item");
5231
5269
  const _component_ux_list = resolveComponent("ux-list");
5232
5270
  const _component_ux_menu = resolveComponent("ux-menu");
5271
+ const _component_flex_cell = resolveComponent("flex-cell");
5272
+ const _component_flex_row = resolveComponent("flex-row");
5233
5273
  const _component_table_row = resolveComponent("table-row");
5234
5274
  return openBlock(), createElementBlock("div", _hoisted_1$K, [
5235
5275
  createElementVNode("div", _hoisted_2$C, [
@@ -5287,10 +5327,38 @@ function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
5287
5327
  })
5288
5328
  ])) : createCommentVNode("", true),
5289
5329
  (openBlock(true), createElementBlock(Fragment, null, renderList($options.renderColumns, (column) => {
5330
+ var _a;
5290
5331
  return openBlock(), createElementBlock("th", {
5291
5332
  onClick: ($event) => $options.toggleSort(column),
5292
- class: normalizeClass(column.class)
5293
- }, toDisplayString(column.title), 11, _hoisted_7$f);
5333
+ class: normalizeClass([{ sortable: column.sortable !== false, active: column.key === ((_a = $data.sorting) == null ? void 0 : _a.key) }, column.class])
5334
+ }, [
5335
+ createVNode(_component_flex_row, {
5336
+ gap: "",
5337
+ vcenter: ""
5338
+ }, {
5339
+ default: withCtx(() => {
5340
+ var _a2;
5341
+ return [
5342
+ createVNode(_component_flex_cell, null, {
5343
+ default: withCtx(() => [
5344
+ createTextVNode(toDisplayString(column.title), 1)
5345
+ ]),
5346
+ _: 2
5347
+ }, 1024),
5348
+ column.key === ((_a2 = $data.sorting) == null ? void 0 : _a2.key) ? (openBlock(), createBlock(_component_flex_cell, {
5349
+ key: 0,
5350
+ shrink: ""
5351
+ }, {
5352
+ default: withCtx(() => [
5353
+ createTextVNode(toDisplayString($options.currentSortDirection === "asc" ? "\u25B4" : "\u25BE"), 1)
5354
+ ]),
5355
+ _: 1
5356
+ })) : createCommentVNode("", true)
5357
+ ];
5358
+ }),
5359
+ _: 2
5360
+ }, 1024)
5361
+ ], 10, _hoisted_7$f);
5294
5362
  }), 256)),
5295
5363
  $props.enableActions ? (openBlock(), createElementBlock("th", _hoisted_8$8, [
5296
5364
  renderSlot(_ctx.$slots, "corner", {}, void 0, true)
@@ -5317,7 +5385,7 @@ function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
5317
5385
  ], 512)
5318
5386
  ]);
5319
5387
  }
5320
- var NativeTable = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$W], ["__scopeId", "data-v-e626ef3a"]]);
5388
+ var NativeTable = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$W], ["__scopeId", "data-v-129ac46c"]]);
5321
5389
  var spinner_vue_vue_type_style_index_0_scoped_true_lang = "";
5322
5390
  const _sfc_main$V = {
5323
5391
  props: {
@@ -6344,6 +6412,9 @@ var safeJsonStringify = safeJsonStringify$1.exports;
6344
6412
  function isUndefined$6(v, type) {
6345
6413
  return v === void 0 || v === null || type == "date" && v.toString && v.toString() === "Invalid Date";
6346
6414
  }
6415
+ function isNotEmpty(value) {
6416
+ return value !== void 0 && value !== null;
6417
+ }
6347
6418
  var InputMixin = {
6348
6419
  props: {
6349
6420
  field: {
@@ -6571,13 +6642,15 @@ var InputMixin = {
6571
6642
  },
6572
6643
  getValue(option2) {
6573
6644
  if (!option2) {
6574
- return;
6645
+ return this.cleanTextInput(option2);
6575
6646
  }
6576
- var value = option2._id || option2.value;
6577
- if (!value && option2.title && !this.returnObject) {
6647
+ var value = this.cleanTextInput(option2._id || option2.value);
6648
+ var hasValue = isNotEmpty(value);
6649
+ if (!hasValue && option2.title && !this.returnObject) {
6578
6650
  value = option2.title;
6579
6651
  }
6580
- return value || option2;
6652
+ value = this.cleanTextInput(value);
6653
+ return isNotEmpty(value) ? value : option2;
6581
6654
  },
6582
6655
  getLabel(option2) {
6583
6656
  if (!option2) {
@@ -6719,7 +6792,9 @@ const _sfc_main$I = {
6719
6792
  }
6720
6793
  } else {
6721
6794
  if (self2.multiValue) {
6722
- val = (val || []).filter(Boolean).map(function(i2) {
6795
+ val = (val || []).filter(function(i2) {
6796
+ return i2 !== void 0 && i2 !== null;
6797
+ }).map(function(i2) {
6723
6798
  return self2.getValue(i2);
6724
6799
  });
6725
6800
  } else {
@@ -6742,13 +6817,27 @@ const _sfc_main$I = {
6742
6817
  val.length = self2.maximum;
6743
6818
  }
6744
6819
  }
6745
- val = val.filter(Boolean).map(function(v) {
6820
+ val = val.filter(function(v) {
6821
+ return v !== void 0 && v !== null;
6822
+ }).map(function(v) {
6746
6823
  var valueKey2 = self2.getValue(v);
6747
6824
  return self2.returnObject ? self2.optionLookup[valueKey2] : valueKey2;
6748
6825
  });
6749
6826
  } else {
6750
6827
  var valueKey = self2.getValue(val);
6751
6828
  val = self2.returnObject ? self2.optionLookup[valueKey] : valueKey;
6829
+ switch (val) {
6830
+ case "":
6831
+ switch (self2.type) {
6832
+ case "decimal":
6833
+ case "float":
6834
+ case "number":
6835
+ case "integer":
6836
+ val = void 0;
6837
+ break;
6838
+ }
6839
+ break;
6840
+ }
6752
6841
  }
6753
6842
  return val;
6754
6843
  }
@@ -6840,7 +6929,7 @@ function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
6840
6929
  ])
6841
6930
  ], 2);
6842
6931
  }
6843
- var NativeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$I], ["__scopeId", "data-v-be09a2cc"]]);
6932
+ var NativeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$I], ["__scopeId", "data-v-a06c20f2"]]);
6844
6933
  var phoneNumberInput_vue_vue_type_style_index_0_scoped_true_lang = "";
6845
6934
  const _sfc_main$H = {
6846
6935
  props: {
@@ -18463,6 +18552,9 @@ const _sfc_main$5 = {
18463
18552
  }
18464
18553
  },
18465
18554
  computed: {
18555
+ viewModeCacheKey() {
18556
+ return `${this.cacheKey}-${this.loadKey}`;
18557
+ },
18466
18558
  dateRangeField() {
18467
18559
  return {
18468
18560
  type: "object",
@@ -18500,7 +18592,7 @@ const _sfc_main$5 = {
18500
18592
  }
18501
18593
  return view;
18502
18594
  },
18503
- sort() {
18595
+ defaultSort() {
18504
18596
  var _a;
18505
18597
  var defaultSort = ((_a = this.definition) == null ? void 0 : _a.defaultSort) || {
18506
18598
  key: "title",
@@ -18681,7 +18773,7 @@ const _sfc_main$5 = {
18681
18773
  },
18682
18774
  loadCriteria() {
18683
18775
  var self2 = this;
18684
- var sort2 = self2.sort;
18776
+ var sort2 = self2.sort || self2.defaultSort;
18685
18777
  var search = self2.keywords;
18686
18778
  var select = self2.selectFields;
18687
18779
  var page = self2.page;
@@ -18811,6 +18903,7 @@ const _sfc_main$5 = {
18811
18903
  promise.then(function(res) {
18812
18904
  cancelInflight = null;
18813
18905
  self2.loading = false;
18906
+ self2.loadKey++;
18814
18907
  });
18815
18908
  promise.catch(function(err) {
18816
18909
  cancelInflight = null;
@@ -18833,6 +18926,7 @@ const _sfc_main$5 = {
18833
18926
  manager,
18834
18927
  loading: true,
18835
18928
  additionalFields: [],
18929
+ loadKey: 1,
18836
18930
  page: {
18837
18931
  size: 50,
18838
18932
  index: 1
@@ -18841,6 +18935,7 @@ const _sfc_main$5 = {
18841
18935
  operator: "and",
18842
18936
  filters: []
18843
18937
  },
18938
+ sort: this.defaultSort,
18844
18939
  keywords: this.search,
18845
18940
  dateRangeFilter: {
18846
18941
  dateRange: this.dateRange
@@ -18849,7 +18944,7 @@ const _sfc_main$5 = {
18849
18944
  };
18850
18945
  }
18851
18946
  };
18852
- const _withScopeId = (n2) => (pushScopeId("data-v-2132dfaf"), n2 = n2(), popScopeId(), n2);
18947
+ const _withScopeId = (n2) => (pushScopeId("data-v-651a3eab"), n2 = n2(), popScopeId(), n2);
18853
18948
  const _hoisted_1$5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("p", null, null, -1));
18854
18949
  const _hoisted_2$4 = { key: 0 };
18855
18950
  const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("p", null, null, -1));
@@ -18888,13 +18983,16 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
18888
18983
  default: withCtx(() => [
18889
18984
  $options.viewMode && $options.viewMode.component ? (openBlock(), createBlock(resolveDynamicComponent($options.viewMode.component), {
18890
18985
  key: 0,
18986
+ cacheKey: $options.viewModeCacheKey,
18891
18987
  selection: $data.manager.items,
18892
18988
  items: $options.items,
18893
18989
  "onClick:actions": $options.actionsClicked,
18894
18990
  "onSelect:item:toggle": $options.rowToggled,
18895
18991
  "onClick:item": $options.rowClicked
18896
- }, null, 8, ["selection", "items", "onClick:actions", "onSelect:item:toggle", "onClick:item"])) : (openBlock(), createBlock(_component_native_table, {
18992
+ }, null, 8, ["cacheKey", "selection", "items", "onClick:actions", "onSelect:item:toggle", "onClick:item"])) : (openBlock(), createBlock(_component_native_table, {
18897
18993
  key: 1,
18994
+ sort: $data.sort,
18995
+ "onUpdate:sort": _cache[0] || (_cache[0] = ($event) => $data.sort = $event),
18898
18996
  enableActions: $props.enableActions,
18899
18997
  total: $options.totalItems,
18900
18998
  selectAll: $options.selectAll,
@@ -18944,7 +19042,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
18944
19042
  })
18945
19043
  ]),
18946
19044
  _: 1
18947
- }, 8, ["enableActions", "total", "selectAll", "deselectAll", "selection", "onClick:row", "onClick:actions", "onSelect:row:toggle", "onSelect:multiple", "onDeselect:multiple", "rows", "columns"]))
19045
+ }, 8, ["sort", "enableActions", "total", "selectAll", "deselectAll", "selection", "onClick:row", "onClick:actions", "onSelect:row:toggle", "onSelect:multiple", "onDeselect:multiple", "rows", "columns"]))
18948
19046
  ]),
18949
19047
  _: 1
18950
19048
  })) : !$data.loading ? (openBlock(), createBlock(_component_flex_column, {
@@ -18980,7 +19078,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
18980
19078
  default: withCtx(() => [
18981
19079
  createVNode(_component_search, {
18982
19080
  modelValue: $data.keywords,
18983
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.keywords = $event),
19081
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.keywords = $event),
18984
19082
  loading: $options.searching,
18985
19083
  debounce: 500,
18986
19084
  placeholder: "Keyword Search"
@@ -18990,14 +19088,14 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
18990
19088
  createVNode(_component_ux_field, {
18991
19089
  field: $options.dateRangeField,
18992
19090
  modelValue: $data.dateRangeFilter,
18993
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.dateRangeFilter = $event)
19091
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.dateRangeFilter = $event)
18994
19092
  }, null, 8, ["field", "modelValue"])
18995
19093
  ])) : createCommentVNode("", true),
18996
19094
  _hoisted_3$4,
18997
19095
  createVNode(_component_filter_builder, {
18998
19096
  definition: $data.definition,
18999
19097
  modelValue: $data.filter,
19000
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.filter = $event)
19098
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.filter = $event)
19001
19099
  }, null, 8, ["definition", "modelValue"])
19002
19100
  ]),
19003
19101
  _: 1
@@ -19017,7 +19115,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
19017
19115
  createElementVNode("div", _hoisted_4$4, [
19018
19116
  createVNode(_component_pager, {
19019
19117
  page: $data.page,
19020
- "onUpdate:page": _cache[3] || (_cache[3] = ($event) => $data.page = $event),
19118
+ "onUpdate:page": _cache[4] || (_cache[4] = ($event) => $data.page = $event),
19021
19119
  total: $options.totalItems
19022
19120
  }, null, 8, ["page", "total"])
19023
19121
  ]),
@@ -19034,7 +19132,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
19034
19132
  _: 3
19035
19133
  })) : createCommentVNode("", true);
19036
19134
  }
19037
- var ContentBrowser = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-2132dfaf"]]);
19135
+ var ContentBrowser = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["__scopeId", "data-v-651a3eab"]]);
19038
19136
  var ModalMixin = {
19039
19137
  props: {
19040
19138
  options: {