@fangzhongya/fang-ui 0.1.18 → 0.1.20

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.
Files changed (105) hide show
  1. package/dist/components/forms/src/data.cjs +3 -3
  2. package/dist/components/forms/src/data.d.ts +1 -1
  3. package/dist/components/forms/src/data.js +3 -3
  4. package/dist/components/forms/src/index2.cjs +5 -3
  5. package/dist/components/forms/src/index2.js +5 -3
  6. package/dist/components/forms/src/setup.cjs +0 -7
  7. package/dist/components/forms/src/setup.js +0 -7
  8. package/dist/components/forms-div/src/data.cjs +7 -1
  9. package/dist/components/forms-div/src/data.d.ts +6 -0
  10. package/dist/components/forms-div/src/data.js +7 -1
  11. package/dist/components/forms-div/src/index2.cjs +35 -10
  12. package/dist/components/forms-div/src/index2.js +36 -11
  13. package/dist/components/forms-item/src/data.cjs +1 -1
  14. package/dist/components/forms-item/src/data.js +1 -1
  15. package/dist/components/forms-item/src/index2.cjs +4 -2
  16. package/dist/components/forms-item/src/index2.js +4 -2
  17. package/dist/components/forms-items/src/data.cjs +1 -1
  18. package/dist/components/forms-items/src/data.js +1 -1
  19. package/dist/components/forms-items/src/index2.cjs +4 -2
  20. package/dist/components/forms-items/src/index2.js +4 -2
  21. package/dist/components/global-config/src/data.cjs +12 -0
  22. package/dist/components/global-config/src/data.d.ts +12 -0
  23. package/dist/components/global-config/src/data.js +12 -0
  24. package/dist/components/index.cjs +8 -6
  25. package/dist/{index.css → components/index.css} +39 -0
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.js +2 -0
  28. package/dist/components/index.scss +1 -0
  29. package/dist/components/index2.scss +2 -2
  30. package/dist/components/list/index.css +12 -0
  31. package/dist/components/list/index.scss +15 -0
  32. package/dist/components/list/src/data.cjs +21 -2
  33. package/dist/components/list/src/data.d.ts +22 -1
  34. package/dist/components/list/src/data.js +21 -2
  35. package/dist/components/list/src/index2.cjs +61 -10
  36. package/dist/components/list/src/index2.js +61 -10
  37. package/dist/components/list/style/index2.scss +1 -0
  38. package/dist/components/page/index.css +11 -0
  39. package/dist/components/tables/common/pagin.cjs +60 -16
  40. package/dist/components/tables/common/pagin.d.ts +8 -0
  41. package/dist/components/tables/common/pagin.js +60 -16
  42. package/dist/components/tables/common/tooltip.cjs +101 -0
  43. package/dist/components/tables/common/tooltip.d.ts +6 -0
  44. package/dist/components/tables/common/tooltip.js +101 -0
  45. package/dist/components/tables/common/util.cjs +3 -3
  46. package/dist/components/tables/common/util.js +3 -3
  47. package/dist/components/tables/src/column.cjs +19 -15
  48. package/dist/components/tables/src/column.d.ts +3 -2
  49. package/dist/components/tables/src/column.js +17 -13
  50. package/dist/components/tables/src/columns3.cjs +16 -32
  51. package/dist/components/tables/src/columns3.js +15 -31
  52. package/dist/components/tables/src/data.cjs +3 -2
  53. package/dist/components/tables/src/data.d.ts +1 -0
  54. package/dist/components/tables/src/data.js +3 -2
  55. package/dist/components/tablespd/index.cjs +9 -0
  56. package/dist/components/tablespd/index.css +88 -0
  57. package/dist/components/tablespd/index.d.ts +4 -0
  58. package/dist/components/tablespd/index.js +9 -0
  59. package/dist/components/tablespd/index.scss +40 -0
  60. package/dist/components/tablespd/src/data.cjs +13 -0
  61. package/dist/components/tablespd/src/data.d.ts +18 -0
  62. package/dist/components/tablespd/src/data.js +13 -0
  63. package/dist/components/tablespd/src/index.cjs +4 -0
  64. package/dist/components/tablespd/src/index.js +4 -0
  65. package/dist/components/tablespd/src/index2.cjs +111 -0
  66. package/dist/components/tablespd/src/index2.js +111 -0
  67. package/dist/components/tablespd/style/index2.scss +4 -0
  68. package/dist/components/tablesv/src/column.cjs +4 -4
  69. package/dist/components/tablesv/src/column.js +3 -3
  70. package/dist/css/index.css +39 -0
  71. package/dist/css/list.css +12 -0
  72. package/dist/css/page.css +11 -0
  73. package/dist/css/tablespd.css +88 -0
  74. package/dist/directives/index.cjs +6 -4
  75. package/dist/directives/index.d.ts +1 -0
  76. package/dist/directives/index.js +4 -2
  77. package/dist/directives/sortable/index.cjs +45 -0
  78. package/dist/directives/sortable/index.d.ts +6 -0
  79. package/dist/directives/sortable/index.js +45 -0
  80. package/dist/expand/{chunk-XY53LCPN.js → chunk-2BLP2ANQ.js} +3 -0
  81. package/dist/expand/{chunk-IEODUGVJ.cjs → chunk-OT6GISSR.cjs} +3 -0
  82. package/dist/expand/components.cjs +5 -5
  83. package/dist/expand/components.js +1 -1
  84. package/dist/expand/config.cjs +2 -2
  85. package/dist/expand/config.js +1 -1
  86. package/dist/hooks/cssname/index.d.ts +2 -2
  87. package/dist/hooks/index.cjs +0 -1
  88. package/dist/hooks/index.js +1 -2
  89. package/dist/hooks/inherit/index.cjs +0 -8
  90. package/dist/hooks/inherit/index.d.ts +0 -1
  91. package/dist/hooks/inherit/index.js +0 -8
  92. package/dist/icons/index.json +1 -1
  93. package/dist/index.cjs +30 -26
  94. package/dist/index.js +6 -2
  95. package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.cjs +2758 -0
  96. package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js +2758 -0
  97. package/dist/utils/vues/getAttrValue.cjs +11 -0
  98. package/dist/utils/vues/getAttrValue.d.ts +3 -0
  99. package/dist/utils/vues/getAttrValue.js +11 -0
  100. package/dist/utils/vues/index.cjs +2 -0
  101. package/dist/utils/vues/index.d.ts +1 -0
  102. package/dist/utils/vues/index.js +2 -0
  103. package/package.json +7 -5
  104. /package/dist/components/{forms-item → forms-items}/index.css +0 -0
  105. /package/dist/css/{forms-item.css → forms-items.css} +0 -0
