@amirjalili1374/ui-kit 1.3.23 → 1.3.24

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/ui-kit.es.js CHANGED
@@ -16950,21 +16950,31 @@ const _hoisted_12$1 = ["onClick", "onKeydown", "aria-expanded", "aria-controls",
16950
16950
  const _hoisted_13$1 = { class: "group-label" };
16951
16951
  const _hoisted_14$1 = ["id", "aria-labelledby"];
16952
16952
  const _hoisted_15$1 = ["tabindex", "onKeydown", "onClick"];
16953
- const _hoisted_16$1 = ["onClick"];
16954
- const _hoisted_17 = { key: 1 };
16955
- const _hoisted_18 = ["tabindex", "onKeydown", "onClick"];
16956
- const _hoisted_19 = ["onClick"];
16957
- const _hoisted_20 = { key: 1 };
16958
- const _hoisted_21 = {
16953
+ const _hoisted_16$1 = {
16954
+ key: 2,
16955
+ class: "d-flex align-center",
16956
+ style: { "gap": "4px" }
16957
+ };
16958
+ const _hoisted_17 = ["onClick"];
16959
+ const _hoisted_18 = ["onClick"];
16960
+ const _hoisted_19 = ["tabindex", "onKeydown", "onClick"];
16961
+ const _hoisted_20 = {
16962
+ key: 2,
16963
+ class: "d-flex align-center",
16964
+ style: { "gap": "4px" }
16965
+ };
16966
+ const _hoisted_21 = ["onClick"];
16967
+ const _hoisted_22 = ["onClick"];
16968
+ const _hoisted_23 = {
16959
16969
  key: 2,
16960
16970
  class: "d-flex justify-center align-center pa-4"
16961
16971
  };
16962
- const _hoisted_22 = {
16972
+ const _hoisted_24 = {
16963
16973
  key: 2,
16964
16974
  class: "pagination-wrapper"
16965
16975
  };
16966
- const _hoisted_23 = { class: "d-flex justify-space-between align-center pa-4" };
16967
- const _hoisted_24 = { class: "text-subtitle-2" };
16976
+ const _hoisted_25 = { class: "d-flex justify-space-between align-center pa-4" };
16977
+ const _hoisted_26 = { class: "text-subtitle-2" };
16968
16978
  const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
16969
16979
  ...{ inheritAttrs: false },
16970
16980
  __name: "CustomDataTable",
@@ -16999,6 +17009,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
16999
17009
  dateWithTimezone: { type: Boolean, default: false },
17000
17010
  bulkMode: { type: Boolean, default: false },
17001
17011
  axiosInstance: {},
17012
+ enableTextTruncation: { type: Boolean, default: false },
17002
17013
  maxTextLength: { default: 50 }
17003
17014
  },
17004
17015
  emits: ["update:selectedItems", "selection-change"],
@@ -17805,9 +17816,22 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
17805
17816
  if (textStr.length <= maxLength) return textStr;
17806
17817
  return textStr.substring(0, maxLength) + "...";
17807
17818
  };
17808
- const shouldTruncate = (text2) => {
17809
- if (text2 === null || text2 === void 0) return false;
17810
- return String(text2).length > props.maxTextLength;
17819
+ const shouldTruncate = (text2, header) => {
17820
+ if (text2 === null || text2 === void 0 || !header) return false;
17821
+ if (header.truncate === false) return false;
17822
+ if (props.enableTextTruncation && (header.truncate === true || header.truncate === void 0)) {
17823
+ return String(text2).length > props.maxTextLength;
17824
+ }
17825
+ if (header.truncate === true) {
17826
+ return String(text2).length > props.maxTextLength;
17827
+ }
17828
+ return false;
17829
+ };
17830
+ const getHeaderForColumn = (columnKey) => {
17831
+ return props.headers.find((h2) => h2.key === columnKey) || null;
17832
+ };
17833
+ const shouldShowCopyButton = (header) => {
17834
+ return (header == null ? void 0 : header.showCopyButton) === true;
17811
17835
  };
17812
17836
  const openTextPreview = (text2, columnTitle, item) => {
17813
17837
  previewText.value = text2 === null || text2 === void 0 ? "" : String(text2);
@@ -18331,14 +18355,37 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18331
18355
  _: 2
18332
18356
  }, 1032, ["color", "onClick"]);
18333
18357
  }), 128))
