akanjs 2.3.2-rc.0 → 2.3.2-rc.1
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/constant/fieldInfo.ts +5 -5
- package/package.json +1 -1
- package/types/constant/fieldInfo.d.ts +4 -4
- package/ui/Field.tsx +1 -4
package/constant/fieldInfo.ts
CHANGED
|
@@ -48,10 +48,10 @@ export type FieldToValue<Field, MapValue = any> = Field extends null
|
|
|
48
48
|
export interface FieldInfoObject {
|
|
49
49
|
[key: string]: FieldInfo<any, ConstantFieldTypeInput | null, any>;
|
|
50
50
|
}
|
|
51
|
-
export type ExtractFieldInfoObject<Obj extends FieldInfoObject
|
|
52
|
-
[K in keyof Obj]: Obj[K] extends FieldInfo<
|
|
51
|
+
export type ExtractFieldInfoObject<Obj extends FieldInfoObject> = {
|
|
52
|
+
[K in keyof Obj]: Obj[K] extends FieldInfo<any, infer FieldValue, infer ExplicitType, infer MapValue>
|
|
53
53
|
? unknown extends ExplicitType
|
|
54
|
-
? FieldToValue<FieldValue
|
|
54
|
+
? FieldToValue<FieldValue, MapValue>
|
|
55
55
|
: ExplicitType
|
|
56
56
|
: never;
|
|
57
57
|
};
|
|
@@ -381,7 +381,7 @@ field.hidden = <
|
|
|
381
381
|
value: Value,
|
|
382
382
|
option: FieldOption<Value, MapValue> = {},
|
|
383
383
|
) =>
|
|
384
|
-
new FieldInfo<"hidden", Value, ExplicitType, MapValue>(value, {
|
|
384
|
+
new FieldInfo<"hidden", Value | null, ExplicitType | null, MapValue>(value, {
|
|
385
385
|
...option,
|
|
386
386
|
fieldType: "hidden",
|
|
387
387
|
nullable: true,
|
|
@@ -394,7 +394,7 @@ field.secret = <
|
|
|
394
394
|
value: Value,
|
|
395
395
|
option: FieldOption<Value, MapValue> = {},
|
|
396
396
|
) =>
|
|
397
|
-
new FieldInfo<"secret", Value, ExplicitType, MapValue>(value, {
|
|
397
|
+
new FieldInfo<"secret", Value | null, ExplicitType | null, MapValue>(value, {
|
|
398
398
|
...option,
|
|
399
399
|
fieldType: "secret",
|
|
400
400
|
select: false,
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@ export type FieldToValue<Field, MapValue = any> = Field extends null ? FieldToVa
|
|
|
11
11
|
export interface FieldInfoObject {
|
|
12
12
|
[key: string]: FieldInfo<any, ConstantFieldTypeInput | null, any>;
|
|
13
13
|
}
|
|
14
|
-
export type ExtractFieldInfoObject<Obj extends FieldInfoObject
|
|
15
|
-
[K in keyof Obj]: Obj[K] extends FieldInfo<
|
|
14
|
+
export type ExtractFieldInfoObject<Obj extends FieldInfoObject> = {
|
|
15
|
+
[K in keyof Obj]: Obj[K] extends FieldInfo<any, infer FieldValue, infer ExplicitType, infer MapValue> ? unknown extends ExplicitType ? FieldToValue<FieldValue, MapValue> : ExplicitType : never;
|
|
16
16
|
};
|
|
17
17
|
export type ConstantFieldKind = "property" | "hidden" | "secret" | "resolve";
|
|
18
18
|
export interface ConstantFieldProps<FieldType extends ConstantFieldKind = ConstantFieldKind, FieldValue = any, MapValue = any, Metadata = {
|
|
@@ -144,8 +144,8 @@ export type PlainTypeToFieldType<PlainType> = PlainType extends [infer First, ..
|
|
|
144
144
|
/** Builds a stored property field with optional validation, default, ref, text, and metadata options. */
|
|
145
145
|
export declare const field: {
|
|
146
146
|
<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"property", Value, ExplicitType, MapValue>;
|
|
147
|
-
hidden<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"hidden", Value, ExplicitType, MapValue>;
|
|
148
|
-
secret<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"secret", Value, ExplicitType, MapValue>;
|
|
147
|
+
hidden<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"hidden", Value | null, ExplicitType | null, MapValue>;
|
|
148
|
+
secret<ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>): FieldInfo<"secret", Value | null, ExplicitType | null, MapValue>;
|
|
149
149
|
};
|
|
150
150
|
/** Builds a resolved field that is derived rather than treated as a stored property. */
|
|
151
151
|
export declare const resolve: <ExplicitType, Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never>(value: Value, option?: FieldOption<Value, MapValue>) => FieldInfo<"resolve", Value, ExplicitType, MapValue>;
|
package/ui/Field.tsx
CHANGED
|
@@ -1345,10 +1345,7 @@ const ParentId = <T extends string, State, Input, Full extends { id: string }, L
|
|
|
1345
1345
|
labelClassName={labelClassName}
|
|
1346
1346
|
selectClassName={selectClassName}
|
|
1347
1347
|
value={value}
|
|
1348
|
-
options={modelList.map((model) =>
|
|
1349
|
-
const label = renderOption?.(model) ?? model.id;
|
|
1350
|
-
return { label: typeof label === "string" ? label : model.id, value: model.id };
|
|
1351
|
-
})}
|
|
1348
|
+
options={modelList.map((model) => model.id)}
|
|
1352
1349
|
renderOption={(renderId) => {
|
|
1353
1350
|
if (!renderId) return null;
|
|
1354
1351
|
const model = modelList.get(renderId);
|