@neeloong/form 0.19.0 → 0.21.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 +61 -30
- package/index.full.js +1530 -820
- package/index.full.min.js +9 -9
- package/index.full.min.mjs +7 -7
- package/index.min.mjs +3 -3
- package/index.mjs +1530 -820
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
3
|
-
* (c) 2024-
|
|
2
|
+
* @neeloong/form v0.21.0
|
|
3
|
+
* (c) 2024-2026 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -783,7 +783,46 @@ type StoreLayout = {
|
|
|
783
783
|
fields?: StoreLayout.Item[] | null | undefined;
|
|
784
784
|
};
|
|
785
785
|
declare namespace StoreLayout {
|
|
786
|
-
type Action = "add" | "move" | "trigger" | "remove" | "serial";
|
|
786
|
+
type Action = "add" | "move" | "trigger" | "remove" | "serial" | "open" | "collapse";
|
|
787
|
+
type Grid = {
|
|
788
|
+
colStart?: number | undefined;
|
|
789
|
+
colSpan?: number | undefined;
|
|
790
|
+
colEnd?: number | undefined;
|
|
791
|
+
rowStart?: number | undefined;
|
|
792
|
+
rowSpan?: number | undefined;
|
|
793
|
+
rowEnd?: number | undefined;
|
|
794
|
+
cell?: "" | "collapse" | "block" | "inline" | "fieldset" | "base" | undefined;
|
|
795
|
+
};
|
|
796
|
+
type Column = {
|
|
797
|
+
/**
|
|
798
|
+
* 操作
|
|
799
|
+
*/
|
|
800
|
+
actions?: StoreLayout.Action[] | undefined;
|
|
801
|
+
/**
|
|
802
|
+
* 操作
|
|
803
|
+
*/
|
|
804
|
+
action?: StoreLayout.Action | undefined;
|
|
805
|
+
/**
|
|
806
|
+
* 字段
|
|
807
|
+
*/
|
|
808
|
+
field?: string | undefined;
|
|
809
|
+
/**
|
|
810
|
+
* 占位符
|
|
811
|
+
*/
|
|
812
|
+
placeholder?: number | undefined;
|
|
813
|
+
/**
|
|
814
|
+
* 模式
|
|
815
|
+
*/
|
|
816
|
+
pattern?: string | undefined;
|
|
817
|
+
/**
|
|
818
|
+
* 宽度
|
|
819
|
+
*/
|
|
820
|
+
width?: number | undefined;
|
|
821
|
+
/**
|
|
822
|
+
* 标签
|
|
823
|
+
*/
|
|
824
|
+
label?: string | undefined;
|
|
825
|
+
};
|
|
787
826
|
type Field = {
|
|
788
827
|
type?: "field" | undefined;
|
|
789
828
|
colStart?: number | undefined;
|
|
@@ -792,13 +831,16 @@ declare namespace StoreLayout {
|
|
|
792
831
|
rowStart?: number | undefined;
|
|
793
832
|
rowSpan?: number | undefined;
|
|
794
833
|
rowEnd?: number | undefined;
|
|
795
|
-
cell?: ""
|
|
834
|
+
cell?: StoreLayout.Grid["cell"];
|
|
796
835
|
field: string;
|
|
797
836
|
html?: string | ParentNode | null | undefined;
|
|
798
837
|
inlineHtml?: string | ParentNode | null | undefined;
|
|
799
838
|
fields?: StoreLayout.Item[] | null | undefined;
|
|
800
839
|
tableFoot?: "add" | "header" | "none" | undefined;
|
|
801
|
-
columns?: (string | StoreLayout.Action[])[] | undefined;
|
|
840
|
+
columns?: (string | number | StoreLayout.Column | StoreLayout.Action[])[] | undefined;
|
|
841
|
+
arrayStyle?: "tree" | "table" | undefined;
|
|
842
|
+
mainMethod?: "move" | "trigger" | "open" | "collapse" | undefined;
|
|
843
|
+
levelKey?: string | undefined;
|
|
802
844
|
};
|
|
803
845
|
type Button = {
|
|
804
846
|
type: "button";
|
|
@@ -808,7 +850,7 @@ declare namespace StoreLayout {
|
|
|
808
850
|
rowStart?: number | undefined;
|
|
809
851
|
rowSpan?: number | undefined;
|
|
810
852
|
rowEnd?: number | undefined;
|
|
811
|
-
cell?: ""
|
|
853
|
+
cell?: StoreLayout.Grid["cell"];
|
|
812
854
|
required?: boolean | undefined;
|
|
813
855
|
label?: string | undefined;
|
|
814
856
|
description?: string | undefined;
|
|
@@ -824,7 +866,7 @@ declare namespace StoreLayout {
|
|
|
824
866
|
rowStart?: number | undefined;
|
|
825
867
|
rowSpan?: number | undefined;
|
|
826
868
|
rowEnd?: number | undefined;
|
|
827
|
-
cell?: ""
|
|
869
|
+
cell?: StoreLayout.Grid["cell"];
|
|
828
870
|
required?: boolean | undefined;
|
|
829
871
|
label?: string | undefined;
|
|
830
872
|
description?: string | undefined;
|
|
@@ -875,8 +917,7 @@ declare class Store<T = any, M = any> {
|
|
|
875
917
|
* @param {Schema.Field<M>} schema 字段的 Schema 定义
|
|
876
918
|
* @param {object} [options] 可选配置
|
|
877
919
|
* @param {Store?} [options.parent]
|
|
878
|
-
* @param {((store: Store) => any) |
|
|
879
|
-
* @param {*} [options.state]
|
|
920
|
+
* @param {((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined} [options.default]
|
|
880
921
|
* @param {number | string | null} [options.index]
|
|
881
922
|
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.size]
|
|
882
923
|
* @param {boolean} [options.null]
|
|
@@ -904,16 +945,13 @@ declare class Store<T = any, M = any> {
|
|
|
904
945
|
* @param {Ref?} [options.ref]
|
|
905
946
|
*
|
|
906
947
|
* @param {((value: any) => any)?} [options.setValue]
|
|
907
|
-
* @param {((value: any) => any)?} [options.
|
|
908
|
-
* @param {((value: any, state: any) => [value: any, state: any])?} [options.convert]
|
|
948
|
+
* @param {((value: any) => any)?} [options.convert]
|
|
909
949
|
*
|
|
910
950
|
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
911
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdateState]
|
|
912
951
|
*/
|
|
913
|
-
constructor(schema: Schema.Field<M>, { null: isNull,
|
|
952
|
+
constructor(schema: Schema.Field<M>, { null: isNull, ref, default: defaultValue, setValue, convert, onUpdate, validator, validators, index, size, new: isNew, parent: parentNode, hidden, clearable, required, disabled, readonly, removable, label, description, placeholder, min, max, step, minLength, maxLength, pattern, values }?: {
|
|
914
953
|
parent?: Store<any, any> | null | undefined;
|
|
915
|
-
default?: ((store: Store) => any) |
|
|
916
|
-
state?: any;
|
|
954
|
+
default?: ((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined;
|
|
917
955
|
index?: string | number | null | undefined;
|
|
918
956
|
size?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
919
957
|
null?: boolean | undefined;
|
|
@@ -959,10 +997,8 @@ declare class Store<T = any, M = any> {
|
|
|
959
997
|
} | undefined;
|
|
960
998
|
ref?: Ref | null | undefined;
|
|
961
999
|
setValue?: ((value: any) => any) | null | undefined;
|
|
962
|
-
|
|
963
|
-
convert?: ((value: any, state: any) => [value: any, state: any]) | null | undefined;
|
|
1000
|
+
convert?: ((value: any) => any) | null | undefined;
|
|
964
1001
|
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
965
|
-
onUpdateState?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
966
1002
|
});
|
|
967
1003
|
/**
|
|
968
1004
|
* 触发事件并通知监听器
|
|
@@ -985,7 +1021,8 @@ declare class Store<T = any, M = any> {
|
|
|
985
1021
|
get kind(): string;
|
|
986
1022
|
get ref(): Ref;
|
|
987
1023
|
schema: Schema.Field<M>;
|
|
988
|
-
|
|
1024
|
+
/** @param {any} [value] @returns {any} */
|
|
1025
|
+
createDefault(value?: any): any;
|
|
989
1026
|
set loading(loading: boolean);
|
|
990
1027
|
get loading(): boolean;
|
|
991
1028
|
/** 存储对象自身 */
|
|
@@ -1111,11 +1148,8 @@ declare class Store<T = any, M = any> {
|
|
|
1111
1148
|
set value(v: T | null);
|
|
1112
1149
|
/** 字段当前值 */
|
|
1113
1150
|
get value(): T | null;
|
|
1114
|
-
set state(v: any);
|
|
1115
|
-
/** 字段状态 */
|
|
1116
|
-
get state(): any;
|
|
1117
1151
|
/** 重置数据 */
|
|
1118
|
-
reset(value?:
|
|
1152
|
+
reset(value?: unknown, isNew?: boolean): void;
|
|
1119
1153
|
/**
|
|
1120
1154
|
* 异步校验
|
|
1121
1155
|
* @overload
|
|
@@ -1153,14 +1187,12 @@ declare class ObjectStore<T extends Record<string, any> = Record<string, any>, M
|
|
|
1153
1187
|
* @param {number | string | null} [options.index]
|
|
1154
1188
|
* @param {boolean} [options.new]
|
|
1155
1189
|
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
1156
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdateState]
|
|
1157
1190
|
*/
|
|
1158
|
-
constructor(schema: Schema.Object<M> & Schema.Attr<M>, { parent, index, new: isNew, onUpdate
|
|
1191
|
+
constructor(schema: Schema.Object<M> & Schema.Attr<M>, { parent, index, new: isNew, onUpdate }?: {
|
|
1159
1192
|
parent?: Store<any, any> | null | undefined;
|
|
1160
1193
|
index?: string | number | null | undefined;
|
|
1161
1194
|
new?: boolean | undefined;
|
|
1162
1195
|
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1163
|
-
onUpdateState?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1164
1196
|
});
|
|
1165
1197
|
[Symbol.iterator](): Generator<[string, Store<any, any>], void, unknown>;
|
|
1166
1198
|
#private;
|
|
@@ -1181,15 +1213,13 @@ declare class ArrayStore<T = any, M = any> extends Store<(T | null)[], M> {
|
|
|
1181
1213
|
* @param {boolean} [options.new]
|
|
1182
1214
|
* @param {boolean} [options.addable]
|
|
1183
1215
|
* @param {(value: any, index: any, store: Store) => void} [options.onUpdate]
|
|
1184
|
-
* @param {(value: any, index: any, store: Store) => void} [options.onUpdateState]
|
|
1185
1216
|
*/
|
|
1186
|
-
constructor(schema: Schema.Field<M>, { parent, onUpdate,
|
|
1217
|
+
constructor(schema: Schema.Field<M>, { parent, onUpdate, index, new: isNew, addable }?: {
|
|
1187
1218
|
parent?: Store<any, any> | null | undefined;
|
|
1188
1219
|
index?: string | number | null | undefined;
|
|
1189
1220
|
new?: boolean | undefined;
|
|
1190
1221
|
addable?: boolean | undefined;
|
|
1191
1222
|
onUpdate?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1192
|
-
onUpdateState?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1193
1223
|
});
|
|
1194
1224
|
get children(): Store<any, any>[];
|
|
1195
1225
|
set selfAddable(v: boolean | null);
|
|
@@ -1221,9 +1251,10 @@ declare class ArrayStore<T = any, M = any> extends Store<(T | null)[], M> {
|
|
|
1221
1251
|
*
|
|
1222
1252
|
* @param {number} from
|
|
1223
1253
|
* @param {number} to
|
|
1254
|
+
* @param {number} quantity
|
|
1224
1255
|
* @returns
|
|
1225
1256
|
*/
|
|
1226
|
-
move(from: number, to: number):
|
|
1257
|
+
move(from: number, to: number, quantity?: number): number;
|
|
1227
1258
|
/**
|
|
1228
1259
|
*
|
|
1229
1260
|
* @param {number} a
|