@cloudbase/weda-ui 3.12.3 → 3.13.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/dist/configs/components/listView.js +19 -3
- package/dist/configs/components/wd-ad.d.ts +3 -0
- package/dist/configs/components/wd-ad.js +3 -3
- package/dist/configs/components/wd-side-tab.js +16 -1
- package/dist/configs/components/wd-store-home.d.ts +36 -0
- package/dist/configs/components/wd-store-home.js +38 -0
- package/dist/configs/components/wd-store-product.d.ts +106 -0
- package/dist/configs/components/wd-store-product.js +102 -0
- package/dist/configs/components/wd-table.js +1 -1
- package/dist/configs/index.d.ts +210 -0
- package/dist/configs/index.js +4 -0
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/index.d.ts +2 -0
- package/dist/web/components/index.js +2 -0
- package/dist/web/components/wd-ad/style/view.css +1 -1
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +13 -6
- package/dist/web/components/wd-select/select/selectUI.js +9 -10
- package/dist/web/components/wd-store-home/index.css +81 -0
- package/dist/web/components/wd-store-home/index.d.ts +8 -0
- package/dist/web/components/wd-store-home/index.js +6 -0
- package/dist/web/components/wd-store-home/style.d.ts +2 -0
- package/dist/web/components/wd-store-home/style.js +2 -0
- package/dist/web/components/wd-store-product/index.d.ts +8 -0
- package/dist/web/components/wd-store-product/index.js +7 -0
- package/dist/web/components/wd-store-product/style.d.ts +2 -0
- package/dist/web/components/wd-store-product/style.js +2 -0
- package/dist/web/components/wd-table/hooks/useChooseList.d.ts +1 -1
- package/dist/web/components/wd-table/hooks/useChooseList.js +5 -4
- package/dist/web/components/wd-tabs/util.js +2 -4
- package/package.json +3 -3
|
@@ -150,5 +150,7 @@ export { default as WdFormObj } from "./wd-form-obj";
|
|
|
150
150
|
export { default as WdFormArr } from "./wd-form-arr";
|
|
151
151
|
export { default as WdRating } from "./wd-rating";
|
|
152
152
|
export { default as WdCascader } from "./wd-cascader";
|
|
153
|
+
export { default as WdStoreHome } from "./wd-store-home";
|
|
154
|
+
export { default as WdStoreProduct } from "./wd-store-product";
|
|
153
155
|
export { default as FormDetail, default as WdFormDetail } from "./formdetail";
|
|
154
156
|
export { default as WdTagSelect, WdTag } from "./wd-tag";
|
|
@@ -211,3 +211,5 @@ export { default as WdFormObj } from './wd-form-obj';
|
|
|
211
211
|
export { default as WdFormArr } from './wd-form-arr';
|
|
212
212
|
export { default as WdRating } from './wd-rating';
|
|
213
213
|
export { default as WdCascader } from './wd-cascader';
|
|
214
|
+
export { default as WdStoreHome } from './wd-store-home';
|
|
215
|
+
export { default as WdStoreProduct } from './wd-store-product';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
3
3
|
import { useState, useImperativeHandle, useMemo, useEffect, useCallback } from 'react';
|
|
4
|
+
import { useDebouncedCallback } from '@react-hookz/web';
|
|
4
5
|
import { LoadingTip } from 'tea-component';
|
|
5
6
|
import { SelectUI as Select } from '../select/selectUI';
|
|
6
7
|
import { WdIcon } from '../../wd-icon';
|
|
@@ -48,7 +49,14 @@ const OptionText = ({ mode, option, selectFields, authFields, onChange, onRelati
|
|
|
48
49
|
const defaultSize = 50;
|
|
49
50
|
const defaultPage = 1;
|
|
50
51
|
export function RelationSelect(props) {
|
|
51
|
-
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const { placeholder, size, disabled, onChange, value, onSearch, addRelationButton, childRef, dataSourceName, selectFields, selectFieldType, primaryField, setRefreshStatus, mode, onRelationOptionJump, enableRelationOptionJump, listWidth = 700, } = props;
|
|
54
|
+
const selectFieldsLength = selectFieldType === 'custom' ? selectFields === null || selectFields === void 0 ? void 0 : selectFields.length : 0;
|
|
55
|
+
// 设置下拉列表与下拉按钮同宽
|
|
56
|
+
// 以传入为准,未传入,在自定义展示字段少于2个时设置为 true,否则设置为false,宽度设置为700,
|
|
57
|
+
const _matchButtonWidth = (_a = props === null || props === void 0 ? void 0 : props.matchButtonWidth) !== null && _a !== void 0 ? _a : selectFieldsLength < 2;
|
|
58
|
+
// 以传入为准,未传入,在不与按钮同宽度的情况下,listHeight 会被设置为 400
|
|
59
|
+
const _listHeight = (_b = props === null || props === void 0 ? void 0 : props.listHeight) !== null && _b !== void 0 ? _b : (_matchButtonWidth ? undefined : 400);
|
|
52
60
|
const { authFields } = useAuthFields({
|
|
53
61
|
dbName: dataSourceName,
|
|
54
62
|
dbFieldNames: [],
|
|
@@ -94,10 +102,10 @@ export function RelationSelect(props) {
|
|
|
94
102
|
options,
|
|
95
103
|
selectFields,
|
|
96
104
|
]);
|
|
97
|
-
const searchOptionListWithWhere =
|
|
105
|
+
const searchOptionListWithWhere = useDebouncedCallback((where = whereList) => {
|
|
98
106
|
empty();
|
|
99
107
|
setQuery({ ...query, pageNo: defaultPage, where });
|
|
100
|
-
}, [empty, query, setQuery, whereList]);
|
|
108
|
+
}, [empty, query, setQuery, whereList], 300);
|
|
101
109
|
useImperativeHandle(childRef, () => {
|
|
102
110
|
return {
|
|
103
111
|
refresh: async () => {
|
|
@@ -127,7 +135,7 @@ export function RelationSelect(props) {
|
|
|
127
135
|
searchOptionListWithWhere(where);
|
|
128
136
|
onSearch(keyword);
|
|
129
137
|
};
|
|
130
|
-
return (_jsx(EnumHoc, { fields: authFields, children: _jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, matchButtonWidth:
|
|
138
|
+
return (_jsx(EnumHoc, { fields: authFields, children: _jsx(Select, { ...props, overlayClassName: isRelationSelectOption ? 'wd-relation-select-overlay' : '', searchable: true, listWidth: listWidth, listHeight: _listHeight, matchButtonWidth: _matchButtonWidth, placeholder: placeholder, appearance: 'button', filter: () => true, size: size, disabled: disabled, autoClearSearchValue: true, options: customOptions, value: value, onChange: onChange, onSearch: searchHandle, tips: isLoading ? '' : undefined, bottomTips: isLoading ? _jsx(LoadingTip, {}) : undefined, onScrollBottom: () => {
|
|
131
139
|
if (!isLoading && customOptions.length < total) {
|
|
132
140
|
setQuery((query) => ({
|
|
133
141
|
...query,
|
|
@@ -182,7 +190,6 @@ export function CustomSelect(props) {
|
|
|
182
190
|
const { format, addRelationButtonText, enableAddRelationButton, events } = props;
|
|
183
191
|
const isEnumType = format === 'x-enum';
|
|
184
192
|
const [refreshStatus, setRefreshStatus] = useState(false);
|
|
185
|
-
const listWidth = 700;
|
|
186
193
|
const addRelationButton = enableAddRelationButton && (_jsxs("span", { className: "wd-add-relation-button-wrap", onClick: () => {
|
|
187
194
|
var _a;
|
|
188
195
|
(_a = events === null || events === void 0 ? void 0 : events.onAddRelationButtonClick) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
@@ -190,5 +197,5 @@ export function CustomSelect(props) {
|
|
|
190
197
|
if (refreshStatus) {
|
|
191
198
|
return _jsx(LoadingTip, {});
|
|
192
199
|
}
|
|
193
|
-
return isEnumType ? (_jsx(EnumSelect, { ...props, addRelationButton: addRelationButton, setRefreshStatus: setRefreshStatus
|
|
200
|
+
return isEnumType ? (_jsx(EnumSelect, { ...props, addRelationButton: addRelationButton, setRefreshStatus: setRefreshStatus })) : (_jsx(RelationSelect, { ...props, addRelationButton: addRelationButton, setRefreshStatus: setRefreshStatus }));
|
|
194
201
|
}
|
|
@@ -42,13 +42,13 @@ function SelectH5(props) {
|
|
|
42
42
|
// 聚焦在搜索框
|
|
43
43
|
const [inputFocus, setInputFocus] = useState(false);
|
|
44
44
|
const [searchValue, setSearchValue] = useState('');
|
|
45
|
-
const [isSearch, setIsSearch] = useState(
|
|
45
|
+
const [isSearch, setIsSearch] = useState(true);
|
|
46
46
|
const [currentSelected, setCurrentSelected] = useSyncValue(getSelectedItem(options, value), isObjectEqual);
|
|
47
47
|
const getOptionList = () => {
|
|
48
48
|
return options.filter((i) => String(i === null || i === void 0 ? void 0 : i.label).toLowerCase().includes(searchValue.toLowerCase()));
|
|
49
49
|
};
|
|
50
50
|
// 前端查询
|
|
51
|
-
const customOptions = isSearch ? getOptionList() : options;
|
|
51
|
+
const customOptions = isSearch && searchValue ? getOptionList() : options;
|
|
52
52
|
const handleZhStart = () => {
|
|
53
53
|
// 判断是否输入中文,则停止搜索
|
|
54
54
|
setIsSearch(false);
|
|
@@ -80,8 +80,7 @@ function SelectH5(props) {
|
|
|
80
80
|
};
|
|
81
81
|
const getInitOptions = () => {
|
|
82
82
|
setSearchValue('');
|
|
83
|
-
|
|
84
|
-
setCurrentSelected([]);
|
|
83
|
+
setCurrentSelected(getSelectedItem(options, value));
|
|
85
84
|
if (onOpen) {
|
|
86
85
|
onOpen();
|
|
87
86
|
}
|
|
@@ -117,8 +116,8 @@ function SelectH5(props) {
|
|
|
117
116
|
if (!isMultiple) {
|
|
118
117
|
// 单选直接关弹窗
|
|
119
118
|
onChange(item.value);
|
|
120
|
-
setVisible(false);
|
|
121
119
|
setCurrentSelected([item]);
|
|
120
|
+
setVisible(false);
|
|
122
121
|
}
|
|
123
122
|
else {
|
|
124
123
|
setCurrentSelected(dealSelectedItem(item));
|
|
@@ -138,7 +137,7 @@ function SelectH5(props) {
|
|
|
138
137
|
}, children: _jsx(OptionList, { onScrollBottom: onScrollBottom, options: customOptions, inputFocus: inputFocus, currentSelected: currentSelected, optionClick: optionClick, bottomTips: bottomTips }) }), footer] })) })] })] }));
|
|
139
138
|
}
|
|
140
139
|
export function SelectUI(props) {
|
|
141
|
-
const { placeholder, size, disabled, onChange, onSearch, searchable, options = [], value, footer, overlayClassName, onOpen, onScrollBottom, tips, bottomTips, mode, format, readOnly, setAllOption, listHeight, listWidth, popupContainer, searchPlaceholder = '搜索选项', } = props;
|
|
140
|
+
const { placeholder, size, disabled, onChange, onSearch, searchable, options = [], value, footer, overlayClassName, onOpen, onScrollBottom, tips, bottomTips, mode, format, readOnly, setAllOption, listHeight, listWidth, popupContainer, searchPlaceholder = '搜索选项', matchButtonWidth = true, ...restProps } = props;
|
|
142
141
|
const platform = usePlatform();
|
|
143
142
|
const [currentOption] = useSyncValue((options === null || options === void 0 ? void 0 : options.map(({ label, value }) => ({ label, value }))) || [], isObjectEqual);
|
|
144
143
|
// 更新option,从而更新最新的选项值
|
|
@@ -165,20 +164,20 @@ export function SelectUI(props) {
|
|
|
165
164
|
return _jsx(SelectH5, { ...props, readValue: readValue, searchPlaceholder: searchPlaceholder });
|
|
166
165
|
}
|
|
167
166
|
else if (mode === 'multiple') {
|
|
168
|
-
return (_jsx(SelectMultiple, { popupContainer: popupContainer, button: (selectedItem) => {
|
|
167
|
+
return (_jsx(SelectMultiple, { ...restProps, popupContainer: popupContainer, button: (selectedItem) => {
|
|
169
168
|
if (!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.length)) {
|
|
170
169
|
return _jsx("div", { className: "wedatea2td-text-weak", children: placeholder });
|
|
171
170
|
}
|
|
172
171
|
return selectedItem.map((i) => (i === null || i === void 0 ? void 0 : i.label) || i.value).join(',');
|
|
173
|
-
}, staging: false, overlayClassName: `${overlayClassName} multiple`, searchable: searchable, matchButtonWidth:
|
|
172
|
+
}, staging: false, overlayClassName: `${overlayClassName} multiple`, searchable: searchable, matchButtonWidth: matchButtonWidth, placeholder: placeholder, searchPlaceholder: searchPlaceholder, appearance: 'button', size: size, disabled: disabled, autoClearSearchValue: true, options: options === null || options === void 0 ? void 0 : options.map((i) => ({ ...i, text: i.text || i.label })), value: Array.isArray(value) ? value : [], onChange: onChange, onSearch: onSearch, footer: footer, onOpen: onOpen, onScrollBottom: onScrollBottom, bottomTips: bottomTips, tips: tips, listHeight: listHeight, listWidth: listWidth }));
|
|
174
173
|
}
|
|
175
174
|
else {
|
|
176
|
-
return (_jsx(Select, { popupContainer: popupContainer, button: (selectedItem) => {
|
|
175
|
+
return (_jsx(Select, { ...restProps, popupContainer: popupContainer, button: (selectedItem) => {
|
|
177
176
|
if (!selectedItem) {
|
|
178
177
|
return _jsx("div", { className: "wedatea2td-text-weak", children: placeholder });
|
|
179
178
|
}
|
|
180
179
|
return (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label) || (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value);
|
|
181
|
-
}, overlayClassName: overlayClassName, searchable: searchable, matchButtonWidth:
|
|
180
|
+
}, overlayClassName: overlayClassName, searchable: searchable, matchButtonWidth: matchButtonWidth, placeholder: placeholder, searchPlaceholder: searchPlaceholder, appearance: 'button', size: size, disabled: disabled, autoClearSearchValue: true, options: options === null || options === void 0 ? void 0 : options.map((i) => ({ ...i, text: i.text || i.label })), value: value, onChange: onChange, onSearch: onSearch, footer: footer, onOpen: onOpen, onScrollBottom: onScrollBottom, bottomTips: bottomTips, tips: tips, listHeight: listHeight, listWidth: listWidth }));
|
|
182
181
|
}
|
|
183
182
|
};
|
|
184
183
|
return (_jsx(WdFormItemReadOnly, { after: props.after, before: props.before, onRelationTagClick: props.onRelationTagClick, readBeforeAfter: true, readOnly: readOnly, readValue: readValue, format: format, value: value, version: 'wd', children: _jsx("div", { "data-testid": isMultiple ? 'form-item-select-multiple-pc' : 'form-select', className: isMultiple ? 'form-select-multiple-pc' : 'form-select-pc', children: render() }) }));
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.wd-store-home__wrap {
|
|
2
|
+
width: 320px;
|
|
3
|
+
background-color: #fff;
|
|
4
|
+
border: 1px solid #f2f2f2;
|
|
5
|
+
border-radius: 2px;
|
|
6
|
+
padding: 15px 15px 0 15px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wd-store-home__content {
|
|
10
|
+
display: flex;
|
|
11
|
+
margin-bottom: 15px;
|
|
12
|
+
}
|
|
13
|
+
.wd-store-home__title {
|
|
14
|
+
margin-bottom: 5px;
|
|
15
|
+
font-size: 18px;
|
|
16
|
+
font-weight: bold;
|
|
17
|
+
}
|
|
18
|
+
.wd-store-home__label {
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
color: rgba(0, 0, 0, 0.4);
|
|
21
|
+
}
|
|
22
|
+
.wd-store-home__img {
|
|
23
|
+
height: 54px;
|
|
24
|
+
width: 54px;
|
|
25
|
+
border-radius: 100%;
|
|
26
|
+
margin-right: 15px;
|
|
27
|
+
}
|
|
28
|
+
.wd-store-home__footer {
|
|
29
|
+
border-top: 1px solid #f2f2f2;
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
padding: 5px 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
color: #b7b7b7;
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
}
|
|
36
|
+
.wd-store-home__icon {
|
|
37
|
+
background-image: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0iMjYiIGhlaWdodD0iMjYiIHZpZXdCb3g9IjAgMCAyNiAyNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIzLjgzMzIgMTAuNjQ0OUMyMy44MzMyIDEyLjAzOCAyMi42ODA1IDEzLjIxMDIgMjEuMTI3IDEzLjUzNTJDMjAuODQ5NyAxMy41OTM3IDIwLjU1NzIgMTMuNjI0IDIwLjI1ODIgMTMuNjI0QzE5Ljg1OTUgMTMuNjI0IDE5LjQ3NiAxMy41Njk5IDE5LjExNjMgMTMuNDY4QzE4LjAxMTMgMTMuMTU2IDE3LjE0NjggMTIuNDA2NCAxNi44MjE4IDExLjQ2ODJDMTYuNzkxNSAxMS4zODE1IDE2Ljc2NzcgMTEuMjkyNyAxNi43NDgyIDExLjIwMzlDMTYuNzI2NSAxMS4yNjY3IDE2LjcwMjcgMTEuMzI5NSAxNi42NzQ1IDExLjM5MjRDMTYuMTMyOCAxMi42NDY5IDE0LjY4OTggMTMuNTQ4MiAxMi45OTk4IDEzLjU0ODJDMTEuMzA5OCAxMy41NDgyIDkuODY2ODQgMTIuNjQ2OSA5LjMyMyAxMS4zOTI0QzkuMjk5MTcgMTEuMzMxNyA5LjI3MzE3IDExLjI3MSA5LjI1MzY3IDExLjIwODJDOS4yMzQxNyAxMS4yOTQ5IDkuMjEwMzQgMTEuMzgxNSA5LjE4IDExLjQ2NkM4Ljg1OTM0IDEyLjQxMjkgNy45ODgzNCAxMy4xNjY5IDYuODc2ODQgMTMuNDc4OUM2LjUyMTUgMTMuNTc4NSA2LjEzOCAxMy42MzI3IDUuNzQxNSAxMy42MzI3QzUuNDQwMzQgMTMuNjMyNyA1LjE1IDEzLjYwMjQgNC44NzA1IDEzLjU0MzlDMy4zMTkxNyAxMy4yMTY3IDIuMTY2NSAxMi4wNDQ1IDIuMTY2NSAxMC42NTM1QzIuMTY2NSAxMC4yODk1IDIuMjQ0NSA5Ljk0MDcxIDIuMzg5NjcgOS42MTc4N0wyLjM5NCA5LjYwNzA0TDQuNjEyNjcgNC42MzQ1NEM1LjExOTY3IDMuNDk5MjEgNi4yNTcxNyAyLjcwODM3IDcuNTgxIDIuNzA4MzdIMTguNDE0M0MxOS43MzYgMi43MDgzNyAyMC44NzM1IDMuNDk5MjEgMjEuMzgwNSA0LjYzMjM3QzIxLjM5MTMgNC42NTE4NyAyMS40IDQuNjcxMzcgMjEuNDA4NyA0LjY5MzA0TDIzLjYwNzggOS42MDQ4N0MyMy43NTA4IDkuOTI3NzEgMjMuODMxIDEwLjI3ODcgMjMuODMxIDEwLjY0NDlIMjMuODMzMloiIGZpbGw9IiNiN2I3YjciLz4KPHBhdGggZD0iTTIxLjY0MDcgMTYuNTc1QzIxLjY0MDcgMTYuNTk2NyAyMS42NDA3IDE2LjYyMDUgMjEuNjM2NCAxNi42NDIyQzIxLjYzNjQgMTYuNjU3NCAyMS42MzY0IDE2LjY3NDcgMjEuNjMyIDE2LjY4OTlWMTYuNjk4NUMyMS4yNDIgMjAuMzk0OSAxNy41MjYyIDIzLjI5MTcgMTMgMjMuMjkxN0M4LjQ3Mzg4IDIzLjI5MTcgNC43NTgwNCAyMC4zOTQ5IDQuMzY4MDQgMTYuNjk4NVYxNi42ODk5QzQuMzYzNzEgMTYuNjc0NyA0LjM2MzcxIDE2LjY1NzQgNC4zNjM3MSAxNi42NDIyQzQuMzU5MzcgMTYuNjIwNSA0LjM1OTM4IDE2LjU5NjcgNC4zNTkzOCAxNi41NzVDNC4zNTkzOCAxNi4wOTYyIDQuNzQ3MjEgMTUuNzA4NCA1LjIyNjA0IDE1LjcwODRDNS42NjgwNCAxNS43MDg0IDYuMDMyMDQgMTYuMDM5OSA2LjA4NjIxIDE2LjQ2NjdDNi4wODgzNyAxNi40Nzk3IDYuMDg4MzcgMTYuNDk0OSA2LjA5MDU0IDE2LjUxQzYuMzgzMDQgMTkuMzMzMiA5LjM2ODcxIDIxLjU1ODQgMTMgMjEuNTU4NEMxNi42MzE0IDIxLjU1ODQgMTkuNjE3IDE5LjMzMzIgMTkuOTA5NSAxNi41MUMxOS45MDk1IDE2LjQ5NDkgMTkuOTA5NSAxNi40Nzk3IDE5LjkxMzkgMTYuNDY2N0MxOS45NjggMTYuMDM5OSAyMC4zMzIgMTUuNzA4NCAyMC43NzQgMTUuNzA4NEMyMS4yNTI5IDE1LjcwODQgMjEuNjQwNyAxNi4wOTYyIDIxLjY0MDcgMTYuNTc1WiIgZmlsbD0iI2I3YjdiNyIvPgo8L3N2Zz4K);
|
|
38
|
+
background-repeat: no-repeat;
|
|
39
|
+
background-position: center;
|
|
40
|
+
background-size: cover;
|
|
41
|
+
width: 20px;
|
|
42
|
+
height: 20px;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
margin-right: 5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* 微信商品 */
|
|
48
|
+
.wd-store-product__wrap {
|
|
49
|
+
background-color: #fafafa;
|
|
50
|
+
border-radius: 15px;
|
|
51
|
+
padding: 15px 15px 0 15px;
|
|
52
|
+
}
|
|
53
|
+
.wd-store-product__img {
|
|
54
|
+
width: 30%;
|
|
55
|
+
margin-right: 15px;
|
|
56
|
+
}
|
|
57
|
+
.wd-store-product__text {
|
|
58
|
+
flex: 1;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
}
|
|
63
|
+
.wd-store-product__text__footer {
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
align-items: end;
|
|
67
|
+
margin-top: 20px;
|
|
68
|
+
color: #fc6346;
|
|
69
|
+
}
|
|
70
|
+
.wd-store-product__text .wd-store-home__label {
|
|
71
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
72
|
+
border-radius: 3px;
|
|
73
|
+
color: rgba(0, 0, 0, 0.4);
|
|
74
|
+
padding: 5px;
|
|
75
|
+
}
|
|
76
|
+
.wd-store-product__text__footer .wd-btn {
|
|
77
|
+
--wd-btn-color-brand: #fc6346;
|
|
78
|
+
--wd-btn-color-brand-hover: #fc6346;
|
|
79
|
+
--wd-btn-color-brand-active: #fc6346;
|
|
80
|
+
--wd-btn-color-brand-focus: #fc6346;
|
|
81
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
|
+
import type { DataType } from '../../../configs/components/wd-store-home';
|
|
4
|
+
import './style';
|
|
5
|
+
export type PropsType = CommonPropsType;
|
|
6
|
+
export default function WdStoreHome(): JSX.Element;
|
|
7
|
+
export interface WdStoreHomeProps extends CommonPropsType, DataType {
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider, Bubble } from 'tea-component';
|
|
3
|
+
import './style';
|
|
4
|
+
export default function WdStoreHome() {
|
|
5
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), _jsx("a", { href: "https://developers.weixin.qq.com/miniprogram/dev/component/store-home.html", target: "_blank", rel: "noreferrer", children: "\u67E5\u770B\u8BF4\u660E" })] }), children: _jsxs("div", { className: "wd-store-home__wrap", children: [_jsxs("div", { className: "wd-store-home__content", children: [_jsx("img", { className: "wd-store-home__img", src: "https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg", alt: "" }), _jsxs("div", { children: [_jsx("p", { className: "wd-store-home__title", children: "\u5C0F\u5E97\u540D\u79F0" }), _jsx("p", { className: "wd-store-home__label", children: "\u5C0F\u5E97\u7B80\u4ECB" })] })] }), _jsxs("div", { className: "wd-store-home__footer", children: [_jsx("i", { className: "wd-store-home__icon" }), "\u5C0F\u5E97\u540D\u79F0"] })] }) }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
|
+
import type { DataType } from '../../../configs/components/wd-store-product';
|
|
4
|
+
import './style';
|
|
5
|
+
export type PropsType = CommonPropsType;
|
|
6
|
+
export default function WdStoreProduct(): JSX.Element;
|
|
7
|
+
export interface WdStoreProductProps extends CommonPropsType, DataType {
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider, Bubble } from 'tea-component';
|
|
3
|
+
import './style';
|
|
4
|
+
import WdButton from '../wd-button';
|
|
5
|
+
export default function WdStoreProduct() {
|
|
6
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: _jsxs(_Fragment, { children: ["\u8BE5\u7EC4\u4EF6\u5FC5\u987B\u5728\u5C0F\u7A0B\u5E8F\u771F\u5B9E\u73AF\u5883\u4F7F\u7528\u624D\u80FD\u591F\u770B\u5230\u5B9E\u9645\u6548\u679C\u3002", _jsx("br", {}), _jsx("a", { href: "https://developers.weixin.qq.com/miniprogram/dev/component/store-product.html", target: "_blank", rel: "noreferrer", children: "\u67E5\u770B\u8BF4\u660E" })] }), children: _jsxs("div", { className: "wd-store-product__wrap", children: [_jsxs("div", { className: "wd-store-home__content", children: [_jsx("img", { className: "wd-store-product__img", src: "https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg", alt: "" }), _jsxs("div", { className: "wd-store-product__text", children: [_jsxs("div", { children: [_jsx("p", { className: "wd-store-home__title", children: "\u5546\u54C1\u540D\u79F0" }), _jsx("span", { className: "wd-store-home__label", children: "\u5546\u54C1\u6807\u7B7E" })] }), _jsxs("div", { className: "wd-store-product__text__footer", children: [_jsx("p", { className: "price", children: "\u00A5\u4EF7\u683C \u8D77" }), " ", _jsx(WdButton, { text: "\u8D2D\u4E70" })] })] })] }), _jsxs("div", { className: "wd-store-home__footer", children: [_jsx("i", { className: "wd-store-home__icon" }), "\u5C0F\u5E97\u540D\u79F0"] })] }) }) }));
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const getDataBaseInfo: (fields: any, format: any, childDbName: any) => any;
|
|
2
2
|
export declare const mapResult: (records: any, primaryColumn: any) => any;
|
|
3
|
-
export declare const useChooseList: ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value
|
|
3
|
+
export declare const useChooseList: ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value }: {
|
|
4
4
|
dataSourceAPI: any;
|
|
5
5
|
queryParams: any;
|
|
6
6
|
childDbName: any;
|
|
@@ -35,20 +35,21 @@ export const getDataBaseInfo = (fields, format, childDbName) => {
|
|
|
35
35
|
};
|
|
36
36
|
export const mapResult = (records, primaryColumn) => {
|
|
37
37
|
return records === null || records === void 0 ? void 0 : records.map((childItem) => ({
|
|
38
|
+
_id: childItem._id,
|
|
38
39
|
value: childItem._id,
|
|
39
40
|
text: childItem[primaryColumn] ? childItem[primaryColumn] : childItem._id,
|
|
40
41
|
label: childItem[primaryColumn] ? childItem[primaryColumn] : childItem._id,
|
|
41
42
|
extra: childItem,
|
|
42
43
|
}));
|
|
43
44
|
};
|
|
44
|
-
export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value
|
|
45
|
+
export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value }) => {
|
|
45
46
|
const [option, setOption] = useState([]);
|
|
46
47
|
const [total, setTotal] = useState(0);
|
|
47
48
|
const [loading, setLoading] = useState(true);
|
|
48
|
-
const unshiftVal = (transformedRecords, itemResult) => {
|
|
49
|
+
const unshiftVal = (transformedRecords, itemResult, originOption) => {
|
|
49
50
|
if (itemResult &&
|
|
50
51
|
transformedRecords.findIndex((item) => item._id === itemResult._id) < 0 &&
|
|
51
|
-
|
|
52
|
+
originOption.findIndex((item) => item._id === itemResult._id) < 0) {
|
|
52
53
|
return [itemResult, ...transformedRecords];
|
|
53
54
|
}
|
|
54
55
|
return transformedRecords;
|
|
@@ -83,7 +84,7 @@ export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primary
|
|
|
83
84
|
// 若下拉列表中无选中值,则将选中值插到数组头部
|
|
84
85
|
if ((isMultiple && (value === null || value === void 0 ? void 0 : value.length)) || value) {
|
|
85
86
|
itemResult.forEach((i) => {
|
|
86
|
-
transformedRecords = unshiftVal(transformedRecords, i);
|
|
87
|
+
transformedRecords = unshiftVal(transformedRecords, i, option);
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
let optionRes = mapResult(transformedRecords, primaryColumn);
|
|
@@ -10,12 +10,10 @@ export const renderSlot = (props) => {
|
|
|
10
10
|
const { tabsDatas, selectedTab, isMultipleSlot } = props;
|
|
11
11
|
if (props.isSlotAuto) {
|
|
12
12
|
const slot = getSlots(props);
|
|
13
|
-
const slotKey = (
|
|
13
|
+
const slotKey = isMultipleSlot ? (_a = tabsDatas[selectedTab]) === null || _a === void 0 ? void 0 : _a.slotKey : '1';
|
|
14
14
|
return slot[`${TAB_SLOT_PREFIX}_${slotKey}`];
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
return isMultipleSlot
|
|
18
|
-
? props[`panel${selectedTab + Number('1')}`]
|
|
19
|
-
: props[`panel1`];
|
|
17
|
+
return isMultipleSlot ? props[`panel${selectedTab + Number('1')}`] : props[`panel1`];
|
|
20
18
|
}
|
|
21
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -148,8 +148,8 @@
|
|
|
148
148
|
"@babel/preset-react": "^7.22.15",
|
|
149
149
|
"@babel/preset-typescript": "^7.22.15",
|
|
150
150
|
"@cloudbase/cals": "^1.2.5",
|
|
151
|
-
"@cloudbase/lowcode-cli": "^0.
|
|
152
|
-
"@cloudbase/weda-cloud-sdk": "^1.0.
|
|
151
|
+
"@cloudbase/lowcode-cli": "^0.22.0",
|
|
152
|
+
"@cloudbase/weda-cloud-sdk": "^1.0.94",
|
|
153
153
|
"@commitlint/cli": "^16.0.2",
|
|
154
154
|
"@commitlint/config-conventional": "^17.7.0",
|
|
155
155
|
"@craco/craco": "^7.1.0",
|