cleek 2.0.1 → 2.0.5

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/cleek.es.js CHANGED
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, computed, watch, h, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, createCommentVNode, renderSlot, mergeProps, withKeys, withModifiers, createElementVNode, pushScopeId, popScopeId, ref, onMounted, getCurrentInstance, unref, normalizeStyle, withCtx, createTextVNode, toDisplayString, withDirectives, isRef, vModelDynamic, createVNode, Fragment, renderList, vModelRadio, vModelSelect, vModelCheckbox, vModelText } from "vue";
20
+ import { defineComponent, computed, watch, h, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, createCommentVNode, renderSlot, mergeProps, withKeys, withModifiers, createElementVNode, pushScopeId, popScopeId, ref, getCurrentInstance, onMounted, unref, normalizeStyle, withCtx, createTextVNode, toDisplayString, withDirectives, isRef, vModelDynamic, createVNode, Fragment, renderList, vModelRadio, vModelSelect, vModelCheckbox, vModelText } from "vue";
21
21
  var validators = {
22
22
  size: (type) => {
23
23
  return ["", "xs", "s", "m", "l", "xl"].includes(type);
@@ -74,13 +74,18 @@ var functions$1 = {
74
74
  return true;
75
75
  return false;
76
76
  },
77
- isTableColumnsVisible(col) {
78
- return !col.isHidden;
77
+ isColumnDisplayed(column) {
78
+ if (column.isDisplayed === false)
79
+ return false;
80
+ return true;
81
+ },
82
+ getCleekOptions(getCurrentInstance2) {
83
+ return getCurrentInstance2().appContext.app.config.globalProperties.$cleekOptions;
79
84
  }
80
85
  };
81
86
  var globalVariables = {
82
87
  defaultFailImg: "df",
83
- imagesFolderPath: "asd",
88
+ imagesFolderPath: "",
84
89
  defaultImgBorderColor: "#EEEEEE"
85
90
  };
86
91
  /*!
@@ -11202,7 +11207,7 @@ defineComponent({
11202
11207
  };
11203
11208
  }
11204
11209
  });
11205
- function render$d(_ctx, _cache, $props, $setup, $data, $options) {
11210
+ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
11206
11211
  const _component_font_awesome_icon = resolveComponent("font-awesome-icon");
11207
11212
  return openBlock(), createElementBlock("div", {
11208
11213
  class: normalizeClass(["ck-icon", $options.computedClass]),
@@ -11231,7 +11236,7 @@ var _export_sfc = (sfc, props) => {
11231
11236
  }
11232
11237
  return target;
11233
11238
  };
11234
- const _sfc_main$j = {
11239
+ const _sfc_main$k = {
11235
11240
  name: "CkIcon",
11236
11241
  components: {
11237
11242
  FontAwesomeIcon
@@ -11278,9 +11283,9 @@ const _sfc_main$j = {
11278
11283
  }
11279
11284
  }
11280
11285
  };
11281
- var ckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", render$d], ["__scopeId", "data-v-77d9963a"]]);
11282
- const _hoisted_1$g = ["title", "aria-label", "disabled"];
11283
- function render$c(_ctx, _cache, $props, $setup, $data, $options) {
11286
+ var ckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", render$b], ["__scopeId", "data-v-77d9963a"]]);
11287
+ const _hoisted_1$h = ["title", "aria-label", "disabled"];
11288
+ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
11284
11289
  const _component_ck_icon = resolveComponent("ck-icon");
11285
11290
  return openBlock(), createElementBlock("button", {
11286
11291
  type: "button",
@@ -11303,13 +11308,13 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) {
11303
11308
  icon: $props.iconRight,
11304
11309
  "icon-pack": $props.iconPack
11305
11310
  }, null, 8, ["icon", "icon-pack"])) : createCommentVNode("", true)
11306
- ], 10, _hoisted_1$g);
11311
+ ], 10, _hoisted_1$h);
11307
11312
  }
11308
11313
  var ckButton_vue_vue_type_style_index_0_scoped_true_lang = "";
11309
11314
  const defaultType = "outlined";
11310
11315
  const defaultColor = "primary";
11311
11316
  const defaultAlign = "left";
11312
- const _sfc_main$i = {
11317
+ const _sfc_main$j = {
11313
11318
  name: "CkButton",
11314
11319
  components: {
11315
11320
  ckIcon
@@ -11363,15 +11368,15 @@ const _sfc_main$i = {
11363
11368
  }
11364
11369
  }
11365
11370
  };
11366
- var ckButton = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", render$c], ["__scopeId", "data-v-a687842a"]]);
11371
+ var ckButton = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", render$a], ["__scopeId", "data-v-a687842a"]]);
11367
11372
  const _withScopeId$2 = (n) => (pushScopeId("data-v-69dfa524"), n = n(), popScopeId(), n);
11368
- const _hoisted_1$f = ["disabled", "checked"];
11369
- const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", { class: "ck-checkbox__element" }, null, -1));
11373
+ const _hoisted_1$g = ["disabled", "checked"];
11374
+ const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", { class: "ck-checkbox__element" }, null, -1));
11370
11375
  const _hoisted_3$5 = {
11371
11376
  key: 0,
11372
11377
  class: "c-Checkbox__label"
11373
11378
  };
11374
- function render$b(_ctx, _cache, $props, $setup, $data, $options) {
11379
+ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
11375
11380
  return openBlock(), createElementBlock("label", mergeProps({ class: "ck-checkbox" }, $options.checkboxAttributes, {
11376
11381
  onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(() => {
11377
11382
  }, ["prevent"]), ["space"])),
@@ -11390,15 +11395,15 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
11390
11395
  $options.value = $event.target.checked;
11391
11396
  $options.onChange($event);
11392
11397
  })
11393
- }, null, 40, _hoisted_1$f),
11394
- _hoisted_2$7,
11398
+ }, null, 40, _hoisted_1$g),
11399
+ _hoisted_2$8,
11395
11400
  _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$5, [
11396
11401
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
11397
11402
  ])) : createCommentVNode("", true)
11398
11403
  ], 16);
11399
11404
  }
11400
11405
  var ckCheckbox_vue_vue_type_style_index_0_scoped_true_lang = "";
11401
- const _sfc_main$h = {
11406
+ const _sfc_main$i = {
11402
11407
  name: "CkCheckbox",
11403
11408
  props: {
11404
11409
  modelValue: { type: Boolean, default: false },
@@ -11431,14 +11436,15 @@ const _sfc_main$h = {
11431
11436
  }
11432
11437
  }
11433
11438
  };
11434
- var ckCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", render$b], ["__scopeId", "data-v-69dfa524"]]);
11439
+ var ckCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", render$9], ["__scopeId", "data-v-69dfa524"]]);
11435
11440
  var ckImg_vue_vue_type_style_index_0_scoped_true_lang = "";
11436
- const _hoisted_1$e = ["src"];
11437
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
11441
+ const _hoisted_1$f = ["src", "alt"];
11442
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
11438
11443
  props: {
11439
11444
  src: { type: String, default: "" },
11440
11445
  isFullPath: { type: Boolean, default: false },
11441
11446
  failImgSrc: { type: String, default: "" },
11447
+ alt: { type: String, default: "" },
11442
11448
  size: { type: String, default: "", validator: validators.size },
11443
11449
  sizeAbsolute: { type: String, default: "" },
11444
11450
  width: { type: String, default: "" },
@@ -11452,19 +11458,22 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11452
11458
  setup(__props) {
11453
11459
  const props = __props;
11454
11460
  const altNeeded = ref(false);
11455
- let context;
11461
+ let isMounted = ref(false);
11456
11462
  const imageUrl = computed(() => {
11463
+ if (!isMounted.value)
11464
+ return "";
11457
11465
  if (props.isFullPath)
11458
11466
  return props.src;
11459
11467
  return getImg(props.src);
11460
11468
  });
11461
11469
  const computedClass = computed(() => {
11462
11470
  const classList2 = [];
11463
- if (!props.size && !props.sizeAbsolute && !props.width && !props.height) {
11464
- props.size = "m";
11471
+ let size = props.size;
11472
+ if (!size && !props.sizeAbsolute && !props.width && !props.height) {
11473
+ size = "m";
11465
11474
  }
11466
- if (props.size)
11467
- classList2.push(`ck-img__size--${props.size}`);
11475
+ if (size)
11476
+ classList2.push(`ck-img__size--${size}`);
11468
11477
  if (props.hasBorder) {
11469
11478
  classList2.push("ck-img__has-border");
11470
11479
  if (functions$1.isColorTemplateVariable(realBorderColor.value)) {
@@ -11511,13 +11520,16 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11511
11520
  }
11512
11521
  function getImg(src) {
11513
11522
  let path = "";
11514
- console.log("context.$cleekOptions", context.$cleekOptions);
11515
- if (context.$cleekOptions.imgPath)
11516
- path = context.$cleekOptions.imgPath;
11523
+ const $cleekOptions = functions$1.getCleekOptions(getCurrentInstance);
11524
+ if ($cleekOptions) {
11525
+ if ($cleekOptions.imgPath)
11526
+ path = $cleekOptions.imgPath;
11527
+ }
11517
11528
  return `${path}${src}`;
11518
11529
  }
11519
11530
  onMounted(() => {
11520
- context = getCurrentInstance().ctx;
11531
+ getCurrentInstance().ctx;
11532
+ isMounted.value = true;
11521
11533
  });
11522
11534
  return (_ctx, _cache) => {
11523
11535
  return openBlock(), createElementBlock("div", {
@@ -11528,24 +11540,25 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
11528
11540
  createElementVNode("img", {
11529
11541
  src: unref(imageUrl),
11530
11542
  style: normalizeStyle(unref(computedImgStyle)),
11543
+ alt: __props.alt,
11531
11544
  onError: _cache[0] || (_cache[0] = ($event) => altNeeded.value = true)
11532
- }, null, 44, _hoisted_1$e)
11545
+ }, null, 44, _hoisted_1$f)
11533
11546
  ], 6);
11534
11547
  };
11535
11548
  }
11536
11549
  });
11537
- var ckImg = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-66708ebe"]]);
11538
- const _hoisted_1$d = ["for"];
11539
- function render$a(_ctx, _cache, $props, $setup, $data, $options) {
11550
+ var ckImg = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-53d78f2e"]]);
11551
+ const _hoisted_1$e = ["for"];
11552
+ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
11540
11553
  return openBlock(), createElementBlock("label", {
11541
11554
  class: normalizeClass(["ck-label", $options.computedClass]),
11542
11555
  for: $props.for
11543
11556
  }, [
11544
11557
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
11545
- ], 10, _hoisted_1$d);
11558
+ ], 10, _hoisted_1$e);
11546
11559
  }
11547
11560
  var ckLabel_vue_vue_type_style_index_0_scoped_true_lang = "";
11548
- const _sfc_main$f = {
11561
+ const _sfc_main$g = {
11549
11562
  name: "CkLabel",
11550
11563
  props: {
11551
11564
  for: { type: String, default: "" },
@@ -11562,11 +11575,11 @@ const _sfc_main$f = {
11562
11575
  }
11563
11576
  }
11564
11577
  };
11565
- var ckLabel = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", render$a], ["__scopeId", "data-v-4b8b9ab4"]]);
11578
+ var ckLabel = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", render$8], ["__scopeId", "data-v-4b8b9ab4"]]);
11566
11579
  var ckInput_vue_vue_type_style_index_0_scoped_true_lang = "";
11567
- const _hoisted_1$c = { class: "ck-input" };
11568
- const _hoisted_2$6 = ["type", "placeholder", "id", "disabled"];
11569
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
11580
+ const _hoisted_1$d = { class: "ck-input" };
11581
+ const _hoisted_2$7 = ["type", "placeholder", "id", "disabled"];
11582
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
11570
11583
  props: {
11571
11584
  modelValue: {},
11572
11585
  type: { type: String, validator: validators.inputType, default: "text" },
@@ -11627,7 +11640,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
11627
11640
  return list;
11628
11641
  });
11629
11642
  return (_ctx, _cache) => {
11630
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
11643
+ return openBlock(), createElementBlock("div", _hoisted_1$d, [
11631
11644
  __props.label ? (openBlock(), createBlock(ckLabel, {
11632
11645
  key: 0,
11633
11646
  align: __props.labelAlign,
@@ -11656,7 +11669,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
11656
11669
  onChange: _cache[1] || (_cache[1] = ($event) => onChange($event)),
11657
11670
  onInput: _cache[2] || (_cache[2] = ($event) => onInput($event)),
11658
11671
  onClick: _cache[3] || (_cache[3] = ($event) => onClick($event))
11659
- }, null, 46, _hoisted_2$6), [
11672
+ }, null, 46, _hoisted_2$7), [
11660
11673
  [vModelDynamic, unref(value)]
11661
11674
  ]),
11662
11675
  __props.iconRight ? (openBlock(), createBlock(ckIcon, {
@@ -11670,13 +11683,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
11670
11683
  };
11671
11684
  }
11672
11685
  });
11673
- var ckInput = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-61fababc"]]);
11686
+ var ckInput = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-61fababc"]]);
11674
11687
  var ckPopup_vue_vue_type_style_index_0_lang = "";
11675
- const _hoisted_1$b = {
11688
+ const _hoisted_1$c = {
11676
11689
  key: 0,
11677
11690
  class: "ck-popup"
11678
11691
  };
11679
- const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "blackout" }, null, -1);
11692
+ const _hoisted_2$6 = /* @__PURE__ */ createElementVNode("div", { class: "blackout" }, null, -1);
11680
11693
  const _hoisted_3$4 = { class: "ck-popup__slot-header" };
11681
11694
  const _hoisted_4$2 = {
11682
11695
  key: 0,
@@ -11729,11 +11742,11 @@ const __default__$1 = {
11729
11742
  }
11730
11743
  }
11731
11744
  };
11732
- const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
11745
+ const _sfc_main$e = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
11733
11746
  setup(__props) {
11734
11747
  return (_ctx, _cache) => {
11735
- return _ctx.value ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
11736
- _hoisted_2$5,
11748
+ return _ctx.value ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
11749
+ _hoisted_2$6,
11737
11750
  createElementVNode("div", {
11738
11751
  class: "popup-container",
11739
11752
  onClick: _cache[4] || (_cache[4] = ($event) => _ctx.onBgClick())
@@ -11786,14 +11799,14 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
11786
11799
  }
11787
11800
  }));
11788
11801
  const _withScopeId$1 = (n) => (pushScopeId("data-v-73a891e8"), n = n(), popScopeId(), n);
11789
- const _hoisted_1$a = ["onKeyup"];
11790
- const _hoisted_2$4 = ["name", "value", "disabled"];
11802
+ const _hoisted_1$b = ["onKeyup"];
11803
+ const _hoisted_2$5 = ["name", "value", "disabled"];
11791
11804
  const _hoisted_3$3 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("div", { class: "c-Radio__element" }, null, -1));