@@ -52,7 +52,7 @@ const dataProps = {
52
52
  }
53
53
  }
54
54
  };
55
- const dataEmit = ["list-events", "selection"];
55
+ const dataEmit = ["list-events", "selection", "drag", "update:value"];
56
56
  const useInit = (props2, emit, refTable, getLocale, isEl) => {
57
57
  var _a, _b;
58
58
  const loading = vue.ref(false);
@@ -75,8 +75,11 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
75
75
  const pagconfig = vue.ref(mpagconfig);
76
76
  const paginat = vue.reactive({
77
77
  is: false,
78
+ // 跨页多选
78
79
  cross: false,
80
+ // 前端分页
79
81
  front: false,
82
+ // 滚动加载
80
83
  scroll: false,
81
84
  current: 1,
82
85
  pageSize: mpagconfig.pageSize,
@@ -222,24 +225,26 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
222
225
  console.log("crossPageData", crossPageData);
223
226
  }
224
227
  function getCrossPageValue(sarr, index) {
228
+ var _a2;
225
229
  const cross = paginat.cross;
226
230
  if (cross) {
227
- if (typeof cross === "string") {
231
+ const rowKey = typeof cross === "string" ? cross : (_a2 = tableConfig.value.config) == null ? void 0 : _a2.rowKey;
232
+ if (rowKey) {
228
233
  const sv = /* @__PURE__ */ new Set();
229
234
  const is = [];
230
235
  if (sarr && index) {
231
236
  crossPageData.value.forEach((arr, i) => {
232
237
  if (i === index) {
233
238
  sarr.forEach((v) => {
234
- if (!is.includes(v[cross])) {
235
- is.push(v[cross]);
239
+ if (!is.includes(v[rowKey])) {
240
+ is.push(v[rowKey]);
236
241
  sv.add(v);
237
242
  }
238
243
  });
239
244
  } else {
240
245
  arr.forEach((v) => {
241
- if (!is.includes(v[cross])) {
242
- is.push(v[cross]);
246
+ if (!is.includes(v[rowKey])) {
247
+ is.push(v[rowKey]);
243
248
  sv.add(v);
244
249
  }
245
250
  });
@@ -247,8 +252,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
247
252
  });
248
253
  if (!crossPageData.value[index]) {
249
254
  sarr.forEach((v) => {
250
- if (!is.includes(v[cross])) {
251
- is.push(v[cross]);
255
+ if (!is.includes(v[rowKey])) {
256
+ is.push(v[rowKey]);
252
257
  sv.add(v);
253
258
  }
254
259
  });
@@ -256,8 +261,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
256
261
  } else {
257
262
  crossPageData.value.forEach((arr) => {
258
263
  arr.forEach((v) => {
259
- if (!is.includes(v[cross])) {
260
- is.push(v[cross]);
264
+ if (!is.includes(v[rowKey])) {
265
+ is.push(v[rowKey]);
261
266
  sv.add(v);
262
267
  }
263
268
  });
@@ -297,14 +302,16 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
297
302
  }
298
303
  }
299
304
  function toggleCrossPage() {
305
+ var _a2;
300
306
  const cross = paginat.cross;
301
307
  if (paginat.is && cross && !paginat.scroll) {
302
308
  const datas = data.list;
303
309
  const vs = getCrossPageValue();
304
- if (typeof cross == "string") {
305
- const iss = vs.map((o) => o[cross]);
310
+ const rowKey = typeof cross === "string" ? cross : (_a2 = tableConfig.value.config) == null ? void 0 : _a2.rowKey;
311
+ if (rowKey) {
312
+ const iss = vs.map((o) => o[rowKey]);
306
313
  const ts = datas.filter((v) => {
307
- return iss.includes(v[cross]);
314
+ return iss.includes(v[rowKey]);
308
315
  });
309
316
  vue.nextTick(() => {
310
317
  ts.forEach((v) => {
@@ -485,7 +492,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
485
492
  const total = list.length;
486
493
  const c = paginat.current;
487
494
  const z = paginat.pageSize;
488
- const data2 = list.slice((c - 1) * z, c * z);
495
+ const v = list.slice((c - 1) * z, c * z);
489
496
  const value = {};
490
497
  let ajaxData = {};
491
498
  if (typeof tableConfig.value.ajax === "object") {
@@ -493,7 +500,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
493
500
  }
494
501
  const l = (ajaxData == null ? void 0 : ajaxData.list) ?? mpagconfig.data.list;
495
502
  const t = (ajaxData == null ? void 0 : ajaxData.total) ?? mpagconfig.data.total;
496
- objValue.setObjValue(value, l, data2);
503
+ objValue.setObjValue(value, l, v);
497
504
  objValue.setObjValue(value, t, total);
498
505
  obj.value = value;
499
506
  }
@@ -637,6 +644,41 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
637
644
  onChange: onScroll
638
645
  };
639
646
  });
647
+ function onSortable({
648
+ oldIndex,
649
+ newIndex
650
+ }) {
651
+ if (oldIndex === newIndex) return;
652
+ const movedItem = data.list.splice(oldIndex, 1)[0];
653
+ data.list.splice(newIndex, 0, movedItem);
654
+ if (paginat.is && paginat.front) {
655
+ const q = (paginat.current - 1) * paginat.pageSize;
656
+ const movedItem2 = props2.value.splice(q + oldIndex, 1)[0];
657
+ props2.value.splice(q + newIndex, 0, movedItem2);
658
+ if (props2.isValue) {
659
+ emit("update:value", props2.value);
660
+ }
661
+ } else {
662
+ if (props2.isValue) {
663
+ emit("update:value", data.list);
664
+ }
665
+ }
666
+ emit("drag", data.list, newIndex, oldIndex);
667
+ }
668
+ const sortable = vue.computed(() => {
669
+ var _a2;
670
+ let is = false;
671
+ if ((_a2 = tableConfig.value.config) == null ? void 0 : _a2.isdrag) {
672
+ is = true;
673
+ }
674
+ return {
675
+ is,
676
+ onEnd: onSortable
677
+ };
678
+ });
679
+ const datavalue = vue.computed(() => {
680
+ return data.list;
681
+ });
640
682
  setValue();
641
683
  return {
642
684
  height,
@@ -650,6 +692,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
650
692
  empty,
651
693
  loading,
652
694
  scroll,
695
+ sortable,
653
696
  onSortChange,
654
697
  onListEvents,
655
698
  onSelect,
@@ -660,7 +703,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
660
703
  onSizeChange,
661
704
  onCurrentChange,
662
705
  paginat,
663
- data
706
+ data,
707
+ datavalue
664
708
  };
665
709
  };
666
710
  exports.dataEmit = dataEmit;
@@ -266,6 +266,13 @@ export declare const useInit: (props: ExtractPropTypes<typeof dataProps>, emit:
266
266
  loadText: string;
267
267
  onChange: () => void;
268
268
  }>;
269
+ sortable: ComputedRef<{
270
+ is: boolean;
271
+ onEnd: ({ oldIndex, newIndex, }: {
272
+ oldIndex: number;
273
+ newIndex: number;
274
+ }) => void;
275
+ }>;
269
276
  onSortChange: (obj: ObjAny) => void;
270
277
  onListEvents: (...arr: any) => void;
271
278
  onSelect: (s: ObjAny, row: ObjStr) => void;
@@ -335,4 +342,5 @@ export declare const useInit: (props: ExtractPropTypes<typeof dataProps>, emit:
335
342
  total: number;
336
343
  list: ObjAny[];
337
344
  };
345
+ datavalue: ComputedRef<ObjAny[]>;
338
346
  };
@@ -50,7 +50,7 @@ const dataProps = {
50
50
  }
51
51
  }
52
52
  };
53
- const dataEmit = ["list-events", "selection"];
53
+ const dataEmit = ["list-events", "selection", "drag", "update:value"];
54
54
  const useInit = (props2, emit, refTable, getLocale, isEl) => {
55
55
  var _a, _b;
56
56
  const loading = ref(false);
@@ -73,8 +73,11 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
73
73
  const pagconfig = ref(mpagconfig);
74
74
  const paginat = reactive({
75
75
  is: false,
76
+ // 跨页多选
76
77
  cross: false,
78
+ // 前端分页
77
79
  front: false,
80
+ // 滚动加载
78
81
  scroll: false,
79
82
  current: 1,
80
83
  pageSize: mpagconfig.pageSize,
@@ -220,24 +223,26 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
220
223
  console.log("crossPageData", crossPageData);
221
224
  }
222
225
  function getCrossPageValue(sarr, index) {
226
+ var _a2;
223
227
  const cross = paginat.cross;
224
228
  if (cross) {
225
- if (typeof cross === "string") {
229
+ const rowKey = typeof cross === "string" ? cross : (_a2 = tableConfig.value.config) == null ? void 0 : _a2.rowKey;
230
+ if (rowKey) {
226
231
  const sv = /* @__PURE__ */ new Set();
227
232
  const is = [];
228
233
  if (sarr && index) {
229
234
  crossPageData.value.forEach((arr, i) => {
230
235
  if (i === index) {
231
236
  sarr.forEach((v) => {
232
- if (!is.includes(v[cross])) {
233
- is.push(v[cross]);
237
+ if (!is.includes(v[rowKey])) {
238
+ is.push(v[rowKey]);
234
239
  sv.add(v);
235
240
  }
236
241
  });
237
242
  } else {
238
243
  arr.forEach((v) => {
239
- if (!is.includes(v[cross])) {
240
- is.push(v[cross]);
244
+ if (!is.includes(v[rowKey])) {
245
+ is.push(v[rowKey]);
241
246
  sv.add(v);
242
247
  }
243
248
  });
@@ -245,8 +250,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
245
250
  });
246
251
  if (!crossPageData.value[index]) {
247
252
  sarr.forEach((v) => {
248
- if (!is.includes(v[cross])) {
249
- is.push(v[cross]);
253
+ if (!is.includes(v[rowKey])) {
254
+ is.push(v[rowKey]);
250
255
  sv.add(v);
251
256
  }
252
257
  });
@@ -254,8 +259,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
254
259
  } else {
255
260
  crossPageData.value.forEach((arr) => {
256
261
  arr.forEach((v) => {
257
- if (!is.includes(v[cross])) {
258
- is.push(v[cross]);
262
+ if (!is.includes(v[rowKey])) {
263
+ is.push(v[rowKey]);
259
264
  sv.add(v);
260
265
  }
261
266
  });
@@ -295,14 +300,16 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
295
300
  }
296
301
  }
297
302
  function toggleCrossPage() {
303
+ var _a2;
298
304
  const cross = paginat.cross;
299
305
  if (paginat.is && cross && !paginat.scroll) {
300
306
  const datas = data.list;
301
307
  const vs = getCrossPageValue();
302
- if (typeof cross == "string") {
303
- const iss = vs.map((o) => o[cross]);
308
+ const rowKey = typeof cross === "string" ? cross : (_a2 = tableConfig.value.config) == null ? void 0 : _a2.rowKey;
309
+ if (rowKey) {
310
+ const iss = vs.map((o) => o[rowKey]);
304
311
  const ts = datas.filter((v) => {
305
- return iss.includes(v[cross]);
312
+ return iss.includes(v[rowKey]);
306
313
  });
307
314
  nextTick(() => {
308
315
  ts.forEach((v) => {
@@ -483,7 +490,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
483
490
  const total = list.length;
484
491
  const c = paginat.current;
485
492
  const z = paginat.pageSize;
486
- const data2 = list.slice((c - 1) * z, c * z);
493
+ const v = list.slice((c - 1) * z, c * z);
487
494
  const value = {};
488
495
  let ajaxData = {};
489
496
  if (typeof tableConfig.value.ajax === "object") {
@@ -491,7 +498,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
491
498
  }
492
499
  const l = (ajaxData == null ? void 0 : ajaxData.list) ?? mpagconfig.data.list;
493
500
  const t = (ajaxData == null ? void 0 : ajaxData.total) ?? mpagconfig.data.total;
494
- setObjValue(value, l, data2);
501
+ setObjValue(value, l, v);
495
502
  setObjValue(value, t, total);
496
503
  obj.value = value;
497
504
  }
@@ -635,6 +642,41 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
635
642
  onChange: onScroll
636
643
  };
637
644
  });
645
+ function onSortable({
646
+ oldIndex,
647
+ newIndex
648
+ }) {
649
+ if (oldIndex === newIndex) return;
650
+ const movedItem = data.list.splice(oldIndex, 1)[0];
651
+ data.list.splice(newIndex, 0, movedItem);
652
+ if (paginat.is && paginat.front) {
653
+ const q = (paginat.current - 1) * paginat.pageSize;
654
+ const movedItem2 = props2.value.splice(q + oldIndex, 1)[0];
655
+ props2.value.splice(q + newIndex, 0, movedItem2);
656
+ if (props2.isValue) {
657
+ emit("update:value", props2.value);
658
+ }
659
+ } else {
660
+ if (props2.isValue) {
661
+ emit("update:value", data.list);
662
+ }
663
+ }
664
+ emit("drag", data.list, newIndex, oldIndex);
665
+ }
666
+ const sortable = computed(() => {
667
+ var _a2;
668
+ let is = false;
669
+ if ((_a2 = tableConfig.value.config) == null ? void 0 : _a2.isdrag) {
670
+ is = true;
671
+ }
672
+ return {
673
+ is,
674
+ onEnd: onSortable
675
+ };
676
+ });
677
+ const datavalue = computed(() => {
678
+ return data.list;
679
+ });
638
680
  setValue();
639
681
  return {
640
682
  height,
@@ -648,6 +690,7 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
648
690
  empty,
649
691
  loading,
650
692
  scroll,
693
+ sortable,
651
694
  onSortChange,
652
695
  onListEvents,
653
696
  onSelect,
@@ -658,7 +701,8 @@ const useInit = (props2, emit, refTable, getLocale, isEl) => {
658
701
  onSizeChange,
659
702
  onCurrentChange,
660
703
  paginat,
661
- data
704
+ data,
705
+ datavalue
662
706
  };
663
707
  };
664
708
  export {
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const index = require("../../tooltip/index.cjs");
5
+ const mergeObject = require("@fangzhongya/utils/basic/object/mergeObject");
6
+ exports.removePopper = null;
7
+ const getCell = function(event) {
8
+ var _a;
9
+ return (_a = event.target) == null ? void 0 : _a.closest("td");
10
+ };
11
+ const getContent = function(event) {
12
+ const target = event.target;
13
+ return target.innerText || target.textContent;
14
+ };
15
+ function isGreaterThan(a, b, epsilon = 0.03) {
16
+ return a - b > epsilon;
17
+ }
18
+ const getPadding = (el) => {
19
+ const style = window.getComputedStyle(el, null);
20
+ const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
21
+ const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
22
+ const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
23
+ const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
24
+ return {
25
+ left: paddingLeft,
26
+ right: paddingRight,
27
+ top: paddingTop,
28
+ bottom: paddingBottom
29
+ };
30
+ };
31
+ function hideTooltip(event) {
32
+ const cellChild = event.target;
33
+ cellChild.title = "";
34
+ }
35
+ function isExceed(cellChild, lineClamp = 1) {
36
+ const range = document.createRange();
37
+ range.setStart(cellChild, 0);
38
+ range.setEnd(cellChild, cellChild.childNodes.length);
39
+ const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
40
+ const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
41
+ const { top, left, right, bottom } = getPadding(cellChild);
42
+ const verticalPadding = top + bottom;
43
+ const horizontalPadding = left + right;
44
+ if (lineClamp > 1) {
45
+ if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
46
+ return true;
47
+ }
48
+ } else {
49
+ if (isGreaterThan(rangeHeight + verticalPadding, cellChildHeight)) {
50
+ return true;
51
+ }
52
+ }
53
+ return false;
54
+ }
55
+ function showTooltip(event, parentNode, showOverflow, lineClamp = 1, props = {}) {
56
+ const cellChild = event.target;
57
+ if (isExceed(cellChild, lineClamp)) {
58
+ if (showOverflow == "title") {
59
+ cellChild.title = getContent(event);
60
+ } else {
61
+ const trigger = event.target;
62
+ createTablePopper(
63
+ trigger,
64
+ { ...props, content: getContent(event) },
65
+ parentNode
66
+ );
67
+ }
68
+ }
69
+ }
70
+ function createTablePopper(trigger, mergedProps, parentNode) {
71
+ var _a, _b;
72
+ if (((_a = exports.removePopper) == null ? void 0 : _a.trigger) === trigger) {
73
+ const comp = exports.removePopper.vm.component;
74
+ mergeObject.mergeObject(comp.props, mergedProps);
75
+ return;
76
+ }
77
+ (_b = exports.removePopper) == null ? void 0 : _b.call(exports);
78
+ const vm = vue.createVNode(index.Tooltip, {
79
+ virtualTriggering: true,
80
+ virtualRef: trigger,
81
+ appendTo: parentNode,
82
+ placement: "top",
83
+ transition: "none",
84
+ hideAfter: 0,
85
+ ...mergedProps
86
+ });
87
+ const container = document.createElement("div");
88
+ vue.render(vm, container);
89
+ vm.component.exposed.onOpen();
90
+ exports.removePopper = () => {
91
+ vue.render(null, container);
92
+ exports.removePopper = null;
93
+ };
94
+ exports.removePopper.trigger = trigger;
95
+ exports.removePopper.vm = vm;
96
+ }
97
+ exports.createTablePopper = createTablePopper;
98
+ exports.getCell = getCell;
99
+ exports.getContent = getContent;
100
+ exports.hideTooltip = hideTooltip;
101
+ exports.showTooltip = showTooltip;
@@ -0,0 +1,6 @@
1
+ export declare let removePopper: any | null;
2
+ export declare const getCell: (event: Event) => HTMLTableCellElement | null;
3
+ export declare const getContent: (event: Event) => string;
4
+ export declare function hideTooltip(event: MouseEvent): void;
5
+ export declare function showTooltip(event: MouseEvent, parentNode: HTMLElement, showOverflow: string | boolean, lineClamp?: number, props?: ObjAny): void;
6
+ export declare function createTablePopper(trigger: HTMLElement, mergedProps: ObjAny, parentNode: HTMLElement): void;
@@ -0,0 +1,101 @@
1
+ import { createVNode, render } from "vue";
2
+ import { Tooltip } from "../../tooltip/index.js";
3
+ import { mergeObject } from "@fangzhongya/utils/basic/object/mergeObject";
4
+ let removePopper = null;
5
+ const getCell = function(event) {
6
+ var _a;
7
+ return (_a = event.target) == null ? void 0 : _a.closest("td");
8
+ };
9
+ const getContent = function(event) {
10
+ const target = event.target;
11
+ return target.innerText || target.textContent;
12
+ };
13
+ function isGreaterThan(a, b, epsilon = 0.03) {
14
+ return a - b > epsilon;
15
+ }
16
+ const getPadding = (el) => {
17
+ const style = window.getComputedStyle(el, null);
18
+ const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
19
+ const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
20
+ const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
21
+ const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
22
+ return {
23
+ left: paddingLeft,
24
+ right: paddingRight,
25
+ top: paddingTop,
26
+ bottom: paddingBottom
27
+ };
28
+ };
29
+ function hideTooltip(event) {
30
+ const cellChild = event.target;
31
+ cellChild.title = "";
32
+ }
33
+ function isExceed(cellChild, lineClamp = 1) {
34
+ const range = document.createRange();
35
+ range.setStart(cellChild, 0);
36
+ range.setEnd(cellChild, cellChild.childNodes.length);
37
+ const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
38
+ const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
39
+ const { top, left, right, bottom } = getPadding(cellChild);
40
+ const verticalPadding = top + bottom;
41
+ const horizontalPadding = left + right;
42
+ if (lineClamp > 1) {
43
+ if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
44
+ return true;
45
+ }
46
+ } else {
47
+ if (isGreaterThan(rangeHeight + verticalPadding, cellChildHeight)) {
48
+ return true;
49
+ }
50
+ }
51
+ return false;
52
+ }
53
+ function showTooltip(event, parentNode, showOverflow, lineClamp = 1, props = {}) {
54
+ const cellChild = event.target;
55
+ if (isExceed(cellChild, lineClamp)) {
56
+ if (showOverflow == "title") {
57
+ cellChild.title = getContent(event);
58
+ } else {
59
+ const trigger = event.target;
60
+ createTablePopper(
61
+ trigger,
62
+ { ...props, content: getContent(event) },
63
+ parentNode
64
+ );
65
+ }
66
+ }
67
+ }
68
+ function createTablePopper(trigger, mergedProps, parentNode) {
69
+ if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
70
+ const comp = removePopper.vm.component;
71
+ mergeObject(comp.props, mergedProps);
72
+ return;
73
+ }
74
+ removePopper == null ? void 0 : removePopper();
75
+ const vm = createVNode(Tooltip, {
76
+ virtualTriggering: true,
77
+ virtualRef: trigger,
78
+ appendTo: parentNode,
79
+ placement: "top",
80
+ transition: "none",
81
+ hideAfter: 0,
82
+ ...mergedProps
83
+ });
84
+ const container = document.createElement("div");
85
+ render(vm, container);
86
+ vm.component.exposed.onOpen();
87
+ removePopper = () => {
88
+ render(null, container);
89
+ removePopper = null;
90
+ };
91
+ removePopper.trigger = trigger;
92
+ removePopper.vm = vm;
93
+ }
94
+ export {
95
+ createTablePopper,
96
+ getCell,
97
+ getContent,
98
+ hideTooltip,
99
+ removePopper,
100
+ showTooltip
101
+ };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("vue");
4
4
  require("../../../utils/index.cjs");
5
- const index = require("../../../hooks/inherit/index.cjs");
5
+ const getAttrValue = require("../../../utils/vues/getAttrValue.cjs");
6
6
  const firstUpper = require("@fangzhongya/utils/basic/string/firstUpper");
7
7
  const splitUpper = require("@fangzhongya/utils/basic/string/splitUpper");
8
8
  const isArray = require("@fangzhongya/utils/basic/array/isArray");
@@ -11,7 +11,7 @@ function setMinWidth(obj, props) {
11
11
  if (obj.width) {
12
12
  return;
13
13
  }
14
- const minWidth = index.useAttrValue(obj, "minWidth");
14
+ const minWidth = getAttrValue.getAttrValue(obj, "minWidth");
15
15
  if (minWidth) {
16
16
  if (typeof minWidth == "function") {
17
17
  return minWidth(obj, config);
@@ -21,7 +21,7 @@ function setMinWidth(obj, props) {
21
21
  return minWidth;
22
22
  }
23
23
  } else {
24
- const minWidth2 = index.useAttrValue(config, "minWidth");
24
+ const minWidth2 = getAttrValue.getAttrValue(config, "minWidth");
25
25
  if (minWidth2) {
26
26
  return minWidth2;
27
27
  } else {
@@ -1,6 +1,6 @@
1
1
  import { withModifiers } from "vue";
2
2
  import "../../../utils/index.js";
3
- import { useAttrValue } from "../../../hooks/inherit/index.js";
3
+ import { getAttrValue } from "../../../utils/vues/getAttrValue.js";
4
4
  import { firstUpper } from "@fangzhongya/utils/basic/string/firstUpper";
5
5
  import { splitUpper } from "@fangzhongya/utils/basic/string/splitUpper";
6
6
  import { isArray } from "@fangzhongya/utils/basic/array/isArray";
@@ -9,7 +9,7 @@ function setMinWidth(obj, props) {
9
9
  if (obj.width) {
10
10
  return;
11
11
  }
12
- const minWidth = useAttrValue(obj, "minWidth");
12
+ const minWidth = getAttrValue(obj, "minWidth");
13
13
  if (minWidth) {
14
14
  if (typeof minWidth == "function") {
15
15
  return minWidth(obj, config);
@@ -19,7 +19,7 @@ function setMinWidth(obj, props) {
19
19
  return minWidth;
20
20
  }
21
21
  } else {
22
- const minWidth2 = useAttrValue(config, "minWidth");
22
+ const minWidth2 = getAttrValue(config, "minWidth");
23
23
  if (minWidth2) {
24
24
  return minWidth2;
25
25
  } else {