@cloudbase/weda-ui 3.11.1 → 3.11.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/style/index.css +2 -2
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/wd-markdown/github-markdown-light.css +1 -1
- package/dist/web/components/wd-select/select/selectUI.js +3 -3
- package/dist/web/components/wd-select/style.d.ts +1 -0
- package/dist/web/components/wd-select/style.js +1 -0
- package/dist/web/components/wd-select/wd-select.css +1 -1
- package/dist/web/components/wd-select-multiple/wd-select-multiple.css +9 -0
- package/dist/web/components/wd-tabs/tabs-h5.js +13 -3
- package/dist/web/components/wd-textarea/wd-textarea.js +3 -6
- package/package.json +3 -3
|
@@ -31,7 +31,7 @@ const getSelectedItem = (options = [], value) => {
|
|
|
31
31
|
return options === null || options === void 0 ? void 0 : options.filter((i) => selectedVal.find((j) => j === i.value));
|
|
32
32
|
};
|
|
33
33
|
function SelectH5(props) {
|
|
34
|
-
const { placeholder, name, disabled, footer, options, value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, } = props;
|
|
34
|
+
const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, } = props;
|
|
35
35
|
const isMultiple = mode === 'multiple';
|
|
36
36
|
const customPickerCls = classNames('weda-ui-custom-picker__cloumns', {
|
|
37
37
|
'weda-ui-custom-picker__cloumns--select-multiple': isMultiple,
|
|
@@ -136,14 +136,14 @@ function SelectH5(props) {
|
|
|
136
136
|
else {
|
|
137
137
|
setVisible(false);
|
|
138
138
|
}
|
|
139
|
-
}, onOk: handleOk, header: inputFocus, className: `${classPrefix}-cascader-modal`, okButtonVisible: isMultiple, popupContainer: popupContainer, children: [searchable && renderSearch(), _jsx("div", { className: `${classPrefix}-custom-view-content`, children: !bottomTips && !customOptions.length ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsxs("div", { children: [_jsx("div", { className: customPickerCls, "data-testid": "weda-ui-custom-picker__cloumns", style: {
|
|
139
|
+
}, onOk: handleOk, header: inputFocus, className: `${classPrefix}-cascader-modal`, okButtonVisible: isMultiple, popupContainer: popupContainer, children: [searchable && renderSearch(), _jsx("div", { className: `${classPrefix}-custom-view-content`, children: !bottomTips && !(customOptions === null || customOptions === void 0 ? void 0 : customOptions.length) ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsxs("div", { children: [_jsx("div", { className: customPickerCls, "data-testid": "weda-ui-custom-picker__cloumns", style: {
|
|
140
140
|
height: inputFocus ? 'calc(100vh - 160px)' : '280px',
|
|
141
141
|
}, children: _jsx(OptionList, { onScrollBottom: onScrollBottom, options: customOptions, inputFocus: inputFocus, currentSelected: currentSelected, optionClick: optionClick, bottomTips: bottomTips }) }), footer] })) })] })] }));
|
|
142
142
|
}
|
|
143
143
|
export function SelectUI(props) {
|
|
144
144
|
const { placeholder, size, disabled, onChange, onSearch, searchable, options, value, footer, overlayClassName, onOpen, onScrollBottom, tips, bottomTips, mode, format, readOnly, setAllOption, listHeight, listWidth, popupContainer, searchPlaceholder = '搜索选项', } = props;
|
|
145
145
|
const platform = usePlatform();
|
|
146
|
-
const [currentOption] = useSyncValue(options.map(({ label, value }) => ({ label, value })), isObjectEqual);
|
|
146
|
+
const [currentOption] = useSyncValue((options === null || options === void 0 ? void 0 : options.map(({ label, value }) => ({ label, value }))) || [], isObjectEqual);
|
|
147
147
|
// 更新option,从而更新最新的选项值
|
|
148
148
|
useEffect(() => {
|
|
149
149
|
if (setAllOption) {
|
|
@@ -116,4 +116,13 @@
|
|
|
116
116
|
text-overflow: ellipsis;
|
|
117
117
|
white-space: nowrap;
|
|
118
118
|
margin-left: 30px;
|
|
119
|
+
margin-right: 0;
|
|
120
|
+
}
|
|
121
|
+
.weda-ui-custom-picker__cloumns--select-multiple.weda-ui-custom-picker__cloumns
|
|
122
|
+
.weda-ui-custom-picker__cloumn-item-text {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
margin-left: 30px;
|
|
127
|
+
margin-right: 0;
|
|
119
128
|
}
|
|
@@ -12,6 +12,7 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
12
12
|
const [showMask, setShowMask] = useState(true);
|
|
13
13
|
const [itemOffset, setItemOffset] = useState(0);
|
|
14
14
|
const [itemOffsetData, setItemOffsetData] = useState(new Map());
|
|
15
|
+
const [showRightMask, setShowRightMask] = useState(true);
|
|
15
16
|
const [selectedTab, setSelectedTab] = useState(selectedIndex);
|
|
16
17
|
const navWrapRef = useRef();
|
|
17
18
|
const platform = usePlatform();
|
|
@@ -40,9 +41,11 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
40
41
|
});
|
|
41
42
|
itemIndex = itemIndex + Number('1');
|
|
42
43
|
}
|
|
44
|
+
// 计算右侧是否显示遮罩
|
|
45
|
+
const paddingWidth = 16;
|
|
43
46
|
const showMask = itemData.get(menuItem.length)['offset'] +
|
|
44
47
|
itemData.get(menuItem.length)['clientWidth'] >
|
|
45
|
-
parentWidth;
|
|
48
|
+
parentWidth + paddingWidth;
|
|
46
49
|
setShowMask(showMask);
|
|
47
50
|
setItemOffsetData(itemData);
|
|
48
51
|
}, [navWrapRef]);
|
|
@@ -94,8 +97,15 @@ export const WdTabsH5 = ({ isMultipleSlot, tabsDatas, selectedIndex, ...restProp
|
|
|
94
97
|
}, 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] }));
|
|
95
98
|
};
|
|
96
99
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: `${classPrefix}-tabs__header`, children: _jsxs("div", { className: `${classPrefix}-tabs__header-item-wrap `, children: [_jsx("div", { ref: navWrapRef, className: `${classPrefix}-tabs__header-item-content`, onScroll: (event) => {
|
|
97
|
-
var _a;
|
|
100
|
+
var _a, _b, _c, _d, _e;
|
|
98
101
|
//滚动条高度
|
|
99
102
|
setItemOffset((_a = event === null || event === void 0 ? void 0 : event.currentTarget) === null || _a === void 0 ? void 0 : _a.scrollLeft);
|
|
100
|
-
|
|
103
|
+
if (restProps.direction !== 'vertical') {
|
|
104
|
+
const parentWidth = (_c = (_b = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.offsetWidth;
|
|
105
|
+
const scrollLeft = (_d = event === null || event === void 0 ? void 0 : event.currentTarget) === null || _d === void 0 ? void 0 : _d.scrollLeft;
|
|
106
|
+
const scrollWidth = (_e = event === null || event === void 0 ? void 0 : event.currentTarget) === null || _e === void 0 ? void 0 : _e.scrollWidth;
|
|
107
|
+
const showRightMask = Math.round(scrollLeft + parentWidth) < scrollWidth;
|
|
108
|
+
setShowRightMask(showRightMask);
|
|
109
|
+
}
|
|
110
|
+
}, children: tabsDatas === null || tabsDatas === void 0 ? void 0 : tabsDatas.map((item, index) => RenderTabItem(index, item)) }), showMask && restProps.direction !== 'vertical' && (_jsx("div", { className: `${classPrefix}-tabs__header-item-mask`, style: { opacity: `${showRightMask ? '1' : '0'}` } }))] }) }), _jsx("div", { className: `${classPrefix}-tabs__body`, children: _jsx("div", { className: `${classPrefix}-tabs__body-content`, children: renderSlot({ ...restProps, selectedTab, tabsDatas, isMultipleSlot }) }) })] }));
|
|
101
111
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useImperativeHandle, useRef, useState, useMemo, useEffect, } from 'react';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
|
+
import { KEY_DOWN_CODE } from '../../utils/constant';
|
|
4
5
|
import { useConfig } from '../../utils/config-context';
|
|
5
6
|
import { WdFormItem } from '../wd-form-item';
|
|
6
7
|
import { useFormInputTrait } from '../form-input-hooks';
|
|
@@ -89,12 +90,8 @@ export const WdTextarea = forwardRef(function WdTextarea(props, ref) {
|
|
|
89
90
|
};
|
|
90
91
|
const handleKeyDown = (e) => {
|
|
91
92
|
var _a;
|
|
92
|
-
if (e.key === 'Enter'
|
|
93
|
-
|
|
94
|
-
if (!e.target.isComposing) {
|
|
95
|
-
e.preventDefault();
|
|
96
|
-
(_a = events.confirm) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
97
|
-
}
|
|
93
|
+
if (e.key === 'Enter' || e.keyCode === KEY_DOWN_CODE) {
|
|
94
|
+
(_a = events.confirm) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
98
95
|
}
|
|
99
96
|
};
|
|
100
97
|
/** widgets */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.4",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"description": "腾讯云微搭低代码组件库模板",
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@antv/g6": "^4.8.5",
|
|
88
|
-
"@cloudbase/weda-client": "^1.1.
|
|
88
|
+
"@cloudbase/weda-client": "^1.1.9",
|
|
89
89
|
"@codemirror/autocomplete": "^6.16.0",
|
|
90
90
|
"@codemirror/lang-javascript": "^6.2.2",
|
|
91
91
|
"@codemirror/lang-json": "^6.0.1",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@babel/preset-env": "^7.22.15",
|
|
148
148
|
"@babel/preset-react": "^7.22.15",
|
|
149
149
|
"@babel/preset-typescript": "^7.22.15",
|
|
150
|
-
"@cloudbase/cals": "^1.2.
|
|
150
|
+
"@cloudbase/cals": "^1.2.5",
|
|
151
151
|
"@cloudbase/lowcode-cli": "^0.21.13",
|
|
152
152
|
"@cloudbase/weda-cloud-sdk": "^1.0.87",
|
|
153
153
|
"@commitlint/cli": "^16.0.2",
|