11792
11805
  const _hoisted_4$1 = {
11793
11806
  key: 0,
11794
11807
  class: "c-Radio__label"
11795
11808
  };
11796
- function render$9(_ctx, _cache, $props, $setup, $data, $options) {
11809
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
11797
11810
  return openBlock(true), createElementBlock(Fragment, null, renderList($props.options, (item, index) => {
11798
11811
  return openBlock(), createElementBlock("label", mergeProps({
11799
11812
  key: `radio-${index}`,
@@ -11814,16 +11827,16 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
11814
11827
  name: $props.name,
11815
11828
  value: item.value,
11816
11829
  disabled: $props.disabled
11817
- }, null, 8, _hoisted_2$4), [
11830
+ }, null, 8, _hoisted_2$5), [
11818
11831
  [vModelRadio, $options.value]
11819
11832
  ]),
11820
11833
  _hoisted_3$3,
11821
11834
  item.label ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(item.label), 1)) : createCommentVNode("", true)
11822
- ], 16, _hoisted_1$a);
11835
+ ], 16, _hoisted_1$b);
11823
11836
  }), 128);
11824
11837
  }
11825
11838
  var ckRadio_vue_vue_type_style_index_0_scoped_true_lang = "";
11826
- const _sfc_main$c = {
11839
+ const _sfc_main$d = {
11827
11840
  name: "CkRadio",
11828
11841
  props: {
11829
11842
  modelValue: { type: String, default: void 0 },
@@ -11855,7 +11868,100 @@ const _sfc_main$c = {
11855
11868
  }
11856
11869
  }
11857
11870
  };
11858
- var ckRadio = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", render$9], ["__scopeId", "data-v-73a891e8"]]);
11871
+ var ckRadio = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", render$7], ["__scopeId", "data-v-73a891e8"]]);
11872
+ var qmApi = {};
11873
+ var qmArray = {
11874
+ arrayToText(arr, key = null) {
11875
+ let msg = "";
11876
+ for (let index = 0; index < arr.length; index++) {
11877
+ if (index) {
11878
+ if (index === arr.length - 1) {
11879
+ msg += " y ";
11880
+ } else {
11881
+ msg += ", ";
11882
+ }
11883
+ }
11884
+ let word;
11885
+ if (key) {
11886
+ word = arr[index][key];
11887
+ } else {
11888
+ word = arr[index];
11889
+ }
11890
+ msg += `"${word}"`;
11891
+ }
11892
+ return msg;
11893
+ },
11894
+ getRandomElementOfArray(arr) {
11895
+ return arr[Math.floor(Math.random() * arr.length)];
11896
+ },
11897
+ hexToRGBA(hex, alpha) {
11898
+ const r = parseInt(hex.slice(1, 3), 16);
11899
+ const g = parseInt(hex.slice(3, 5), 16);
11900
+ const b = parseInt(hex.slice(5, 7), 16);
11901
+ if (alpha)
11902
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
11903
+ return `rgb(${r}, ${g}, ${b})`;
11904
+ },
11905
+ removeOfArray(list, findFunction) {
11906
+ if (!list || !findFunction)
11907
+ return;
11908
+ const index = list.findIndex(findFunction);
11909
+ if (index === -1)
11910
+ return;
11911
+ list.splice(index, 1);
11912
+ },
11913
+ removeOfArrayById(list, id) {
11914
+ const index = list.findIndex((i) => i.id === id);
11915
+ if (index === -1)
11916
+ return;
11917
+ list.splice(index, 1);
11918
+ },
11919
+ replaceInList(arr, NewItem, prop = "id") {
11920
+ if (!NewItem)
11921
+ return;
11922
+ const index = arr.findIndex((i) => i[prop] === NewItem[prop]);
11923
+ if (index !== -1)
11924
+ arr.splice(index, 1, NewItem);
11925
+ },
11926
+ sort(arr, keys) {
11927
+ if (typeof keys === "string")
11928
+ keys = [keys];
11929
+ if (keys.length === 2) {
11930
+ if (keys[1] === "DESC" || keys[1] === "ASC") {
11931
+ keys = [keys];
11932
+ }
11933
+ }
11934
+ const finalKeys = [];
11935
+ keys.forEach((key) => {
11936
+ if (typeof key === "string")
11937
+ key = [key];
11938
+ if (typeof key[1] === "undefined")
11939
+ key[1] = "ASC";
11940
+ finalKeys.push(key);
11941
+ });
11942
+ return arr.sort((a, b) => {
11943
+ let value = 0;
11944
+ finalKeys.forEach(([key, order2]) => {
11945
+ if (!value) {
11946
+ const mult = order2 === "DESC" ? -1 : 1;
11947
+ if (a[key] < b[key])
11948
+ value = -1 * mult;
11949
+ if (a[key] > b[key])
11950
+ value = 1 * mult;
11951
+ }
11952
+ });
11953
+ return value;
11954
+ });
11955
+ }
11956
+ };
11957
+ var qmAudio = {
11958
+ reproduceAudio(path) {
11959
+ if (path) {
11960
+ const audio = new Audio(path);
11961
+ audio.play();
11962
+ }
11963
+ }
11964
+ };
11859
11965
  const qmStr = {
11860
11966
  capitalize(str) {
11861
11967
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -11873,6 +11979,15 @@ const qmStr = {
11873
11979
  str = str.toLowerCase();
11874
11980
  return str;
11875
11981
  },
11982
+ getRandomStr(length = 10) {
11983
+ let result = "";
11984
+ const characters = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz123456789";
11985
+ const charactersLength = characters.length;
11986
+ for (let i = 0; i < length; i++) {
11987
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
11988
+ }
11989
+ return result;
11990
+ },
11876
11991
  padZeros(num, size = 2) {
11877
11992
  return `000000000${num}`.substr(-size);
11878
11993
  },
@@ -11892,9 +12007,146 @@ const qmStr = {
11892
12007
  return joinArray;
11893
12008
  }
11894
12009
  };
12010
+ var qmNum = {
12011
+ getRandomInt(min2, max2) {
12012
+ min2 = Math.ceil(min2);
12013
+ max2 = Math.floor(max2);
12014
+ return Math.floor(Math.random() * (max2 - min2 + 1)) + min2;
12015
+ },
12016
+ setPrice(num, { precision = 2 } = {}) {
12017
+ if (!num)
12018
+ return 0;
12019
+ return +parseFloat(num).toFixed(precision);
12020
+ },
12021
+ presentNum(num, forceDecimal = false) {
12022
+ num = +num;
12023
+ let finalInt = "0";
12024
+ let decimal = "00";
12025
+ const isNegative = num < 0;
12026
+ const isValidNum = !(!num || !+num);
12027
+ if (isValidNum) {
12028
+ num = parseFloat(Math.abs(num)).toFixed(2);
12029
+ decimal = num.substring(num.length - 2, num.length);
12030
+ const int = num.substring(0, num.length - 3);
12031
+ const reversedInt = qmStr.reverseString(int);
12032
+ let reversedRealInt = "";
12033
+ for (let i = 0; i < reversedInt.length; i++) {
12034
+ reversedRealInt += reversedInt.charAt(i);
12035
+ if (i + 1 >= reversedInt.length)
12036
+ continue;
12037
+ if ((i + 1) % 3)
12038
+ continue;
12039
+ reversedRealInt += ".";
12040
+ }
12041
+ finalInt = qmStr.reverseString(reversedRealInt);
12042
+ }
12043
+ let finalValue = finalInt;
12044
+ if (isNegative)
12045
+ finalValue = `-${finalValue}`;
12046
+ if (forceDecimal || +decimal) {
12047
+ finalValue = `${finalValue},${decimal}`;
12048
+ }
12049
+ return finalValue;
12050
+ },
12051
+ removeNoNumber(str, isFloat = false) {
12052
+ let newStr = "";
12053
+ str = str.toString();
12054
+ for (let i = 0; i < str.length; i++) {
12055
+ if (str[i] == parseInt(str[i], 10)) {
12056
+ newStr += str[i];
12057
+ } else if (isFloat && str[i] == "," || isFloat && str[i] == ".") {
12058
+ newStr += ".";
12059
+ isFloat = false;
12060
+ }
12061
+ }
12062
+ return newStr;
12063
+ },
12064
+ showPrice(num, Extra = { hideIcon: false, currency: "$" }) {
12065
+ if (Extra.hideIcon !== true)
12066
+ Extra.hideIcon = false;
12067
+ let presentedNum = this.presentNum(num, true);
12068
+ const isNegative = presentedNum[0] === "-";
12069
+ if (isNegative)
12070
+ presentedNum = presentedNum.substring(1, presentedNum.length);
12071
+ if (!Extra.hideIcon)
12072
+ presentedNum = `${Extra.currency}${presentedNum}`;
12073
+ if (isNegative)
12074
+ presentedNum = `- ${presentedNum}`;
12075
+ return presentedNum;
12076
+ },
12077
+ simplifyNum(num) {
12078
+ if (!(num % 1))
12079
+ return Math.floor(num);
12080
+ return this.presentNum(num);
12081
+ }
12082
+ };
12083
+ function getKeyValue(obj, key) {
12084
+ return obj[key];
12085
+ }
12086
+ function setKeyValue(obj, key, value) {
12087
+ obj[key] = value;
12088
+ }
12089
+ var qmObj = {
12090
+ addEmptyOptionToList(optionsList, { prop = "name", title = "Todos", noneId = 0 } = {}) {
12091
+ const noneOption = {
12092
+ id: noneId,
12093
+ [prop]: title
12094
+ };
12095
+ const newList = [...optionsList];
12096
+ newList.unshift(noneOption);
12097
+ return newList;
12098
+ },
12099
+ copyAvaibleFields(ObjEditable, ObjToCopy) {
12100
+ for (const key in ObjEditable) {
12101
+ if (typeof getKeyValue(ObjToCopy, key) !== "undefined") {
12102
+ setKeyValue(ObjEditable, key, getKeyValue(ObjToCopy, key));
12103
+ }
12104
+ }
12105
+ },
12106
+ isArray(obj) {
12107
+ return obj.constructor === Array;
12108
+ },
12109
+ objsAreTheSame(obj1, obj2) {
12110
+ for (const key in obj1) {
12111
+ if (getKeyValue(obj1, key) != getKeyValue(obj2, key))
12112
+ return false;
12113
+ }
12114
+ for (const key in obj2) {
12115
+ if (getKeyValue(obj1, key) != getKeyValue(obj2, key))
12116
+ return false;
12117
+ }
12118
+ return true;
12119
+ },
12120
+ qoIsObjEmpty(obj = {}) {
12121
+ return obj && Object.keys(obj).length === 0 && Object.getPrototypeOf(obj) === Object.prototype;
12122
+ }
12123
+ };
12124
+ var main$1 = {
12125
+ qmApi,
12126
+ qmArray,
12127
+ qmAudio,
12128
+ qmNum,
12129
+ qmObj,
12130
+ qmStr
12131
+ };
12132
+ var App;
12133
+ (function(App2) {
12134
+ class SomeClass {
12135
+ getName() {
12136
+ return "name";
12137
+ }
12138
+ }
12139
+ App2.SomeClass = SomeClass;
12140
+ class OtherClass {
12141
+ getName() {
12142
+ return "name";
12143
+ }
12144
+ }
12145
+ App2.OtherClass = OtherClass;
12146
+ })(App || (App = {}));
11895
12147
  var ckSelect_vue_vue_type_style_index_0_scoped_true_lang = "";
11896
- const _hoisted_1$9 = ["value"];
11897
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
12148
+ const _hoisted_1$a = ["value"];
12149
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
11898
12150
  props: {
11899
12151
  modelValue: { default: null, type: [Boolean, Number, Object, Array, String] },
11900
12152
  prop: { type: String, default: "name" },
@@ -11919,6 +12171,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
11919
12171
  emits: ["update:modelValue", "click", "change"],
11920
12172
  setup(__props, { emit: emits }) {
11921
12173
  const props = __props;
12174
+ const { qmStr: qmStr2 } = main$1;
11922
12175
  const search = ref("");
11923
12176
  ref(null);
11924
12177
  const value = computed({
@@ -11934,7 +12187,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
11934
12187
  const filteredOptions = computed(() => {
11935
12188
  const list = props.options.filter((option) => {
11936
12189
  const name = getOptionName(option);
11937
- return qmStr.checkContainsStr(name, search.value);
12190
+ return qmStr2.checkContainsStr(name, search.value);
11938
12191
  });
11939
12192
  return list;
11940
12193
  });
@@ -12032,7 +12285,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
12032
12285
  return openBlock(), createElementBlock("option", {
12033
12286
  value: getOptionKey(option),
12034
12287
  key: option
12035
- }, toDisplayString(getOptionName(option)), 9, _hoisted_1$9);
12288
+ }, toDisplayString(getOptionName(option)), 9, _hoisted_1$a);
12036
12289
  }), 128))
