@neeloong/form 0.27.0 → 0.29.0
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/index.d.mts +114 -104
- package/index.full.js +213 -109
- package/index.full.min.js +6 -6
- package/index.full.min.mjs +7 -7
- package/index.min.mjs +2 -2
- package/index.mjs +213 -110
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.29.0
|
|
3
3
|
* (c) 2024-2026 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -450,101 +450,17 @@ declare class Store<T = any, M = any, S extends {
|
|
|
450
450
|
new (...p: ConstructorParameters<typeof Store>): Store;
|
|
451
451
|
}): void;
|
|
452
452
|
/**
|
|
453
|
-
* @param {Schema.Field<M, S>} schema 字段的 Schema 定义
|
|
454
|
-
* @param {
|
|
455
|
-
* @param {Store?} [options.parent]
|
|
456
|
-
* @param {Partial<S>?} [options.states]
|
|
457
|
-
* @param {((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined} [options.default]
|
|
458
|
-
* @param {number | string | null} [options.index]
|
|
459
|
-
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.size]
|
|
460
|
-
* @param {boolean} [options.null]
|
|
461
|
-
* @param {boolean} [options.new]
|
|
462
|
-
* @param {boolean} [options.hidden]
|
|
463
|
-
* @param {boolean} [options.clearable]
|
|
464
|
-
* @param {boolean} [options.required]
|
|
465
|
-
* @param {boolean} [options.disabled]
|
|
466
|
-
* @param {boolean} [options.readonly]
|
|
467
|
-
* @param {boolean} [options.removable]
|
|
468
|
-
*
|
|
469
|
-
* @param {string} [options.label] 字段标签
|
|
470
|
-
* @param {string} [options.description] 字段描述
|
|
471
|
-
* @param {string} [options.placeholder] 占位符
|
|
472
|
-
* @param {number} [options.min] 日期、时间、数字的最小值
|
|
473
|
-
* @param {number} [options.max] 日期、时间、数字的最大值
|
|
474
|
-
* @param {number} [options.step] 日期、时间、数字的步长
|
|
475
|
-
* @param {number} [options.minLength]
|
|
476
|
-
* @param {number} [options.maxLength]
|
|
477
|
-
* @param {RegExp} [options.pattern]
|
|
478
|
-
* @param {(Schema.Value.Group | Schema.Value | string | number)[]} [options.values] 可选值
|
|
479
|
-
* @param {Schema.Validator | Schema.Validator[] | null} [options.validator]
|
|
480
|
-
* @param {{[k in keyof Schema.Events]?: Schema.AsyncValidator | Schema.AsyncValidator[] | null}} [options.validators]
|
|
481
|
-
*
|
|
482
|
-
* @param {Ref?} [options.ref]
|
|
483
|
-
*
|
|
484
|
-
* @param {((value: any) => any)?} [options.setValue]
|
|
485
|
-
* @param {((value: any) => any)?} [options.convert]
|
|
486
|
-
*
|
|
487
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
453
|
+
* @param {Schema.Field<M, S> | Store<T,M,S>} schema 字段的 Schema 定义
|
|
454
|
+
* @param {StoreOptions | AbortSignal | null} [options] 可选配置
|
|
488
455
|
*/
|
|
489
|
-
constructor(schema: Schema.Field<M, S
|
|
490
|
-
|
|
491
|
-
[x: string]: Schema.State;
|
|
492
|
-
}> | null | undefined;
|
|
493
|
-
states?: Partial<S> | null | undefined;
|
|
494
|
-
default?: ((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined;
|
|
495
|
-
index?: string | number | null | undefined;
|
|
496
|
-
size?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
497
|
-
null?: boolean | undefined;
|
|
498
|
-
new?: boolean | undefined;
|
|
499
|
-
hidden?: boolean | undefined;
|
|
500
|
-
clearable?: boolean | undefined;
|
|
501
|
-
required?: boolean | undefined;
|
|
502
|
-
disabled?: boolean | undefined;
|
|
503
|
-
readonly?: boolean | undefined;
|
|
504
|
-
removable?: boolean | undefined;
|
|
505
|
-
label?: string | undefined;
|
|
506
|
-
description?: string | undefined;
|
|
507
|
-
placeholder?: string | undefined;
|
|
508
|
-
min?: number | undefined;
|
|
509
|
-
max?: number | undefined;
|
|
510
|
-
step?: number | undefined;
|
|
511
|
-
minLength?: number | undefined;
|
|
512
|
-
maxLength?: number | undefined;
|
|
513
|
-
pattern?: RegExp | undefined;
|
|
514
|
-
values?: (string | number | Schema.Value | Schema.Value.Group)[] | undefined;
|
|
515
|
-
validator?: Schema.Validator | Schema.Validator[] | null | undefined;
|
|
516
|
-
validators?: {
|
|
517
|
-
/**
|
|
518
|
-
* 输入
|
|
519
|
-
*/
|
|
520
|
-
input?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
521
|
-
/**
|
|
522
|
-
* 变化
|
|
523
|
-
*/
|
|
524
|
-
change?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
525
|
-
/**
|
|
526
|
-
* 点击
|
|
527
|
-
*/
|
|
528
|
-
click?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
529
|
-
/**
|
|
530
|
-
* 聚焦
|
|
531
|
-
*/
|
|
532
|
-
focus?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
533
|
-
/**
|
|
534
|
-
* 失焦
|
|
535
|
-
*/
|
|
536
|
-
blur?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
537
|
-
} | undefined;
|
|
538
|
-
ref?: Ref | null | undefined;
|
|
539
|
-
setValue?: ((value: any) => any) | null | undefined;
|
|
540
|
-
convert?: ((value: any) => any) | null | undefined;
|
|
541
|
-
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
542
|
-
});
|
|
456
|
+
constructor(schema: Schema.Field<M, S> | Store<T, M, S>, options?: StoreOptions | AbortSignal | null);
|
|
457
|
+
get schema(): Schema.Field<M, S>;
|
|
543
458
|
/**
|
|
544
459
|
* 触发事件并通知监听器
|
|
545
460
|
* @template {keyof Schema.Events} K
|
|
546
461
|
* @param {K} event
|
|
547
462
|
* @param {Schema.Events[K]} value
|
|
463
|
+
* @returns {boolean}
|
|
548
464
|
*/
|
|
549
465
|
emit<K extends keyof Schema.Events>(event: K, value: Schema.Events[K]): boolean;
|
|
550
466
|
/**
|
|
@@ -560,7 +476,6 @@ declare class Store<T = any, M = any, S extends {
|
|
|
560
476
|
/** 存储类类别,继承的自定义类需要设置自定义的此只读属性 */
|
|
561
477
|
get kind(): string;
|
|
562
478
|
get ref(): Ref;
|
|
563
|
-
schema: Schema.Field<M, S>;
|
|
564
479
|
get states(): S | null;
|
|
565
480
|
get layout(): StoreLayout.Field<any>;
|
|
566
481
|
/** @param {any} [value] @returns {any} */
|
|
@@ -696,21 +611,11 @@ declare class Store<T = any, M = any, S extends {
|
|
|
696
611
|
* @returns {Store?}
|
|
697
612
|
*/
|
|
698
613
|
child(key: string | number): Store | null;
|
|
699
|
-
/**
|
|
700
|
-
|
|
701
|
-
* @template {Object.<string, Schema.State>} [S=Object.<string, Schema.State>]
|
|
702
|
-
* @param {Schema<M, S>} schema 数据结构模式
|
|
703
|
-
*/
|
|
704
|
-
bindObject<M_1 = any, S_1 extends {
|
|
705
|
-
[x: string]: Schema.State;
|
|
706
|
-
} = {
|
|
707
|
-
[x: string]: Schema.State;
|
|
708
|
-
}>(schema: Schema<M_1, S_1>): () => void;
|
|
614
|
+
/** 内容是否已改变 */
|
|
615
|
+
get changed(): boolean;
|
|
709
616
|
set value(v: T | null);
|
|
710
617
|
/** 字段当前值 */
|
|
711
618
|
get value(): T | null;
|
|
712
|
-
/** 内容是否已改变 */
|
|
713
|
-
get changed(): boolean;
|
|
714
619
|
/** 重置数据 */
|
|
715
620
|
reset(value?: unknown, isNew?: boolean): void;
|
|
716
621
|
/**
|
|
@@ -735,6 +640,85 @@ declare class Store<T = any, M = any, S extends {
|
|
|
735
640
|
[Symbol.iterator](): IterableIterator<[key: string | number, value: Store]>;
|
|
736
641
|
#private;
|
|
737
642
|
}
|
|
643
|
+
type StoreOptions<T = any, M = any, S extends {
|
|
644
|
+
[x: string]: Schema.State;
|
|
645
|
+
} = {
|
|
646
|
+
[x: string]: Schema.State;
|
|
647
|
+
}> = {
|
|
648
|
+
parent?: Store<any, any, {
|
|
649
|
+
[x: string]: Schema.State;
|
|
650
|
+
}> | null | undefined;
|
|
651
|
+
states?: Partial<S> | null | undefined;
|
|
652
|
+
default?: ((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined;
|
|
653
|
+
index?: string | number | null | undefined;
|
|
654
|
+
size?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
655
|
+
null?: boolean | undefined;
|
|
656
|
+
new?: boolean | undefined;
|
|
657
|
+
hidden?: boolean | undefined;
|
|
658
|
+
clearable?: boolean | undefined;
|
|
659
|
+
required?: boolean | undefined;
|
|
660
|
+
disabled?: boolean | undefined;
|
|
661
|
+
readonly?: boolean | undefined;
|
|
662
|
+
removable?: boolean | undefined;
|
|
663
|
+
/**
|
|
664
|
+
* 字段标签
|
|
665
|
+
*/
|
|
666
|
+
label?: string | undefined;
|
|
667
|
+
/**
|
|
668
|
+
* 字段描述
|
|
669
|
+
*/
|
|
670
|
+
description?: string | undefined;
|
|
671
|
+
/**
|
|
672
|
+
* 占位符
|
|
673
|
+
*/
|
|
674
|
+
placeholder?: string | undefined;
|
|
675
|
+
/**
|
|
676
|
+
* 日期、时间、数字的最小值
|
|
677
|
+
*/
|
|
678
|
+
min?: number | undefined;
|
|
679
|
+
/**
|
|
680
|
+
* 日期、时间、数字的最大值
|
|
681
|
+
*/
|
|
682
|
+
max?: number | undefined;
|
|
683
|
+
/**
|
|
684
|
+
* 日期、时间、数字的步长
|
|
685
|
+
*/
|
|
686
|
+
step?: number | undefined;
|
|
687
|
+
minLength?: number | undefined;
|
|
688
|
+
maxLength?: number | undefined;
|
|
689
|
+
pattern?: RegExp | undefined;
|
|
690
|
+
/**
|
|
691
|
+
* 可选值
|
|
692
|
+
*/
|
|
693
|
+
values?: (string | number | Schema.Value | Schema.Value.Group)[] | undefined;
|
|
694
|
+
validator?: Schema.Validator | Schema.Validator[] | null | undefined;
|
|
695
|
+
validators?: {
|
|
696
|
+
/**
|
|
697
|
+
* 输入
|
|
698
|
+
*/
|
|
699
|
+
input?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
700
|
+
/**
|
|
701
|
+
* 变化
|
|
702
|
+
*/
|
|
703
|
+
change?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
704
|
+
/**
|
|
705
|
+
* 点击
|
|
706
|
+
*/
|
|
707
|
+
click?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
708
|
+
/**
|
|
709
|
+
* 聚焦
|
|
710
|
+
*/
|
|
711
|
+
focus?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
712
|
+
/**
|
|
713
|
+
* 失焦
|
|
714
|
+
*/
|
|
715
|
+
blur?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
716
|
+
} | undefined;
|
|
717
|
+
ref?: Ref | null | undefined;
|
|
718
|
+
setValue?: ((value: any) => any) | null | undefined;
|
|
719
|
+
convert?: ((value: any) => any) | null | undefined;
|
|
720
|
+
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
721
|
+
};
|
|
738
722
|
|
|
739
723
|
/** @import { Schema } from '../Schema.types.mjs' */
|
|
740
724
|
/**
|
|
@@ -851,6 +835,32 @@ declare class ArrayStore<T = any, M = any, S extends {
|
|
|
851
835
|
#private;
|
|
852
836
|
}
|
|
853
837
|
|
|
838
|
+
/** @import { Schema } from '../Schema.types.mjs' */
|
|
839
|
+
/**
|
|
840
|
+
* @template [T=any]
|
|
841
|
+
* @template [M=any]
|
|
842
|
+
* @template {Object.<string, Schema.State>} [S=Object.<string, Schema.State>]
|
|
843
|
+
* @extends {Store<T, M, S>}
|
|
844
|
+
*/
|
|
845
|
+
declare class BindObjectStore<T = any, M = any, S extends {
|
|
846
|
+
[x: string]: Schema.State;
|
|
847
|
+
} = {
|
|
848
|
+
[x: string]: Schema.State;
|
|
849
|
+
}> extends Store<T, M, S> {
|
|
850
|
+
/**
|
|
851
|
+
* @param {Schema<any, Object.<string, Schema.State>>} schema 数据结构模式
|
|
852
|
+
* @param {Store<T, M, S>} store
|
|
853
|
+
* @param {AbortSignal} [signal]
|
|
854
|
+
*/
|
|
855
|
+
constructor(schema: Schema<any, {
|
|
856
|
+
[x: string]: Schema.State;
|
|
857
|
+
}>, store: Store<T, M, S>, signal?: AbortSignal);
|
|
858
|
+
[Symbol.iterator](): Generator<[string, Store<any, any, {
|
|
859
|
+
[x: string]: Schema.State;
|
|
860
|
+
}>], void, unknown>;
|
|
861
|
+
#private;
|
|
862
|
+
}
|
|
863
|
+
|
|
854
864
|
/**
|
|
855
865
|
* 解析模板内容
|
|
856
866
|
* @param {string} source 输入源字符串
|
|
@@ -1458,4 +1468,4 @@ declare function renderStore<T>(store: Store, fieldRenderer: StoreLayout.Rendere
|
|
|
1458
1468
|
clone?: boolean;
|
|
1459
1469
|
}) | null): void;
|
|
1460
1470
|
|
|
1461
|
-
export { ArrayStore, Component, Enhancement, index_d as Layout, ObjectStore, type Ref, Schema, Store, StoreLayout, effect, render, renderStore, watch };
|
|
1471
|
+
export { ArrayStore, BindObjectStore, Component, Enhancement, index_d as Layout, ObjectStore, type Ref, Schema, Store, StoreLayout, type StoreOptions, effect, render, renderStore, watch };
|