18334
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
18335
- shouldTruncate(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)) ? (openBlock(), createElementBlock("span", {
18358
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_16$1, [
18359
+ shouldTruncate(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), getHeaderForColumn(column.key || "")) ? (openBlock(), createElementBlock("span", {
18336
18360
  key: 0,
18337
18361
  class: "truncated-text",
18338
18362
  style: { cursor: "pointer", color: "rgb(var(--v-theme-primary))", textDecoration: "underline" },
18339
18363
  onClick: withModifiers(($event) => openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"])
18340
- }, toDisplayString(truncateText(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item))), 9, _hoisted_16$1)) : (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)), 1))
18341
- ], 64))
18364
+ }, toDisplayString(truncateText(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item))), 9, _hoisted_17)) : (openBlock(), createElementBlock("span", {
18365
+ key: 1,
18366
+ onClick: withModifiers(($event) => shouldShowCopyButton(getHeaderForColumn(column.key || "")) && openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"]),
18367
+ style: normalizeStyle({ cursor: shouldShowCopyButton(getHeaderForColumn(column.key || "")) ? "pointer" : "default" })
18368
+ }, toDisplayString(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)), 13, _hoisted_18)),
18369
+ shouldShowCopyButton(getHeaderForColumn(column.key || "")) ? (openBlock(), createBlock(VBtn, {
18370
+ key: 2,
18371
+ icon: "",
18372
+ size: "x-small",
18373
+ variant: "text",
18374
+ color: "primary",
18375
+ onClick: withModifiers(($event) => openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"]),
18376
+ style: { "min-width": "24px", "width": "24px", "height": "24px" }
18377
+ }, {
18378
+ default: withCtx(() => [
18379
+ createVNode(VIcon, { size: "16" }, {
18380
+ default: withCtx(() => [..._cache[38] || (_cache[38] = [
18381
+ createTextVNode("mdi-content-copy", -1)
18382
+ ])]),
18383
+ _: 1
18384
+ })
18385
+ ]),
18386
+ _: 1
18387
+ }, 8, ["onClick"])) : createCommentVNode("", true)
18388
+ ]))
18342
18389
  ], 4);
18343
18390
  }), 128))
18344
18391
  ], 44, _hoisted_15$1)
@@ -18421,7 +18468,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18421
18468
  class: "mr-2",
18422
18469
  onClick: ($event) => openDialog(item)