12037
12290
  ], 34), [
12038
12291
  [vModelSelect, unref(value)]
@@ -12041,15 +12294,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
12041
12294
  };
12042
12295
  }
12043
12296
  });
12044
- var ckSelect = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-02fab5ba"]]);
12297
+ var ckSelect = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-31af160a"]]);
12045
12298
  const _withScopeId = (n) => (pushScopeId("data-v-022b9f3c"), n = n(), popScopeId(), n);
12046
- const _hoisted_1$8 = ["disabled"];
12047
- const _hoisted_2$3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "ck-switch__slider" }, null, -1));
12299
+ const _hoisted_1$9 = ["disabled"];
12300
+ const _hoisted_2$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "ck-switch__slider" }, null, -1));
12048
12301
  const _hoisted_3$2 = {
12049
12302
  key: 0,
12050
12303
  class: "ck-switch__content"
12051
12304
  };
12052
- function render$8(_ctx, _cache, $props, $setup, $data, $options) {
12305
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
12053
12306
  return openBlock(), createElementBlock("label", mergeProps({ class: "ck-switch" }, $options.computedAttributes, {
12054
12307
  class: $options.computedClass,
12055
12308
  onKeydown: _cache[2] || (_cache[2] = withKeys(withModifiers(() => {
@@ -12066,17 +12319,17 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
12066
12319
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $options.value = $event),
12067
12320
  disabled: $props.disabled,
12068
12321
  onClick: _cache[1] || (_cache[1] = ($event) => $options.onTrigger())
12069
- }, null, 8, _hoisted_1$8), [
12322
+ }, null, 8, _hoisted_1$9), [
12070
12323
  [vModelCheckbox, $options.value]
12071
12324
  ]),
12072
- _hoisted_2$3,
12325
+ _hoisted_2$4,
12073
12326
  _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$2, [
12074
12327
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
12075
12328
  ])) : createCommentVNode("", true)
12076
12329
  ], 16);
