@cloudtower/eagle 0.35.8 → 481.0.2

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.
Files changed (55) hide show
  1. package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
  2. package/dist/cjs/core/index.js +12 -15
  3. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
  4. package/dist/cjs/index.js +245 -249
  5. package/dist/cjs/stats1.html +1 -1
  6. package/dist/components.css +2314 -2492
  7. package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
  8. package/dist/esm/core/index.js +2 -4
  9. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
  10. package/dist/esm/index.js +0 -2
  11. package/dist/esm/stats1.html +1 -1
  12. package/dist/linaria.merged.scss +2952 -3142
  13. package/dist/src/core/index.d.ts +0 -5
  14. package/dist/src/coreX/Dialogs/RejectDialog/RejectDialog.type.d.ts +1 -5
  15. package/dist/src/coreX/index.d.ts +0 -1
  16. package/dist/src/hooks/index.d.ts +0 -1
  17. package/dist/src/utils/index.d.ts +0 -1
  18. package/dist/stories/docs/coreX/Dialogs/RejectDialog.stories.d.ts +1 -3
  19. package/dist/style.css +2314 -2492
  20. package/package.json +4 -6
  21. package/dist/cjs/core/Duration/index.js +0 -78
  22. package/dist/cjs/core/LocalUpload/LocalUpload.hooks.js +0 -66
  23. package/dist/cjs/core/LocalUpload/LocalUpload.js +0 -103
  24. package/dist/cjs/core/LocalUpload/LocalUpload.style.js +0 -13
  25. package/dist/cjs/core/LocalUpload/LocalUpload.widget.js +0 -379
  26. package/dist/cjs/hooks/useFormatDuration.js +0 -35
  27. package/dist/cjs/utils/formatDuration.js +0 -67
  28. package/dist/esm/core/Duration/index.js +0 -72
  29. package/dist/esm/core/LocalUpload/LocalUpload.hooks.js +0 -63
  30. package/dist/esm/core/LocalUpload/LocalUpload.js +0 -97
  31. package/dist/esm/core/LocalUpload/LocalUpload.style.js +0 -10
  32. package/dist/esm/core/LocalUpload/LocalUpload.widget.js +0 -365
  33. package/dist/esm/hooks/useFormatDuration.js +0 -33
  34. package/dist/esm/utils/formatDuration.js +0 -65
  35. package/dist/src/core/Duration/duration.type.d.ts +0 -42
  36. package/dist/src/core/Duration/index.d.ts +0 -4
  37. package/dist/src/core/LocalUpload/LocalUpload.d.ts +0 -15
  38. package/dist/src/core/LocalUpload/LocalUpload.hooks.d.ts +0 -32
  39. package/dist/src/core/LocalUpload/LocalUpload.style.d.ts +0 -3
  40. package/dist/src/core/LocalUpload/LocalUpload.type.d.ts +0 -175
  41. package/dist/src/core/LocalUpload/LocalUpload.widget.d.ts +0 -23
  42. package/dist/src/core/LocalUpload/index.d.ts +0 -2
  43. package/dist/src/coreX/Copy/CopyButton.d.ts +0 -5
  44. package/dist/src/coreX/Copy/CopyButton.type.d.ts +0 -8
  45. package/dist/src/coreX/Copy/CopyTooltip.d.ts +0 -5
  46. package/dist/src/coreX/Copy/CopyTooltip.typs.d.ts +0 -16
  47. package/dist/src/coreX/Copy/index.d.ts +0 -2
  48. package/dist/src/hooks/__tests__/useFormatDuration.test.d.ts +0 -1
  49. package/dist/src/hooks/useFormatDuration.d.ts +0 -31
  50. package/dist/src/utils/__test__/formatDuration.spec.d.ts +0 -1
  51. package/dist/src/utils/formatDuration.d.ts +0 -28
  52. package/dist/stories/docs/core/Duration.stories.d.ts +0 -88
  53. package/dist/stories/docs/core/LocalUpload.stories.d.ts +0 -74
  54. package/dist/stories/docs/coreX/Copy/CopyButton.stories.d.ts +0 -66
  55. package/dist/stories/docs/coreX/Copy/CopyTooltip.stories.d.ts +0 -66