18423
18470
  }, {
18424
- default: withCtx(() => [..._cache[38] || (_cache[38] = [
18471
+ default: withCtx(() => [..._cache[39] || (_cache[39] = [
18425
18472
  createTextVNode(" ویرایش ✏️ ", -1)
18426
18473
  ])]),
18427
18474
  _: 1
@@ -18433,7 +18480,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18433
18480
  class: "mr-2",
18434
18481
  onClick: ($event) => openDeleteDialog(item)
18435
18482
  }, {
18436
- default: withCtx(() => [..._cache[39] || (_cache[39] = [
18483
+ default: withCtx(() => [..._cache[40] || (_cache[40] = [
18437
18484
  createTextVNode("حذف ❌ ", -1)
18438
18485
  ])]),
18439
18486
  _: 1
@@ -18445,7 +18492,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18445
18492
  class: "mr-2",
18446
18493
  onClick: ($event) => goToRoute("view", item)
18447
18494
  }, {
18448
- default: withCtx(() => [..._cache[40] || (_cache[40] = [
18495
+ default: withCtx(() => [..._cache[41] || (_cache[41] = [
18449
18496
  createTextVNode("🔍 نمایش ", -1)
18450
18497
  ])]),
18451
18498
  _: 1
@@ -18523,30 +18570,53 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18523
18570
  _: 2
18524
18571
  }, 1032, ["color", "onClick"]);
18525
18572
  }), 128))
18526
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
18527
- shouldTruncate(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)) ? (openBlock(), createElementBlock("span", {
18573
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_20, [
18574
+ shouldTruncate(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), getHeaderForColumn(column.key || "")) ? (openBlock(), createElementBlock("span", {
18528
18575
  key: 0,
18529
18576
  class: "truncated-text",
18530
18577
  style: { cursor: "pointer", color: "rgb(var(--v-theme-primary))", textDecoration: "underline" },
18531
18578
  onClick: withModifiers(($event) => openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"])
18532
- }, toDisplayString(truncateText(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item))), 9, _hoisted_19)) : (openBlock(), createElementBlock("span", _hoisted_20, toDisplayString(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)), 1))
18533
- ], 64))
18579
+ }, toDisplayString(truncateText(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item))), 9, _hoisted_21)) : (openBlock(), createElementBlock("span", {
18580
+ key: 1,
18581
+ onClick: withModifiers(($event) => shouldShowCopyButton(getHeaderForColumn(column.key || "")) && openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"]),
18582
+ style: normalizeStyle({ cursor: shouldShowCopyButton(getHeaderForColumn(column.key || "")) ? "pointer" : "default" })
18583
+ }, toDisplayString(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item)), 13, _hoisted_22)),
18584
+ shouldShowCopyButton(getHeaderForColumn(column.key || "")) ? (openBlock(), createBlock(VBtn, {
18585
+ key: 2,
18586
+ icon: "",
18587
+ size: "x-small",
18588
+ variant: "text",
18589
+ color: "primary",
18590
+ onClick: withModifiers(($event) => openTextPreview(getTranslatedValue(getNestedValue2(item, column.key || ""), column, item), column.title || column.key || "", item), ["stop"]),
18591
+ style: { "min-width": "24px", "width": "24px", "height": "24px" }
18592
+ }, {
18593
+ default: withCtx(() => [
18594
+ createVNode(VIcon, { size: "16" }, {
18595
+ default: withCtx(() => [..._cache[42] || (_cache[42] = [
18596
+ createTextVNode("mdi-content-copy", -1)
18597
+ ])]),
18598
+ _: 1
18599
+ })
18600
+ ]),
18601
+ _: 1
18602
+ }, 8, ["onClick"])) : createCommentVNode("", true)
18603
+ ]))
18534
18604
  ], 4);
18535
18605
  }), 128))
18536
- ], 44, _hoisted_18)
18606
+ ], 44, _hoisted_19)
18537
18607
  ]),
18538
18608
  _: 1
18539
18609
  }, 8, ["headers", "items", "items-per-page", "height"])),
18540
- isLoadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_21, [
18610
+ isLoadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_23, [
18541
18611
  createVNode(VProgressCircular, {
18542
18612
  indeterminate: "",
18543
18613
  color: "primary"
18544
18614
  })
18545
18615
  ])) : createCommentVNode("", true)
18546
18616
  ], 64)),