12077
12330
  }
12078
12331
  var ckSwitch_vue_vue_type_style_index_0_scoped_true_lang = "";
12079
- const _sfc_main$a = {
12332
+ const _sfc_main$b = {
12080
12333
  name: "Switch",
12081
12334
  props: {
12082
12335
  modelValue: { type: Boolean, default: false },
@@ -12115,12 +12368,12 @@ const _sfc_main$a = {
12115
12368
  }
12116
12369
  }
12117
12370
  };
12118
- var ckSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", render$8], ["__scopeId", "data-v-022b9f3c"]]);
12119
- const _hoisted_1$7 = { class: "ck-switch-options__container-exterior" };
12120
- const _hoisted_2$2 = ["onClick"];
12121
- function render$7(_ctx, _cache, $props, $setup, $data, $options) {
12371
+ var ckSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", render$6], ["__scopeId", "data-v-022b9f3c"]]);
12372
+ const _hoisted_1$8 = { class: "ck-switch-options__container-exterior" };
12373
+ const _hoisted_2$3 = ["onClick"];
12374
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
12122
12375
  const _component_ck_label = resolveComponent("ck-label");
12123
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
12376
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
12124
12377
  $props.label ? (openBlock(), createBlock(_component_ck_label, {
12125
12378
  key: 0,
12126
12379
  align: $props.labelAlign
@@ -12139,13 +12392,13 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
12139
12392
  key: `ck-switch-options${index}`,
12140
12393
  style: normalizeStyle($options.computedItemStyle),
12141
12394
  onClick: ($event) => $options.selectedOption = $options.getOptionValue(Option)
12142
- }, toDisplayString(Option[$props.prop]), 15, _hoisted_2$2);
12395
+ }, toDisplayString(Option[$props.prop]), 15, _hoisted_2$3);
12143
12396
  }), 128))
