@ahoo-wang/fetcher-viewer 3.1.6 → 3.1.9

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 (72) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/components/RemoteSelect.d.ts.map +1 -1
  4. package/dist/components/TagInput.d.ts.map +1 -1
  5. package/dist/filter/AssemblyFilter.d.ts.map +1 -1
  6. package/dist/filter/BoolFilter.d.ts.map +1 -1
  7. package/dist/filter/DateTimeFilter.d.ts.map +1 -1
  8. package/dist/filter/IdFilter.d.ts.map +1 -1
  9. package/dist/filter/NumberFilter.d.ts.map +1 -1
  10. package/dist/filter/SelectFilter.d.ts.map +1 -1
  11. package/dist/filter/TextFilter.d.ts.map +1 -1
  12. package/dist/filter/TypedFilter.d.ts +2 -2
  13. package/dist/filter/TypedFilter.d.ts.map +1 -1
  14. package/dist/filter/filterRegistry.d.ts +49 -47
  15. package/dist/filter/filterRegistry.d.ts.map +1 -1
  16. package/dist/filter/operator/locale/index.d.ts.map +1 -1
  17. package/dist/filter/operator/locale/operator.zh_CN.d.ts.map +1 -1
  18. package/dist/filter/panel/AvailableFilterSelect.d.ts.map +1 -1
  19. package/dist/filter/panel/AvailableFilterSelectModal.d.ts.map +1 -1
  20. package/dist/filter/panel/EditableFilterPanel.d.ts.map +1 -1
  21. package/dist/filter/panel/RemovableTypedFilter.d.ts.map +1 -1
  22. package/dist/filter/panel/index.d.ts.map +1 -1
  23. package/dist/filter/types.d.ts +1 -1
  24. package/dist/filter/types.d.ts.map +1 -1
  25. package/dist/filter/useFilterState.d.ts.map +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.es.js +1227 -841
  29. package/dist/index.es.js.map +1 -1
  30. package/dist/index.umd.js +1 -1
  31. package/dist/index.umd.js.map +1 -1
  32. package/dist/registry/componentRegistry.d.ts +100 -0
  33. package/dist/registry/componentRegistry.d.ts.map +1 -0
  34. package/dist/registry/index.d.ts +2 -0
  35. package/dist/registry/index.d.ts.map +1 -0
  36. package/dist/table/cell/AvatarCell.d.ts +122 -0
  37. package/dist/table/cell/AvatarCell.d.ts.map +1 -0
  38. package/dist/table/cell/CalendarTime.d.ts +178 -0
  39. package/dist/table/cell/CalendarTime.d.ts.map +1 -0
  40. package/dist/table/cell/CurrencyCell.d.ts +275 -0
  41. package/dist/table/cell/CurrencyCell.d.ts.map +1 -0
  42. package/dist/table/cell/DateTimeCell.d.ts +125 -0
  43. package/dist/table/cell/DateTimeCell.d.ts.map +1 -0
  44. package/dist/table/cell/ImageCell.d.ts +129 -0
  45. package/dist/table/cell/ImageCell.d.ts.map +1 -0
  46. package/dist/table/cell/ImageGroupCell.d.ts +129 -0
  47. package/dist/table/cell/ImageGroupCell.d.ts.map +1 -0
  48. package/dist/table/cell/LinkCell.d.ts +104 -0
  49. package/dist/table/cell/LinkCell.d.ts.map +1 -0
  50. package/dist/table/cell/TagCell.d.ts +101 -0
  51. package/dist/table/cell/TagCell.d.ts.map +1 -0
  52. package/dist/table/cell/TagsCell.d.ts +128 -0
  53. package/dist/table/cell/TagsCell.d.ts.map +1 -0
  54. package/dist/table/cell/TextCell.d.ts +101 -0
  55. package/dist/table/cell/TextCell.d.ts.map +1 -0
  56. package/dist/table/cell/TypedCell.d.ts +99 -0
  57. package/dist/table/cell/TypedCell.d.ts.map +1 -0
  58. package/dist/table/cell/cellRegistry.d.ts +40 -0
  59. package/dist/table/cell/cellRegistry.d.ts.map +1 -0
  60. package/dist/table/cell/currencyFormatter.d.ts +161 -0
  61. package/dist/table/cell/currencyFormatter.d.ts.map +1 -0
  62. package/dist/table/cell/index.d.ts +54 -0
  63. package/dist/table/cell/index.d.ts.map +1 -0
  64. package/dist/table/cell/types.d.ts +128 -0
  65. package/dist/table/cell/types.d.ts.map +1 -0
  66. package/dist/table/cell/utils.d.ts +24 -0
  67. package/dist/table/cell/utils.d.ts.map +1 -0
  68. package/dist/table/index.d.ts +2 -0
  69. package/dist/table/index.d.ts.map +1 -0
  70. package/dist/types.d.ts +3 -0
  71. package/dist/types.d.ts.map +1 -1
  72. package/package.json +3 -3
