@fangzhongya/fang-ui 0.1.19 → 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.
- package/dist/components/forms/src/data.cjs +3 -3
- package/dist/components/forms/src/data.d.ts +1 -1
- package/dist/components/forms/src/data.js +3 -3
- package/dist/components/forms/src/index2.cjs +5 -3
- package/dist/components/forms/src/index2.js +5 -3
- package/dist/components/forms/src/setup.cjs +0 -7
- package/dist/components/forms/src/setup.js +0 -7
- package/dist/components/forms-div/src/data.cjs +1 -1
- package/dist/components/forms-div/src/data.js +1 -1
- package/dist/components/forms-div/src/index2.cjs +7 -1
- package/dist/components/forms-div/src/index2.js +7 -1
- package/dist/components/forms-item/src/data.cjs +1 -1
- package/dist/components/forms-item/src/data.js +1 -1
- package/dist/components/forms-item/src/index2.cjs +4 -2
- package/dist/components/forms-item/src/index2.js +4 -2
- package/dist/components/forms-items/src/data.cjs +1 -1
- package/dist/components/forms-items/src/data.js +1 -1
- package/dist/components/forms-items/src/index2.cjs +4 -2
- package/dist/components/forms-items/src/index2.js +4 -2
- package/dist/components/global-config/src/data.cjs +12 -0
- package/dist/components/global-config/src/data.d.ts +12 -0
- package/dist/components/global-config/src/data.js +12 -0
- package/dist/components/index.cjs +8 -6
- package/dist/{index.css → components/index.css} +39 -22
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.scss +2 -2
- package/dist/components/index2.scss +2 -2
- package/dist/components/list/index.css +12 -0
- package/dist/components/list/index.scss +15 -0
- package/dist/components/list/src/data.cjs +21 -2
- package/dist/components/list/src/data.d.ts +22 -1
- package/dist/components/list/src/data.js +21 -2
- package/dist/components/list/src/index2.cjs +61 -10
- package/dist/components/list/src/index2.js +61 -10
- package/dist/components/list/style/index2.scss +1 -0
- package/dist/components/page/index.css +11 -0
- package/dist/components/tables/common/pagin.cjs +60 -16
- package/dist/components/tables/common/pagin.d.ts +8 -0
- package/dist/components/tables/common/pagin.js +60 -16
- package/dist/components/tables/common/tooltip.cjs +101 -0
- package/dist/components/tables/common/tooltip.d.ts +6 -0
- package/dist/components/tables/common/tooltip.js +101 -0
- package/dist/components/tables/common/util.cjs +3 -3
- package/dist/components/tables/common/util.js +3 -3
- package/dist/components/tables/src/column.cjs +19 -15
- package/dist/components/tables/src/column.d.ts +3 -2
- package/dist/components/tables/src/column.js +17 -13
- package/dist/components/tables/src/columns3.cjs +16 -32
- package/dist/components/tables/src/columns3.js +15 -31
- package/dist/components/tables/src/data.cjs +3 -2
- package/dist/components/tables/src/data.d.ts +1 -0
- package/dist/components/tables/src/data.js +3 -2
- package/dist/components/tablespd/index.cjs +9 -0
- package/dist/components/tablespd/index.css +88 -0
- package/dist/components/tablespd/index.d.ts +4 -0
- package/dist/components/tablespd/index.js +9 -0
- package/dist/components/tablespd/index.scss +40 -0
- package/dist/components/tablespd/src/data.cjs +13 -0
- package/dist/components/tablespd/src/data.d.ts +18 -0
- package/dist/components/tablespd/src/data.js +13 -0
- package/dist/components/tablespd/src/index.cjs +4 -0
- package/dist/components/tablespd/src/index.js +4 -0
- package/dist/components/tablespd/src/index2.cjs +111 -0
- package/dist/components/tablespd/src/index2.js +111 -0
- package/dist/components/tablespd/style/index2.scss +4 -0
- package/dist/components/tablesv/src/column.cjs +4 -4
- package/dist/components/tablesv/src/column.js +3 -3
- package/dist/css/index.css +39 -22
- package/dist/css/list.css +12 -0
- package/dist/css/page.css +11 -0
- package/dist/css/tablespd.css +88 -0
- package/dist/directives/index.cjs +6 -4
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.js +4 -2
- package/dist/directives/sortable/index.cjs +45 -0
- package/dist/directives/sortable/index.d.ts +6 -0
- package/dist/directives/sortable/index.js +45 -0
- package/dist/expand/{chunk-XY53LCPN.js → chunk-2BLP2ANQ.js} +3 -0
- package/dist/expand/{chunk-IEODUGVJ.cjs → chunk-OT6GISSR.cjs} +3 -0
- package/dist/expand/components.cjs +5 -5
- package/dist/expand/components.js +1 -1
- package/dist/expand/config.cjs +2 -2
- package/dist/expand/config.js +1 -1
- package/dist/hooks/cssname/index.d.ts +2 -2
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +1 -2
- package/dist/hooks/inherit/index.cjs +0 -8
- package/dist/hooks/inherit/index.d.ts +0 -1
- package/dist/hooks/inherit/index.js +0 -8
- package/dist/icons/index.json +1 -1
- package/dist/index.cjs +30 -26
- package/dist/index.js +6 -2
- package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.cjs +2758 -0
- package/dist/node_modules/.pnpm/sortablejs@1.15.6/node_modules/sortablejs/modular/sortable.esm.js +2758 -0
- package/dist/utils/vues/getAttrValue.cjs +11 -0
- package/dist/utils/vues/getAttrValue.d.ts +3 -0
- package/dist/utils/vues/getAttrValue.js +11 -0
- package/dist/utils/vues/index.cjs +2 -0
- package/dist/utils/vues/index.d.ts +1 -0
- package/dist/utils/vues/index.js +2 -0
- package/package.json +7 -5
- /package/dist/components/{forms-item → forms-items}/index.css +0 -0
- /package/dist/components/{date-picker → global-config}/index.css +0 -0
- /package/dist/css/{forms-item.css → forms-items.css} +0 -0
- /package/dist/css/{date-picker.css → global-config.css} +0 -0
|
@@ -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
|
-
|
|
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[
|
|
233
|
-
is.push(v[
|
|
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[
|
|
240
|
-
is.push(v[
|
|
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[
|
|
249
|
-
is.push(v[
|
|
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[
|
|
258
|
-
is.push(v[
|
|
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
|
-
|
|
303
|
-
|
|
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[
|
|
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
|
|
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,
|
|
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
|
|
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 =
|
|
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 =
|
|
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 {
|
|
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 =
|
|
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 =
|
|
22
|
+
const minWidth2 = getAttrValue(config, "minWidth");
|
|
23
23
|
if (minWidth2) {
|
|
24
24
|
return minWidth2;
|
|
25
25
|
} else {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const util = require("../common/util.cjs");
|
|
5
|
-
const index
|
|
5
|
+
const index = require("../../table-column/index.cjs");
|
|
6
6
|
const use = require("../../common/use.cjs");
|
|
7
|
-
const
|
|
7
|
+
const getAttrValue = require("../../../utils/vues/getAttrValue.cjs");
|
|
8
8
|
const compons = require("../../common/compons.cjs");
|
|
9
9
|
const config = require("../common/config.cjs");
|
|
10
10
|
const noProps = ["children", "class", "minWidth", "label"];
|
|
@@ -12,9 +12,9 @@ function setProps(obj, props) {
|
|
|
12
12
|
const table = props.table;
|
|
13
13
|
const robj = {};
|
|
14
14
|
const issort = table["sort"];
|
|
15
|
-
robj["showOverflowTooltip"] = table
|
|
15
|
+
robj["showOverflowTooltip"] = Boolean(getAttrValue.getAttrValue(obj, "showOverflow")) || getAttrValue.getAttrValue(table, "showOverflowTooltip") || Boolean(getAttrValue.getAttrValue(table, "showOverflow"));
|
|
16
16
|
robj["header-align"] = table["align"];
|
|
17
|
-
robj["align"] =
|
|
17
|
+
robj["align"] = getAttrValue.getAttrValue(obj, "headerAlign") || table["align"];
|
|
18
18
|
Object.keys(obj).forEach((key) => {
|
|
19
19
|
if (!noProps.includes(key)) {
|
|
20
20
|
if (obj[key] !== "") {
|
|
@@ -99,28 +99,32 @@ function setHeader(obj, scope, slots, emit, props, index2) {
|
|
|
99
99
|
index2
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
|
|
102
|
+
function getTableColumn(obj, emit, props, slots, index$1, def) {
|
|
103
|
+
if (obj.type == "selection") {
|
|
104
|
+
def = void 0;
|
|
105
|
+
}
|
|
104
106
|
return vue.h(
|
|
105
|
-
index
|
|
107
|
+
index.TableColumn,
|
|
106
108
|
{
|
|
107
|
-
...props,
|
|
109
|
+
...setProps(obj, props),
|
|
108
110
|
className: obj.class,
|
|
109
|
-
minWidth: util.setMinWidth(obj,
|
|
111
|
+
minWidth: util.setMinWidth(obj, props)
|
|
110
112
|
},
|
|
111
113
|
{
|
|
112
|
-
default:
|
|
113
|
-
return setSslot(obj, scope, emit, slots, propss, index2);
|
|
114
|
-
},
|
|
114
|
+
default: def,
|
|
115
115
|
header: (scope) => {
|
|
116
|
-
return setHeader(obj, scope, slots, emit,
|
|
116
|
+
return setHeader(obj, scope, slots, emit, props, index$1);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
+
function getDom(obj, emit, props, slots, index2) {
|
|
122
|
+
return getTableColumn(obj, emit, props, slots, index2, (scope) => {
|
|
123
|
+
return setSslot(obj, scope, emit, slots, props, index2);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
121
126
|
function columnRender(obj, emit, props, slots, index2) {
|
|
122
127
|
return getDom(obj, emit, props, slots, index2);
|
|
123
128
|
}
|
|
124
129
|
exports.columnRender = columnRender;
|
|
125
|
-
exports.
|
|
126
|
-
exports.setProps = setProps;
|
|
130
|
+
exports.getTableColumn = getTableColumn;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VNode, RendererNode, RendererElement } from 'vue';
|
|
2
|
-
export declare function
|
|
3
|
-
|
|
2
|
+
export declare function getTableColumn(obj: ListObj, emit: Function, props: ObjAny, slots: ObjAny, index: number, def?: Function): VNode<RendererNode, RendererElement, {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}>;
|
|
4
5
|
export declare function columnRender(obj: ListObj, emit: Function, props: ObjAny, slots: ObjAny, index: number): VNode<RendererNode, RendererElement, {
|
|
5
6
|
[key: string]: any;
|
|
6
7
|
}>;
|
|
@@ -2,7 +2,7 @@ import { h } from "vue";
|
|
|
2
2
|
import { setMinWidth } from "../common/util.js";
|
|
3
3
|
import { TableColumn } from "../../table-column/index.js";
|
|
4
4
|
import { useSetSlot, useSetCompon, useGetDomValue, useGetDomLabel } from "../../common/use.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getAttrValue } from "../../../utils/vues/getAttrValue.js";
|
|
6
6
|
import { useGetCompons } from "../../common/compons.js";
|
|
7
7
|
import { provides } from "../common/config.js";
|
|
8
8
|
const noProps = ["children", "class", "minWidth", "label"];
|
|
@@ -10,9 +10,9 @@ function setProps(obj, props) {
|
|
|
10
10
|
const table = props.table;
|
|
11
11
|
const robj = {};
|
|
12
12
|
const issort = table["sort"];
|
|
13
|
-
robj["showOverflowTooltip"] = table
|
|
13
|
+
robj["showOverflowTooltip"] = Boolean(getAttrValue(obj, "showOverflow")) || getAttrValue(table, "showOverflowTooltip") || Boolean(getAttrValue(table, "showOverflow"));
|
|
14
14
|
robj["header-align"] = table["align"];
|
|
15
|
-
robj["align"] =
|
|
15
|
+
robj["align"] = getAttrValue(obj, "headerAlign") || table["align"];
|
|
16
16
|
Object.keys(obj).forEach((key) => {
|
|
17
17
|
if (!noProps.includes(key)) {
|
|
18
18
|
if (obj[key] !== "") {
|
|
@@ -97,30 +97,34 @@ function setHeader(obj, scope, slots, emit, props, index) {
|
|
|
97
97
|
index
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
100
|
+
function getTableColumn(obj, emit, props, slots, index, def) {
|
|
101
|
+
if (obj.type == "selection") {
|
|
102
|
+
def = void 0;
|
|
103
|
+
}
|
|
102
104
|
return h(
|
|
103
105
|
TableColumn,
|
|
104
106
|
{
|
|
105
|
-
...props,
|
|
107
|
+
...setProps(obj, props),
|
|
106
108
|
className: obj.class,
|
|
107
|
-
minWidth: setMinWidth(obj,
|
|
109
|
+
minWidth: setMinWidth(obj, props)
|
|
108
110
|
},
|
|
109
111
|
{
|
|
110
|
-
default:
|
|
111
|
-
return setSslot(obj, scope, emit, slots, propss, index);
|
|
112
|
-
},
|
|
112
|
+
default: def,
|
|
113
113
|
header: (scope) => {
|
|
114
|
-
return setHeader(obj, scope, slots, emit,
|
|
114
|
+
return setHeader(obj, scope, slots, emit, props, index);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
|
+
function getDom(obj, emit, props, slots, index) {
|
|
120
|
+
return getTableColumn(obj, emit, props, slots, index, (scope) => {
|
|
121
|
+
return setSslot(obj, scope, emit, slots, props, index);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
119
124
|
function columnRender(obj, emit, props, slots, index) {
|
|
120
125
|
return getDom(obj, emit, props, slots, index);
|
|
121
126
|
}
|
|
122
127
|
export {
|
|
123
128
|
columnRender,
|
|
124
|
-
|
|
125
|
-
setProps
|
|
129
|
+
getTableColumn
|
|
126
130
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const util = require("../common/util.cjs");
|
|
5
3
|
const use = require("../../common/use.cjs");
|
|
6
|
-
const index = require("../../table-column/index.cjs");
|
|
7
4
|
const column = require("./column.cjs");
|
|
8
5
|
function getLists(arrs, emit, props, slots, listobj) {
|
|
9
6
|
let arr = [];
|
|
10
|
-
arrs == null ? void 0 : arrs.forEach((obj, index
|
|
7
|
+
arrs == null ? void 0 : arrs.forEach((obj, index) => {
|
|
11
8
|
if (listobj) {
|
|
12
9
|
obj.father = obj.father ?? listobj;
|
|
13
10
|
}
|
|
@@ -25,39 +22,26 @@ function getLists(arrs, emit, props, slots, listobj) {
|
|
|
25
22
|
);
|
|
26
23
|
} else {
|
|
27
24
|
arr.push(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
obj
|
|
43
|
-
);
|
|
44
|
-
},
|
|
45
|
-
header: (scope) => {
|
|
46
|
-
return column.setHeader(
|
|
47
|
-
obj,
|
|
48
|
-
scope,
|
|
49
|
-
slots,
|
|
50
|
-
emit,
|
|
51
|
-
props,
|
|
52
|
-
index$1
|
|
53
|
-
);
|
|
54
|
-
}
|
|
25
|
+
column.getTableColumn(
|
|
26
|
+
obj,
|
|
27
|
+
emit,
|
|
28
|
+
props,
|
|
29
|
+
slots,
|
|
30
|
+
index,
|
|
31
|
+
(scope) => {
|
|
32
|
+
return getLists(
|
|
33
|
+
obj.children,
|
|
34
|
+
emit,
|
|
35
|
+
props,
|
|
36
|
+
slots,
|
|
37
|
+
obj
|
|
38
|
+
);
|
|
55
39
|
}
|
|
56
40
|
)
|
|
57
41
|
);
|
|
58
42
|
}
|
|
59
43
|
} else {
|
|
60
|
-
const dom = column.columnRender(obj, emit, props, slots, index
|
|
44
|
+
const dom = column.columnRender(obj, emit, props, slots, index);
|
|
61
45
|
if (dom) {
|
|
62
46
|
arr.push(dom);
|
|
63
47
|
}
|