@@ -1,365 +0,0 @@
1
- import { Uploading16GradientGrayIcon, Uploading16GradientBlueIcon, Upload24GradientGrayIcon, Upload24GradientBlueIcon, Upload48GradientBlueIcon, XmarkRemove16SecondaryIcon, ExclamationErrorCircleFill16RedIcon, File16GradientBlueIcon, Loading16GradientBlueIcon, XmarkRemove24SecondaryIcon } from '@cloudtower/icons-react';
2
- import { cx } from '@linaria/core';
3
- import Button from '../Button/index.js';
4
- import Byte from '../Byte/index.js';
5
- import Icon from '../Icon/index.js';
6
- import Tooltip from '../Tooltip/index.js';
7
- import { Typo } from '../Typo/index.js';
8
- import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
9
- import useParrotTranslation from '../../hooks/useParrotTranslation.js';
10
- import cs from 'classnames';
11
- import _ from 'lodash';
12
- import React__default, { useState } from 'react';
13
- import { useFileValidation, useFileCountErrorClear } from './LocalUpload.hooks.js';
14
- import { FileInfoWrapperStyle } from './LocalUpload.style.js';
15
- import { Upload } from 'antd';
16
-
17
- var __defProp = Object.defineProperty;
18
- var __defProps = Object.defineProperties;
19
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
20
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
21
- var __hasOwnProp = Object.prototype.hasOwnProperty;
22
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
23
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
24
- var __spreadValues = (a, b) => {
25
- for (var prop in b || (b = {}))
26
- if (__hasOwnProp.call(b, prop))
27
- __defNormalProp(a, prop, b[prop]);
28
- if (__getOwnPropSymbols)
29
- for (var prop of __getOwnPropSymbols(b)) {
30
- if (__propIsEnum.call(b, prop))
31
- __defNormalProp(a, prop, b[prop]);
32
- }
33
- return a;
34
- };
35
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
36
- const STATUS_ICON_MAP = {
37
- error: ExclamationErrorCircleFill16RedIcon,
38
- success: File16GradientBlueIcon,
39
- validating: Loading16GradientBlueIcon,
40
- "need-validate": Loading16GradientBlueIcon
41
- };
42
- const createBeforeUploadHandler = ({
43
- fileList,
44
- setFileList,
45
- validate,
46
- maxCount,
47
- isSingleSelect,
48
- setError,
49
- t,
50
- checkSingleSelectCount = false
51
- }) => {
52
- return (file, _fileList) => {
53
- if (isSingleSelect) {
54
- if (checkSingleSelectCount && _fileList.length > 1) {
55
- setError(t("components.exceed_max_count", { count: 1 }) || "");
56
- return false;
57
- } else {
58
- setError("");
59
- }
60
- const _file2 = file;
61
- _file2.fileStatus = validate ? "need-validate" : "success";
62
- setFileList([_file2]);
63
- return false;
64
- }
65
- if (fileList.length + _fileList.length > maxCount) {
66
- setError(t("components.exceed_max_count", { count: maxCount }) || "");
67
- } else {
68
- setError("");
69
- }
70
- const _file = file;
71
- _file.fileStatus = validate ? "need-validate" : "success";
72
- const index = _fileList.findIndex((f) => f.uid === _file.uid);
73
- if (index !== -1) {
74
- const newList = _.uniqBy(
75
- [...fileList, ..._fileList.slice(0, index + 1)],
76
- "uid"
77
- );
78
- setFileList(newList);
79
- }
80
- return false;
81
- };
82
- };
83
- const UploadLabel = ({ className, children }) => {
84
- return /* @__PURE__ */ React__default.createElement("label", { className: cx("upload-label", Typo.Label.l2_regular, className) }, children);
85
- };
86
- const UploadDescription = ({ className, children }) => {
87
- return /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-description", Typo.Label.l4_regular, className) }, children);
88
- };
89
- const UploadButton = ({
90
- children,
91
- hideIcon = false,
92
- className,
93
- fileList,
94
- setFileList,
95
- validate,
96
- maxCount,
97
- multiple = false,
98
- disabled,
99
- accept
100
- }) => {
101
- const { t } = useParrotTranslation();
102
- const [error, setError] = useState("");
103
- const _maxCount = multiple ? maxCount || Infinity : 1;
104
- const isSingleSelect = _maxCount === 1;
105
- useFileValidation({
106
- fileList,
107
- setFileList,
108
- validate,
109
- createNewFile: false
110
- });
111
- useFileCountErrorClear({
112
- fileList,
113
- maxCount: _maxCount,
114
- setError
115
- });
116
- const props = {
117
- accept,
118
- fileList,
119
- showUploadList: false,
120
- beforeUpload: createBeforeUploadHandler({
121
- fileList,
122
- setFileList,
123
- validate,
124
- maxCount: _maxCount,
125
- isSingleSelect,
126
- setError,
127
- t,
128
- checkSingleSelectCount: false
129
- }),
130
- multiple
131
- };
132
- return /* @__PURE__ */ React__default.createElement(Upload, __spreadProps(__spreadValues({}, props), { className: cs("upload-button", className) }), /* @__PURE__ */ React__default.createElement(
133
- Button,
134
- {
135
- disabled,
136
- prefixIcon: !hideIcon ? /* @__PURE__ */ React__default.createElement(Icon, { src: Uploading16GradientGrayIcon }) : void 0,
137
- hoverPrefixIcon: !hideIcon ? /* @__PURE__ */ React__default.createElement(Icon, { src: Uploading16GradientBlueIcon }) : void 0
138
- },
139
- children
140
- ), error ? /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-error", Typo.Label.l4_regular) }, error) : null);
141
- };
142
- const UploadDragger = ({
143
- children,
144
- className,
145
- fileList,
146
- setFileList,
147
- validate,
148
- maxCount,
149
- multiple = false,
150
- disabled,
151
- accept
152
- }) => {
153
- var _a;
154
- const { t } = useParrotTranslation();
155
- const [error, setError] = useState("");
156
- const _maxCount = multiple ? maxCount || Infinity : 1;
157
- const isSingleSelect = _maxCount === 1;
158
- const reachMaxCount = !!maxCount && !isSingleSelect && fileList.length >= maxCount;
159
- useFileValidation({
160
- fileList,
161
- setFileList,
162
- validate,
163
- createNewFile: true
164
- });
165
- useFileCountErrorClear({
166
- fileList,
167
- maxCount: _maxCount,
168
- setError
169
- });
170
- const props = {
171
- accept,
172
- fileList,
173
- showUploadList: false,
174
- beforeUpload: createBeforeUploadHandler({
175
- fileList,
176
- setFileList,
177
- validate,
178
- maxCount: _maxCount,
179
- isSingleSelect,
180
- setError,
181
- t,
182
- checkSingleSelectCount: true
183
- }),
184
- disabled,
185
- multiple
186
- };
187
- const DefaultChildren = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
188
- Icon,
189
- {
190
- src: (fileList == null ? void 0 : fileList.length) ? reachMaxCount ? Upload24GradientGrayIcon : Upload24GradientBlueIcon : Upload48GradientBlueIcon,
191
- iconHeight: (fileList == null ? void 0 : fileList.length) ? 24 : 48,
192
- iconWidth: (fileList == null ? void 0 : fileList.length) ? 24 : 48
193
- }
194
- ), /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-drag-text", Typo.Label.l2_regular) }, t("components.upload_file_desc")));
195
- const fileStatus = isSingleSelect ? ((_a = fileList[0]) == null ? void 0 : _a.fileStatus) || "success" : void 0;
196
- const FileInfo = ({ file }) => {
197
- const fileStatus2 = file.fileStatus || "success";
198
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "file-info", onClick: (e) => e.preventDefault() }, /* @__PURE__ */ React__default.createElement(
199
- Icon,
200
- {
201
- src: STATUS_ICON_MAP[fileStatus2],
202
- isRotate: fileStatus2 === "validating" || fileStatus2 === "need-validate"
203
- }
204
- ), /* @__PURE__ */ React__default.createElement("div", { className: cx("file-name", Typo.Label.l4_regular) }, file.name || file.fileName)), /* @__PURE__ */ React__default.createElement(Button, { className: Typo.Label.l2_regular, type: "link" }, t("components.reselect_file")));
205
- };
206
- const Error2 = () => {
207
- if (error) {
208
- return /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-error", Typo.Label.l4_regular) }, error);
209
- }
210
- const file = fileList[0];
211
- if (isSingleSelect && (file == null ? void 0 : file.fileStatus) === "error" && file.error) {
212
- return /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-error", Typo.Label.l4_regular) }, file.error);
213
- }
214
- return null;
215
- };
216
- return /* @__PURE__ */ React__default.createElement("div", { className: cs("upload-drag", className) }, /* @__PURE__ */ React__default.createElement(
217
- Upload.Dragger,
218
- __spreadProps(__spreadValues({}, props), {
219
- disabled: disabled || fileStatus === "validating",
220
- className: cs(
221
- "upload-drag-area",
222
- fileList.length ? "has-file" : "",
223
- reachMaxCount && "reach-max-count",
224
- isSingleSelect && "single",
225
- fileStatus === "error" && "file-error",
226
- fileStatus === "validating" && "file-validating"
227
- )
228
- }),
229
- isSingleSelect && fileList.length ? /* @__PURE__ */ React__default.createElement(FileInfo, { file: fileList[0] }) : children || DefaultChildren
230
- ), /* @__PURE__ */ React__default.createElement(Error2, null));
231
- };
232
- const UploadFileInfo = ({
233
- file,
234
- removeFile,
235
- disabled,
236
- onRemove
237
- }) => {
238
- const fileStatus = file.fileStatus || "success";
239
- const handleRemove = () => {
240
- var _a;
241
- removeFile((_a = file.uid) != null ? _a : "");
242
- if (onRemove && "fileStatus" in file) {
243
- onRemove(file);
244
- }
245
- };
246
- return /* @__PURE__ */ React__default.createElement(
247
- "div",
248
- {
249
- className: cs(FileInfoWrapperStyle, {
250
- "file-error-wrapper": fileStatus === "error",
251
- disabled
252
- })
253
- },
254
- /* @__PURE__ */ React__default.createElement(
255
- Icon,
256
- {
257
- src: STATUS_ICON_MAP[fileStatus],
258
- isRotate: fileStatus === "validating" || fileStatus === "need-validate"
259
- }
260
- ),
261
- /* @__PURE__ */ React__default.createElement("div", { className: cx("file-info", Typo.Label.l4_regular) }, /* @__PURE__ */ React__default.createElement(
262
- OverflowTooltip,
263
- {
264
- className: "file-name",
265
- content: file.name || file.fileName,
266
- tooltip: file.name || file.fileName
267
- }
268
- ), file.size ? /* @__PURE__ */ React__default.createElement("div", { className: "file-info" }, /* @__PURE__ */ React__default.createElement(
269
- Byte,
270
- {
271
- rawValue: file.size,
272
- valueClassName: "file-size",
273
- unitClassName: "file-size-unit"
274
- }
275
- )) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null), file.fileStatus === "error" && !!file.error && /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-file-error", Typo.Footnote.f2_regular) }, file.error)),
276
- /* @__PURE__ */ React__default.createElement(
277
- Icon,
278
- {
279
- src: XmarkRemove16SecondaryIcon,
280
- onClick: disabled ? void 0 : handleRemove
281
- }
282
- )
283
- );
284
- };
285
- const FileListItem = ({ file, removeFile, onRemove }) => {
286
- const fileStatus = file.fileStatus || "success";
287
- const { t } = useParrotTranslation();
288
- const handleRemove = (e) => {
289
- e.stopPropagation();
290
- removeFile(file.uid);
291
- onRemove == null ? void 0 : onRemove(file);
292
- };
293
- return /* @__PURE__ */ React__default.createElement(
294
- "div",
295
- {
296
- className: cx("upload-file-item", Typo.Label.l4_regular),
297
- key: file.uid
298
- },
299
- /* @__PURE__ */ React__default.createElement("div", { className: "upload-file-info" }, /* @__PURE__ */ React__default.createElement("div", { className: "file-info" }, /* @__PURE__ */ React__default.createElement(
300
- Icon,
301
- {
302
- src: STATUS_ICON_MAP[fileStatus],
303
- isRotate: fileStatus === "validating" || fileStatus === "need-validate"
304
- }
305
- ), /* @__PURE__ */ React__default.createElement(
306
- "div",
307
- {
308
- className: fileStatus === "validating" || fileStatus === "need-validate" ? "validating" : ""
309
- },
310
- file.name || file.fileName
311
- )), /* @__PURE__ */ React__default.createElement(Tooltip, { title: t("common.remove") }, /* @__PURE__ */ React__default.createElement(
312
- Icon,
313
- {
314
- className: "remove-button",
315
- src: XmarkRemove24SecondaryIcon,
316
- onClick: handleRemove
317
- }
318
- ))),
319
- file.fileStatus === "error" && !!file.error && /* @__PURE__ */ React__default.createElement("div", { className: cx("upload-file-error", Typo.Footnote.f2_regular) }, file.error)
320
- );
321
- };
322
- const UploadFileList = ({
323
- className,
324
- fileList,
325
- removeFile,
326
- type = "list",
327
- disableRemove = false,
328
- onRemove
329
- }) => {
330
- if (!fileList.length) {
331
- return null;
332
- }
333
- return /* @__PURE__ */ React__default.createElement(
334
- "div",
335
- {
336
- className: cs(
337
- "upload-file-list",
338
- type === "list" ? "" : "upload-file-info-list",
339
- className
340
- )
341
- },
342
- fileList.map(
343
- (file) => type === "list" ? /* @__PURE__ */ React__default.createElement(
344
- FileListItem,
345
- {
346
- key: file.uid,
347
- file,
348
- removeFile,
349
- onRemove
350
- }
351
- ) : /* @__PURE__ */ React__default.createElement(
352
- UploadFileInfo,
353
- {
354
- key: file.uid,
355
- file,
356
- removeFile,
357
- disabled: disableRemove,
358
- onRemove
359
- }
360
- )
361
- )
362
- );
363
- };
364
-
365
- export { FileListItem, UploadButton, UploadDescription, UploadDragger, UploadFileInfo, UploadFileList, UploadLabel };
@@ -1,33 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { formatDuration } from '../utils/formatDuration.js';
3
-
4
- function useFormatDuration(milliseconds, options = {
5
- maxDisplayUnits: 2,
6
- useAbbreviation: false,
7
- minUnit: "second"
8
- }) {
9
- const {
10
- maxDisplayUnits = 2,
11
- useAbbreviation = false,
12
- minUnit = "second"
13
- } = options;
14
- const result = useMemo(() => {
15
- const items = formatDuration(milliseconds, { maxDisplayUnits, minUnit });
16
- const shouldUseAbbreviation = items.length > 1 && useAbbreviation;
17
- const parts = items.map((item) => {
18
- const suffix = shouldUseAbbreviation ? "_abbreviation" : "";
19
- const i18nKey = `unit.${item.unit}${suffix}`;
20
- return {
21
- value: item.value,
22
- unit: item.unit,
23
- i18nKey
24
- };
25
- });
26
- return {
27
- parts
28
- };
29
- }, [milliseconds, maxDisplayUnits, useAbbreviation, minUnit]);
30
- return result;
31
- }
32
-
33
- export { useFormatDuration };
@@ -1,65 +0,0 @@
1
- function formatDuration(milliseconds, options = {}) {
2
- const { maxDisplayUnits = 2, minUnit = "second" } = options;
3
- const effectiveMaxDisplayUnits = Math.max(1, maxDisplayUnits);
4
- if (milliseconds < 0 || milliseconds === 0) {
5
- const minUnitValue2 = minUnit || "second";
6
- return [{ value: 0, unit: minUnitValue2 }];
7
- }
8
- const units = [
9
- { value: 365 * 24 * 60 * 60 * 1e3, unit: "year" },
10
- { value: 30 * 24 * 60 * 60 * 1e3, unit: "month" },
11
- { value: 7 * 24 * 60 * 60 * 1e3, unit: "week" },
12
- { value: 24 * 60 * 60 * 1e3, unit: "day" },
13
- { value: 60 * 60 * 1e3, unit: "hour" },
14
- { value: 60 * 1e3, unit: "minute" },
15
- { value: 1e3, unit: "second" },
16
- { value: 1, unit: "millisecond" }
17
- ];
18
- const minUnitValue = minUnit || "second";
19
- const minUnitIndex = units.findIndex((u) => u.unit === minUnitValue);
20
- if (minUnitIndex === -1) {
21
- const defaultMinUnitIndex = units.findIndex((u) => u.unit === "second");
22
- const filteredUnits2 = units.slice(0, defaultMinUnitIndex + 1);
23
- const parts2 = [];
24
- let remaining2 = milliseconds;
25
- for (const unitDef of filteredUnits2) {
26
- if (remaining2 >= unitDef.value) {
27
- const count = Math.floor(remaining2 / unitDef.value);
28
- remaining2 = remaining2 % unitDef.value;
29
- parts2.push({
30
- value: count,
31
- unit: unitDef.unit
32
- });
33
- if (parts2.length >= effectiveMaxDisplayUnits) {
34
- break;
35
- }
36
- }
37
- }
38
- if (parts2.length === 0) {
39
- return [{ value: 0, unit: "second" }];
40
- }
41
- return parts2;
42
- }
43
- const filteredUnits = units.slice(0, minUnitIndex + 1);
44
- const parts = [];
45
- let remaining = milliseconds;
46
- for (const unitDef of filteredUnits) {
47
- if (remaining >= unitDef.value) {
48
- const count = Math.floor(remaining / unitDef.value);
49
- remaining = remaining % unitDef.value;
50
- parts.push({
51
- value: count,
52
- unit: unitDef.unit
53
- });
54
- if (parts.length >= effectiveMaxDisplayUnits) {
55
- break;
56
- }
57
- }
58
- }
59
- if (parts.length === 0) {
60
- return [{ value: 0, unit: minUnitValue || "second" }];
61
- }
62
- return parts;
63
- }
64
-
65
- export { formatDuration };
@@ -1,42 +0,0 @@
1
- /// <reference types="react" />
2
- import { IEmptyProps } from "../../core/Empty";
3
- import { DurationUnitType, FormatDurationItem } from "../../utils/formatDuration";
4
- import { RawValue } from "../Units/units.type";
5
- /**
6
- * Duration 组件的属性类型
7
- */
8
- export interface DurationProps extends Omit<RawValue, "decimals"> {
9
- /**
10
- * 最大展示单位数量,默认为 2
11
- * @default 2
12
- * @example
13
- * maxDisplayUnits={3} // 最多展示 3 个单位,如:1 day 1 hour 1 minute
14
- */
15
- maxDisplayUnits?: number;
16
- /**
17
- * 最小展示单位,默认为 "second"(秒)
18
- * @default "second"
19
- * @example
20
- * minUnit="minute" // 最小单位为分钟,秒数会被忽略
21
- */
22
- minUnit?: DurationUnitType;
23
- /**
24
- * Empty组件的配置属性
25
- */
26
- emptyProps?: IEmptyProps;
27
- /**
28
- * 自定义返回结果的渲染
29
- * 当提供此函数时,将使用自定义渲染函数来渲染持续时间,而不是使用默认的渲染方式
30
- * @param parts 格式化后的持续时间数组,每个元素包含 value 和 unit
31
- * @returns 自定义的 React 节点
32
- * @example
33
- * contentRender={(parts) => (
34
- * <div>
35
- * {parts.map((part, i) => (
36
- * <span key={i}>{part.value} {part.unit}</span>
37
- * ))}
38
- * </div>
39
- * )}
40
- */
41
- contentRender?: (parts: FormatDurationItem[]) => React.ReactNode;
42
- }
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { DurationProps } from "./duration.type";
3
- declare const Duration: React.FC<DurationProps>;
4
- export default Duration;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { UploadWrapper } from "./LocalUpload.style";
3
- import type { LocalUploadProps } from "./LocalUpload.type";
4
- import { UploadButton, UploadDescription, UploadDragger, UploadFileInfo, UploadFileList, UploadLabel } from "./LocalUpload.widget";
5
- type UploadComponents = {
6
- Wrapper: typeof UploadWrapper;
7
- Label: typeof UploadLabel;
8
- Description: typeof UploadDescription;
9
- Button: typeof UploadButton;
10
- Dragger: typeof UploadDragger;
11
- FileList: typeof UploadFileList;
12
- FileInfo: typeof UploadFileInfo;
13
- };
14
- export declare const LocalUpload: React.ForwardRefExoticComponent<LocalUploadProps & React.RefAttributes<HTMLDivElement>> & UploadComponents;
15
- export {};
@@ -1,32 +0,0 @@
1
- import type { LocalUploadButtonProps, LocalUploadDraggerProps, LocalUploadFile } from "./LocalUpload.type";
2
- /**
3
- * Custom hook to handle file validation automatically.
4
- * When files with status "need-validate" are detected, it validates them
5
- * and updates their status based on the validation result.
6
- *
7
- * @param options - Configuration options
8
- * @param options.fileList - Current file list
9
- * @param options.setFileList - Function to update file list
10
- * @param options.validate - Validation function
11
- * @param options.createNewFile - Whether to create a new File object when updating (for immutability)
12
- */
13
- export declare const useFileValidation: ({ fileList, setFileList, validate, createNewFile, }: {
14
- fileList: LocalUploadFile[];
15
- setFileList: (files: LocalUploadFile[]) => void;
16
- validate?: LocalUploadDraggerProps["validate"] | LocalUploadButtonProps["validate"];
17
- createNewFile?: boolean | undefined;
18
- }) => void;
19
- /**
20
- * Custom hook to clear error message when file count changes and is within the max count limit.
21
- * This hook tracks file count changes using a ref to avoid unnecessary updates.
22
- *
23
- * @param options - Configuration options
24
- * @param options.fileList - Current file list
25
- * @param options.maxCount - Maximum allowed file count
26
- * @param options.setError - Function to set error message
27
- */
28
- export declare const useFileCountErrorClear: ({ fileList, maxCount, setError, }: {
29
- fileList: LocalUploadFile[];
30
- maxCount: number;
31
- setError: (error: string) => void;
32
- }) => void;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const UploadWrapper: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
- export declare const FileInfoWrapperStyle: import("@linaria/core").LinariaClassName;