@@ -0,0 +1,128 @@
1
+ import { default as React } from 'react';
2
+ import { AttributesCapable } from '../../types';
3
+ /**
4
+ * Represents the data structure for a single table cell.
5
+ *
6
+ * This interface encapsulates all the information needed to render a cell,
7
+ * including the value to display, the complete record for context, and
8
+ * the row index for conditional rendering or styling.
9
+ *
10
+ * @template ValueType - The type of the cell value (e.g., string, number, Date).
11
+ * @template RecordType - The type of the complete record object.
12
+ * @interface CellData
13
+ *
14
+ * @property {ValueType} value - The value to display in the cell.
15
+ * @property {RecordType} record - The full record object providing context for the cell.
16
+ * @property {number} index - The zero-based index of the row in the table.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * interface User {
21
+ * id: number;
22
+ * name: string;
23
+ * email: string;
24
+ * }
25
+ *
26
+ * const cellData: CellData<string, User> = {
27
+ * value: "john@example.com",
28
+ * record: { id: 1, name: "John", email: "john@example.com" },
29
+ * index: 0
30
+ * };
31
+ * ```
32
+ */
33
+ export interface CellData<ValueType = any, RecordType = any> {
34
+ /** The value to display in the cell. */
35
+ value: ValueType;
36
+ /** The full record object for context. */
37
+ record: RecordType;
38
+ /** The index of the row in the table. */
39
+ index: number;
40
+ }
41
+ /**
42
+ * Props for rendering a table cell component.
43
+ *
44
+ * This interface defines the standard props structure for all cell components,
45
+ * combining cell data with optional attributes for customization. It extends
46
+ * AttributesCapable to provide a consistent way to pass component-specific
47
+ * attributes.
48
+ *
49
+ * @template ValueType - The type of the cell value (e.g., string, number, Date).
50
+ * @template RecordType - The type of the record containing the cell data.
51
+ * @template Attributes - The type of additional attributes passed to the cell component.
52
+ * @interface CellProps
53
+ * @extends AttributesCapable<Attributes>
54
+ *
55
+ * @property {CellData<ValueType, RecordType>} data - The cell data containing value, record, and index.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * interface User {
60
+ * id: number;
61
+ * name: string;
62
+ * }
63
+ *
64
+ * // Text cell props
65
+ * const textCellProps: CellProps<string, User, TextProps> = {
66
+ * data: {
67
+ * value: "John Doe",
68
+ * record: { id: 1, name: "John Doe" },
69
+ * index: 0
70
+ * },
71
+ * attributes: { ellipsis: true }
72
+ * };
73
+ *
74
+ * // Number cell props
75
+ * const numberCellProps: CellProps<number, User, InputNumberProps> = {
76
+ * data: {
77
+ * value: 25,
78
+ * record: { id: 1, name: "John Doe" },
79
+ * index: 0
80
+ * },
81
+ * attributes: { min: 0, max: 100 }
82
+ * };
83
+ * ```
84
+ */
85
+ export interface CellProps<ValueType = any, RecordType = any, Attributes = any> extends AttributesCapable<Attributes> {
86
+ data: CellData<ValueType, RecordType>;
87
+ }
88
+ /**
89
+ * A React component for rendering table cells.
90
+ *
91
+ * This type represents functional React components that can render table cells.
92
+ * Cell components receive standardized props containing the cell data and
93
+ * optional attributes, and return JSX elements for display in table rows.
94
+ *
95
+ * @template ValueType - The type of the cell value.
96
+ * @template RecordType - The type of the record containing the cell data.
97
+ * @template Attributes - The type of additional attributes for the component.
98
+ * @typedef CellComponent
99
+ * @type {React.FC<CellProps<ValueType, RecordType, Attributes>>}
100
+ *
101
+ * @example
102
+ * ```tsx
103
+ * // Text cell component
104
+ * const TextCell: CellComponent<string, User, TextProps> = ({ data, attributes }) => {
105
+ * return <Typography.Text {...attributes}>{data.value}</Typography.Text>;
106
+ * };
107
+ *
108
+ * // Number cell component
109
+ * const NumberCell: CellComponent<number, Product, InputNumberProps> = ({ data, attributes }) => {
110
+ * return <InputNumber value={data.value} {...attributes} />;
111
+ * };
112
+ *
113
+ * // Usage in table
114
+ * const columns = [
115
+ * {
116
+ * title: 'Name',
117
+ * render: (value, record, index) => (
118
+ * <TextCell
119
+ * data={{ value, record, index }}
120
+ * attributes={{ ellipsis: true }}
121
+ * />
122
+ * )
123
+ * }
124
+ * ];
125
+ * ```
126
+ */
127
+ export type CellComponent<ValueType = any, RecordType = any, Attributes = any> = React.FC<CellProps<ValueType, RecordType, Attributes>>;
128
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/table/cell/types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,QAAQ,CAAC,SAAS,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG;IACzD,wCAAwC;IACxC,KAAK,EAAE,SAAS,CAAC;IACjB,0CAA0C;IAC1C,MAAM,EAAE,UAAU,CAAC;IACnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,SAAS,CAAC,SAAS,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,CAC5E,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IACrC,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,MAAM,aAAa,CACvB,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,UAAU,GAAG,GAAG,IACd,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Dayjs } from 'dayjs';
2
+ export declare function parseDayjs(value: string | number | Date | Dayjs): Dayjs;
3
+ export declare function isNullOrUndefined(value: any): value is null | undefined;
4
+ /**
5
+ * Checks if a value is a valid image source URL.
6
+ *
7
+ * This function determines whether a given value can be used as an image source
8
+ * by checking if it's a string that represents a valid image URL. It supports
9
+ * absolute URLs (http/https), relative URLs (/), and data URLs (data:image/).
10
+ *
11
+ * @param value - The value to check
12
+ * @returns true if the value is a valid image source, false otherwise
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * isValidImageSrc('https://example.com/image.jpg') // true
17
+ * isValidImageSrc('/images/avatar.png') // true
18
+ * isValidImageSrc('data:image/png;base64,iVBORw0KGgo...') // true
19
+ * isValidImageSrc('John Doe') // false
20
+ * isValidImageSrc(null) // false
21
+ * ```
22
+ */
23
+ export declare function isValidImageSrc(value: any): value is string;
24
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/table/cell/utils.ts"],"names":[],"mappings":"AAaA,OAAc,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAErC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAKvE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAEvE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CA4B3D"}
@@ -0,0 +1,2 @@
1
+ export * from './cell';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAaA,cAAc,QAAQ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -4,4 +4,7 @@ export interface StyleCapable {
4
4
  style?: React.CSSProperties;
5
5
  className?: string;
6
6
  }
