@neeloong/form 0.28.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 +109 -127
- package/index.full.js +177 -180
- package/index.full.min.js +2 -2
- package/index.full.min.mjs +4 -4
- package/index.min.mjs +2 -2
- package/index.mjs +176 -180
- 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
|
*/
|
|
@@ -410,31 +410,6 @@ type Ref = {
|
|
|
410
410
|
[k: string]: Ref | undefined;
|
|
411
411
|
};
|
|
412
412
|
|
|
413
|
-
/** @import { Schema } from '../Schema.types.mjs' */
|
|
414
|
-
/**
|
|
415
|
-
* @template [T=any]
|
|
416
|
-
* @template [M=any]
|
|
417
|
-
* @template {Object.<string, Schema.State>} [S=Object.<string, Schema.State>]
|
|
418
|
-
* @extends {Store<T, M, S>}
|
|
419
|
-
*/
|
|
420
|
-
declare class BindObjectStore<T = any, M = any, S extends {
|
|
421
|
-
[x: string]: Schema.State;
|
|
422
|
-
} = {
|
|
423
|
-
[x: string]: Schema.State;
|
|
424
|
-
}> extends Store<T, M, S> {
|
|
425
|
-
/**
|
|
426
|
-
* @param {Schema<any, Object.<string, Schema.State>>} schema 数据结构模式
|
|
427
|
-
* @param {Store<T, M, S>} store
|
|
428
|
-
*/
|
|
429
|
-
constructor(schema: Schema<any, {
|
|
430
|
-
[x: string]: Schema.State;
|
|
431
|
-
}>, store: Store<T, M, S>);
|
|
432
|
-
[Symbol.iterator](): Generator<[string, Store<any, any, {
|
|
433
|
-
[x: string]: Schema.State;
|
|
434
|
-
}>], void, unknown>;
|
|
435
|
-
#private;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
413
|
/** @import { Ref } from './ref.mjs' */
|
|
439
414
|
/** @import { Schema } from '../Schema.types.mjs' */
|
|
440
415
|
/** @import { StoreLayout } from '../StoreLayout.types.mjs' */
|
|
@@ -476,95 +451,9 @@ declare class Store<T = any, M = any, S extends {
|
|
|
476
451
|
}): void;
|
|
477
452
|
/**
|
|
478
453
|
* @param {Schema.Field<M, S> | Store<T,M,S>} schema 字段的 Schema 定义
|
|
479
|
-
* @param {
|
|
480
|
-
* @param {Store?} [options.parent]
|
|
481
|
-
* @param {Partial<S>?} [options.states]
|
|
482
|
-
* @param {((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined} [options.default]
|
|
483
|
-
* @param {number | string | null} [options.index]
|
|
484
|
-
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.size]
|
|
485
|
-
* @param {boolean} [options.null]
|
|
486
|
-
* @param {boolean} [options.new]
|
|
487
|
-
* @param {boolean} [options.hidden]
|
|
488
|
-
* @param {boolean} [options.clearable]
|
|
489
|
-
* @param {boolean} [options.required]
|
|
490
|
-
* @param {boolean} [options.disabled]
|
|
491
|
-
* @param {boolean} [options.readonly]
|
|
492
|
-
* @param {boolean} [options.removable]
|
|
493
|
-
*
|
|
494
|
-
* @param {string} [options.label] 字段标签
|
|
495
|
-
* @param {string} [options.description] 字段描述
|
|
496
|
-
* @param {string} [options.placeholder] 占位符
|
|
497
|
-
* @param {number} [options.min] 日期、时间、数字的最小值
|
|
498
|
-
* @param {number} [options.max] 日期、时间、数字的最大值
|
|
499
|
-
* @param {number} [options.step] 日期、时间、数字的步长
|
|
500
|
-
* @param {number} [options.minLength]
|
|
501
|
-
* @param {number} [options.maxLength]
|
|
502
|
-
* @param {RegExp} [options.pattern]
|
|
503
|
-
* @param {(Schema.Value.Group | Schema.Value | string | number)[]} [options.values] 可选值
|
|
504
|
-
* @param {Schema.Validator | Schema.Validator[] | null} [options.validator]
|
|
505
|
-
* @param {{[k in keyof Schema.Events]?: Schema.AsyncValidator | Schema.AsyncValidator[] | null}} [options.validators]
|
|
506
|
-
*
|
|
507
|
-
* @param {Ref?} [options.ref]
|
|
508
|
-
*
|
|
509
|
-
* @param {((value: any) => any)?} [options.setValue]
|
|
510
|
-
* @param {((value: any) => any)?} [options.convert]
|
|
511
|
-
*
|
|
512
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
454
|
+
* @param {StoreOptions | AbortSignal | null} [options] 可选配置
|
|
513
455
|
*/
|
|
514
|
-
constructor(schema: Schema.Field<M, S> | Store<T, M, S>,
|
|
515
|
-
parent?: Store<any, any, {
|
|
516
|
-
[x: string]: Schema.State;
|
|
517
|
-
}> | null | undefined;
|
|
518
|
-
states?: Partial<S> | null | undefined;
|
|
519
|
-
default?: ((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined;
|
|
520
|
-
index?: string | number | null | undefined;
|
|
521
|
-
size?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
522
|
-
null?: boolean | undefined;
|
|
523
|
-
new?: boolean | undefined;
|
|
524
|
-
hidden?: boolean | undefined;
|
|
525
|
-
clearable?: boolean | undefined;
|
|
526
|
-
required?: boolean | undefined;
|
|
527
|
-
disabled?: boolean | undefined;
|
|
528
|
-
readonly?: boolean | undefined;
|
|
529
|
-
removable?: boolean | undefined;
|
|
530
|
-
label?: string | undefined;
|
|
531
|
-
description?: string | undefined;
|
|
532
|
-
placeholder?: string | undefined;
|
|
533
|
-
min?: number | undefined;
|
|
534
|
-
max?: number | undefined;
|
|
535
|
-
step?: number | undefined;
|
|
536
|
-
minLength?: number | undefined;
|
|
537
|
-
maxLength?: number | undefined;
|
|
538
|
-
pattern?: RegExp | undefined;
|
|
539
|
-
values?: (string | number | Schema.Value | Schema.Value.Group)[] | undefined;
|
|
540
|
-
validator?: Schema.Validator | Schema.Validator[] | null | undefined;
|
|
541
|
-
validators?: {
|
|
542
|
-
/**
|
|
543
|
-
* 输入
|
|
544
|
-
*/
|
|
545
|
-
input?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
546
|
-
/**
|
|
547
|
-
* 变化
|
|
548
|
-
*/
|
|
549
|
-
change?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
550
|
-
/**
|
|
551
|
-
* 点击
|
|
552
|
-
*/
|
|
553
|
-
click?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
554
|
-
/**
|
|
555
|
-
* 聚焦
|
|
556
|
-
*/
|
|
557
|
-
focus?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
558
|
-
/**
|
|
559
|
-
* 失焦
|
|
560
|
-
*/
|
|
561
|
-
blur?: Schema.AsyncValidator | Schema.AsyncValidator[] | null | undefined;
|
|
562
|
-
} | undefined;
|
|
563
|
-
ref?: Ref | null | undefined;
|
|
564
|
-
setValue?: ((value: any) => any) | null | undefined;
|
|
565
|
-
convert?: ((value: any) => any) | null | undefined;
|
|
566
|
-
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
567
|
-
});
|
|
456
|
+
constructor(schema: Schema.Field<M, S> | Store<T, M, S>, options?: StoreOptions | AbortSignal | null);
|
|
568
457
|
get schema(): Schema.Field<M, S>;
|
|
569
458
|
/**
|
|
570
459
|
* 触发事件并通知监听器
|
|
@@ -722,18 +611,6 @@ declare class Store<T = any, M = any, S extends {
|
|
|
722
611
|
* @returns {Store?}
|
|
723
612
|
*/
|
|
724
613
|
child(key: string | number): Store | null;
|
|
725
|
-
/**
|
|
726
|
-
* @template [M=any]
|
|
727
|
-
* @template {Object.<string, Schema.State>} [S=Object.<string, Schema.State>]
|
|
728
|
-
* @param {Schema<M, S>} schema 数据结构模式
|
|
729
|
-
* @param {AbortSignal} [signal]
|
|
730
|
-
* @returns {BindObjectStore}
|
|
731
|
-
*/
|
|
732
|
-
bindObject<M_1 = any, S_1 extends {
|
|
733
|
-
[x: string]: Schema.State;
|
|
734
|
-
} = {
|
|
735
|
-
[x: string]: Schema.State;
|
|
736
|
-
}>(schema: Schema<M_1, S_1>, signal?: AbortSignal): BindObjectStore;
|
|
737
614
|
/** 内容是否已改变 */
|
|
738
615
|
get changed(): boolean;
|
|
739
616
|
set value(v: T | null);
|
|
@@ -763,6 +640,85 @@ declare class Store<T = any, M = any, S extends {
|
|
|
763
640
|
[Symbol.iterator](): IterableIterator<[key: string | number, value: Store]>;
|
|
764
641
|
#private;
|
|
765
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
|
+
};
|
|
766
722
|
|
|
767
723
|
/** @import { Schema } from '../Schema.types.mjs' */
|
|
768
724
|
/**
|
|
@@ -879,6 +835,32 @@ declare class ArrayStore<T = any, M = any, S extends {
|
|
|
879
835
|
#private;
|
|
880
836
|
}
|
|
881
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
|
+
|
|
882
864
|
/**
|
|
883
865
|
* 解析模板内容
|
|
884
866
|
* @param {string} source 输入源字符串
|
|
@@ -1486,4 +1468,4 @@ declare function renderStore<T>(store: Store, fieldRenderer: StoreLayout.Rendere
|
|
|
1486
1468
|
clone?: boolean;
|
|
1487
1469
|
}) | null): void;
|
|
1488
1470
|
|
|
1489
|
-
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 };
|