12144
12397
  ], 2)
12145
12398
  ]);
12146
12399
  }
12147
12400
  var ckSwitchOptions_vue_vue_type_style_index_0_scoped_true_lang = "";
12148
- const _sfc_main$9 = {
12401
+ const _sfc_main$a = {
12149
12402
  components: {
12150
12403
  ckLabel
12151
12404
  },
@@ -12193,19 +12446,19 @@ const _sfc_main$9 = {
12193
12446
  }
12194
12447
  }
12195
12448
  };
12196
- var ckSwitchOptions = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", render$7], ["__scopeId", "data-v-f0c51430"]]);
12197
- const _hoisted_1$6 = { class: "ck-tr" };
12198
- function render$6(_ctx, _cache) {
12199
- return openBlock(), createElementBlock("tr", _hoisted_1$6, [
12449
+ var ckSwitchOptions = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", render$5], ["__scopeId", "data-v-f0c51430"]]);
12450
+ const _hoisted_1$7 = { class: "ck-tr" };
12451
+ function render$4(_ctx, _cache) {
12452
+ return openBlock(), createElementBlock("tr", _hoisted_1$7, [
12200
12453
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
12201
12454
  ]);
12202
12455
  }
12203
12456
  var ckTr_vue_vue_type_style_index_0_scoped_true_lang = "";
12204
- const _sfc_main$8 = {};
12205
- var ckTr = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", render$6], ["__scopeId", "data-v-1dd12190"]]);
12206
- const _hoisted_1$5 = { class: "ck-th" };
12207
- function render$5(_ctx, _cache, $props, $setup, $data, $options) {
12208
- return openBlock(), createElementBlock("th", _hoisted_1$5, [
12457
+ const _sfc_main$9 = {};
12458
+ var ckTr = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", render$4], ["__scopeId", "data-v-1dd12190"]]);
12459
+ const _hoisted_1$6 = { class: "ck-th" };
12460
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
12461
+ return openBlock(), createElementBlock("th", _hoisted_1$6, [
12209
12462
  createElementVNode("span", {
12210
12463
  class: normalizeClass($options.computedSpanClass),
12211
12464
  style: normalizeStyle($options.computedStyle)
@@ -12215,7 +12468,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
12215
12468
  ]);
12216
12469
  }
12217
12470
  var ckTh_vue_vue_type_style_index_0_scoped_true_lang = "";
12218
- const _sfc_main$7 = {
12471
+ const _sfc_main$8 = {
12219
12472
  props: {
12220
12473
  align: { type: String, default: "center", validator: validators.align },
12221
12474
  minWidth: { type: String, default: void 0 }
@@ -12236,46 +12489,38 @@ const _sfc_main$7 = {
12236
12489
  }
12237
12490
  }
12238
12491
  };
12239
- var ckTh = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", render$5], ["__scopeId", "data-v-e9943550"]]);
12240
- function render$4(_ctx, _cache, $props, $setup, $data, $options) {
12241
- const _component_ck_th = resolveComponent("ck-th");
12242
- return $options.isVisible ? (openBlock(), createBlock(_component_ck_th, {
12243
- key: 0,
12244
- align: $props.col.align,
12245
- "min-width": $props.col.minWidth
12246
- }, {
12247
- default: withCtx(() => [
12248
- createTextVNode(toDisplayString($props.col.title), 1)
12249
- ]),
12250
- _: 1
12251
- }, 8, ["align", "min-width"])) : createCommentVNode("", true);
12252
- }
12253
- const _sfc_main$6 = {
12254
- components: {
12255
- ckTh
12256
- },
12492
+ var ckTh = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", render$3], ["__scopeId", "data-v-e9943550"]]);
12493
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
12257
12494
  props: {
12258
12495
  col: { type: Object, required: true }
12259
12496
  },
12260
- computed: {
12261
- isVisible() {
12262
- return functions$1.isTableColumnsVisible(this.col);
12263
- }
12497
+ setup(__props) {
12498
+ return (_ctx, _cache) => {
12499
+ return openBlock(), createBlock(ckTh, {
12500
+ align: __props.col.align,
12501
+ "min-width": __props.col.minWidth
12502
+ }, {
12503
+ default: withCtx(() => [
12504
+ createTextVNode(toDisplayString(__props.col.title), 1)
12505
+ ]),
12506
+ _: 1
12507
+ }, 8, ["align", "min-width"]);
12508
+ };
12264
12509
  }
12265
- };
12266
- var ckTableTitle = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", render$4]]);
12510
+ });
12267
12511
  var ckTable__headerItems_vue_vue_type_style_index_0_scoped_true_lang = "";
12268
- const _hoisted_1$4 = { class: "ck-table__header-items" };
12269
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
12512
+ const _hoisted_1$5 = { class: "ck-table__header-items" };
12513
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
12270
12514
  props: {
12271
12515
  search: { type: String, default: void 0 },
12516
+ hasColumnsManager: { type: Boolean, default: false },
12272
12517
  hideRefreshBtn: { type: Boolean, required: true },
12273
12518
  hideItemsPerPage: { type: Boolean, required: true },
12274
12519
  currentPage: { type: Number, required: true },
12275
12520
  itemsPerPage: { type: Number, required: true },
12276
12521
  listLength: { type: Number, required: true }
12277
12522
  },
12278
- emits: ["update:search", "refreshList"],
12523
+ emits: ["update:search", "refreshList", "openColumnsManager"],
12279
12524
  setup(__props, { emit: emits }) {
12280
12525
  const props = __props;
12281
12526
  const searchLocal = computed({
@@ -12298,6 +12543,19 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
12298
12543
  return props.listLength;
12299
12544
  return value;
12300
12545
  });
12546
+ const itemsPerPageIsVisible = computed(() => {
12547
+ return !props.hideItemsPerPage && props.listLength;
12548
+ });
12549
+ const searchGroupValue = computed(() => {
12550
+ if (itemsPerPageIsVisible.value && props.hasColumnsManager) {
12551
+ return "center";
12552
+ }
12553
+ if (itemsPerPageIsVisible.value)
12554
+ return "right";
12555
+ if (props.hasColumnsManager)
12556
+ return "left";
12557
+ return "";
12558
+ });
12301
12559
  function checkRefresh() {
12302
12560
  const search = searchLocal.value;
12303
12561
  setTimeout(() => {
@@ -12307,14 +12565,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
12307
12565
  }, 1e3);
12308
12566
  }
12309
12567
  return (_ctx, _cache) => {
12310
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
12568
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
12311
12569
  !__props.hideRefreshBtn ? (openBlock(), createBlock(ckButton, {
12312
12570
  key: 0,
12313
12571
  type: "flat",
12314
12572
  icon: "redo-alt",
12573
+ title: "Recargar lista",
12315
12574
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("refreshList", false))
12316
12575
  })) : createCommentVNode("", true),
12317
- !__props.hideItemsPerPage && __props.listLength ? (openBlock(), createElementBlock("div", {
12576
+ unref(itemsPerPageIsVisible) ? (openBlock(), createElementBlock("div", {
12318
12577
  key: 1,
12319
12578
  class: normalizeClass(["items-per-page", { "ck-component__group--left": !unref(hideSearch) }])
12320
12579
  }, toDisplayString(unref(itemsPerPageStart)) + " - " + toDisplayString(unref(itemsPerPageEnd)) + " de " + toDisplayString(__props.listLength), 3)) : createCommentVNode("", true),
@@ -12324,17 +12583,25 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
12324
12583
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(searchLocal) ? searchLocal.value = $event : null),
12325
12584
  icon: "search",
12326
12585
  placeholder: "Buscar...",
12327
- group: __props.hideItemsPerPage ? "" : "right",
12586
+ group: unref(searchGroupValue),
12328
12587
  onInput: _cache[2] || (_cache[2] = ($event) => checkRefresh())
12329
- }, null, 8, ["modelValue", "group"])) : createCommentVNode("", true)
12588
+ }, null, 8, ["modelValue", "group"])) : createCommentVNode("", true),
12589
+ __props.hasColumnsManager ? (openBlock(), createBlock(ckButton, {
12590
+ key: 3,
12591
+ icon: "columns",
12592
+ type: "filled",
12593
+ title: "Administrador de columnas",
12594
+ group: unref(itemsPerPageIsVisible) || !unref(hideSearch) ? "left" : "",
12595
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("openColumnsManager"))
12596
+ }, null, 8, ["group"])) : createCommentVNode("", true)
12330
12597
  ]);
12331
12598
  };
