@kilnonedre/foundation 0.0.14 → 0.0.16
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 +59 -37
- package/dist/index.js +14 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -136,16 +136,16 @@ type SemanticColorToken = {
|
|
|
136
136
|
};
|
|
137
137
|
declare const getSemanticColor: (semanticColor: EnumSemanticColor, variant: EnumVariant) => SemanticColorToken;
|
|
138
138
|
|
|
139
|
-
interface ConfigProp$
|
|
139
|
+
interface ConfigProp$j {
|
|
140
140
|
semanticColor?: EnumSemanticColor;
|
|
141
141
|
variant?: EnumVariant;
|
|
142
142
|
children?: ReactNode;
|
|
143
143
|
className?: string;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
declare const Badge: ({ semanticColor, variant, children, className, }: ConfigProp$
|
|
146
|
+
declare const Badge: ({ semanticColor, variant, children, className, }: ConfigProp$j) => react_jsx_runtime.JSX.Element;
|
|
147
147
|
|
|
148
|
-
interface ConfigProp$
|
|
148
|
+
interface ConfigProp$i {
|
|
149
149
|
semanticColor?: EnumSemanticColor;
|
|
150
150
|
variant?: EnumVariant;
|
|
151
151
|
children?: ReactNode;
|
|
@@ -157,15 +157,15 @@ interface ConfigProp$h {
|
|
|
157
157
|
type?: 'button' | 'submit' | 'reset';
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
declare const Button: ({ semanticColor, variant, children, className, onClick, disabled, type, size, loading, }: ConfigProp$
|
|
160
|
+
declare const Button: ({ semanticColor, variant, children, className, onClick, disabled, type, size, loading, }: ConfigProp$i) => react_jsx_runtime.JSX.Element;
|
|
161
161
|
|
|
162
|
-
interface ConfigProp$
|
|
162
|
+
interface ConfigProp$h {
|
|
163
163
|
options: Array<CommonOption>;
|
|
164
164
|
value?: string | null;
|
|
165
165
|
onChange: (_v: string) => void;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
declare const CheckboxSingleList: (props: ConfigProp$
|
|
168
|
+
declare const CheckboxSingleList: (props: ConfigProp$h) => react_jsx_runtime.JSX.Element;
|
|
169
169
|
|
|
170
170
|
interface ConfigListRespT<T> {
|
|
171
171
|
items: Array<T>;
|
|
@@ -193,7 +193,7 @@ type AdvancedFilterCtx = {
|
|
|
193
193
|
draftFilters: Record<string, unknown>;
|
|
194
194
|
setDraftFilters: (_updater: (_prev: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
195
195
|
};
|
|
196
|
-
type ConfigProp$
|
|
196
|
+
type ConfigProp$g<T, P> = {
|
|
197
197
|
columns: Array<ColumnDef<T>>;
|
|
198
198
|
renderList: (_params: P) => Promise<ConfigApiRespT<ConfigListRespT<T>>>;
|
|
199
199
|
getRowId?: (_row: T) => string;
|
|
@@ -221,7 +221,7 @@ declare const KeywordSearchBar: (props: ConfigProps$1) => react_jsx_runtime.JSX.
|
|
|
221
221
|
|
|
222
222
|
declare const TableEmpty: () => react_jsx_runtime.JSX.Element;
|
|
223
223
|
|
|
224
|
-
interface ConfigProp$
|
|
224
|
+
interface ConfigProp$f {
|
|
225
225
|
id?: string;
|
|
226
226
|
mode: EnumFormMode;
|
|
227
227
|
children: ReactNode;
|
|
@@ -235,22 +235,22 @@ interface ConfigProp$e {
|
|
|
235
235
|
onOpenChange: (_nextOpen: boolean) => void;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
declare const TableFormDialog: (props: ConfigProp$
|
|
238
|
+
declare const TableFormDialog: (props: ConfigProp$f) => react_jsx_runtime.JSX.Element;
|
|
239
239
|
|
|
240
|
-
interface ConfigProp$
|
|
240
|
+
interface ConfigProp$e {
|
|
241
241
|
text: string;
|
|
242
242
|
className?: ClassValue;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
declare const TableHeaderText: (props: ConfigProp$
|
|
245
|
+
declare const TableHeaderText: (props: ConfigProp$e) => react_jsx_runtime.JSX.Element;
|
|
246
246
|
|
|
247
|
-
interface ConfigProp$
|
|
247
|
+
interface ConfigProp$d {
|
|
248
248
|
value: Array<CommonObject>;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
declare const TableImage: (props: ConfigProp$
|
|
251
|
+
declare const TableImage: (props: ConfigProp$d) => react_jsx_runtime.JSX.Element;
|
|
252
252
|
|
|
253
|
-
interface ConfigProp$
|
|
253
|
+
interface ConfigProp$c {
|
|
254
254
|
totalPage: number;
|
|
255
255
|
size: number;
|
|
256
256
|
sizeList: Array<number>;
|
|
@@ -259,18 +259,18 @@ interface ConfigProp$b {
|
|
|
259
259
|
onUpdateSize: (_size: number) => void;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
declare const TablePagination: (props: ConfigProp$
|
|
262
|
+
declare const TablePagination: (props: ConfigProp$c) => react_jsx_runtime.JSX.Element;
|
|
263
263
|
|
|
264
|
-
interface ConfigProp$
|
|
264
|
+
interface ConfigProp$b {
|
|
265
265
|
text?: string | number;
|
|
266
266
|
wrap?: boolean;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
declare const TableText: (props: ConfigProp$
|
|
269
|
+
declare const TableText: (props: ConfigProp$b) => react_jsx_runtime.JSX.Element;
|
|
270
270
|
|
|
271
|
-
declare const DataTable: <T, P>(props: ConfigProp$
|
|
271
|
+
declare const DataTable: <T, P>(props: ConfigProp$g<T, P>) => react_jsx_runtime.JSX.Element;
|
|
272
272
|
|
|
273
|
-
interface ConfigProp$
|
|
273
|
+
interface ConfigProp$a {
|
|
274
274
|
children: ReactNode;
|
|
275
275
|
title?: string;
|
|
276
276
|
content?: ReactNode;
|
|
@@ -279,9 +279,9 @@ interface ConfigProp$9 {
|
|
|
279
279
|
onConfirm?: () => void | Promise<void>;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
declare const Dialog: (props: ConfigProp$
|
|
282
|
+
declare const Dialog: (props: ConfigProp$a) => react_jsx_runtime.JSX.Element;
|
|
283
283
|
|
|
284
|
-
interface ConfigProp$
|
|
284
|
+
interface ConfigProp$9<T> {
|
|
285
285
|
columns: Array<ColumnDef<T>>;
|
|
286
286
|
list?: Array<T>;
|
|
287
287
|
enableRowSelection?: boolean;
|
|
@@ -290,7 +290,7 @@ interface ConfigProp$8<T> {
|
|
|
290
290
|
navigate?: (_id: UUID) => void;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
declare const DisplayTable: <T>(props: ConfigProp$
|
|
293
|
+
declare const DisplayTable: <T>(props: ConfigProp$9<T>) => react_jsx_runtime.JSX.Element;
|
|
294
294
|
|
|
295
295
|
interface ConfigCascaderOption {
|
|
296
296
|
label: string;
|
|
@@ -327,7 +327,7 @@ declare const DropdownCascaderMulti: ({ value, ...props }: ConfigDropdownCascade
|
|
|
327
327
|
|
|
328
328
|
declare const DropdownCascaderSingle: (props: ConfigDropdownCascaderSingleProp) => react_jsx_runtime.JSX.Element;
|
|
329
329
|
|
|
330
|
-
interface ConfigProp$
|
|
330
|
+
interface ConfigProp$8<T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>> {
|
|
331
331
|
id: string;
|
|
332
332
|
name: TName;
|
|
333
333
|
label: string;
|
|
@@ -342,16 +342,16 @@ interface ConfigProp$7<T extends FieldValues, TName extends FieldPath<T> = Field
|
|
|
342
342
|
}) => ReactNode;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
declare const FieldController: <T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>>({ required, ...props }: ConfigProp$
|
|
345
|
+
declare const FieldController: <T extends FieldValues, TName extends FieldPath<T> = FieldPath<T>>({ required, ...props }: ConfigProp$8<T, TName>) => react_jsx_runtime.JSX.Element;
|
|
346
346
|
|
|
347
|
-
interface ConfigProp$
|
|
347
|
+
interface ConfigProp$7 {
|
|
348
348
|
className?: string;
|
|
349
349
|
children: ReactNode;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
declare const FieldGroup: (props: ConfigProp$
|
|
352
|
+
declare const FieldGroup: (props: ConfigProp$7) => react_jsx_runtime.JSX.Element;
|
|
353
353
|
|
|
354
|
-
interface ConfigProp$
|
|
354
|
+
interface ConfigProp$6 {
|
|
355
355
|
id: string;
|
|
356
356
|
name: string;
|
|
357
357
|
required?: boolean;
|
|
@@ -362,9 +362,9 @@ interface ConfigProp$5 {
|
|
|
362
362
|
children?: ReactNode;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
declare const FieldPlain: ({ required, mode, ...props }: ConfigProp$
|
|
365
|
+
declare const FieldPlain: ({ required, mode, ...props }: ConfigProp$6) => react_jsx_runtime.JSX.Element;
|
|
366
366
|
|
|
367
|
-
interface ConfigProp$
|
|
367
|
+
interface ConfigProp$5 {
|
|
368
368
|
id?: string;
|
|
369
369
|
name: string;
|
|
370
370
|
value?: string | number | null;
|
|
@@ -373,9 +373,9 @@ interface ConfigProp$4 {
|
|
|
373
373
|
render?: ReactNode;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
declare const FieldText: ({ id, name, value, placeholder, required, render, }: ConfigProp$
|
|
376
|
+
declare const FieldText: ({ id, name, value, placeholder, required, render, }: ConfigProp$5) => react_jsx_runtime.JSX.Element;
|
|
377
377
|
|
|
378
|
-
interface ConfigProp$
|
|
378
|
+
interface ConfigProp$4 {
|
|
379
379
|
value: string;
|
|
380
380
|
onValueChange: (_val: string) => void;
|
|
381
381
|
onLabelChange?: (_val: string) => void;
|
|
@@ -383,9 +383,9 @@ interface ConfigProp$3 {
|
|
|
383
383
|
optionList: Array<CommonOption>;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
declare const FormSelect: (props: ConfigProp$
|
|
386
|
+
declare const FormSelect: (props: ConfigProp$4) => react_jsx_runtime.JSX.Element;
|
|
387
387
|
|
|
388
|
-
interface ConfigProp$
|
|
388
|
+
interface ConfigProp$3 {
|
|
389
389
|
value?: Date;
|
|
390
390
|
onChange: (_value?: Date) => void;
|
|
391
391
|
id?: string;
|
|
@@ -394,7 +394,7 @@ interface ConfigProp$2 {
|
|
|
394
394
|
timePlaceholder?: string;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
declare const FormTimePicker: (props: ConfigProp$
|
|
397
|
+
declare const FormTimePicker: (props: ConfigProp$3) => react_jsx_runtime.JSX.Element;
|
|
398
398
|
|
|
399
399
|
interface ConfigProps {
|
|
400
400
|
value?: Array<string>;
|
|
@@ -415,12 +415,19 @@ declare const Provider: ({ children }: {
|
|
|
415
415
|
children: React.ReactNode;
|
|
416
416
|
}) => react_jsx_runtime.JSX.Element;
|
|
417
417
|
|
|
418
|
+
interface ConfigProp$2 {
|
|
419
|
+
children: ReactNode;
|
|
420
|
+
className?: ClassValue;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare const Text: (props: ConfigProp$2) => react_jsx_runtime.JSX.Element;
|
|
424
|
+
|
|
418
425
|
interface ConfigProp$1 {
|
|
419
426
|
children: ReactNode;
|
|
420
427
|
className?: ClassValue;
|
|
421
428
|
}
|
|
422
429
|
|
|
423
|
-
declare const
|
|
430
|
+
declare const Title: (props: ConfigProp$1) => react_jsx_runtime.JSX.Element;
|
|
424
431
|
|
|
425
432
|
interface ConfigProp<T extends object, K extends keyof T> {
|
|
426
433
|
key: K;
|
|
@@ -472,7 +479,22 @@ declare const isValidEmail: (string: string) => boolean;
|
|
|
472
479
|
|
|
473
480
|
declare const isValidURL: (string: string) => boolean;
|
|
474
481
|
|
|
475
|
-
|
|
482
|
+
/**
|
|
483
|
+
* 将空字符串转换为 undefined。
|
|
484
|
+
*
|
|
485
|
+
* 常用于 Zod 的 preprocess 场景,避免用户输入空字符串时被视为有效值。
|
|
486
|
+
*
|
|
487
|
+
* 示例:
|
|
488
|
+
* - '' => undefined
|
|
489
|
+
* - ' ' => undefined
|
|
490
|
+
* - 'hello' => 'hello'
|
|
491
|
+
* - null => undefined
|
|
492
|
+
* - 123 => undefined
|
|
493
|
+
*
|
|
494
|
+
* @param value 待处理的值
|
|
495
|
+
* @returns 去除首尾空格后的字符串,若为空则返回 undefined
|
|
496
|
+
*/
|
|
497
|
+
declare const emptyToUndefined: (value: unknown) => string | undefined;
|
|
476
498
|
declare const enumValues: <T extends Record<string, string>>(obj: T) => [T[keyof T], ...T[keyof T][]];
|
|
477
499
|
declare const zTextOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
478
500
|
declare const zTextRequired: (label: string, min?: number, max?: number) => z.ZodString;
|
|
@@ -502,4 +524,4 @@ declare const zCoerceNumberOptional: (label: string, min?: number, max?: number)
|
|
|
502
524
|
declare const zDecimal: (label: string, min?: number, max?: number) => z.ZodString;
|
|
503
525
|
declare const zDecimalOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
504
526
|
|
|
505
|
-
export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, type ConfigCascaderOption, type ConfigDropdownCascaderMultiProp, type ConfigDropdownCascaderSingleProp, type ConfigRenderBase, type ConfigRenderPasswordInput, DataTable, Dialog, DisplayTable, DropdownCascaderMulti, DropdownCascaderSingle, 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, KeywordSearchBar, MediaUploader, Provider, type SemanticColorToken, TableEmpty, TableFormDialog, TableHeaderText, TableImage, TablePagination, TableText, Text, type UUID, boolToText, buildColumn, cn, emptyToUndefined, enumApprovalStatusOptions, enumApprovalViewOptions, enumEntityStatusOptions, enumFormModeOptions, enumGenderTypeOptions, enumMapProviderOptions, enumOrderStatusOptions, enumPublishMethodOptions, enumSemanticColorOptions, enumStorageMethodOptions, enumToOptions, enumValues, enumVariantOptions, formatDateTime, formatDecimal, genUuid, getOptionMap, getSemanticColor, getSuccessMessage, isEmpty, isFormData, isValidEmail, isValidURL, renderBody, renderCascaderNodes, 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 };
|
|
527
|
+
export { Badge, Button, CheckboxSingleList, type CommonObject, type CommonOption, type ConfigCascaderOption, type ConfigDropdownCascaderMultiProp, type ConfigDropdownCascaderSingleProp, type ConfigRenderBase, type ConfigRenderPasswordInput, DataTable, Dialog, DisplayTable, DropdownCascaderMulti, DropdownCascaderSingle, 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, KeywordSearchBar, MediaUploader, Provider, type SemanticColorToken, TableEmpty, TableFormDialog, TableHeaderText, TableImage, TablePagination, TableText, Text, Title, type UUID, boolToText, buildColumn, cn, emptyToUndefined, enumApprovalStatusOptions, enumApprovalViewOptions, enumEntityStatusOptions, enumFormModeOptions, enumGenderTypeOptions, enumMapProviderOptions, enumOrderStatusOptions, enumPublishMethodOptions, enumSemanticColorOptions, enumStorageMethodOptions, enumToOptions, enumValues, enumVariantOptions, formatDateTime, formatDecimal, genUuid, getOptionMap, getSemanticColor, getSuccessMessage, isEmpty, isFormData, isValidEmail, isValidURL, renderBody, renderCascaderNodes, 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 };
|
package/dist/index.js
CHANGED
|
@@ -512,9 +512,11 @@ var isValidURL = (string) => {
|
|
|
512
512
|
// src/util/validator/schema.ts
|
|
513
513
|
import { z } from "zod";
|
|
514
514
|
var emptyToUndefined = (value) => {
|
|
515
|
-
if (typeof value !== "string")
|
|
515
|
+
if (typeof value !== "string") {
|
|
516
|
+
return void 0;
|
|
517
|
+
}
|
|
516
518
|
const v = value.trim();
|
|
517
|
-
return v
|
|
519
|
+
return v || void 0;
|
|
518
520
|
};
|
|
519
521
|
var enumValues = (obj) => Object.values(obj);
|
|
520
522
|
var zTextOptional = (label, min = 1, max = 32) => z.preprocess(
|
|
@@ -3435,16 +3437,22 @@ var Provider = ({ children }) => {
|
|
|
3435
3437
|
return /* @__PURE__ */ jsx48(TooltipProvider, { children });
|
|
3436
3438
|
};
|
|
3437
3439
|
|
|
3438
|
-
// src/
|
|
3440
|
+
// src/components/title/index.tsx
|
|
3439
3441
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
3442
|
+
var Title = (props) => {
|
|
3443
|
+
return /* @__PURE__ */ jsx49("div", { className: cn2("text-lg font-bold", props.className), children: props.children });
|
|
3444
|
+
};
|
|
3445
|
+
|
|
3446
|
+
// src/render/column/build-column/index.tsx
|
|
3447
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
3440
3448
|
var buildColumn = () => (props) => {
|
|
3441
3449
|
const { key, label, render } = props;
|
|
3442
3450
|
return {
|
|
3443
3451
|
accessorKey: key,
|
|
3444
|
-
header: () => /* @__PURE__ */
|
|
3452
|
+
header: () => /* @__PURE__ */ jsx50(TableHeaderText, { text: label }),
|
|
3445
3453
|
cell: ({ row }) => {
|
|
3446
3454
|
const value = row.original[key];
|
|
3447
|
-
return render ? render(value, row.original) : /* @__PURE__ */
|
|
3455
|
+
return render ? render(value, row.original) : /* @__PURE__ */ jsx50(TableText, { text: String(value ?? "") });
|
|
3448
3456
|
},
|
|
3449
3457
|
meta: {
|
|
3450
3458
|
label
|
|
@@ -3498,6 +3506,7 @@ export {
|
|
|
3498
3506
|
TablePagination,
|
|
3499
3507
|
TableText,
|
|
3500
3508
|
Text,
|
|
3509
|
+
Title,
|
|
3501
3510
|
boolToText,
|
|
3502
3511
|
buildColumn,
|
|
3503
3512
|
cn2 as cn,
|