@opentiny/vue-renderless 3.24.0 → 3.25.0
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/anchor/index.js +1 -1
- package/cascader-node/vue.js +1 -0
- package/date-range/index.js +1 -1
- package/file-upload/index.js +2 -0
- package/grid/plugins/exportExcel.js +1 -2
- package/grid/utils/column.js +96 -64
- package/grid/utils/common.js +79 -20
- package/grid/utils/dom.js +70 -97
- package/grid-select/index.js +2 -2
- package/input/index.js +2 -2
- package/input/vue.js +1 -2
- package/package.json +3 -3
- package/pager/vue.js +1 -0
- package/search/index.js +2 -1
- package/select/index.js +2 -2
- package/types/button.type.d.ts +5 -0
- package/types/pager.type.d.ts +0 -1
package/anchor/index.js
CHANGED
package/cascader-node/vue.js
CHANGED
|
@@ -20,6 +20,7 @@ const renderless = (props, { computed, reactive, inject, watch }, { dispatch })
|
|
|
20
20
|
inActivePath: computed(() => api2.isInPath(parent.state.activePath)),
|
|
21
21
|
inCheckedPath: computed(() => api2.comptCheckPath()),
|
|
22
22
|
value: computed(() => props.node.getValueByOption()),
|
|
23
|
+
// 仅 mf 用到nodeLabel
|
|
23
24
|
nodeLabel: computed(() => {
|
|
24
25
|
return parent.state.renderLabelFn ? parent.state.renderLabelFn({ node: props.node, data: props.node.data }) : props.node.label;
|
|
25
26
|
})
|
package/date-range/index.js
CHANGED
|
@@ -139,7 +139,7 @@ const handleClear = ({ emit, state }) => () => {
|
|
|
139
139
|
state.rightDate = nextMonth1(state.leftDate);
|
|
140
140
|
state.rangeState.selecting = false;
|
|
141
141
|
state.rangeState.endDate = null;
|
|
142
|
-
emit("pick",
|
|
142
|
+
emit("pick", []);
|
|
143
143
|
};
|
|
144
144
|
const handleChangeRange = (state, props) => (val) => {
|
|
145
145
|
if (props.readonly) {
|
package/file-upload/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "../../chunk-G2ADBYYC.js";
|
|
2
|
-
import { extend } from "@opentiny/utils";
|
|
3
|
-
import { browserInfo } from "@opentiny/utils";
|
|
2
|
+
import { extend, browserInfo } from "@opentiny/utils";
|
|
4
3
|
const isIE = browserInfo.name === "ie";
|
|
5
4
|
const rgbRegExp = /^rgba?\((\d+),\s(\d+),\s(\d+)([\s\S]*)\)$/;
|
|
6
5
|
const hexRegExp = /^#([a-zA-Z0-9]{3}|[a-zA-Z0-9]{6})$/;
|
package/grid/utils/column.js
CHANGED
|
@@ -2,72 +2,104 @@ import "../../chunk-G2ADBYYC.js";
|
|
|
2
2
|
import { isBoolean } from "../static";
|
|
3
3
|
import { initFilter } from "./common";
|
|
4
4
|
let columnUniqueId = 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
column.footerClassName = context.footerClassName;
|
|
29
|
-
column.indexMethod = context.indexMethod;
|
|
30
|
-
column.formatText = context.formatText;
|
|
31
|
-
column.formatValue = context.formatValue;
|
|
32
|
-
setColumnFormat(column, context);
|
|
33
|
-
column.sortable = context.sortable;
|
|
34
|
-
column.sortBy = context.sortBy;
|
|
35
|
-
column.sortMethod = context.sortMethod;
|
|
36
|
-
column.remoteSort = context.remoteSort;
|
|
37
|
-
column.filterMultiple = isBoolean(context.filterMultiple) ? context.filterMultiple : true;
|
|
38
|
-
column.filterMethod = context.filterMethod;
|
|
39
|
-
column.filterRender = context.filterRender;
|
|
40
|
-
column.filter = context.filter && initFilter(context.filter);
|
|
41
|
-
column.treeNode = context.treeNode;
|
|
42
|
-
column.renderer = context.renderer;
|
|
43
|
-
column.editor = context.editor;
|
|
44
|
-
column.operationConfig = context.operationConfig;
|
|
45
|
-
column.equals = context.equals;
|
|
5
|
+
class FixedDetails {
|
|
6
|
+
constructor(fixedType) {
|
|
7
|
+
this.isLeft = fixedType === "left";
|
|
8
|
+
this.isLeftLast = false;
|
|
9
|
+
this.isRight = fixedType === "right";
|
|
10
|
+
this.isRightFirst = false;
|
|
11
|
+
this.left = 0;
|
|
12
|
+
this.right = 0;
|
|
13
|
+
}
|
|
14
|
+
getStyle(rightExtra = 0) {
|
|
15
|
+
const { isLeft, left, isRight, right } = this;
|
|
16
|
+
return {
|
|
17
|
+
left: isLeft ? `${left}px` : void 0,
|
|
18
|
+
right: isRight ? `${right + rightExtra}px` : void 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
getClass() {
|
|
22
|
+
const { isLeftLast, isRightFirst } = this;
|
|
23
|
+
return {
|
|
24
|
+
"fixed-left-last__column": isLeftLast,
|
|
25
|
+
"fixed-right-first__column": isRightFirst
|
|
26
|
+
};
|
|
27
|
+
}
|
|
46
28
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
29
|
+
class ColumnConfig {
|
|
30
|
+
constructor(context, { renderHeader, renderCell, renderData } = {}, config = {}) {
|
|
31
|
+
this.id = `col_${++columnUniqueId}`;
|
|
32
|
+
this.type = context.type;
|
|
33
|
+
this.prop = context.prop;
|
|
34
|
+
this.rules = context.rules;
|
|
35
|
+
this.required = context.required;
|
|
36
|
+
this.property = context.field || context.prop;
|
|
37
|
+
this.title = context.title;
|
|
38
|
+
this.label = context.label;
|
|
39
|
+
this.width = context.width;
|
|
40
|
+
this.minWidth = context.minWidth;
|
|
41
|
+
this.resizable = context.resizable;
|
|
42
|
+
this._fixed = context.fixed;
|
|
43
|
+
this._fixedDetails = context.fixed ? new FixedDetails(context.fixed) : void 0;
|
|
44
|
+
this.align = context.align;
|
|
45
|
+
this.headerAlign = context.headerAlign;
|
|
46
|
+
this.footerAlign = context.footerAlign;
|
|
47
|
+
this.showOverflow = context.showOverflow;
|
|
48
|
+
this.showHeaderOverflow = context.showHeaderOverflow;
|
|
49
|
+
this.showTip = context.showTip;
|
|
50
|
+
this.showHeaderTip = context.showHeaderTip;
|
|
51
|
+
this.className = context.class || context.className;
|
|
52
|
+
this.headerClassName = context.headerClassName;
|
|
53
|
+
this.footerClassName = context.footerClassName;
|
|
54
|
+
this.indexMethod = context.indexMethod;
|
|
55
|
+
this.formatText = context.formatText;
|
|
56
|
+
this.formatValue = context.formatValue;
|
|
57
|
+
this.format = context.formatConfig;
|
|
58
|
+
this.sortable = context.sortable;
|
|
59
|
+
this.sortBy = context.sortBy;
|
|
60
|
+
this.sortMethod = context.sortMethod;
|
|
61
|
+
this.remoteSort = context.remoteSort;
|
|
62
|
+
this.filterMultiple = isBoolean(context.filterMultiple) ? context.filterMultiple : true;
|
|
63
|
+
this.filterMethod = context.filterMethod;
|
|
64
|
+
this.filterRender = context.filterRender;
|
|
65
|
+
this.filter = context.filter && initFilter(context.filter);
|
|
66
|
+
this.treeNode = context.treeNode;
|
|
67
|
+
this.renderer = context.renderer;
|
|
68
|
+
this.editor = context.editor;
|
|
69
|
+
this.operationConfig = context.operationConfig;
|
|
70
|
+
this.equals = context.equals;
|
|
71
|
+
this.params = context.params;
|
|
72
|
+
this.visible = true;
|
|
73
|
+
this.level = 1;
|
|
74
|
+
this.rowSpan = 1;
|
|
75
|
+
this.colSpan = 1;
|
|
76
|
+
this.order = null;
|
|
77
|
+
this.renderWidth = 0;
|
|
78
|
+
this.renderHeight = 0;
|
|
79
|
+
this.resizeWidth = 0;
|
|
80
|
+
this.renderLeft = 0;
|
|
81
|
+
this.model = {};
|
|
82
|
+
this.renderHeader = renderHeader || context.renderHeader;
|
|
83
|
+
this.renderCell = renderCell || context.renderCell;
|
|
84
|
+
this.renderData = renderData;
|
|
85
|
+
this.showIcon = isBoolean(context.showIcon) ? context.showIcon : true;
|
|
86
|
+
this.loading = false;
|
|
87
|
+
this.slots = context.slots;
|
|
88
|
+
this.own = context;
|
|
89
|
+
this.asyncPrefix = config.constant.asyncPrefix;
|
|
90
|
+
}
|
|
91
|
+
set fixed(val) {
|
|
92
|
+
this._fixed = val;
|
|
93
|
+
this._fixedDetails = val ? new FixedDetails(val) : void 0;
|
|
94
|
+
}
|
|
95
|
+
get fixed() {
|
|
96
|
+
return this._fixed;
|
|
97
|
+
}
|
|
98
|
+
get fixedDetails() {
|
|
99
|
+
return this._fixedDetails;
|
|
100
|
+
}
|
|
68
101
|
}
|
|
69
102
|
const getColumnConfig = (context, options, config) => context instanceof ColumnConfig ? context : new ColumnConfig(context, options, config);
|
|
70
103
|
export {
|
|
71
|
-
getColumnConfig
|
|
72
|
-
setColumnFormat
|
|
104
|
+
getColumnConfig
|
|
73
105
|
};
|
package/grid/utils/common.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../../chunk-G2ADBYYC.js";
|
|
4
|
-
import { isNull } from "@opentiny/utils";
|
|
5
|
-
import {
|
|
6
|
-
import { get, isFunction, set } from "../static";
|
|
4
|
+
import { isNull, find, isFunction } from "@opentiny/utils";
|
|
5
|
+
import { get, set } from "../static";
|
|
7
6
|
const gridSize = ["medium", "small", "mini"];
|
|
8
7
|
const getSize = ({ size, $parent }) => size || ($parent && gridSize.includes($parent.size) ? $parent.size : null);
|
|
9
8
|
const getFuncText = (content) => isFunction(content) ? content() : content;
|
|
@@ -12,17 +11,42 @@ const getRowid = ($table, row) => {
|
|
|
12
11
|
const rowId = get(row, getRowkey($table));
|
|
13
12
|
return rowId ? encodeURIComponent(rowId) : "";
|
|
14
13
|
};
|
|
15
|
-
const getColumnList = (columns) => {
|
|
14
|
+
const getColumnList = (columns, options = {}, level = 0) => {
|
|
16
15
|
const result = [];
|
|
17
|
-
columns.forEach((column) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
columns.forEach((column, index) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const hasChildren = (_a = column.children) == null ? void 0 : _a.length;
|
|
19
|
+
if (!options.hasFixed && column.fixed) {
|
|
20
|
+
options.hasFixed = true;
|
|
21
|
+
}
|
|
22
|
+
if (!options.isCheckable && column.type === "selection") {
|
|
23
|
+
options.isCheckable = true;
|
|
22
24
|
}
|
|
25
|
+
if (level === 0 && !options.isGroup && hasChildren) {
|
|
26
|
+
options.isGroup = true;
|
|
27
|
+
}
|
|
28
|
+
options.columnCaches.push({ colid: column.id, column, index });
|
|
29
|
+
result.push.apply(result, hasChildren ? getColumnList(column.children, options, level + 1) : [column]);
|
|
23
30
|
});
|
|
24
31
|
return result;
|
|
25
32
|
};
|
|
33
|
+
const repairFixed = (root) => {
|
|
34
|
+
const subtree = [];
|
|
35
|
+
let fixed;
|
|
36
|
+
const recursive = (col) => {
|
|
37
|
+
subtree.push(col);
|
|
38
|
+
if (!fixed && col.fixed) {
|
|
39
|
+
fixed = col.fixed;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(col.children) && col.children.length > 0) {
|
|
42
|
+
col.children.forEach((col2) => recursive(col2));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
recursive(root);
|
|
46
|
+
if (fixed) {
|
|
47
|
+
subtree.forEach((c) => c.fixed = fixed);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
26
50
|
const getClass = (property, params) => property ? isFunction(property) ? property(params) : property : "";
|
|
27
51
|
const getFilters = (filters) => (filters || []).map(({ label, value, data, checked }) => ({
|
|
28
52
|
label,
|
|
@@ -32,17 +56,25 @@ const getFilters = (filters) => (filters || []).map(({ label, value, data, check
|
|
|
32
56
|
checked: !!checked
|
|
33
57
|
}));
|
|
34
58
|
const initFilter = (filter) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
const {
|
|
61
|
+
values,
|
|
62
|
+
value: valueKey = "value",
|
|
63
|
+
checked: checkedKey = "checked",
|
|
64
|
+
condition,
|
|
65
|
+
enumable,
|
|
66
|
+
multi,
|
|
67
|
+
inputFilter
|
|
68
|
+
} = filter;
|
|
69
|
+
const value = ((_a = values == null ? void 0 : values.filter) == null ? void 0 : _a.call(values, (i) => i[checkedKey]).map((i) => i[valueKey])) || [];
|
|
70
|
+
const hasChecked = (_c = (_b = values == null ? void 0 : values.some) == null ? void 0 : _b.call(values, (i) => i[checkedKey])) != null ? _c : false;
|
|
71
|
+
const filterOptions = {
|
|
72
|
+
condition: { input: "", relation: "equals", empty: null, type: null, value },
|
|
73
|
+
hasFilter: inputFilter && !!(condition == null ? void 0 : condition.input) || enumable && multi && hasChecked || false,
|
|
74
|
+
custom: null,
|
|
75
|
+
showClear: true
|
|
76
|
+
};
|
|
77
|
+
return __spreadValues(__spreadValues({}, filterOptions), filter);
|
|
46
78
|
};
|
|
47
79
|
const formatText = (value) => `${isNull(value) ? "" : value}`;
|
|
48
80
|
const setCellValue = (row, column, value) => {
|
|
@@ -116,8 +148,33 @@ const getListeners = ($attrs, $listeners) => {
|
|
|
116
148
|
});
|
|
117
149
|
return listeners;
|
|
118
150
|
};
|
|
151
|
+
function dfsCopy(tree, callback, parent = void 0, isTree = false, childrenKey = "children") {
|
|
152
|
+
let copy;
|
|
153
|
+
if (Array.isArray(tree)) {
|
|
154
|
+
copy = [];
|
|
155
|
+
tree.forEach((node, index) => {
|
|
156
|
+
const copyItem = callback(node, index, parent);
|
|
157
|
+
if (copyItem) {
|
|
158
|
+
copy.push(copyItem);
|
|
159
|
+
}
|
|
160
|
+
if (isTree) {
|
|
161
|
+
const children = node[childrenKey];
|
|
162
|
+
if (children) {
|
|
163
|
+
const childrenCopy = dfsCopy(children, callback, node, isTree, childrenKey);
|
|
164
|
+
if (copyItem) {
|
|
165
|
+
copyItem[childrenKey] = childrenCopy;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return copy;
|
|
172
|
+
}
|
|
173
|
+
let rowUniqueId = 0;
|
|
174
|
+
const getRowUniqueId = () => `row_${++rowUniqueId}`;
|
|
119
175
|
export {
|
|
120
176
|
assemColumn,
|
|
177
|
+
dfsCopy,
|
|
121
178
|
emitEvent,
|
|
122
179
|
formatText,
|
|
123
180
|
getCellValue,
|
|
@@ -126,11 +183,13 @@ export {
|
|
|
126
183
|
getFilters,
|
|
127
184
|
getFuncText,
|
|
128
185
|
getListeners,
|
|
186
|
+
getRowUniqueId,
|
|
129
187
|
getRowid,
|
|
130
188
|
getRowkey,
|
|
131
189
|
getSize,
|
|
132
190
|
gridSize,
|
|
133
191
|
hasChildrenList,
|
|
134
192
|
initFilter,
|
|
193
|
+
repairFixed,
|
|
135
194
|
setCellValue
|
|
136
195
|
};
|
package/grid/utils/dom.js
CHANGED
|
@@ -8,8 +8,12 @@ const CELL_CLS = ".tiny-grid-cell";
|
|
|
8
8
|
const ROW_CLS = ".tiny-grid-body__row";
|
|
9
9
|
const isPx = (val) => val && /^\d+(px)?$/.test(val);
|
|
10
10
|
const isScale = (val) => val && /^\d+%$/.test(val);
|
|
11
|
-
const updateCellTitle = (event) => {
|
|
12
|
-
|
|
11
|
+
const updateCellTitle = (event, td) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const cellEl = td ? td.querySelector(".tiny-grid-cell-text") || td.querySelector(CELL_CLS) : (_a = event.currentTarget) == null ? void 0 : _a.querySelector(CELL_CLS);
|
|
14
|
+
if (!cellEl) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
13
17
|
const content = cellEl.innerText;
|
|
14
18
|
if (cellEl.getAttribute("title") !== content) {
|
|
15
19
|
cellEl.setAttribute("title", content);
|
|
@@ -17,109 +21,75 @@ const updateCellTitle = (event) => {
|
|
|
17
21
|
};
|
|
18
22
|
const rowToVisible = ($table, row) => {
|
|
19
23
|
$table.$nextTick(() => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
const { $refs, scrollYLoad, rowHeight, headerHeight, footerHeight, _tileInfo, _graphInfo } = $table;
|
|
25
|
+
const { tableBody: bodyVm } = $refs;
|
|
26
|
+
const { $el } = bodyVm;
|
|
27
|
+
const { map } = _tileInfo;
|
|
28
|
+
const { graphed } = _graphInfo;
|
|
29
|
+
const trEl = $el.querySelector(`[${ATTR_NAME}="${getRowid($table, row)}"]`);
|
|
30
|
+
const visibleStart = headerHeight;
|
|
31
|
+
const visibleEnd = $el.clientHeight - footerHeight;
|
|
32
|
+
const scrollTop = $el.scrollTop;
|
|
33
|
+
let position, trHeight;
|
|
34
|
+
let flag = false;
|
|
35
|
+
if (scrollYLoad) {
|
|
36
|
+
position = headerHeight + rowHeight * graphed.indexOf(map.get(row)) - scrollTop;
|
|
37
|
+
trHeight = rowHeight;
|
|
38
|
+
flag = true;
|
|
39
|
+
} else if (trEl) {
|
|
40
|
+
position = trEl.offsetTop - scrollTop;
|
|
41
|
+
trHeight = trEl.clientHeight;
|
|
42
|
+
flag = true;
|
|
43
|
+
}
|
|
44
|
+
if (flag) {
|
|
45
|
+
if (position < visibleStart) {
|
|
46
|
+
$el.scrollTop = scrollTop - (visibleStart - position);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
position += trHeight;
|
|
50
|
+
if (position > visibleEnd) {
|
|
51
|
+
$el.scrollTop = scrollTop + (position - visibleEnd);
|
|
43
52
|
}
|
|
44
53
|
}
|
|
45
54
|
});
|
|
46
55
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
from.fixed === "left" && (scrollLeft = 0);
|
|
51
|
-
from.fixed === "right" && (scrollLeft = body.scrollWidth);
|
|
56
|
+
const colToVisible = ($table, column) => {
|
|
57
|
+
if (column.fixed) {
|
|
58
|
+
return;
|
|
52
59
|
}
|
|
53
|
-
return scrollLeft;
|
|
54
|
-
}
|
|
55
|
-
function computeScrollLeft($table, td) {
|
|
56
|
-
const { tableBody } = $table.$refs;
|
|
57
|
-
const { visibleColumn } = $table;
|
|
58
|
-
const { scrollLeft: bodyLeft, clientWidth: bodyWidth } = tableBody.$el;
|
|
59
|
-
let leftWidth = 0;
|
|
60
|
-
let rightWidth = 0;
|
|
61
|
-
visibleColumn.forEach((column) => {
|
|
62
|
-
if (column.fixed === "left") {
|
|
63
|
-
leftWidth += column.renderWidth;
|
|
64
|
-
} else if (column.fixed === "right") {
|
|
65
|
-
rightWidth += column.renderWidth;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
const tdLeft = td._accumulateRenderWidth || td.offsetLeft + (td.offsetParent ? td.offsetParent.offsetLeft : 0);
|
|
69
|
-
const tdWidth = td._renderWidth || td.clientWidth;
|
|
70
|
-
let scrollLeft;
|
|
71
|
-
if (tdLeft < bodyLeft + leftWidth) {
|
|
72
|
-
scrollLeft = tdLeft - leftWidth;
|
|
73
|
-
} else if (tdLeft + tdWidth > bodyLeft + bodyWidth - rightWidth) {
|
|
74
|
-
scrollLeft = tdLeft + tdWidth - bodyWidth + rightWidth;
|
|
75
|
-
} else {
|
|
76
|
-
scrollLeft = bodyLeft;
|
|
77
|
-
}
|
|
78
|
-
return scrollLeft;
|
|
79
|
-
}
|
|
80
|
-
function setBodyLeft(body, td, $table, column, move) {
|
|
81
|
-
const { isLeftArrow, isRightArrow, from } = move || {};
|
|
82
|
-
const bodyScollLeft = computeScrollLeft($table, td);
|
|
83
|
-
$table.scrollTo(bodyScollLeft);
|
|
84
|
-
$table.lastScrollLeft = bodyScollLeft;
|
|
85
|
-
if (from) {
|
|
86
|
-
const direction = isLeftArrow ? "left" : isRightArrow ? "right" : null;
|
|
87
|
-
const fixedDom = $table.elemStore[`${direction}-body-list`];
|
|
88
|
-
const mainBody = $table.elemStore["main-body-wrapper"];
|
|
89
|
-
const { left, right } = td.getBoundingClientRect();
|
|
90
|
-
let offset = 0;
|
|
91
|
-
if (isLeftArrow && fixedDom) {
|
|
92
|
-
const div = fixedDom.querySelector("td.fixed__column");
|
|
93
|
-
const division = div ? div.getBoundingClientRect().left : fixedDom.getBoundingClientRect().right;
|
|
94
|
-
division > left && (offset = left - division);
|
|
95
|
-
}
|
|
96
|
-
if (isRightArrow && fixedDom) {
|
|
97
|
-
const div = fixedDom.querySelector("td:not(.fixed__column)") || fixedDom;
|
|
98
|
-
const division = div.getBoundingClientRect().left;
|
|
99
|
-
division < right && (offset = right - division);
|
|
100
|
-
}
|
|
101
|
-
mainBody.scrollLeft = getFixedLeft($table, from, column, body, offset);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const colToVisible = ($table, column, move) => {
|
|
105
60
|
$table.$nextTick(() => {
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
61
|
+
const { $refs, scrollXLoad, visibleColumn, columnStore } = $table;
|
|
62
|
+
const { tableBody: bodyVm } = $refs;
|
|
63
|
+
const { $el } = bodyVm;
|
|
64
|
+
const { leftList, rightList } = columnStore;
|
|
65
|
+
const tdEl = $el.querySelector(`.${column.id}`);
|
|
66
|
+
const visibleStart = leftList.reduce((p, c) => p += c.renderWidth, 0);
|
|
67
|
+
const visibleEnd = $el.clientWidth - rightList.reduce((p, c) => p += c.renderWidth, 0);
|
|
68
|
+
const scrollLeft = $el.scrollLeft;
|
|
69
|
+
const colWidth = column.renderWidth;
|
|
70
|
+
let position;
|
|
71
|
+
let flag = false;
|
|
72
|
+
if (scrollXLoad) {
|
|
73
|
+
flag = true;
|
|
74
|
+
position = -scrollLeft;
|
|
75
|
+
for (const col of visibleColumn) {
|
|
76
|
+
if (col === column)
|
|
115
77
|
break;
|
|
116
|
-
|
|
117
|
-
|
|
78
|
+
position += col.renderWidth;
|
|
79
|
+
}
|
|
80
|
+
} else if (tdEl) {
|
|
81
|
+
flag = true;
|
|
82
|
+
position = tdEl.offsetLeft - scrollLeft;
|
|
83
|
+
}
|
|
84
|
+
if (flag) {
|
|
85
|
+
if (position < visibleStart) {
|
|
86
|
+
$el.scrollLeft = scrollLeft - (visibleStart - position);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
position += colWidth;
|
|
90
|
+
if (position > visibleEnd) {
|
|
91
|
+
$el.scrollLeft = scrollLeft + (position - visibleEnd);
|
|
118
92
|
}
|
|
119
|
-
gridbodyEl.scrollLeft = computeScrollLeft($table, {
|
|
120
|
-
_accumulateRenderWidth: scrollLeft,
|
|
121
|
-
_renderWidth: column.renderWidth
|
|
122
|
-
});
|
|
123
93
|
}
|
|
124
94
|
});
|
|
125
95
|
};
|
|
@@ -130,6 +100,9 @@ const hasDataTag = (el, value) => {
|
|
|
130
100
|
if (el.host) {
|
|
131
101
|
el = el.host;
|
|
132
102
|
}
|
|
103
|
+
if (!(el == null ? void 0 : el.getAttribute)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
133
106
|
return (" " + el.getAttribute("data-tag") + " ").includes(" " + value + " ");
|
|
134
107
|
};
|
|
135
108
|
const getEventTargetNode = (event, container, queryCls) => {
|
package/grid-select/index.js
CHANGED
|
@@ -17,9 +17,9 @@ const filter = ({ props, state, vm }) => (value) => {
|
|
|
17
17
|
const { multiple, valueField, filterMethod, remote, remoteMethod } = props;
|
|
18
18
|
if ((props.filterable || props.searchable) && typeof filterMethod === "function") {
|
|
19
19
|
const table = vm.$refs.gridRef.$refs.tinyTable;
|
|
20
|
-
const fullData = table.
|
|
20
|
+
const fullData = table.getTableData().fullData;
|
|
21
21
|
vm.$refs.gridRef.scrollTo(null, 0);
|
|
22
|
-
table.
|
|
22
|
+
table.loadTableData(filterMethod(value, fullData) || []);
|
|
23
23
|
vm.$refs.gridRef.handleTableData(!value);
|
|
24
24
|
state.previousQuery = value;
|
|
25
25
|
} else if (remote && typeof remoteMethod === "function") {
|
package/input/index.js
CHANGED
|
@@ -89,7 +89,7 @@ const calcTextareaHeight = ({
|
|
|
89
89
|
if (boxSizing === STYLE.BorderBox) {
|
|
90
90
|
minHeight = minHeight + paddingSize + borderSize;
|
|
91
91
|
}
|
|
92
|
-
if (props.size) {
|
|
92
|
+
if (props.size || minRows === 1) {
|
|
93
93
|
minHeight = props.size === "mini" ? minHeight * 0.67 : props.size === "small" ? minHeight : minHeight * 1.17;
|
|
94
94
|
}
|
|
95
95
|
if (props.height) {
|
|
@@ -97,7 +97,7 @@ const calcTextareaHeight = ({
|
|
|
97
97
|
}
|
|
98
98
|
if (!state.isDisplayOnly) {
|
|
99
99
|
height = Math.max(minHeight, height);
|
|
100
|
-
textareaStyle.minHeight = `${minHeight}px`;
|
|
100
|
+
textareaStyle.minHeight = `${Math.floor(minHeight)}px`;
|
|
101
101
|
} else {
|
|
102
102
|
textareaStyle.minHeight = `0px`;
|
|
103
103
|
}
|
package/input/vue.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.0",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"author": "OpenTiny Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/utils": "~3.
|
|
29
|
-
"@opentiny/vue-hooks": "~3.
|
|
28
|
+
"@opentiny/utils": "~3.25.0",
|
|
29
|
+
"@opentiny/vue-hooks": "~3.25.0",
|
|
30
30
|
"color": "4.2.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/pager/vue.js
CHANGED
|
@@ -79,6 +79,7 @@ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick,
|
|
|
79
79
|
showPager: computed(() => api2.computedShowPager()),
|
|
80
80
|
internalLayout: computed(() => api2.computedInternalLayout()),
|
|
81
81
|
totalText: computed(() => api2.computedTotalText()),
|
|
82
|
+
internalPageSizes: computed(() => props.pageSizes || [10, 20, 30, 40, 50, 100]),
|
|
82
83
|
internalPageCount: computed(() => api2.computedInternalPageCount()),
|
|
83
84
|
showJumperSuffix: (_b = (_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.showJumperSuffix) != null ? _b : true,
|
|
84
85
|
align: computed(() => {
|
package/search/index.js
CHANGED
|
@@ -38,7 +38,8 @@ const searchEnterKey = ({ api, props, vm, nextTick }) => (event) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const clickOutside = ({ parent, props, state }) => (event) => {
|
|
41
|
-
|
|
41
|
+
const path = (event == null ? void 0 : event.composedPath) && event.composedPath();
|
|
42
|
+
if (path ? !path.includes(parent.$el) : !parent.$el.contains(event.target)) {
|
|
42
43
|
state.show = false;
|
|
43
44
|
props.mini && !state.currentValue && (state.collapse = true);
|
|
44
45
|
}
|
package/select/index.js
CHANGED
|
@@ -57,9 +57,9 @@ const gridOnQueryChange = ({ props, vm, constants, state }) => (value) => {
|
|
|
57
57
|
const { multiple, valueField, filterMethod, remote, remoteMethod } = props;
|
|
58
58
|
if ((props.filterable || props.searchable) && typeof filterMethod === "function") {
|
|
59
59
|
const table = vm.$refs.selectGrid.$refs.tinyTable;
|
|
60
|
-
const fullData = table.
|
|
60
|
+
const fullData = table.getTableData().fullData;
|
|
61
61
|
vm.$refs.selectGrid.scrollTo(null, 0);
|
|
62
|
-
table.
|
|
62
|
+
table.loadTableData(filterMethod(value, fullData) || []);
|
|
63
63
|
vm.$refs.selectGrid.handleTableData(!value).then(() => state.selectEmitter.emit(constants.EVENT_NAME.updatePopper));
|
|
64
64
|
state.previousQuery = value;
|
|
65
65
|
} else if (remote && typeof remoteMethod === "function") {
|
package/types/button.type.d.ts
CHANGED