12332
12599
  }
12333
12600
  });
12334
- var TableHeaderItems = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-5c48aabc"]]);
12601
+ var TableHeaderItems = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2936ca90"]]);
12335
12602
  var ckTable__pagination_vue_vue_type_style_index_0_scoped_true_lang = "";
12336
- const _hoisted_1$3 = { class: "ck-table__pagination" };
12337
- const _hoisted_2$1 = ["onClick"];
12603
+ const _hoisted_1$4 = { class: "ck-table__pagination" };
12604
+ const _hoisted_2$2 = ["onClick"];
12338
12605
  const _hoisted_3$1 = ["onClick"];
12339
12606
  const itemsShowed = 5;
12340
12607
  const __default__ = {
@@ -12410,14 +12677,14 @@ const __default__ = {
12410
12677
  }
12411
12678
  }
12412
12679
  };
12413
- const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
12680
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
12414
12681
  setup(__props) {
12415
12682
  return (_ctx, _cache) => {
12416
12683
  return __props.currentPage && _ctx.totalPages > 1 ? (openBlock(), createElementBlock("div", {
12417
12684
  key: 0,
12418
12685
  class: normalizeClass(["ck-table__pagination-container", `pagination-align--${__props.align}`])
12419
12686
  }, [
12420
- createElementVNode("div", _hoisted_1$3, [
12687
+ createElementVNode("div", _hoisted_1$4, [
12421
12688
  _ctx.hasArrowLeft ? (openBlock(), createElementBlock("div", {
12422
12689
  key: 0,
12423
12690
  class: "ck-table__pagination--arrow-left",
@@ -12429,7 +12696,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
12429
12696
  return openBlock(), createElementBlock("div", {
12430
12697
  class: "ck-table__pagination-item pagination-item__left",
12431
12698
  onClick: ($event) => _ctx.updateCurrentPage(num)
12432
- }, toDisplayString(num), 9, _hoisted_2$1);
12699
+ }, toDisplayString(num), 9, _hoisted_2$2);
12433
12700
  }), 256)),
12434
12701
  createVNode(ckInput, {
12435
12702
  class: "ck-table__pagination-input",
@@ -12459,7 +12726,79 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
12459
12726
  };
12460
12727
  }
12461
12728
  }));
12462
- var TablePagination = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-7ad6042e"]]);
12729
+ var TablePagination = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-7ad6042e"]]);
12730
+ var ckTable__columnsManager_vue_vue_type_style_index_0_scoped_true_lang = "";
12731
+ const _hoisted_1$3 = { class: "columns-manger-container" };
12732
+ const _hoisted_2$1 = { class: "columns-manger__item" };
12733
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
12734
+ props: {
12735
+ modelValue: { type: Boolean, required: true },
12736
+ columns: { type: Object, required: true },
12737
+ columnsArray: { type: Array, required: true }
12738
+ },
12739
+ emits: ["update:modelValue"],
12740
+ setup(__props, { emit: emits }) {
12741
+ const props = __props;
12742
+ let columnsCheckable = ref([]);
12743
+ const isActive = computed({
12744
+ get() {
12745
+ return props.modelValue;
12746
+ },
12747
+ set(val) {
12748
+ emits("update:modelValue", val);
12749
+ }
12750
+ });
12751
+ watch(() => isActive.value, (val) => {
12752
+ if (!val)
12753
+ return;
12754
+ setColumnsCheckable();
12755
+ });
12756
+ function setColumnsCheckable() {
12757
+ console.log("hoola");
12758
+ const list = [];
12759
+ props.columnsArray.forEach((col) => {
12760
+ if (functions$1)
12761
+ list.push({
12762
+ name: col.name,
12763
+ title: col.title,
12764
+ value: functions$1.isColumnDisplayed(col)
12765
+ });
12766
+ });
12767
+ columnsCheckable.value = list;
12768
+ }
12769
+ function setColumnDisplayValue(colName, value) {
12770
+ props.columns[colName].isDisplayed = value;
12771
+ }
12772
+ return (_ctx, _cache) => {
12773
+ return openBlock(), createBlock(_sfc_main$e, {
12774
+ modelValue: unref(isActive),
12775
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(isActive) ? isActive.value = $event : null),
12776
+ title: "Administrador de columnas"
12777
+ }, {
12778
+ default: withCtx(() => [
12779
+ createElementVNode("div", _hoisted_1$3, [
12780
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(columnsCheckable), (col) => {
12781
+ return openBlock(), createElementBlock("div", _hoisted_2$1, [
12782
+ createVNode(ckCheckbox, {
12783
+ modelValue: col.value,
12784
+ "onUpdate:modelValue": ($event) => col.value = $event,
12785
+ onChange: ($event) => setColumnDisplayValue(col.name, col.value)
12786
+ }, {
12787
+ default: withCtx(() => [
12788
+ createTextVNode(toDisplayString(col.title), 1)
12789
+ ]),
12790
+ _: 2
12791
+ }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"])
12792
+ ]);
12793
+ }), 256))
12794
+ ])
12795
+ ]),
12796
+ _: 1
12797
+ }, 8, ["modelValue"]);
12798
+ };
12799
+ }
12800
+ });
12801
+ var TableColumnsManager = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-6ae82d89"]]);
12463
12802
  var ckTable_vue_vue_type_style_index_0_scoped_true_lang = "";
