@cloudbase/weda-ui 3.7.3 → 3.7.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.
@@ -108,18 +108,28 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
108
108
  return fileIdList.length < maxUploadCount;
109
109
  }, [fileIdList, single, maxUploadCount, uploading]);
110
110
  const uploadChange = async (e) => {
111
+ var _a, _b, _c, _d, _e, _f;
111
112
  let files = [...e.target.files];
112
113
  if (files.some((f) => f.size > maxSize * 1024 * 1024)) {
113
- weui.alert(`请上传不超过 ${maxSize}M 的图片`);
114
+ (_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.utils) === null || _b === void 0 ? void 0 : _b.showToast({
115
+ title: `请上传不超过 ${maxSize}M 的图片`,
116
+ icon: 'none',
117
+ });
114
118
  return false;
115
119
  }
116
120
  if (files.length > finalMaxImgCount) {
117
121
  // 防止一下子选择过多文件
118
- weui.alert(`最多只能上传${finalMaxImgCount}张图片,请重新选择`);
122
+ (_d = (_c = window === null || window === void 0 ? void 0 : window.$w) === null || _c === void 0 ? void 0 : _c.utils) === null || _d === void 0 ? void 0 : _d.showToast({
123
+ title: `最多只能上传${finalMaxImgCount}张图片,请重新选择`,
124
+ icon: 'none',
125
+ });
119
126
  return false;
120
127
  }
121
128
  if (fileIdList.length + files.length > finalMaxImgCount) {
122
- weui.alert(`最多只能上传${finalMaxImgCount}张图片`);
129
+ (_f = (_e = window === null || window === void 0 ? void 0 : window.$w) === null || _e === void 0 ? void 0 : _e.utils) === null || _f === void 0 ? void 0 : _f.showToast({
130
+ title: `最多只能上传${finalMaxImgCount}张图片`,
131
+ icon: 'none',
132
+ });
123
133
  return false;
124
134
  }
125
135
  let shouldUploadToCos = true;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import weui from '../../../utils/weui';
4
3
  import isObjectEqual from '../../../utils/isObjectEqual';
5
4
  import { ConfigProvider, Button, Text, List, Progress, Tooltip, } from 'tea-component';
6
5
  import { filterStrList, isCloudFileID, isHttpFileID, transSize, transFileCloudidToName, randomStr, isInIde, isWebInMiniprogram, transFileName, } from '../../../utils/platform';
@@ -133,23 +132,36 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
133
132
  events,
134
133
  fileSizeObj,
135
134
  }, 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", className: classNames(`${CLASS_PREFIX}__btn--weak`), disabled: btnDisabled, text: btnTitle }))) : (_jsxs("div", { children: [_jsx("input", { id: "uploaderInput", type: "file", "data-testid": "button-up", className: "weui-uploader-mobile__input", accept: accepts.join(','), multiple: !single, onChange: async (e) => {
135
+ var _a, _b, _c, _d, _e, _f, _g, _h;
136
136
  let fileList = [...e.target.files];
137
137
  if (single && fileList.length > 1) {
138
- weui.alert(`上传文件总数不能超过1个`);
138
+ (_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.utils) === null || _b === void 0 ? void 0 : _b.showToast({
139
+ title: `上传文件总数不能超过1个`,
140
+ icon: 'none',
141
+ });
139
142
  return false;
140
143
  }
141
144
  if (fileList.length + fileIDList.length >
142
145
  maxUploadCount) {
143
- weui.alert(`上传文件总数不能超过${maxUploadCount}个`);
146
+ (_d = (_c = window === null || window === void 0 ? void 0 : window.$w) === null || _c === void 0 ? void 0 : _c.utils) === null || _d === void 0 ? void 0 : _d.showToast({
147
+ title: `上传文件总数不能超过${maxUploadCount}个`,
148
+ icon: 'none',
149
+ });
144
150
  return false;
145
151
  }
146
152
  if (maxSizeLimit &&
147
153
  fileList.some((f) => f.size > maxSizeLimit * 1024 * 1024)) {
148
- weui.alert(`请上传不超过${maxSizeLimit}M的文件`);
154
+ (_f = (_e = window === null || window === void 0 ? void 0 : window.$w) === null || _e === void 0 ? void 0 : _e.utils) === null || _f === void 0 ? void 0 : _f.showToast({
155
+ title: `请上传不超过${maxSizeLimit}M的文件`,
156
+ icon: 'none',
157
+ });
149
158
  return false;
150
159
  }
151
160
  if (fileList.some((f) => f.size > 1024 * 1024 * 1024)) {
152
- weui.alert(`请上传不超过1024M的文件`);
161
+ (_h = (_g = window === null || window === void 0 ? void 0 : window.$w) === null || _g === void 0 ? void 0 : _g.utils) === null || _h === void 0 ? void 0 : _h.showToast({
162
+ title: `请上传不超过1024M的文件`,
163
+ icon: 'none',
164
+ });
153
165
  return false;
154
166
  }
155
167
  let shouldUploadToCos = true;
@@ -185,7 +185,7 @@ const getSearchValues = (searchValues) => {
185
185
  });
186
186
  };
187
187
  const getPageParam = ({ defaultSort, sort: _sort, params, _defaultPageSize, _defaultPageIndex, supportManyRelated, columns, isSupportMultipleSort, }) => {
188
- let sort = defaultSort;
188
+ let sort = defaultSort || [];
189
189
  // 运行态有值,以运行态为准
190
190
  if ((_sort === null || _sort === void 0 ? void 0 : _sort.length) && _sort[0].order) {
191
191
  params.orderBy = _sort[0].by;
@@ -193,7 +193,7 @@ const getPageParam = ({ defaultSort, sort: _sort, params, _defaultPageSize, _def
193
193
  sort = _sort;
194
194
  }
195
195
  // 后端根据业务字段排序
196
- sort = sort.map((n) => {
196
+ sort = sort === null || sort === void 0 ? void 0 : sort.map((n) => {
197
197
  var _a;
198
198
  return ({
199
199
  ...n,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",