18547
- props.showPagination ? (openBlock(), createElementBlock("div", _hoisted_22, [
18548
- createElementVNode("div", _hoisted_23, [
18549
- createElementVNode("div", _hoisted_24, " نمایش " + toDisplayString((currentPage.value - 1) * itemsPerPage.value + 1) + " تا " + toDisplayString(Math.min(currentPage.value * itemsPerPage.value, totalSize.value)) + " از " + toDisplayString(totalSize.value) + " رکورد ", 1),
18617
+ props.showPagination ? (openBlock(), createElementBlock("div", _hoisted_24, [
18618
+ createElementVNode("div", _hoisted_25, [
18619
+ createElementVNode("div", _hoisted_26, " نمایش " + toDisplayString((currentPage.value - 1) * itemsPerPage.value + 1) + " تا " + toDisplayString(Math.min(currentPage.value * itemsPerPage.value, totalSize.value)) + " از " + toDisplayString(totalSize.value) + " رکورد ", 1),
18550
18620
  createVNode(VPagination, {
18551
18621
  modelValue: currentPage.value,
18552
18622
  "onUpdate:modelValue": [
@@ -18649,7 +18719,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18649
18719
  color: "error",
18650
18720
  onClick: _cache[5] || (_cache[5] = ($event) => dialog.value = false)
18651
18721
  }, {
18652
- default: withCtx(() => [..._cache[41] || (_cache[41] = [
18722
+ default: withCtx(() => [..._cache[43] || (_cache[43] = [
18653
18723
  createTextVNode("انصراف", -1)
18654
18724
  ])]),
18655
18725
  _: 1
@@ -18682,13 +18752,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18682
18752
  createVNode(VCard, null, {
18683
18753
  default: withCtx(() => [
18684
18754
  createVNode(VCardTitle, null, {
18685
- default: withCtx(() => [..._cache[42] || (_cache[42] = [
18755
+ default: withCtx(() => [..._cache[44] || (_cache[44] = [
18686
18756
  createTextVNode("حذف آیتم", -1)
18687
18757
  ])]),
18688
18758
  _: 1
18689
18759
  }),
18690
18760
  createVNode(VCardText, null, {
18691
- default: withCtx(() => [..._cache[43] || (_cache[43] = [
18761
+ default: withCtx(() => [..._cache[45] || (_cache[45] = [
18692
18762
  createTextVNode(" آیا مایل به حذف این رکورد هستید ?", -1)
18693
18763
  ])]),
18694
18764
  _: 1
@@ -18699,7 +18769,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18699
18769
  color: "grey",
18700
18770
  onClick: _cache[7] || (_cache[7] = ($event) => deleteDialog.value = false)
18701
18771
  }, {
18702
- default: withCtx(() => [..._cache[44] || (_cache[44] = [
18772
+ default: withCtx(() => [..._cache[46] || (_cache[46] = [
18703
18773
  createTextVNode("انصراف", -1)
18704
18774
  ])]),
18705
18775
  _: 1
@@ -18711,7 +18781,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18711
18781
  return deleteItem(String(((_a2 = itemToDelete.value) == null ? void 0 : _a2.id) || ""));
18712
18782
  })
18713
18783
  }, {
18714
- default: withCtx(() => [..._cache[45] || (_cache[45] = [
18784
+ default: withCtx(() => [..._cache[47] || (_cache[47] = [
18715
18785
  createTextVNode("حذف", -1)
18716
18786
  ])]),
18717
18787
  _: 1
@@ -18739,28 +18809,28 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18739
18809
  color: "red",
18740
18810
  class: "me-2"
18741
18811
  }, {
18742
- default: withCtx(() => [..._cache[46] || (_cache[46] = [
18812
+ default: withCtx(() => [..._cache[48] || (_cache[48] = [
18743
18813
  createTextVNode("🗑️", -1)
18744
18814
  ])]),
18745
18815
  _: 1
18746
18816
  }),
18747
- _cache[47] || (_cache[47] = createTextVNode(" حذف گروهی ", -1))
18817
+ _cache[49] || (_cache[49] = createTextVNode(" حذف گروهی ", -1))
18748
18818
  ]),
18749
18819
  _: 1
18750
18820
  }),
18751
18821
  createVNode(VCardText, null, {
18752
18822
  default: withCtx(() => [
18753
18823
  createElementVNode("p", null, [
18754
- _cache[48] || (_cache[48] = createTextVNode(" آیا مایل به حذف ", -1)),
18824
+ _cache[50] || (_cache[50] = createTextVNode(" آیا مایل به حذف ", -1)),
18755
18825
  createElementVNode("strong", null, toDisplayString(selectedCount.value), 1),
18756
- _cache[49] || (_cache[49] = createTextVNode(" آیتم انتخاب شده هستید؟ ", -1))
18826
+ _cache[51] || (_cache[51] = createTextVNode(" آیتم انتخاب شده هستید؟ ", -1))
18757
18827
  ]),
18758
18828
  createVNode(VAlert, {
18759
18829
  type: "warning",
18760
18830
  variant: "tonal",
18761
18831
  class: "mt-3"
18762
18832
  }, {
18763
- default: withCtx(() => [..._cache[50] || (_cache[50] = [
18833
+ default: withCtx(() => [..._cache[52] || (_cache[52] = [
18764
18834
  createTextVNode(" این عمل قابل بازگشت نیست! ", -1)
18765
18835
  ])]),
18766
18836
  _: 1
@@ -18775,7 +18845,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18775
18845
  color: "grey",
18776
18846
  onClick: _cache[10] || (_cache[10] = ($event) => groupDeleteDialog.value = false)
18777
18847
  }, {
18778
- default: withCtx(() => [..._cache[51] || (_cache[51] = [
18848
+ default: withCtx(() => [..._cache[53] || (_cache[53] = [
18779
18849
  createTextVNode("انصراف", -1)
18780
18850
  ])]),
18781
18851
  _: 1
@@ -18841,7 +18911,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18841
18911
  createVNode(VCard, null, {
18842
18912
  default: withCtx(() => [
18843
18913
  createVNode(VCardTitle, null, {
18844
- default: withCtx(() => [..._cache[52] || (_cache[52] = [
18914
+ default: withCtx(() => [..._cache[54] || (_cache[54] = [
18845
18915
  createTextVNode("فیلتر", -1)
18846
18916
  ])]),
18847
18917
  _: 1
@@ -18884,7 +18954,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18884
18954
  }, {
18885
18955
  default: withCtx(() => [
18886
18956
  createVNode(VIcon, null, {
18887
- default: withCtx(() => [..._cache[53] || (_cache[53] = [
18957
+ default: withCtx(() => [..._cache[55] || (_cache[55] = [
18888
18958
  createTextVNode("mdi-close", -1)
18889
18959
  ])]),
18890
18960
  _: 1
@@ -18917,12 +18987,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18917
18987
  }, {
18918
18988
  default: withCtx(() => [
18919
18989
  createVNode(VIcon, { start: "" }, {
18920
- default: withCtx(() => [..._cache[54] || (_cache[54] = [
18990
+ default: withCtx(() => [..._cache[56] || (_cache[56] = [
18921
18991
  createTextVNode("mdi-content-copy", -1)
18922
18992
  ])]),
18923
18993
  _: 1
18924
18994
  }),
18925
- _cache[55] || (_cache[55] = createTextVNode(" کپی متن ", -1))
18995
+ _cache[57] || (_cache[57] = createTextVNode(" کپی متن ", -1))
18926
18996
  ]),
18927
18997
  _: 1
18928
18998
  }),
@@ -18932,12 +19002,12 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18932
19002
  }, {
18933
19003
  default: withCtx(() => [
18934
19004
  createVNode(VIcon, { start: "" }, {
18935
- default: withCtx(() => [..._cache[56] || (_cache[56] = [
19005
+ default: withCtx(() => [..._cache[58] || (_cache[58] = [
18936
19006
  createTextVNode("mdi-content-copy", -1)
18937
19007
  ])]),
18938
19008
  _: 1
18939
19009
  }),
18940
- _cache[57] || (_cache[57] = createTextVNode(" کپی رکورد کامل ", -1))
19010
+ _cache[59] || (_cache[59] = createTextVNode(" کپی رکورد کامل ", -1))
18941
19011
  ]),
18942
19012
  _: 1
18943
19013
  }),
@@ -18945,7 +19015,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18945
19015
  color: "grey",
18946
19016
  onClick: _cache[19] || (_cache[19] = ($event) => textPreviewDialog.value = false)
18947
19017
  }, {
18948
- default: withCtx(() => [..._cache[58] || (_cache[58] = [
19018
+ default: withCtx(() => [..._cache[60] || (_cache[60] = [
18949
19019
  createTextVNode("بستن", -1)
18950
19020
  ])]),
18951
19021
  _: 1
@@ -18972,7 +19042,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent$1({
18972
19042
  variant: "text",
18973
19043
  onClick: _cache[21] || (_cache[21] = ($event) => snackbar.value = false)
18974
19044
  }, {
18975
- default: withCtx(() => [..._cache[59] || (_cache[59] = [
19045
+ default: withCtx(() => [..._cache[61] || (_cache[61] = [
18976
19046
  createTextVNode(" بستن ", -1)
18977
19047
  ])]),
18978
19048
  _: 1