@kilnonedre/foundation 0.0.21 → 0.0.22

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 CHANGED
@@ -496,10 +496,10 @@ declare const isValidURL: (string: string) => boolean;
496
496
  */
497
497
  declare const emptyToUndefined: (value: unknown) => string | undefined;
498
498
  declare const enumValues: <T extends Record<string, string>>(obj: T) => [T[keyof T], ...T[keyof T][]];
499
- declare const zTextOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
499
+ declare const zTextOptional: (label: string, min?: number, max?: number) => z.ZodString;
500
500
  declare const zTextRequired: (label: string, min?: number, max?: number) => z.ZodString;
501
501
  declare const zIdCard: (label?: string) => z.ZodString;
502
- declare const zIdCardOptional: (label?: string) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
502
+ declare const zIdCardOptional: (label?: string) => z.ZodOptional<z.ZodString>;
503
503
  declare const zEmail: (max?: number) => z.ZodString;
504
504
  declare const zPhone: (max?: number) => z.ZodString;
505
505
  declare const zId: (label?: string) => z.ZodString;
@@ -520,8 +520,8 @@ declare const zDateOptional: (label: string) => z.ZodOptional<z.ZodDate>;
520
520
  declare const zNumber: (label: string, min?: number, max?: number) => z.ZodNumber;
521
521
  declare const zNumberOptional: (label: string, min?: number, max?: number) => z.ZodOptional<z.ZodNumber>;
522
522
  declare const zCoerceNumber: (label: string, min?: number, max?: number) => z.ZodCoercedNumber<unknown>;
523
- declare const zCoerceNumberOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
523
+ declare const zCoerceNumberOptional: (label: string, min?: number, max?: number) => z.ZodOptional<z.ZodCoercedNumber<unknown>>;
524
524
  declare const zDecimal: (label: string, min?: number, max?: number) => z.ZodString;
525
- declare const zDecimalOptional: (label: string, min?: number, max?: number) => z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
525
+ declare const zDecimalOptional: (label: string, min?: number, max?: number) => z.ZodOptional<z.ZodString>;
526
526
 
527
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
@@ -519,20 +519,16 @@ var emptyToUndefined = (value) => {
519
519
  return v || void 0;
520
520
  };
521
521
  var enumValues = (obj) => Object.values(obj);
522
- var zTextOptional = (label, min = 1, max = 32) => z.preprocess(
523
- emptyToUndefined,
524
- z.string().trim().min(min, `${label}\u81F3\u5C11 ${min} \u4E2A\u5B57\u7B26`).max(max, `${label}\u6700\u591A ${max} \u4E2A\u5B57\u7B26`).optional()
525
- );
522
+ var zTextOptional = (label, min = 1, max = 32) => z.string().trim().max(max, `${label}\u6700\u591A ${max} \u4E2A\u5B57\u7B26`).refine((v) => v === "" || v.length >= min, {
523
+ message: `${label}\u81F3\u5C11 ${min} \u4E2A\u5B57\u7B26`
524
+ });
526
525
  var zTextRequired = (label, min = 1, max = 32) => z.string({
527
526
  message: `\u8BF7\u8F93\u5165${label}`
528
527
  }).trim().min(min, `${label}\u81F3\u5C11 ${min} \u4E2A\u5B57\u7B26`).max(max, `${label}\u6700\u591A ${max} \u4E2A\u5B57\u7B26`);
529
528
  var zIdCard = (label = "\u8EAB\u4EFD\u8BC1\u53F7") => z.string({
530
529
  message: `\u8BF7\u8F93\u5165${label}`
531
530
  }).trim().regex(/^\d{15}$|^\d{17}(\d|X|x)$/, `${label}\u683C\u5F0F\u4E0D\u6B63\u786E`);
532
- var zIdCardOptional = (label = "\u8EAB\u4EFD\u8BC1\u53F7") => z.preprocess(
533
- emptyToUndefined,
534
- z.string().trim().regex(/^\d{15}$|^\d{17}(\d|X|x)$/, `${label}\u683C\u5F0F\u4E0D\u6B63\u786E`).optional()
535
- );
531
+ var zIdCardOptional = (label = "\u8EAB\u4EFD\u8BC1\u53F7") => z.string().trim().regex(/^\d{15}$|^\d{17}(\d|X|x)$/, `${label}\u683C\u5F0F\u4E0D\u6B63\u786E`).optional();
536
532
  var zEmail = (max = 32) => z.string({
537
533
  message: "\u8BF7\u8F93\u5165\u90AE\u7BB1"
538
534
  }).trim().email("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1").max(max, `\u90AE\u7BB1\u6700\u591A ${max} \u4E2A\u5B57\u7B26`);
@@ -610,7 +606,7 @@ var zCoerceNumber = (label, min, max) => {
610
606
  }
611
607
  return schema;
612
608
  };
613
- var zCoerceNumberOptional = (label, min, max) => z.preprocess(emptyToUndefined, zCoerceNumber(label, min, max).optional());
609
+ var zCoerceNumberOptional = (label, min, max) => zCoerceNumber(label, min, max).optional();
614
610
  var zDecimal = (label, min, max) => {
615
611
  let schema = z.string({
616
612
  message: `\u8BF7\u8F93\u5165${label}`
@@ -627,7 +623,7 @@ var zDecimal = (label, min, max) => {
627
623
  }
628
624
  return schema;
629
625
  };
630
- var zDecimalOptional = (label, min, max) => z.preprocess(emptyToUndefined, zDecimal(label, min, max).optional());
626
+ var zDecimalOptional = (label, min, max) => zDecimal(label, min, max).optional();
631
627
 
632
628
  // src/type/enum/approval-status.ts
633
629
  var EnumApprovalStatus = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kilnonedre/foundation",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "private": false,
5
5
  "description": "Kilnonedre frontend foundation package",
6
6
  "type": "module",