@qikdev/vue-ui 0.1.92 → 0.1.93

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.92";
35
+ const version$1 = "0.1.93";
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;
@@ -4949,6 +4949,9 @@ const _sfc_main$$ = {
4949
4949
  selected: {
4950
4950
  type: Boolean
4951
4951
  },
4952
+ index: {
4953
+ type: Number
4954
+ },
4952
4955
  row: {
4953
4956
  type: Object,
4954
4957
  required: true
@@ -4979,7 +4982,8 @@ const _sfc_main$$ = {
4979
4982
  this.$emit("click:actions", row);
4980
4983
  },
4981
4984
  clickSelect(row) {
4982
- this.$emit("click:select", row);
4985
+ const index2 = this.index;
4986
+ this.$emit("click:select", row, index2);
4983
4987
  }
4984
4988
  },
4985
4989
  computed: {
@@ -5144,9 +5148,24 @@ const _sfc_main$_ = {
5144
5148
  },
5145
5149
  data() {
5146
5150
  return {
5147
- sorting: this.sort
5151
+ sorting: this.sort,
5152
+ lastSelectedIndex: null,
5153
+ shift: false,
5154
+ keyListenersAdded: false
5148
5155
  };
5149
5156
  },
5157
+ mounted() {
5158
+ this.addKeyListeners();
5159
+ },
5160
+ activated() {
5161
+ this.addKeyListeners();
5162
+ },
5163
+ beforeUnmount() {
5164
+ this.removeKeyListeners();
5165
+ },
5166
+ deactivated() {
5167
+ this.removeKeyListeners();
5168
+ },
5150
5169
  computed: {
5151
5170
  currentSortDirection() {
5152
5171
  var _a;
@@ -5187,6 +5206,32 @@ const _sfc_main$_ = {
5187
5206
  }
5188
5207
  },
5189
5208
  methods: {
5209
+ keyDown(event) {
5210
+ if (event.keyCode == 16) {
5211
+ this.shift = true;
5212
+ }
5213
+ },
5214
+ keyUp(event) {
5215
+ if (event.keyCode == 16) {
5216
+ this.shift = false;
5217
+ }
5218
+ },
5219
+ addKeyListeners() {
5220
+ if (this.keyListenersAdded) {
5221
+ return;
5222
+ }
5223
+ window.addEventListener("keydown", this.keyDown, true);
5224
+ window.addEventListener("keyup", this.keyUp, true);
5225
+ this.keyListenersAdded = true;
5226
+ },
5227
+ removeKeyListeners() {
5228
+ if (!this.keyListenersAdded) {
5229
+ return;
5230
+ }
5231
+ window.removeEventListener("keydown", this.keyDown, true);
5232
+ window.removeEventListener("keyup", this.keyUp, true);
5233
+ this.keyListenersAdded = false;
5234
+ },
5190
5235
  togglePage() {
5191
5236
  var self2 = this;
5192
5237
  if (self2.pageSelected) {
@@ -5218,6 +5263,13 @@ const _sfc_main$_ = {
5218
5263
  }
5219
5264
  return array;
5220
5265
  },
5266
+ selectRange(start, end) {
5267
+ const self2 = this;
5268
+ const startIndex = Math.min(start, end);
5269
+ const endIndex = Math.max(start, end) + 1;
5270
+ var targetRows = self2.renderRows.slice(startIndex, endIndex);
5271
+ self2.$emit("select:multiple", targetRows);
5272
+ },
5221
5273
  toggleSort(column) {
5222
5274
  var _a, _b;
5223
5275
  const currentKey = (_a = this.sorting) == null ? void 0 : _a.key;
@@ -5241,7 +5293,15 @@ const _sfc_main$_ = {
5241
5293
  clickActions(row) {
5242
5294
  this.$emit("click:actions", row);
5243
5295
  },
5244
- clickSelect(row) {
5296
+ clickSelect(row, index2) {
5297
+ const currentSelectedIndex = this.lastSelectedIndex;
5298
+ if (this.shift) {
5299
+ if (currentSelectedIndex != index2) {
5300
+ console.log("FROM", currentSelectedIndex, "-", index2);
5301
+ return this.selectRange(currentSelectedIndex, index2);
5302
+ }
5303
+ }
5304
+ this.lastSelectedIndex = index2;
5245
5305
  this.$emit("select:row:toggle", row);
5246
5306
  }
5247
5307
  }
@@ -5367,7 +5427,7 @@ function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
5367
5427
  ])
5368
5428
  ]),
5369
5429
  createElementVNode("tbody", null, [
5370
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.renderRows, (row) => {
5430
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.renderRows, (row, index2) => {
5371
5431
  return openBlock(), createBlock(_component_table_row, {
5372
5432
  enableSelection: $props.enableSelection,
5373
5433
  enableActions: $props.enableActions,
@@ -5378,15 +5438,16 @@ function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
5378
5438
  "onClick:actions": $options.clickActions,
5379
5439
  selected: $options.isSelected(row),
5380
5440
  row,
5441
+ index: index2,
5381
5442
  columns: $props.columns
5382
- }, null, 8, ["enableSelection", "enableActions", "onClick:cell", "onClick:row", "onClick:select", "onClick:actions", "selected", "row", "columns"]);
5443
+ }, null, 8, ["enableSelection", "enableActions", "onClick:cell", "onClick:row", "onClick:select", "onClick:actions", "selected", "row", "index", "columns"]);
5383
5444
  }), 128))
5384
5445
  ])