7
+ export interface AttributesCapable<Attributes = any> {
8
+ attributes?: Attributes;
9
+ }
7
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB,CAAC,UAAU,GAAG,GAAG;IACjD,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-viewer",
3
- "version": "3.1.6",
3
+ "version": "3.1.9",
4
4
  "description": "A comprehensive React component library for API documentation viewing and data filtering, built on top of Ant Design and the Fetcher ecosystem. Provides reusable UI components for building rich data-driven applications with advanced filtering capabilities and remote data selection.",
5
5
  "keywords": [
6
6
  "react",
@@ -57,14 +57,14 @@
57
57
  "@testing-library/react": "^16.0.0",
58
58
  "@types/react": ">=19.0.0",
59
59
  "@types/react-dom": ">=19.0.0",
60
- "@vitejs/plugin-react": "^5.1.0",
60
+ "@vitejs/plugin-react": "^5.1.1",
61
61
  "@vitest/coverage-v8": "^3.2.4",
62
62
  "@vitest/ui": "^3.2.4",
63
63
  "babel-plugin-react-compiler": "^1.0.0",
64
64
  "eslint": "^9.39.1",
65
65
  "eslint-plugin-react-hooks": "^7.0.1",
66
66
  "globals": "^16.5.0",
67
- "jsdom": "^27.1.0",
67
+ "jsdom": "^27.2.0",
68
68
  "prettier": "^3.6.2",
69
69
  "react-compiler-runtime": "^1.0.0",
70
70
  "typescript": "^5.9.3",