@kilnonedre/foundation 0.0.3 → 0.0.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.
- package/dist/index.d.ts +54 -20
- package/dist/index.js +979 -680
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import { ColumnDef } from '@tanstack/react-table';
|
|
4
|
-
import {
|
|
5
|
+
import { FieldValues, FieldPath, Control, ControllerRenderProps, ControllerFieldState, UseFormReturn } from 'react-hook-form';
|
|
5
6
|
import { ClassValue } from 'clsx';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
|
|
9
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
10
|
+
|
|
11
|
+
interface CommonObject {
|
|
12
|
+
id: UUID;
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CommonOption {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
8
21
|
declare const EnumApprovalStatus: {
|
|
9
22
|
readonly PENDING: "PENDING";
|
|
10
23
|
readonly APPROVED: "APPROVED";
|
|
@@ -13,6 +26,7 @@ declare const EnumApprovalStatus: {
|
|
|
13
26
|
};
|
|
14
27
|
type EnumApprovalStatus = (typeof EnumApprovalStatus)[keyof typeof EnumApprovalStatus];
|
|
15
28
|
declare const EnumApprovalStatusLabel: Record<EnumApprovalStatus, string>;
|
|
29
|
+
declare const enumApprovalStatusOptions: CommonOption[];
|
|
16
30
|
|
|
17
31
|
declare const EnumApprovalView: {
|
|
18
32
|
readonly ALL: "ALL";
|
|
@@ -21,6 +35,7 @@ declare const EnumApprovalView: {
|
|
|
21
35
|
};
|
|
22
36
|
type EnumApprovalView = (typeof EnumApprovalView)[keyof typeof EnumApprovalView];
|
|
23
37
|
declare const EnumApprovalViewLabel: Record<EnumApprovalView, string>;
|
|
38
|
+
declare const enumApprovalViewOptions: CommonOption[];
|
|
24
39
|
|
|
25
40
|
declare const EnumEntityStatus: {
|
|
26
41
|
readonly ACTIVE: "ACTIVE";
|
|
@@ -29,6 +44,7 @@ declare const EnumEntityStatus: {
|
|
|
29
44
|
};
|
|
30
45
|
type EnumEntityStatus = (typeof EnumEntityStatus)[keyof typeof EnumEntityStatus];
|
|
31
46
|
declare const EnumEntityStatusLabel: Record<EnumEntityStatus, string>;
|
|
47
|
+
declare const enumEntityStatusOptions: CommonOption[];
|
|
32
48
|
|
|
33
49
|
declare const EnumFormMode: {
|
|
34
50
|
readonly VIEW: "VIEW";
|
|
@@ -38,6 +54,7 @@ declare const EnumFormMode: {
|
|
|
38
54
|
};
|
|
39
55
|
type EnumFormMode = (typeof EnumFormMode)[keyof typeof EnumFormMode];
|
|
40
56
|
declare const EnumFormModeLabel: Record<EnumFormMode, string>;
|
|
57
|
+
declare const enumFormModeOptions: CommonOption[];
|
|
41
58
|
|
|
42
59
|
declare const EnumGenderType: {
|
|
43
60
|
readonly MALE: "MALE";
|
|
@@ -46,6 +63,7 @@ declare const EnumGenderType: {
|
|
|
46
63
|
};
|
|
47
64
|
type EnumGenderType = (typeof EnumGenderType)[keyof typeof EnumGenderType];
|
|
48
65
|
declare const EnumGenderTypeLabel: Record<EnumGenderType, string>;
|
|
66
|
+
declare const enumGenderTypeOptions: CommonOption[];
|
|
49
67
|
|
|
50
68
|
declare const EnumMapProvider: {
|
|
51
69
|
readonly AMAP: "AMAP";
|
|
@@ -53,6 +71,7 @@ declare const EnumMapProvider: {
|
|
|
53
71
|
};
|
|
54
72
|
type EnumMapProvider = (typeof EnumMapProvider)[keyof typeof EnumMapProvider];
|
|
55
73
|
declare const EnumMapProviderLabel: Record<EnumMapProvider, string>;
|
|
74
|
+
declare const enumMapProviderOptions: CommonOption[];
|
|
56
75
|
|
|
57
76
|
declare const EnumOrderStatus: {
|
|
58
77
|
readonly CREATED: "CREATED";
|
|
@@ -65,6 +84,7 @@ declare const EnumOrderStatus: {
|
|
|
65
84
|
};
|
|
66
85
|
type EnumOrderStatus = (typeof EnumOrderStatus)[keyof typeof EnumOrderStatus];
|
|
67
86
|
declare const EnumOrderStatusLabel: Record<EnumOrderStatus, string>;
|
|
87
|
+
declare const enumOrderStatusOptions: CommonOption[];
|
|
68
88
|
|
|
69
89
|
declare const EnumPublishMethod: {
|
|
70
90
|
readonly IMMEDIATE: "IMMEDIATE";
|
|
@@ -73,6 +93,7 @@ declare const EnumPublishMethod: {
|
|
|
73
93
|
};
|
|
74
94
|
type EnumPublishMethod = (typeof EnumPublishMethod)[keyof typeof EnumPublishMethod];
|
|
75
95
|
declare const EnumPublishMethodLabel: Record<EnumPublishMethod, string>;
|
|
96
|
+
declare const enumPublishMethodOptions: CommonOption[];
|
|
76
97
|
|
|
77
98
|
declare const EnumSemanticColor: {
|
|
78
99
|
readonly PRIMARY: "PRIMARY";
|
|
@@ -85,6 +106,7 @@ declare const EnumSemanticColor: {
|
|
|
85
106
|
};
|
|
86
107
|
type EnumSemanticColor = (typeof EnumSemanticColor)[keyof typeof EnumSemanticColor];
|
|
87
108
|
declare const EnumSemanticColorLabel: Record<EnumSemanticColor, string>;
|
|
109
|
+
declare const enumSemanticColorOptions: CommonOption[];
|
|
88
110
|
|
|
89
111
|
declare const EnumStorageMethod: {
|
|
90
112
|
readonly COLD: "COLD";
|
|
@@ -93,6 +115,7 @@ declare const EnumStorageMethod: {
|
|
|
93
115
|
};
|
|
94
116
|
type EnumStorageMethod = (typeof EnumStorageMethod)[keyof typeof EnumStorageMethod];
|
|
95
117
|
declare const EnumStorageMethodLabel: Record<EnumStorageMethod, string>;
|
|
118
|
+
declare const enumStorageMethodOptions: CommonOption[];
|
|
96
119
|
|
|
97
120
|
declare const EnumVariant: {
|
|
98
121
|
readonly SOLID: "SOLID";
|
|
@@ -101,6 +124,7 @@ declare const EnumVariant: {
|
|
|
101
124
|
};
|
|
102
125
|
type EnumVariant = (typeof EnumVariant)[keyof typeof EnumVariant];
|
|
103
126
|
declare const EnumVariantLabel: Record<EnumVariant, string>;
|
|
127
|
+
declare const enumVariantOptions: CommonOption[];
|
|
104
128
|
|
|
105
129
|
type SemanticColorToken = {
|
|
106
130
|
bg: string;
|
|
@@ -135,18 +159,6 @@ interface ConfigProp$d {
|
|
|
135
159
|
|
|
136
160
|
declare const Button: ({ semanticColor, variant, children, className, onClick, disabled, type, size, loading, }: ConfigProp$d) => react_jsx_runtime.JSX.Element;
|
|
137
161
|
|
|
138
|
-
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
139
|
-
|
|
140
|
-
interface CommonObject {
|
|
141
|
-
id: UUID;
|
|
142
|
-
url: string;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
interface CommonOption {
|
|
146
|
-
value: string;
|
|
147
|
-
label: string;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
162
|
interface ConfigProp$c {
|
|
151
163
|
options: Array<CommonOption>;
|
|
152
164
|
value?: string | null;
|
|
@@ -277,22 +289,22 @@ declare const DropdownCascaderMulti: ({ value, ...props }: ConfigDropdownCascade
|
|
|
277
289
|
|
|
278
290
|
declare const DropdownCascader: (props: ConfigDropdownCascaderSingleProp) => react_jsx_runtime.JSX.Element;
|
|
279
291
|
|
|
280
|
-
interface ConfigProp$6 {
|
|
292
|
+
interface ConfigProp$6<T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>> {
|
|
281
293
|
id: string;
|
|
282
|
-
name:
|
|
294
|
+
name: TName;
|
|
295
|
+
label: string;
|
|
283
296
|
required?: boolean;
|
|
284
297
|
tip?: string;
|
|
285
|
-
control: Control<
|
|
298
|
+
control: Control<T>;
|
|
286
299
|
mode?: EnumFormMode;
|
|
287
|
-
label?: string;
|
|
288
300
|
children: (_params: {
|
|
289
|
-
field: ControllerRenderProps<
|
|
301
|
+
field: ControllerRenderProps<T, FieldPath<T>>;
|
|
290
302
|
fieldState: ControllerFieldState;
|
|
291
303
|
id: string;
|
|
292
304
|
}) => ReactNode;
|
|
293
305
|
}
|
|
294
306
|
|
|
295
|
-
declare const FieldController: ({ required, ...props }: ConfigProp$6) => react_jsx_runtime.JSX.Element;
|
|
307
|
+
declare const FieldController: <T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>>({ required, ...props }: ConfigProp$6<T, TName>) => react_jsx_runtime.JSX.Element;
|
|
296
308
|
|
|
297
309
|
interface ConfigProp$5 {
|
|
298
310
|
className?: string;
|
|
@@ -372,6 +384,28 @@ interface ConfigProp {
|
|
|
372
384
|
|
|
373
385
|
declare const Text: (props: ConfigProp) => react_jsx_runtime.JSX.Element;
|
|
374
386
|
|
|
387
|
+
interface ConfigRenderBase<T extends FieldValues> {
|
|
388
|
+
mode?: EnumFormMode;
|
|
389
|
+
form: UseFormReturn<T>;
|
|
390
|
+
id: string;
|
|
391
|
+
name: FieldPath<T>;
|
|
392
|
+
label: string;
|
|
393
|
+
required?: boolean;
|
|
394
|
+
tip?: string;
|
|
395
|
+
}
|
|
396
|
+
interface ConfigRenderPasswordInput<T extends FieldValues> extends ConfigRenderBase<T> {
|
|
397
|
+
hidden: boolean;
|
|
398
|
+
onHiddenChange: (_hidden: boolean) => void;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare const getSuccessMessage: (mode: EnumFormMode) => "" | "创建成功" | "更新成功" | "删除成功";
|
|
402
|
+
declare const renderFooter: (mode: EnumFormMode) => react_jsx_runtime.JSX.Element;
|
|
403
|
+
declare const renderConfirmFooter: () => react_jsx_runtime.JSX.Element;
|
|
404
|
+
declare const renderBody: (mode: EnumFormMode, formFields: () => ReactNode, form: UseFormReturn<FieldValues>) => string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
405
|
+
declare const renderTextarea: <T extends FieldValues>(props: ConfigRenderBase<T>) => react_jsx_runtime.JSX.Element;
|
|
406
|
+
declare const renderInput: <T extends FieldValues>(props: ConfigRenderBase<T>) => react_jsx_runtime.JSX.Element;
|
|
407
|
+
declare const renderPasswordInput: <T extends FieldValues>(props: ConfigRenderPasswordInput<T>) => react_jsx_runtime.JSX.Element;
|
|
408
|
+
|
|
375
409
|
declare const boolToText: (bool: boolean) => "是" | "否";
|
|
376
410
|
|
|
377
411
|
declare function cn(...inputs: ClassValue[]): string;
|
|
@@ -422,4 +456,4 @@ declare const zCoerceNumberOptional: (label: string, min?: number, max?: number)
|
|
|
422
456
|
declare const zDecimal: (label: string, min?: number, max?: number) => z.ZodString;
|
|
423
457
|
declare const zDecimalOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
424
458
|
|
|
425
|
-
export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, DataTable, Dialog, DisplayTable, DropdownCascader, DropdownCascaderMulti, EnumApprovalStatus, EnumApprovalStatusLabel, EnumApprovalView, EnumApprovalViewLabel, EnumEntityStatus, EnumEntityStatusLabel, EnumFormMode, EnumFormModeLabel, EnumGenderType, EnumGenderTypeLabel, EnumMapProvider, EnumMapProviderLabel, EnumOrderStatus, EnumOrderStatusLabel, EnumPublishMethod, EnumPublishMethodLabel, EnumSemanticColor, EnumSemanticColorLabel, EnumStorageMethod, EnumStorageMethodLabel, EnumVariant, EnumVariantLabel, FieldController, FieldGroup, FieldPlain, FieldText, FormSelect, FormTimePicker, MediaUploader, Provider, type SemanticColorToken, TableFormDialog, TablePagination, Text, type UUID, boolToText, cn, emptyToUndefined, enumToOptions, enumValues, formatDateTime, formatDecimal, genUuid, getSemanticColor, isEmpty, isFormData, isValidEmail, isValidURL, zBool, zCoerceNumber, zCoerceNumberOptional, zDate, zDateOptional, zDecimal, zDecimalOptional, zEmail, zEnumNullable, zEnumNullableOptional, zEnumNullableRequired, zEnumOptional, zEnumRequired, zId, zIdCard, zIdCardOptional, zIds, zImageId, zImageIdRequired, zImageIds, zImageIdsOptional, zNumber, zNumberOptional, zPhone, zTextOptional, zTextRequired, zTexts };
|
|
459
|
+
export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, DataTable, Dialog, DisplayTable, DropdownCascader, DropdownCascaderMulti, EnumApprovalStatus, EnumApprovalStatusLabel, EnumApprovalView, EnumApprovalViewLabel, EnumEntityStatus, EnumEntityStatusLabel, EnumFormMode, EnumFormModeLabel, EnumGenderType, EnumGenderTypeLabel, EnumMapProvider, EnumMapProviderLabel, EnumOrderStatus, EnumOrderStatusLabel, EnumPublishMethod, EnumPublishMethodLabel, EnumSemanticColor, EnumSemanticColorLabel, EnumStorageMethod, EnumStorageMethodLabel, EnumVariant, EnumVariantLabel, FieldController, FieldGroup, FieldPlain, FieldText, FormSelect, FormTimePicker, MediaUploader, Provider, type SemanticColorToken, TableFormDialog, TablePagination, Text, type UUID, boolToText, cn, emptyToUndefined, enumApprovalStatusOptions, enumApprovalViewOptions, enumEntityStatusOptions, enumFormModeOptions, enumGenderTypeOptions, enumMapProviderOptions, enumOrderStatusOptions, enumPublishMethodOptions, enumSemanticColorOptions, enumStorageMethodOptions, enumToOptions, enumValues, enumVariantOptions, formatDateTime, formatDecimal, genUuid, getSemanticColor, getSuccessMessage, isEmpty, isFormData, isValidEmail, isValidURL, renderBody, renderConfirmFooter, renderFooter, renderInput, renderPasswordInput, renderTextarea, zBool, zCoerceNumber, zCoerceNumberOptional, zDate, zDateOptional, zDecimal, zDecimalOptional, zEmail, zEnumNullable, zEnumNullableOptional, zEnumNullableRequired, zEnumOptional, zEnumRequired, zId, zIdCard, zIdCardOptional, zIds, zImageId, zImageIdRequired, zImageIds, zImageIdsOptional, zNumber, zNumberOptional, zPhone, zTextOptional, zTextRequired, zTexts };
|