5385
5446
  ])
5386
5447
  ], 512)
5387
5448
  ]);
5388
5449
  }
5389
- var NativeTable = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$_], ["__scopeId", "data-v-23402222"]]);
5450
+ var NativeTable = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$_], ["__scopeId", "data-v-2b235040"]]);
5390
5451
  var spinner_vue_vue_type_style_index_0_scoped_true_lang = "";
5391
5452
  const _sfc_main$Z = {
5392
5453
  props: {
@@ -16154,7 +16215,8 @@ function computedExpression(key) {
16154
16215
  return;
16155
16216
  }
16156
16217
  let context = self2.expressionsContext;
16157
- return service.evaluateExpression(expression, context);
16218
+ let result = service.evaluateExpression(expression, context);
16219
+ return result;
16158
16220
  };
16159
16221
  }
16160
16222
  const _sfc_main$h = {
@@ -16220,7 +16282,7 @@ const _sfc_main$h = {
16220
16282
  isDirtyBeforeInput: false
16221
16283
  };
16222
16284
  },
16223
- inject: ["parentFormElement"],
16285
+ inject: ["parentFormElement", "additionalContext"],
16224
16286
  provide() {
16225
16287
  return {
16226
16288
  fieldPath: this.fieldPath
@@ -16470,11 +16532,13 @@ const _sfc_main$h = {
16470
16532
  return this.field.expressions;
16471
16533
  },
16472
16534
  expressionsContext() {
16473
- return {
16535
+ const context = {
16474
16536
  this: this.model,
16475
16537
  model: this.model,
16476
- data: this.parentModel
16538
+ data: this.parentModel,
16539
+ additional: __spreadValues({}, this.additionalContext.value)
16477
16540
  };
16541
+ return context;
16478
16542
  },
16479
16543
  hidden() {
16480
16544
  if (this.actualField.readOnly) {
@@ -16847,7 +16911,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
16847
16911
  $options.error && $data.validateResults.message ? (openBlock(), createElementBlock("div", _hoisted_1$c, toDisplayString($data.validateResults.message), 1)) : createCommentVNode("", true)
16848
16912
  ], 34)) : createCommentVNode("", true);
16849
16913
  }
16850
- var UXFormField = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-1d0f7c92"]]);
16914
+ var UXFormField = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-64d30f70"]]);
16851
16915
  var form_vue_vue_type_style_index_0_scoped_true_lang = "";
16852
16916
  const _sfc_main$g = {
16853
16917
  props: {