cloud-web-corejs 1.0.245 → 1.0.246
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/package.json +1 -1
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +10 -0
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +150 -40
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/edit-tree-button-group-config-dialog.vue +281 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +569 -197
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +18 -17
- package/src/components/xform/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +26 -26
- package/src/components/xform/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +67 -13
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +3 -3
- package/src/components/xform/form-render/container-item/data-table-mixin.js +2 -11
- package/src/components/xform/form-render/container-item/sub-form-item.vue +10 -2
- package/src/components/xform/icon-picker/icons.json +284 -0
- package/src/components/xform/icon-picker/index.vue +145 -0
- package/src/components/xform/utils/sfc-generator.js +2 -2
- package/src/components/xform/utils/tableColumnHelper.js +156 -0
|
@@ -389,12 +389,12 @@ export function buildFieldWidget(widget, formConfig) {
|
|
|
389
389
|
let customLabelDom =
|
|
390
390
|
`<template #label><span class="custom-label">${wop.labelIconPosition === 'front' ?
|
|
391
391
|
(!!wop.labelTooltip ?
|
|
392
|
-
`<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>${wop.label}` :
|
|
392
|
+
`<el-tooltip content="${wop.labelTooltip}" effect="light" popper-class="label-tooltip-pre-line"><i class="${wop.labelIconClass}"></i></el-tooltip>${wop.label}` :
|
|
393
393
|
`<i class="${wop.labelIconClass}"></i>${wop.label}`
|
|
394
394
|
)
|
|
395
395
|
:
|
|
396
396
|
(!!wop.labelTooltip ?
|
|
397
|
-
`${wop.label}<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>` :
|
|
397
|
+
`${wop.label}<el-tooltip content="${wop.labelTooltip}" effect="light" popper-class="label-tooltip-pre-line"><i class="${wop.labelIconClass}"></i></el-tooltip>` :
|
|
398
398
|
`${wop.label}<i class="${wop.labelIconClass}"></i>`
|
|
399
399
|
)
|
|
400
400
|
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
function buildColumnConfigMap(tableColumns, map = {}) {
|
|
2
|
+
if (!tableColumns || !tableColumns.length) {
|
|
3
|
+
return map;
|
|
4
|
+
}
|
|
5
|
+
tableColumns.forEach((col) => {
|
|
6
|
+
if (col.prop) {
|
|
7
|
+
map[col.prop] = col;
|
|
8
|
+
}
|
|
9
|
+
if (col.columnId) {
|
|
10
|
+
map[`__id__${col.columnId}`] = col;
|
|
11
|
+
}
|
|
12
|
+
if (col.children && col.children.length) {
|
|
13
|
+
buildColumnConfigMap(col.children, map);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return map;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function enrichColumnList(columns, configMap) {
|
|
20
|
+
if (!columns || !columns.length) {
|
|
21
|
+
return columns;
|
|
22
|
+
}
|
|
23
|
+
return columns.map((col) => {
|
|
24
|
+
const newCol = Object.assign({}, col);
|
|
25
|
+
if (col.slots) {
|
|
26
|
+
newCol.slots = Object.assign({}, col.slots);
|
|
27
|
+
}
|
|
28
|
+
const field = col.field;
|
|
29
|
+
const columnId = col.params && col.params.columnId;
|
|
30
|
+
const config =
|
|
31
|
+
(field && configMap[field]) ||
|
|
32
|
+
(columnId && configMap[`__id__${columnId}`]);
|
|
33
|
+
if (config) {
|
|
34
|
+
applyColumnLabelIcon(newCol, config);
|
|
35
|
+
}
|
|
36
|
+
if (col.children && col.children.length) {
|
|
37
|
+
newCol.children = enrichColumnList(col.children, configMap);
|
|
38
|
+
}
|
|
39
|
+
return newCol;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Apply data-table column header icon config to vxe-table column definition.
|
|
45
|
+
*/
|
|
46
|
+
export function resolveColumnRequiredFlag(columnConfig) {
|
|
47
|
+
if (!columnConfig) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (columnConfig.required) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
if (columnConfig.editWidget?.options?.required) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (columnConfig.widget?.options?.required) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
const widgetOptions =
|
|
60
|
+
columnConfig.widgetOptions ?? columnConfig.columnOption;
|
|
61
|
+
const editWidgetOptions =
|
|
62
|
+
columnConfig.editWidgetOptions ?? columnConfig.editColumnOption;
|
|
63
|
+
return !!(widgetOptions?.required || editWidgetOptions?.required);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function buildVxeTitlePrefixTooltip(tooltip) {
|
|
67
|
+
if (!tooltip) {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
if (/\r?\n/.test(tooltip)) {
|
|
71
|
+
return {
|
|
72
|
+
content: tooltip
|
|
73
|
+
.replace(/&/g, "&")
|
|
74
|
+
.replace(/</g, "<")
|
|
75
|
+
.replace(/>/g, ">")
|
|
76
|
+
.replace(/\r\n/g, "\n")
|
|
77
|
+
.replace(/\n/g, "<br/>"),
|
|
78
|
+
useHTML: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return { content: tooltip };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function applyColumnLabelIcon(col, columnConfig) {
|
|
85
|
+
if (!col || !columnConfig) {
|
|
86
|
+
return col;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const iconClass = columnConfig.labelIconClass;
|
|
90
|
+
const position = columnConfig.labelIconPosition || "rear";
|
|
91
|
+
const tooltip = columnConfig.labelTooltip;
|
|
92
|
+
const required = resolveColumnRequiredFlag(columnConfig);
|
|
93
|
+
const title = col.title;
|
|
94
|
+
const displayIconClass = iconClass || (tooltip ? "el-icon-info" : null);
|
|
95
|
+
|
|
96
|
+
if (!displayIconClass && !required) {
|
|
97
|
+
return col;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const buildIcon = (h) => {
|
|
101
|
+
const icon = h("i", { class: ["vxe-cell-help-icon", displayIconClass] });
|
|
102
|
+
if (!tooltip) {
|
|
103
|
+
return icon;
|
|
104
|
+
}
|
|
105
|
+
return h(
|
|
106
|
+
"el-tooltip",
|
|
107
|
+
{
|
|
108
|
+
props: {
|
|
109
|
+
content: tooltip,
|
|
110
|
+
effect: "dark",
|
|
111
|
+
placement: "top",
|
|
112
|
+
popperClass: "label-tooltip-pre-line",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
[icon]
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
if (displayIconClass && position === "front" && !required) {
|
|
120
|
+
col.titlePrefix = {
|
|
121
|
+
icon: displayIconClass,
|
|
122
|
+
...buildVxeTitlePrefixTooltip(tooltip),
|
|
123
|
+
};
|
|
124
|
+
return col;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (required && !displayIconClass) {
|
|
128
|
+
col.titlePrefix = { icon: "vxe-cell--required-icon" };
|
|
129
|
+
return col;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
col.slots = col.slots || {};
|
|
133
|
+
delete col.titlePrefix;
|
|
134
|
+
|
|
135
|
+
col.slots.header = (params, h) => {
|
|
136
|
+
const nodes = [];
|
|
137
|
+
if (required) {
|
|
138
|
+
nodes.push(h("i", { class: "vxe-cell--required-icon" }));
|
|
139
|
+
}
|
|
140
|
+
if (displayIconClass && position === "front") {
|
|
141
|
+
nodes.push(buildIcon(h));
|
|
142
|
+
}
|
|
143
|
+
nodes.push(h("span", { class: "vxe-cell--title" }, title));
|
|
144
|
+
if (displayIconClass && position === "rear") {
|
|
145
|
+
nodes.push(buildIcon(h));
|
|
146
|
+
}
|
|
147
|
+
return nodes;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return col;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function enrichTableColumnsWithLabelIcon(columns, tableColumns) {
|
|
154
|
+
const configMap = buildColumnConfigMap(tableColumns || []);
|
|
155
|
+
return enrichColumnList(columns, configMap);
|
|
156
|
+
}
|