@cloudbase/weda-ui 3.17.3 → 3.17.5

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.
@@ -5,7 +5,7 @@ import { upload as uploadAction, checkBeforeUpload, getPreviewFileMap, getInitTe
5
5
  import { errorHandler } from '../../../../utils/error';
6
6
  import { isNil } from '../../../../utils/lodash';
7
7
  import { toBase64Uri } from '../../../../utils/file2base64';
8
- import { randomStr } from '../../../../utils/platform';
8
+ import { randomStr, browserEnv } from '../../../../utils/platform';
9
9
  // 默认图片类型
10
10
  export const IMAGE_TYPES = [
11
11
  'image/jpg',
@@ -17,7 +17,7 @@ export const IMAGE_TYPES = [
17
17
  'image/gif',
18
18
  ];
19
19
  export const Upload = forwardRef(function Upload({ children, ...props }, ref) {
20
- const { maxUploadCount, acceptTypes, multiple, maxSize, capture, disabled, readOnly, name, isCompressBeforeUpload, compressQuality, compressedHeight, compressedWidth, events, onChange, callbacks, setUploadHandle, value: _value, } = props;
20
+ const { maxUploadCount, acceptTypes, multiple, maxSize, disabled, readOnly, name, isCompressBeforeUpload, compressQuality, compressedHeight, compressedWidth, events, onChange, callbacks, setUploadHandle, value: _value, sourceType, } = props;
21
21
  const inputRef = React.useRef(null);
22
22
  const [inputId, setInputId] = useState(() => {
23
23
  return getUuid();
@@ -196,5 +196,6 @@ export const Upload = forwardRef(function Upload({ children, ...props }, ref) {
196
196
  }
197
197
  return uploadHandle;
198
198
  }, [deleteFile, onClick, previewFile, setUploadHandle, uploadInstance]);
199
- return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, name: name, disabled: disabled || readOnly, type: "file", onClick: (e) => e.stopPropagation(), style: { display: 'none' }, accept: accepts, multiple: multiple, onChange: uploadChange, ...(capture != null ? { capture } : {}) }, inputId), children] }));
199
+ const capture = sourceType === 'camera' ? true : null;
200
+ return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, name: name, disabled: disabled || readOnly, type: "file", onClick: (e) => e.stopPropagation(), style: { display: 'none' }, accept: accepts, multiple: multiple && !(browserEnv().android && browserEnv().weixin), onChange: uploadChange, ...(capture != null ? { capture } : {}) }, inputId), children] }));
200
201
  });
@@ -2,7 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import * as React from 'react';
3
3
  import weui from '../../../utils/weui';
4
4
  import classNames from '../../../utils/classnames';
5
- import { browserEnv } from '../../../utils/platform';
6
5
  import { IMAGE_TYPES, encodeConvert } from './uploader.pc';
7
6
  import { useTempUrl } from '../../../utils/hooks/use-cloud-id-temp-url';
8
7
  import { Upload } from './upload';
@@ -41,8 +40,8 @@ export function ImageUploaderH5(props) {
41
40
  outSetUploadHandle(uploadHandle);
42
41
  }
43
42
  }, [outSetUploadHandle]);