12464
12803
  const _hoisted_1$2 = { class: "ck-table" };
12465
12804
  const _hoisted_2 = {
@@ -12475,7 +12814,8 @@ const _hoisted_5 = { key: 0 };
12475
12814
  const _hoisted_6 = { key: 1 };
12476
12815
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
12477
12816
  props: {
12478
- columns: { type: Array, required: true, default: () => [] },
12817
+ columns: { type: [Array, Object], required: true, default: () => [] },
12818
+ hasColumnsManager: { type: Boolean, default: false },
12479
12819
  currentPage: { type: Number, default: 0 },
12480
12820
  itemsPerPage: { type: Number, default: 40 },
12481
12821
  listLength: { type: Number, default: 0 },
@@ -12488,6 +12828,25 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
12488
12828
  emits: ["refreshList", "update:search", "update:currentPage"],
12489
12829
  setup(__props, { emit: emits }) {
12490
12830
  const props = __props;
12831
+ const { qmObj: qmObj2 } = main$1;
12832
+ const IsPopupActive = ref({
12833
+ columnsManager: false
12834
+ });
12835
+ const columnsAreObj = computed(() => !qmObj2.isArray(props.columns));
12836
+ const columnsArray = computed(() => {
12837
+ if (!columnsAreObj.value)
12838
+ return props.columns;
12839
+ const arr = Object.values(props.columns);
12840
+ const keys = Object.keys(props.columns);
12841
+ arr.forEach((col, index) => {
12842
+ const key = keys[index];
12843
+ col.name = key;
12844
+ });
12845
+ return arr;
12846
+ });
12847
+ const filteredColumnsList = computed(() => {
12848
+ return columnsArray.value.filter(functions$1.isColumnDisplayed);
12849
+ });
12491
12850
  const searchLocal = computed({
12492
12851
  get() {
12493
12852
  return props.search;
@@ -12507,114 +12866,150 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
12507
12866
  function refreshList(pageChange = false) {
12508
12867
  emits("refreshList", pageChange);
12509
12868
  }
12869
+ function openColumnsManager() {
12870
+ if (columnsAreObj.value) {
12871
+ IsPopupActive.value.columnsManager = true;
12872
+ } else {
12873
+ console.log("ERROR ck-table", "The columns list should be an object");
12874
+ }
12875
+ }
12510
12876
  return (_ctx, _cache) => {
12511
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
12512
- _ctx.$slots.header || !__props.hideHeaderActions ? (openBlock(), createElementBlock("div", _hoisted_2, [
12513
- !__props.hideHeaderActions ? (openBlock(), createBlock(TableHeaderItems, {
12514
- key: 0,
12515
- search: unref(searchLocal),
12516
- "onUpdate:search": _cache[0] || (_cache[0] = ($event) => isRef(searchLocal) ? searchLocal.value = $event : null),
12517
- currentPage: __props.currentPage,
12518
- itemsPerPage: __props.itemsPerPage,
12519
- listLength: __props.listLength,
12520
- hideRefreshBtn: __props.hideRefreshBtn,
12521
- hideItemsPerPage: __props.hideItemsPerPage,
12522
- onRefreshList: _cache[1] || (_cache[1] = ($event) => refreshList($event))
12523
- }, null, 8, ["search", "currentPage", "itemsPerPage", "listLength", "hideRefreshBtn", "hideItemsPerPage"])) : createCommentVNode("", true),
12524
- _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_3, [
12525
- renderSlot(_ctx.$slots, "header", {}, void 0, true)
12526
- ])) : createCommentVNode("", true)
12527
- ])) : createCommentVNode("", true),
12528
- createElementVNode("table", _hoisted_4, [
12529
- __props.columns.length ? (openBlock(), createElementBlock("thead", _hoisted_5, [
12530
- createVNode(ckTr, null, {
12531
- default: withCtx(() => [
12532
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (col) => {
12533
- return openBlock(), createBlock(ckTableTitle, {
12534
- key: col.title,
12535
- col
12536
- }, null, 8, ["col"]);
12537
- }), 128))
12538
- ]),
12539
- _: 1
12540
- })
12877
+ return openBlock(), createElementBlock(Fragment, null, [
12878
+ __props.hasColumnsManager && unref(columnsAreObj) ? (openBlock(), createBlock(TableColumnsManager, {
12879
+ key: 0,
12880
+ modelValue: IsPopupActive.value.columnsManager,
12881
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => IsPopupActive.value.columnsManager = $event),
12882
+ columnsArray: unref(columnsArray),
12883
+ columns: __props.columns
12884
+ }, null, 8, ["modelValue", "columnsArray", "columns"])) : createCommentVNode("", true),
12885
+ createElementVNode("div", _hoisted_1$2, [
12886
+ _ctx.$slots.header || !__props.hideHeaderActions ? (openBlock(), createElementBlock("div", _hoisted_2, [
12887
+ !__props.hideHeaderActions ? (openBlock(), createBlock(TableHeaderItems, {
12888
+ key: 0,
12889
+ search: unref(searchLocal),
12890
+ "onUpdate:search": _cache[1] || (_cache[1] = ($event) => isRef(searchLocal) ? searchLocal.value = $event : null),
12891
+ currentPage: __props.currentPage,
12892
+ hasColumnsManager: __props.hasColumnsManager,
12893
+ itemsPerPage: __props.itemsPerPage,
12894
+ listLength: __props.listLength,
12895
+ hideRefreshBtn: __props.hideRefreshBtn,
12896
+ hideItemsPerPage: __props.hideItemsPerPage,
12897
+ onRefreshList: _cache[2] || (_cache[2] = ($event) => refreshList($event)),
12898
+ onOpenColumnsManager: _cache[3] || (_cache[3] = ($event) => openColumnsManager())
12899
+ }, null, 8, ["search", "currentPage", "hasColumnsManager", "itemsPerPage", "listLength", "hideRefreshBtn", "hideItemsPerPage"])) : createCommentVNode("", true),
12900
+ _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_3, [
12901
+ renderSlot(_ctx.$slots, "header", {}, void 0, true)
12902
+ ])) : createCommentVNode("", true)
12541
12903
  ])) : createCommentVNode("", true),
12542
- createElementVNode("tbody", null, [
12543
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
12904
+ createElementVNode("table", _hoisted_4, [
12905
+ unref(filteredColumnsList).length ? (openBlock(), createElementBlock("thead", _hoisted_5, [
12906
+ createVNode(ckTr, null, {
12907
+ default: withCtx(() => [
12908
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredColumnsList), (col) => {
12909
+ return openBlock(), createBlock(_sfc_main$7, {
12910
+ key: col.title,
12911
+ col
12912
+ }, null, 8, ["col"]);
12913
+ }), 128))
12914
+ ]),
12915
+ _: 1
12916
+ })
12917
+ ])) : createCommentVNode("", true),
12918
+ createElementVNode("tbody", null, [
12919
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
12920
+ ]),
12921
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("tfoot", _hoisted_6, [
12922
+ renderSlot(_ctx.$slots, "footer", {}, void 0, true)
12923
+ ])) : createCommentVNode("", true)
12544
12924
  ]),
12545
- _ctx.$slots.footer ? (openBlock(), createElementBlock("tfoot", _hoisted_6, [
12546
- renderSlot(_ctx.$slots, "footer", {}, void 0, true)
12547
- ])) : createCommentVNode("", true)
12548
- ]),
12549
- createVNode(TablePagination, {
12550
- currentPage: unref(currentPageLocal),
12551
- "onUpdate:currentPage": _cache[2] || (_cache[2] = ($event) => isRef(currentPageLocal) ? currentPageLocal.value = $event : null),
12552
- itemsPerPage: __props.itemsPerPage,
12553
- listLength: __props.listLength,
12554
- align: __props.paginationAlign,
12555
- onRefreshList: _cache[3] || (_cache[3] = ($event) => refreshList(true))
12556
- }, null, 8, ["currentPage", "itemsPerPage", "listLength", "align"])
12557
- ]);
12925
+ createVNode(TablePagination, {
12926
+ currentPage: unref(currentPageLocal),
12927
+ "onUpdate:currentPage": _cache[4] || (_cache[4] = ($event) => isRef(currentPageLocal) ? currentPageLocal.value = $event : null),
12928
+ itemsPerPage: __props.itemsPerPage,
12929
+ listLength: __props.listLength,
12930
+ align: __props.paginationAlign,
12931
+ onRefreshList: _cache[5] || (_cache[5] = ($event) => refreshList(true))
12932
+ }, null, 8, ["currentPage", "itemsPerPage", "listLength", "align"])
12933
+ ])
12934
+ ], 64);
12558
12935
  };
