@cloudbase/weda-ui 3.30.0 → 3.30.1
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/type-utils/type-form.js +2 -2
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +2 -2
- package/dist/web/components/wd-form/hooks/use-auth-value.d.ts +1 -0
- package/dist/web/components/wd-form/hooks/use-auth-value.js +3 -1
- package/dist/web/components/wd-form/index.js +35 -1
- package/dist/web/components/wd-input-phone/wd-input-phone.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +4 -2
- package/dist/web/components/wd-table/components/FilterFieldsPanel/index.js +17 -4
- package/package.json +4 -2
|
@@ -138,7 +138,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
138
138
|
isEdit,
|
|
139
139
|
events,
|
|
140
140
|
fileSizeObj,
|
|
141
|
-
}, children: _jsx("div", { "data-testid": "uploadFileH5", className: cls, id: id, style: style, children: _jsxs("div", { className: classNames(`${CLASS_PREFIX}`), children: [isEdit && (_jsx("div", { className: classNames(`${CLASS_PREFIX}__hd`, layout), children: _jsx("div", { children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { variant: "outline",
|
|
141
|
+
}, children: _jsx("div", { "data-testid": "uploadFileH5", className: cls, id: id, style: style, children: _jsxs("div", { className: classNames(`${CLASS_PREFIX}`), children: [isEdit && (_jsx("div", { className: classNames(`${CLASS_PREFIX}__hd`, layout), children: _jsx("div", { children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { variant: "outline", disabled: btnDisabled, text: uploadBtnTitle, size: "sm" }))) : (_jsxs("div", { children: [_jsx("input", { ref: inputRef, id: "uploaderInput", type: "file", "data-testid": "button-up", className: "weui-uploader-mobile__input", accept: accepts.join(','), multiple: !single, onClick: () => {
|
|
142
142
|
inputRef.current && (inputRef.current.value = '');
|
|
143
143
|
}, onChange: async (e) => {
|
|
144
144
|
let fileList = [...e.target.files];
|
|
@@ -210,7 +210,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
210
210
|
}
|
|
211
211
|
fileList.forEach((f) => (f['_uuid'] = randomStr()));
|
|
212
212
|
setFileList((list) => [...list, ...fileList]);
|
|
213
|
-
} }), _jsx(WdButton, { variant: "outline",
|
|
213
|
+
} }), _jsx(WdButton, { variant: "outline", text: uploadBtnTitle, size: "sm" }), !single && _jsx(Text, { className: `${CLASS_PREFIX}__tips`, children: uploadSupportText })] })) }) })), _jsx("div", { className: `${CLASS_PREFIX}__bd`, children: _jsxs(List, { children: [fileIDList.map((d) => (_jsx(List.Item, { children: _jsx(TcbFileEcho, { fileID: d, fileList: fileList, onChange: handleChange, disabled: disabled, deleteVisible: deleteVisible, downloadVisible: downloadVisible, formType: formType }) }, d))), fileList.map((item) => (_jsx(List.Item, { children: _jsx(TcbFileUpload, { id: id, disabled: disabled, file: item, downloadVisible: downloadVisible, deleteVisible: deleteVisible && !disabled, formType: formType }) }, item === null || item === void 0 ? void 0 : item._uuid)))] }) })] }) }) }) }))({
|
|
214
214
|
id,
|
|
215
215
|
className: cls,
|
|
216
216
|
style,
|
|
@@ -26,10 +26,12 @@ export function useAuthValue({ isDataModel, dataSourceName, }) {
|
|
|
26
26
|
return authValue;
|
|
27
27
|
}
|
|
28
28
|
export const createSetStateForAuth = (setters) => {
|
|
29
|
-
const { setReadOnly, setVisible } = setters;
|
|
29
|
+
const { setReadOnly, setVisible, unregister } = setters;
|
|
30
30
|
return (value) => {
|
|
31
31
|
if (value === 'n') {
|
|
32
32
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
33
|
+
// 无权限时取消注册,从表单容器移除
|
|
34
|
+
unregister === null || unregister === void 0 ? void 0 : unregister();
|
|
33
35
|
}
|
|
34
36
|
else if (value === 'r') {
|
|
35
37
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(true);
|
|
@@ -266,9 +266,43 @@ const WdForm = withFormContainer(React.forwardRef(function WdForm(props, ref) {
|
|
|
266
266
|
try {
|
|
267
267
|
formsItemMap.forEach((items, name) => {
|
|
268
268
|
items.forEach((item) => {
|
|
269
|
+
// 创建取消注册的回调
|
|
270
|
+
const unregister = () => {
|
|
271
|
+
// 从 formsItemMap 中移除该表单项
|
|
272
|
+
const currentItems = formsItemMap.get(name);
|
|
273
|
+
if (currentItems) {
|
|
274
|
+
const removedArr = currentItems.filter((i) => i !== item);
|
|
275
|
+
if (removedArr.length <= 0) {
|
|
276
|
+
formsItemMap.delete(name);
|
|
277
|
+
setFormItemMapList((list) => list.filter((n) => n !== name));
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
formsItemMap.set(name, removedArr);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// 从表单值中移除该字段
|
|
284
|
+
setFormFieldsValue((prev) => {
|
|
285
|
+
if (prev && name in prev) {
|
|
286
|
+
const next = { ...prev };
|
|
287
|
+
delete next[name];
|
|
288
|
+
return next;
|
|
289
|
+
}
|
|
290
|
+
return prev;
|
|
291
|
+
});
|
|
292
|
+
// 从初始值缓存中移除该字段
|
|
293
|
+
setFieldInitValueCache((prev) => {
|
|
294
|
+
if (prev && name in prev) {
|
|
295
|
+
const next = { ...prev };
|
|
296
|
+
delete next[name];
|
|
297
|
+
return next;
|
|
298
|
+
}
|
|
299
|
+
return prev;
|
|
300
|
+
});
|
|
301
|
+
};
|
|
269
302
|
const setStateForAuth = createSetStateForAuth({
|
|
270
303
|
setVisible: item.setVisible,
|
|
271
304
|
setReadOnly: item.setReadOnly,
|
|
305
|
+
unregister,
|
|
272
306
|
});
|
|
273
307
|
if (!isDataModel) {
|
|
274
308
|
// 非模型数据源
|
|
@@ -313,7 +347,7 @@ const WdForm = withFormContainer(React.forwardRef(function WdForm(props, ref) {
|
|
|
313
347
|
}
|
|
314
348
|
},
|
|
315
349
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
316
|
-
[formsItemMap]);
|
|
350
|
+
[formsItemMap, setFormFieldsValue]);
|
|
317
351
|
const { data: formInitValueToSet } = useInitValueFromRemote(datasourceType, dataSourceProfile, fetchedInitialValues);
|
|
318
352
|
useEffect(() => {
|
|
319
353
|
if (initValueLoadingStatus !== 'done' || !fetchedInitialValues)
|
|
@@ -10,5 +10,5 @@ export const WdInputPhone = forwardRef(function WdInputPhone(props, ref) {
|
|
|
10
10
|
const { classPrefix } = useConfig();
|
|
11
11
|
const wrapCls = `${classPrefix}-form-input-number-wrap `;
|
|
12
12
|
const pattern = /^[()\d\s+\-ext]{0,20}$/;
|
|
13
|
-
return (_jsx(WdInput, { ...props, inputPattern: pattern, maxLength: 20, wrapClassName: wrapCls, classRoot: "input-phone", rules: rules, ref: ref }));
|
|
13
|
+
return (_jsx(WdInput, { ...props, inputPattern: pattern, maxLength: 20, wrapClassName: wrapCls, classRoot: "input-phone", rules: rules, ref: ref, type: "number" }));
|
|
14
14
|
});
|
|
@@ -965,13 +965,15 @@ export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEn
|
|
|
965
965
|
supportManyRelated,
|
|
966
966
|
showRelationWithTag,
|
|
967
967
|
});
|
|
968
|
-
|
|
968
|
+
//[权限过滤] 过滤 columnSets,只保留 defaultColumns 中存在的 key
|
|
969
|
+
const defaultColumnKeys = new Set(defaultColumns.map((col) => col.key));
|
|
970
|
+
let fixedColumnSets = columnSets.filter((col) => defaultColumnKeys.has(col.key));
|
|
969
971
|
// h5端不冻结
|
|
970
972
|
if (!isH5) {
|
|
971
973
|
fixedColumnSets = getFixedColumnSets({
|
|
972
974
|
fixedFront,
|
|
973
975
|
fixedEnd,
|
|
974
|
-
columnSets,
|
|
976
|
+
columnSets: fixedColumnSets,
|
|
975
977
|
});
|
|
976
978
|
}
|
|
977
979
|
const baseColumns = filterCustomColumns({
|
|
@@ -90,7 +90,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
|
|
|
90
90
|
});
|
|
91
91
|
// 值筛选条件
|
|
92
92
|
filterValues.forEach((i) => {
|
|
93
|
-
var _a, _b, _c;
|
|
93
|
+
var _a, _b, _c, _d;
|
|
94
94
|
switch (i.fieldCalculation.value) {
|
|
95
95
|
case 'scope':
|
|
96
96
|
if (i.filterType === 'number') {
|
|
@@ -138,7 +138,20 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
|
|
|
138
138
|
searchValues.push({ key: i.name, val: `^${escapeRegExp(i.value)}`, rel: i.fieldCalculation.value });
|
|
139
139
|
break;
|
|
140
140
|
case 'nsearch_ci':
|
|
141
|
-
|
|
141
|
+
{
|
|
142
|
+
if (i.filterType === 'string') {
|
|
143
|
+
// 数组类型按数组查询
|
|
144
|
+
if (Array.isArray(i.value) && i.value.length) {
|
|
145
|
+
searchValues.push({ key: i.name, val: i.value, rel: i.fieldCalculation.value });
|
|
146
|
+
}
|
|
147
|
+
else if (i.value) {
|
|
148
|
+
searchValues.push({ key: i.name, val: (_b = textToString(i.value)) === null || _b === void 0 ? void 0 : _b.trim(), rel: i.fieldCalculation.value });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
searchValues.push({ key: i.name, val: `${escapeRegExp(i.value)}`, rel: i.fieldCalculation.value });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
142
155
|
break;
|
|
143
156
|
default: {
|
|
144
157
|
const searchItem = {
|
|
@@ -147,11 +160,11 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
|
|
|
147
160
|
rel: i.fieldCalculation.value,
|
|
148
161
|
};
|
|
149
162
|
if (i.filterType === 'string') {
|
|
150
|
-
if (arrayInputType.includes(i.fieldCalculation.value) && ((
|
|
163
|
+
if (arrayInputType.includes(i.fieldCalculation.value) && ((_c = searchItem === null || searchItem === void 0 ? void 0 : searchItem.val) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
151
164
|
searchValues.push(searchItem);
|
|
152
165
|
}
|
|
153
166
|
else {
|
|
154
|
-
searchItem.val = (
|
|
167
|
+
searchItem.val = (_d = textToString(i.value)) === null || _d === void 0 ? void 0 : _d.trim();
|
|
155
168
|
searchValues.push(searchItem);
|
|
156
169
|
}
|
|
157
170
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"test:watch": "npm run test:jest -- --watch",
|
|
44
44
|
"prestart:e2e-server": "node ./tools/e2e-prepare.mjs",
|
|
45
45
|
"start:e2e-server": "node ./lowcode-comps/e2e-server.js",
|
|
46
|
+
"prestart:e2e-server-local": "node ./tools/e2e-prepare-local.mjs",
|
|
47
|
+
"pack:local-debug": "cd lowcode-comps && npx ts-node scripts/index.ts pack --host 127.0.0.1 -p 8388 --local-debug",
|
|
46
48
|
"test:e2e-component": "npm run build-mp && npx cypress run --component",
|
|
47
49
|
"test:e2e-cals": "WAIT_ON_TIMEOUT=900000 start-server-and-test start:e2e-server 2333 'npx cypress run -b chrome --headless'",
|
|
48
50
|
"test:manual-e2e-cals": "start-server-and-test start:e2e-server 2333 'npx cypress open -b chrome'",
|
|
@@ -153,7 +155,7 @@
|
|
|
153
155
|
"@babel/preset-typescript": "^7.22.15",
|
|
154
156
|
"@cloudbase/cals": "^1.2.23",
|
|
155
157
|
"@cloudbase/lowcode-cli": "^0.23.0",
|
|
156
|
-
"@cloudbase/weda-cloud-sdk": "^1.0.
|
|
158
|
+
"@cloudbase/weda-cloud-sdk": "^1.0.109",
|
|
157
159
|
"@commitlint/cli": "^16.0.2",
|
|
158
160
|
"@commitlint/config-conventional": "^17.7.0",
|
|
159
161
|
"@craco/craco": "^7.1.0",
|