44
- const multiple = !single && !(browserEnv().android && browserEnv().weixin);
45
- return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsx("div", { className: "weui-uploader__bd", children: _jsx(Upload, { ...props, acceptTypes: acceptTypes, events: events, capture: sourceType === 'camera' ? 'capture' : null, multiple: multiple, maxSize: maxSize, maxUploadCount: maxUploadCount, disabled: disabled, onChange: onChange, callbacks: callbacks, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, children: _jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(_a = (tempFile !== null && tempFile !== void 0 ? tempFile : [])) === null || _a === void 0 ? void 0 : _a.map((f) => (_jsx(SingleImage, { tempFile: f, deleteBySrc: (file) => {
43
+ const multiple = !single;
44
+ return (_jsx("div", { className: cls, id: id, style: style, children: _jsxs("div", { className: classNames('weui-uploader weui-cells weui-cells_form weda-formcells', layout, layoutCls), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: tempFile.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsx("div", { className: "weui-uploader__bd", children: _jsx(Upload, { ...props, acceptTypes: acceptTypes, events: events, multiple: multiple, maxSize: maxSize, maxUploadCount: maxUploadCount, disabled: disabled, onChange: onChange, callbacks: callbacks, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, sourceType: sourceType, children: _jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(_a = (tempFile !== null && tempFile !== void 0 ? tempFile : [])) === null || _a === void 0 ? void 0 : _a.map((f) => (_jsx(SingleImage, { tempFile: f, deleteBySrc: (file) => {
46
45
  var _a;
47
46
  (_a = uploadRef === null || uploadRef === void 0 ? void 0 : uploadRef.current) === null || _a === void 0 ? void 0 : _a.delete({ cloudId: file.cloudId });
48
47
  }, disabled: disabled || readOnly || sourceType === 'album', imgTypeCls: imgTypeCls }, f === null || f === void 0 ? void 0 : f.cloudId))), tempFile.length < 1 && readOnly && _jsx(_Fragment, { children: "-" }), showAdd && !readOnly && (_jsx("li", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled && sourceType !== 'album' && (_jsx("span", { onClick: () => {
@@ -45,7 +45,7 @@ export function UploaderPCInner(props) {
45
45
  tips && (extraProps['title'] = tips);
46
46
  maxSize && (extraProps['maxSize'] = maxSize * 1024 * 1024);
47
47
  const hasActions = !uploading && !readOnly && !(disabled || sourceType === 'camera');
48
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Upload, { ...extraProps, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", portalContainer: portalContainer, actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.cloudId))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("div", { className: `_weda-fn-upload-result__item wedatea2td-disabled weda-uploader-btn__box ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) || (single && tempFile.length < 1 && !uploading)) &&
48
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Upload, { ...extraProps, ref: uploadRef, value: defaultValue, setUploadHandle: setUploadRef, sourceType: sourceType, children: _jsxs("div", { className: "_weda-fn-upload-result", children: [tempFile === null || tempFile === void 0 ? void 0 : tempFile.map((d, index) => (_jsx("div", { className: `_weda-fn-upload-result__item ${imgTypeCls}`, children: _jsx(TcbImage, { index: index, allFile: tempFile, tempFile: d, imgTypeCls: imgTypeCls, isZoom: true, previewIcon: "td:browse", portalContainer: portalContainer, actions: hasActions && (_jsx(WdIcon, { className: `${CLASS_PREFIX}__image-actions-delete`, name: "td:delete", onClick: () => deleteHandle(d), size: "sm" })) }) }, d.cloudId))), _jsxs("div", { className: `${CLASS_PREFIX}__input-box`, children: [readOnly && tempFile.length < 1 && _jsx("div", { children: "-" }), sourceType === 'camera' || (disabled && !readOnly) ? (_jsx("div", { className: `_weda-fn-upload-result__item wedatea2td-disabled weda-uploader-btn__box ${imgTypeCls}`, children: _jsxs("div", { className: "_weda-fn-upload-result__status", children: [_jsx("i", { className: "wedatea2td-icon wedatea2td-icon-plus", role: "img", "aria-label": "plus" }), _jsx("span", { className: "wedatea2td-mt-1n wedatea2td-text-label wedatea2td-fz-reset", children: btnTitle })] }) })) : (((!single && tempFile.length < maxUploadCount) || (single && tempFile.length < 1 && !uploading)) &&
49
49
  !readOnly && (
50
50
  // single 模式时,当数组为空且不在上传文件过程中时显示
51
51
  _jsxs("div", {
@@ -12,16 +12,16 @@ import AllEmpty from '../../form/select/status/allEmpty';
12
12
  import { X_RUNTIME_DEFAULT } from '../../../../configs/type-utils/x-runtime-default';
13
13
  import '../style';
14
14
  const OptionList = ({ options, inputFocus, currentSelected, optionClick, bottomTips, onScrollBottom }) => {
15
- return (_jsxs(List, { className: "weda-ui-custom-picker__cloumn", style: {
15
+ return (_jsxs(List, { className: "weda-ui-custom-picker__column", style: {
16
16
  height: inputFocus ? 'calc(100vh - 190px)' : '250px',
17
17
  }, onScrollBottom: onScrollBottom, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
18
18
  // is-selected 选中态
19
- // is-disabled 禁用态,该状态备用,暂时不让生效index === -1
20
- const itemCls = classNames('weda-ui-custom-picker__cloumn-item', {
19
+ // is-disabled 禁用态
20
+ const itemCls = classNames('weda-ui-custom-picker__column-item', {
21
21
  'is-selected': currentSelected.find((i) => i.value === item.value),
22
22
  'is-disabled': item.disabled,
23
23
  });
24
- return (_jsx(List.Item, { className: itemCls, onClick: (e) => optionClick(item, e), children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text', children: item.text || item.label }) }, index));
24
+ return (_jsx(List.Item, { className: itemCls, onClick: (e) => optionClick(item, e), children: _jsx("p", { className: 'weda-ui-custom-picker__column-item-text', children: item.text || item.label }) }, index));
25
25
  }), bottomTips && (_jsx(List.Item, { children: _jsx("div", { className: "weda-ui-custom-picker__status weda-ui-custom-picker__status--empty", children: bottomTips }) }))] }));
26
26
  };
27
27
  const getSelectedItem = (options = [], value) => {
@@ -31,9 +31,9 @@ const getSelectedItem = (options = [], value) => {
31
31
  function SelectH5(props) {
32
32
  const { placeholder, name, disabled, footer, options = [], value, onChange, overlayClassName, searchable, bottomTips, onSearch, onOpen, onScrollBottom, mode, readValue, popupContainer, searchPlaceholder, filterable, onBlur, onFocus, } = props;
33
33
  const isMultiple = mode === 'multiple';
34
- const customPickerCls = classNames('weda-ui-custom-picker__cloumns', {
35
- 'weda-ui-custom-picker__cloumns--select-multiple': isMultiple,
36
- 'weda-ui-custom-picker__cloumns--select': !isMultiple,
34
+ const customPickerCls = classNames('weda-ui-custom-picker__columns', {
35
+ 'weda-ui-custom-picker__columns--select-multiple': isMultiple,
36
+ 'weda-ui-custom-picker__columns--select': !isMultiple,
37
37
  [`${overlayClassName}`]: true,
38
38
  });
39
39
  const [visible, setVisible] = useState(false);
@@ -133,7 +133,7 @@ function SelectH5(props) {
133
133
  else {
134
134
  setVisible(false);
135
135
  }
136
- }, 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: {
136
+ }, 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__columns", style: {
137
137
  height: inputFocus ? 'calc(100vh - 160px)' : '280px',
138
138
  }, children: _jsx(OptionList, { onScrollBottom: onScrollBottom, options: customOptions, inputFocus: inputFocus, currentSelected: currentSelected, optionClick: optionClick, bottomTips: bottomTips }) }), footer] })) })] })] }));
139
139
  }
@@ -174,21 +174,21 @@
174
174
  min-height: 105px;
175
175
  }
176
176
  /* h5端关联下拉样式 */
177
- .weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select.wd-relation-select-overlay
178
- .weda-ui-custom-picker__cloumn-item {
177
+ .weda-ui-custom-picker__columns.weda-ui-custom-picker__columns--select.wd-relation-select-overlay
178
+ .weda-ui-custom-picker__column-item {
179
179
  height: auto;
180
180
  }
181
- .wd-relation-select-overlay .weda-ui-custom-picker__cloumn-item-text {
181
+ .wd-relation-select-overlay .weda-ui-custom-picker__column-item-text {
182
182
  margin: 0;
183
183
  }
184
- .weda-ui-custom-picker__cloumns.wd-relation-select-overlay {
184
+ .weda-ui-custom-picker__columns.wd-relation-select-overlay {
185
185
  overflow: auto;
186
186
  }
187
- .weda-ui-custom-picker__cloumns.wd-relation-select-overlay .weda-ui-custom-picker__cloumn {
187
+ .weda-ui-custom-picker__columns.wd-relation-select-overlay .weda-ui-custom-picker__column {
188
188
  width: auto;
189
189
  min-width: 100%;
190
190
  }
191
- .weda-ui-custom-picker__cloumns.wd-relation-select-overlay .weda-ui-custom-picker__cloumn-item.is-selected {
191
+ .weda-ui-custom-picker__columns.wd-relation-select-overlay .weda-ui-custom-picker__column-item.is-selected {
192
192
  background-color: var(--wd-color-brand-light, #ecf2fe);
193
193
  border-radius: 3px;
194
194
  }
@@ -45,34 +45,23 @@
45
45
  display: none;
46
46
  }
47
47
 
48
- .wd-form-item.wd-pc-select-multiple-root
49
- .form-select-multiple-pc
50
- .wedatea2td-dropdown-btn.wedatea2td-dropdown__header {
48
+ .wd-form-item.wd-pc-select-multiple-root .form-select-multiple-pc .wedatea2td-dropdown-btn.wedatea2td-dropdown__header {
51
49
  border: none;
52
50
  padding: 0;
53
51
  display: flex;
54
52
  align-items: center;
55
53
  }
56
54
 
57
- .wd-form-item.wd-pc-select-multiple-root
58
- .form-select-multiple-pc
59
- i.wedatea2td-icon-arrowdown {
55
+ .wd-form-item.wd-pc-select-multiple-root .form-select-multiple-pc i.wedatea2td-icon-arrowdown {
60
56
  display: none;
61
57
  }
62
58
 
63
- .wd-form-item.wd-pc-select-multiple-root
64
- .form-select-multiple-pc
65
- i.wedatea2td-icon-dismiss {
59
+ .wd-form-item.wd-pc-select-multiple-root .form-select-multiple-pc i.wedatea2td-icon-dismiss {
66
60
  display: none;
67
61
  }
68
62
 
69
- .wd-form-item.wd-pc-select-multiple-root
70
- .form-select-multiple-pc
71
- .wedatea2td-text-weak,
72
- .wd-form-item.wd-pc-select-multiple-root
73
- .wedatea2td-dropdown__value
74
- div
75
- div:not(.weda-ui-show-label) {
63
+ .wd-form-item.wd-pc-select-multiple-root .form-select-multiple-pc .wedatea2td-text-weak,
64
+ .wd-form-item.wd-pc-select-multiple-root .wedatea2td-dropdown__value div div:not(.weda-ui-show-label) {
76
65
  color: var(--wd-color-text-placeholder) !important;
77
66
  }
78
67
 
@@ -88,10 +77,7 @@
88
77
  padding-right: calc(var(--wd-size-icon-md));
89
78
  }
90
79
 
91
- .wd-relation-select-overlay.multiple
92
- .wedatea2td-dropdown-box
93
- .wedatea2td-list--option
94
- > li {
80
+ .wd-relation-select-overlay.multiple .wedatea2td-dropdown-box .wedatea2td-list--option > li {
95
81
  width: fit-content !important;
96
82
  min-width: 100%;
97
83
  padding: 0;
@@ -106,20 +92,19 @@
106
92
  overflow: hidden;
107
93
  }
108
94
  /* h5端关联下拉样式 */
109
- .weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select-multiple.wd-relation-select-overlay
110
- .weda-ui-custom-picker__cloumn-item {
95
+ .weda-ui-custom-picker__columns.weda-ui-custom-picker__columns--select-multiple.wd-relation-select-overlay
96
+ .weda-ui-custom-picker__column-item {
111
97
  height: auto;
112
98
  }
113
- .weda-ui-custom-picker__cloumns--select-multiple
114
- .weda-ui-custom-picker__cloumn-item-text {
99
+ .weda-ui-custom-picker__columns--select-multiple .weda-ui-custom-picker__column-item-text {
115
100
  overflow: hidden;
116
101
  text-overflow: ellipsis;
117
102
  white-space: nowrap;
118
103
  margin-left: 30px;
119
104
  margin-right: 0;
120
105
  }
121
- .weda-ui-custom-picker__cloumns--select-multiple.weda-ui-custom-picker__cloumns
122
- .weda-ui-custom-picker__cloumn-item-text {
106
+ .weda-ui-custom-picker__columns--select-multiple.weda-ui-custom-picker__columns
107
+ .weda-ui-custom-picker__column-item-text {
123
108
  overflow: hidden;
124
109
  text-overflow: ellipsis;
125
110
  white-space: nowrap;
@@ -703,7 +703,7 @@ export const getFieldValue = (name, _record, relatedFieldName, isManyField) => {
703
703
  }
704
704
  return v2 !== undefined ? v2 : v1;
705
705
  }
706
- return record[name];
706
+ return record === null || record === void 0 ? void 0 : record[name];
707
707
  };
708
708
  export const slotRender = (Slot, props = {}) => {
709
709
  if (typeof Slot === 'function') {
@@ -44,5 +44,5 @@ export const WdUploadImage = forwardRef(function WdUploadImage(props, ref) {
44
44
  const multiple = !single;
45
45
  if (!visible)
46
46
  return null;
47
- return (_jsx(WdFormItem, { ...formItemProps, children: template === 'custom' ? (_jsx(Upload, { events: events, acceptTypes: acceptTypes, maxSize: maxSize, maxUploadCount: maxUploadCount, readOnly: readOnly, disabled: disabled, isCompressBeforeUpload: isCompressBeforeUpload, compressQuality: compressQuality, compressedHeight: compressedHeight, compressedWidth: compressedWidth, callbacks: callbacks, value: value, multiple: multiple, capture: sourceType === 'camera' ? 'capture' : null, onChange: onChange, ref: uploadRef, setUploadHandle: setUploadHandle, children: children })) : (_jsx(Uploader, { events: events, labelVisible: false, acceptTypes: acceptTypes, defaultValue: value, maxSize: maxSize, maxUploadCount: maxUploadCount, single: single, tips: tips, showShape: showShape, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, isCompressBeforeUpload: isCompressBeforeUpload, compressQuality: compressQuality, compressedHeight: compressedHeight, compressedWidth: compressedWidth, sourceType: sourceType, callbacks: callbacks, setUploadHandle: setUploadHandle })) }));
47
+ return (_jsx(WdFormItem, { ...formItemProps, children: template === 'custom' ? (_jsx(Upload, { events: events, acceptTypes: acceptTypes, maxSize: maxSize, maxUploadCount: maxUploadCount, readOnly: readOnly, disabled: disabled, isCompressBeforeUpload: isCompressBeforeUpload, compressQuality: compressQuality, compressedHeight: compressedHeight, compressedWidth: compressedWidth, callbacks: callbacks, value: value, multiple: multiple, sourceType: sourceType, onChange: onChange, ref: uploadRef, setUploadHandle: setUploadHandle, children: children })) : (_jsx(Uploader, { events: events, labelVisible: false, acceptTypes: acceptTypes, defaultValue: value, maxSize: maxSize, maxUploadCount: maxUploadCount, single: single, tips: tips, showShape: showShape, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, isCompressBeforeUpload: isCompressBeforeUpload, compressQuality: compressQuality, compressedHeight: compressedHeight, compressedWidth: compressedWidth, sourceType: sourceType, callbacks: callbacks, setUploadHandle: setUploadHandle })) }));
48
48
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/weda-ui",
3
- "version": "3.17.3",
3
+ "version": "3.17.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index",
6
6
  "miniprogram": "mpdist",