@cloudbase/weda-ui 3.21.2 → 3.21.4
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/configs/components/wd-select-multiple.js +12 -0
- package/dist/configs/components/wd-select.js +12 -0
- package/dist/configs/components/wd-table.js +4 -0
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/chart/statisticsCard/index.js +9 -6
- package/dist/web/components/richText/index.js +11 -21
- package/dist/web/components/richTextView/index.css +56 -4
- package/dist/web/components/richTextView/style.d.ts +1 -0
- package/dist/web/components/richTextView/style.js +1 -0
- package/dist/web/components/table/ExportFileModalByApi/index.js +11 -14
- package/dist/web/components/wd-form/form-utils.d.ts +1 -0
- package/dist/web/components/wd-form/form-utils.js +17 -0
- package/dist/web/components/wd-form/hooks/use-remote-value.js +1 -1
- package/dist/web/components/wd-form/index.js +14 -39
- package/dist/web/components/wd-select/select/selectUI.js +9 -7
- package/dist/web/components/wd-select/wd-select.js +1 -1
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +1 -1
- package/dist/web/components/wd-tabs/tabs-h5.js +14 -13
- package/dist/web/components/wd-tabs/tabs-pc.js +15 -16
- package/dist/web/utils/tool.js +19 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { useState, useCallback, useRef, useEffect } from 'react';
|
|
|
3
3
|
import { useConfig } from '../../utils/config-context';
|
|
4
4
|
import { usePlatform } from '../../utils/platform';
|
|
5
5
|
import WdIcon from '../wd-icon';
|
|
6
|
-
import { useSyncedRef } from '@react-hookz/web';
|
|
6
|
+
import { useDebouncedCallback, useSyncedRef } from '@react-hookz/web';
|
|
7
7
|
import { renderSlot } from './util';
|
|
8
8
|
export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProps }) => {
|
|
9
9
|
const { classPrefix } = useConfig();
|
|
@@ -57,27 +57,29 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
57
57
|
useEffect(() => {
|
|
58
58
|
setSelectedTab(selectedIndex);
|
|
59
59
|
}, [selectedIndex]);
|
|
60
|
+
const debouncedChangeEvent = useDebouncedCallback((value) => {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = restProps === null || restProps === void 0 ? void 0 : restProps.events) === null || _a === void 0 ? void 0 : _a.change(value);
|
|
63
|
+
}, [restProps],
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
65
|
+
300);
|
|
60
66
|
// 渲染菜单
|
|
61
67
|
const RenderTabItem = (index, item) => {
|
|
62
68
|
return (_jsxs("div", { className: `${classPrefix}-tabs__item ${(item === null || item === void 0 ? void 0 : item.selected) ? 'is-selected' : ''} ${(item === null || item === void 0 ? void 0 : item.isDisabled) ? 'is-disabled' : ''}`, onClick: () => {
|
|
63
|
-
var _a, _b, _c, _d, _e, _f
|
|
69
|
+
var _a, _b, _c, _d, _e, _f;
|
|
64
70
|
if (!(item === null || item === void 0 ? void 0 : item.isDisabled) && !(item === null || item === void 0 ? void 0 : item.selected)) {
|
|
65
71
|
if (restProps.direction !== 'vertical') {
|
|
66
72
|
const parentWidths = (_b = (_a = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.clientWidth;
|
|
67
73
|
const result = parentWidths * ((position === null || position === void 0 ? void 0 : position.index) + Number('1')) -
|
|
68
|
-
(((_c = itemOffsetData.get(index)) === null || _c === void 0 ? void 0 : _c.clientWidth) +
|
|
69
|
-
|
|
70
|
-
if (result >= 0 &&
|
|
71
|
-
itemOffsetData.get(index).offset <=
|
|
72
|
-
parentWidths * (position === null || position === void 0 ? void 0 : position.index)) {
|
|
74
|
+
(((_c = itemOffsetData.get(index)) === null || _c === void 0 ? void 0 : _c.clientWidth) + ((_d = itemOffsetData.get(index)) === null || _d === void 0 ? void 0 : _d.offset));
|
|
75
|
+
if (result >= 0 && itemOffsetData.get(index).offset <= parentWidths * (position === null || position === void 0 ? void 0 : position.index)) {
|
|
73
76
|
setPosition({
|
|
74
77
|
index: position.index,
|
|
75
78
|
offset: -itemOffsetData.get(index).offset,
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
// 大于父级容器
|
|
79
|
-
if (result < 0 &&
|
|
80
|
-
result - parentWidths * (position === null || position === void 0 ? void 0 : position.index) < position.offset) {
|
|
82
|
+
if (result < 0 && result - parentWidths * (position === null || position === void 0 ? void 0 : position.index) < position.offset) {
|
|
81
83
|
setPosition({
|
|
82
84
|
index: position.index,
|
|
83
85
|
offset: result + position.offset,
|
|
@@ -89,13 +91,11 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
89
91
|
// HACK widget 时序
|
|
90
92
|
if ((_f = (_e = $node.current) === null || _e === void 0 ? void 0 : _e._getInstanceRef()) === null || _f === void 0 ? void 0 : _f.current) {
|
|
91
93
|
const currentSelectedValue = item === null || item === void 0 ? void 0 : item.value;
|
|
92
|
-
if (currentSelectedValue !==
|
|
93
|
-
$node.current._getInstanceRef().current.selectedValue
|
|
94
|
-
$node.current._getInstanceRef().current.selectedValue =
|
|
95
|
-
currentSelectedValue;
|
|
94
|
+
if (currentSelectedValue !== $node.current._getInstanceRef().current.selectedValue) {
|
|
95
|
+
$node.current._getInstanceRef().current.selectedValue = currentSelectedValue;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
(
|
|
98
|
+
debouncedChangeEvent({ value: item === null || item === void 0 ? void 0 : item.value });
|
|
99
99
|
}
|
|
100
100
|
}, children: [(item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'prefix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null, _jsx("div", { className: `${classPrefix}-tabs__item-text`, children: item === null || item === void 0 ? void 0 : item.label }), (item === null || item === void 0 ? void 0 : item.iconType) !== 'none' && (item === null || item === void 0 ? void 0 : item.iconPosition) === 'suffix' ? (_jsx("div", { className: `${classPrefix}-tabs__item-icon`, children: _jsx(WdIcon, { type: item === null || item === void 0 ? void 0 : item.iconType, name: (item === null || item === void 0 ? void 0 : item.iconType) === 'inner' ? item === null || item === void 0 ? void 0 : item.innerIcon : item === null || item === void 0 ? void 0 : item.outerImage, src: (item === null || item === void 0 ? void 0 : item.iconType) === 'custom' ? item === null || item === void 0 ? void 0 : item.outerImage : '', size: "xs" }) })) : null] }));
|
|
101
101
|
};
|
|
@@ -108,8 +108,7 @@ export const WdTabsPc = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
108
108
|
});
|
|
109
109
|
} })), _jsx("div", { className: `${classPrefix}-tabs__header-item-wrap`, children: _jsx("div", { ref: navWrapRef, className: `${classPrefix}-tabs__header-item-content`, style: {
|
|
110
110
|
transform: `translate(${position.offset}px, 0px)`,
|
|
111
|
-
}, children: tabsDatas === null || tabsDatas === void 0 ? void 0 : tabsDatas.map((item, index) => RenderTabItem(index, item)) }) }), showButton &&
|
|
112
|
-
position.index + Number('2') < Object.keys(menuOffset).length && (_jsx("div", { className: `${classPrefix}-tabs__header-nav-right`, onClick: () => {
|
|
111
|
+
}, children: tabsDatas === null || tabsDatas === void 0 ? void 0 : tabsDatas.map((item, index) => RenderTabItem(index, item)) }) }), showButton && position.index + Number('2') < Object.keys(menuOffset).length && (_jsx("div", { className: `${classPrefix}-tabs__header-nav-right`, onClick: () => {
|
|
113
112
|
const result = menuPosition - menuOffset[position.index + Number('1')];
|
|
114
113
|
setMenuPosition(result);
|
|
115
114
|
setPosition({
|
package/dist/web/utils/tool.js
CHANGED
|
@@ -81,7 +81,7 @@ export const getFieldsTypeName = (fields) => {
|
|
|
81
81
|
else if (type === 'number' && format === 'time') {
|
|
82
82
|
item.fieldsTypeName = '时间';
|
|
83
83
|
}
|
|
84
|
-
else if (
|
|
84
|
+
else if (['string', 'array'].includes(type) && format === 'x-enum') {
|
|
85
85
|
item.fieldsTypeName = '枚举';
|
|
86
86
|
}
|
|
87
87
|
else if (type === 'object' && format === 'x-location') {
|
|
@@ -102,6 +102,9 @@ export const getFieldsTypeName = (fields) => {
|
|
|
102
102
|
else if (type === 'string' && format === 'related' && fatherAction === 'related') {
|
|
103
103
|
item.fieldsTypeName = '主子明细';
|
|
104
104
|
}
|
|
105
|
+
else if (type === 'string' && format === 'related') {
|
|
106
|
+
item.fieldsTypeName = '主子明细';
|
|
107
|
+
}
|
|
105
108
|
else if (type === 'string' && format === 'father-son') {
|
|
106
109
|
item.fieldsTypeName = '关联关系';
|
|
107
110
|
}
|
|
@@ -117,6 +120,21 @@ export const getFieldsTypeName = (fields) => {
|
|
|
117
120
|
else if (type === 'array' && format === 'one-many') {
|
|
118
121
|
item.fieldsTypeName = '一对多';
|
|
119
122
|
}
|
|
123
|
+
else if (format === 'many-one') {
|
|
124
|
+
item.fieldsTypeName = '多对一';
|
|
125
|
+
}
|
|
126
|
+
else if (format === 'one-one') {
|
|
127
|
+
item.fieldsTypeName = '一对一';
|
|
128
|
+
}
|
|
129
|
+
else if (format === 'many-many') {
|
|
130
|
+
item.fieldsTypeName = '多对多';
|
|
131
|
+
}
|
|
132
|
+
else if (format === 'one-many') {
|
|
133
|
+
item.fieldsTypeName = '一对多';
|
|
134
|
+
}
|
|
135
|
+
else if (type === 'string' && format === 'tel') {
|
|
136
|
+
item.fieldsTypeName = '电话';
|
|
137
|
+
}
|
|
120
138
|
return item;
|
|
121
139
|
});
|
|
122
140
|
};
|