12559
12936
  }
12560
12937
  });
12561
- var ckTable = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-cac87456"]]);
12562
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
12563
- return openBlock(), createElementBlock("td", {
12564
- class: normalizeClass(["ck-td", $options.computedTdClass])
12565
- }, [
12566
- createElementVNode("span", {
12567
- class: normalizeClass($options.computedSpanClass),
12568
- style: normalizeStyle($options.computedStyle)
12569
- }, [
12570
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
12571
- ], 6)
12572
- ], 2);
12573
- }
12938
+ var ckTable = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4abe8990"]]);
12574
12939
  var ckTd_vue_vue_type_style_index_0_scoped_true_lang = "";
12575
- const _sfc_main$2 = {
12940
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
12576
12941
  props: {
12942
+ col: { type: Object, default: void 0 },
12577
12943
  wrap: { type: Boolean, default: false },
12578
12944
  block: { type: Boolean, default: false },
12579
12945
  autoWidth: { type: Boolean, default: false },
12580
- align: { type: String, default: "center", validator: validators.align },
12946
+ align: { type: String, default: void 0, validator: validators.align },
12581
12947
  fixedWidth: { type: String, default: "" },
12582
12948
  minWidth: { type: String, default: "" },
12583
12949
  maxWidth: { type: String, default: "" },
12584
12950
  maxHeight: { type: String, default: "" }
12585
12951
  },
12586
- computed: {
12587
- computedTdClass() {
12952
+ setup(__props) {
12953
+ const props = __props;
12954
+ const computedTdClass = computed(() => {
12588
12955
  return {
12589
- "auto-width": this.autoWidth
12956
+ "auto-width": props.autoWidth
12590
12957
  };
12591
- },
12592
- computedSpanClass() {
12593
- return {
12594
- block: this.block,
12595
- "wrap-text": this.wrap,
12596
- "align-center": this.align !== "left" && this.align !== "right",
12597
- "align-left": this.align === "left",
12598
- "align-right": this.align === "right"
12599
- };
12600
- },
12601
- computedStyle() {
12958
+ });
12959
+ const computedSpanClass = computed(() => {
12960
+ const list = [];
12961
+ let align;
12962
+ if (props.col)
12963
+ align = props.col.align;
12964
+ if (props.align)
12965
+ align = props.align;
12966
+ if (align) {
12967
+ if (align === "center")
12968
+ list.push("align-center");
12969
+ if (align === "right")
12970
+ list.push("align-right");
12971
+ }
12972
+ if (props.block)
12973
+ list.push("block");
12974
+ if (props.block)
12975
+ list.push("wrap-text");
12976
+ return list;
12977
+ });
12978
+ const computedStyle = computed(() => {
12602
12979
  const list = {};
12603
- if (this.minWidth)
12604
- list["min-width"] = this.minWidth;
12605
- if (this.fixedWidth)
12606
- list["min-width"] = this.fixedWidth;
12607
- if (this.maxWidth)
12608
- list["max-width"] = this.maxWidth;
12609
- if (this.fixedWidth)
12610
- list["max-width"] = this.fixedWidth;
12611
- if (this.maxHeight)
12612
- list["max-height"] = this.maxHeight;
12980
+ if (props.minWidth)
12981
+ list["min-width"] = props.minWidth;
12982
+ if (props.fixedWidth)
12983
+ list["min-width"] = props.fixedWidth;
12984
+ if (props.maxWidth)
12985
+ list["max-width"] = props.maxWidth;
12986
+ if (props.fixedWidth)
12987
+ list["max-width"] = props.fixedWidth;
12988
+ if (props.maxHeight)
12989
+ list["max-height"] = props.maxHeight;
12613
12990
  return list;
12614
- }
12991
+ });
12992
+ const isColumnDisplayed = computed(() => {
12993
+ if (!props.col)
12994
+ return true;
12995
+ return functions$1.isColumnDisplayed(props.col);
12996
+ });
12997
+ return (_ctx, _cache) => {
12998
+ return unref(isColumnDisplayed) ? (openBlock(), createElementBlock("td", {
12999
+ key: 0,
13000
+ class: normalizeClass(["ck-td", unref(computedTdClass)])
13001
+ }, [
13002
+ createElementVNode("span", {
13003
+ class: normalizeClass(unref(computedSpanClass)),
13004
+ style: normalizeStyle(unref(computedStyle))
13005
+ }, [
13006
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
13007
+ ], 6)
13008
+ ], 2)) : createCommentVNode("", true);
13009
+ };
12615
13010
  }
12616
- };
12617
- var ckTd = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", render$3], ["__scopeId", "data-v-70c634f2"]]);
13011
+ });
13012
+ var ckTd = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c34b91ca"]]);
12618
13013
  const _hoisted_1$1 = { class: "ck-textarea" };
12619
13014
  function render$2(_ctx, _cache, $props, $setup, $data, $options) {
12620
13015
  const _component_ck_label = resolveComponent("ck-label");
@@ -15260,7 +15655,7 @@ var components = /* @__PURE__ */ Object.freeze({
15260
15655
  ckImg,
15261
15656
  ckInput,
15262
15657
  ckLabel,
15263
- ckPopup: _sfc_main$d,
15658
+ ckPopup: _sfc_main$e,
15264
15659
  ckRadio,
15265
15660
  ckSelect,
15266
15661
  ckSwitch,
@@ -15307,4 +15702,4 @@ const install = function installCleek(app, options) {
15307
15702
  app.component(componentName, component);
15308
15703
  });
15309
15704
  };
15310
- export { events as EVENTS, mitt as EventBus, ckButton, ckCheckbox, ckIcon, ckImg, ckInput, ckLabel, _sfc_main$d as ckPopup, ckRadio, ckSelect, ckSwitch, ckSwitchOptions, ckTable, ckTd, ckTextarea, ckTh, ckTooltip, ckTr, install as default, lockScroll, unlockScroll };
15705
+ export { events as EVENTS, mitt as EventBus, ckButton, ckCheckbox, ckIcon, ckImg, ckInput, ckLabel, _sfc_main$e as ckPopup, ckRadio, ckSelect, ckSwitch, ckSwitchOptions, ckTable, ckTd, ckTextarea, ckTh, ckTooltip, ckTr, install as default, lockScroll, unlockScroll };