@neeloong/form 0.20.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 +43 -25
- package/index.full.js +640 -676
- package/index.full.min.js +8 -8
- package/index.full.min.mjs +6 -6
- package/index.min.mjs +3 -3
- package/index.mjs +640 -676
- 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
|
|
|
@@ -793,6 +793,36 @@ declare namespace StoreLayout {
|
|
|
793
793
|
rowEnd?: number | undefined;
|
|
794
794
|
cell?: "" | "collapse" | "block" | "inline" | "fieldset" | "base" | undefined;
|
|
795
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
|
+
};
|
|
796
826
|
type Field = {
|
|
797
827
|
type?: "field" | undefined;
|
|
798
828
|
colStart?: number | undefined;
|
|
@@ -807,7 +837,7 @@ declare namespace StoreLayout {
|
|
|
807
837
|
inlineHtml?: string | ParentNode | null | undefined;
|
|
808
838
|
fields?: StoreLayout.Item[] | null | undefined;
|
|
809
839
|
tableFoot?: "add" | "header" | "none" | undefined;
|
|
810
|
-
columns?: (string | number | StoreLayout.Action[])[] | undefined;
|
|
840
|
+
columns?: (string | number | StoreLayout.Column | StoreLayout.Action[])[] | undefined;
|
|
811
841
|
arrayStyle?: "tree" | "table" | undefined;
|
|
812
842
|
mainMethod?: "move" | "trigger" | "open" | "collapse" | undefined;
|
|
813
843
|
levelKey?: string | undefined;
|
|
@@ -887,8 +917,7 @@ declare class Store<T = any, M = any> {
|
|
|
887
917
|
* @param {Schema.Field<M>} schema 字段的 Schema 定义
|
|
888
918
|
* @param {object} [options] 可选配置
|
|
889
919
|
* @param {Store?} [options.parent]
|
|
890
|
-
* @param {((store: Store) => any) |
|
|
891
|
-
* @param {*} [options.state]
|
|
920
|
+
* @param {((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined} [options.default]
|
|
892
921
|
* @param {number | string | null} [options.index]
|
|
893
922
|
* @param {number | Signal.State<number> | Signal.Computed<number>} [options.size]
|
|
894
923
|
* @param {boolean} [options.null]
|
|
@@ -916,16 +945,13 @@ declare class Store<T = any, M = any> {
|
|
|
916
945
|
* @param {Ref?} [options.ref]
|
|
917
946
|
*
|
|
918
947
|
* @param {((value: any) => any)?} [options.setValue]
|
|
919
|
-
* @param {((value: any) => any)?} [options.
|
|
920
|
-
* @param {((value: any, state: any) => [value: any, state: any])?} [options.convert]
|
|
948
|
+
* @param {((value: any) => any)?} [options.convert]
|
|
921
949
|
*
|
|
922
950
|
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
923
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdateState]
|
|
924
951
|
*/
|
|
925
|
-
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 }?: {
|
|
926
953
|
parent?: Store<any, any> | null | undefined;
|
|
927
|
-
default?: ((store: Store) => any) |
|
|
928
|
-
state?: any;
|
|
954
|
+
default?: ((store: Store, value?: any) => any) | object | number | string | boolean | null | undefined;
|
|
929
955
|
index?: string | number | null | undefined;
|
|
930
956
|
size?: number | Signal.State<number> | Signal.Computed<number> | undefined;
|
|
931
957
|
null?: boolean | undefined;
|
|
@@ -971,10 +997,8 @@ declare class Store<T = any, M = any> {
|
|
|
971
997
|
} | undefined;
|
|
972
998
|
ref?: Ref | null | undefined;
|
|
973
999
|
setValue?: ((value: any) => any) | null | undefined;
|
|
974
|
-
|
|
975
|
-
convert?: ((value: any, state: any) => [value: any, state: any]) | null | undefined;
|
|
1000
|
+
convert?: ((value: any) => any) | null | undefined;
|
|
976
1001
|
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
977
|
-
onUpdateState?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
978
1002
|
});
|
|
979
1003
|
/**
|
|
980
1004
|
* 触发事件并通知监听器
|
|
@@ -997,7 +1021,8 @@ declare class Store<T = any, M = any> {
|
|
|
997
1021
|
get kind(): string;
|
|
998
1022
|
get ref(): Ref;
|
|
999
1023
|
schema: Schema.Field<M>;
|
|
1000
|
-
|
|
1024
|
+
/** @param {any} [value] @returns {any} */
|
|
1025
|
+
createDefault(value?: any): any;
|
|
1001
1026
|
set loading(loading: boolean);
|
|
1002
1027
|
get loading(): boolean;
|
|
1003
1028
|
/** 存储对象自身 */
|
|
@@ -1123,11 +1148,8 @@ declare class Store<T = any, M = any> {
|
|
|
1123
1148
|
set value(v: T | null);
|
|
1124
1149
|
/** 字段当前值 */
|
|
1125
1150
|
get value(): T | null;
|
|
1126
|
-
set state(v: any);
|
|
1127
|
-
/** 字段状态 */
|
|
1128
|
-
get state(): any;
|
|
1129
1151
|
/** 重置数据 */
|
|
1130
|
-
reset(value?:
|
|
1152
|
+
reset(value?: unknown, isNew?: boolean): void;
|
|
1131
1153
|
/**
|
|
1132
1154
|
* 异步校验
|
|
1133
1155
|
* @overload
|
|
@@ -1165,14 +1187,12 @@ declare class ObjectStore<T extends Record<string, any> = Record<string, any>, M
|
|
|
1165
1187
|
* @param {number | string | null} [options.index]
|
|
1166
1188
|
* @param {boolean} [options.new]
|
|
1167
1189
|
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
1168
|
-
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdateState]
|
|
1169
1190
|
*/
|
|
1170
|
-
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 }?: {
|
|
1171
1192
|
parent?: Store<any, any> | null | undefined;
|
|
1172
1193
|
index?: string | number | null | undefined;
|
|
1173
1194
|
new?: boolean | undefined;
|
|
1174
1195
|
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1175
|
-
onUpdateState?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1176
1196
|
});
|
|
1177
1197
|
[Symbol.iterator](): Generator<[string, Store<any, any>], void, unknown>;
|
|
1178
1198
|
#private;
|
|
@@ -1193,15 +1213,13 @@ declare class ArrayStore<T = any, M = any> extends Store<(T | null)[], M> {
|
|
|
1193
1213
|
* @param {boolean} [options.new]
|
|
1194
1214
|
* @param {boolean} [options.addable]
|
|
1195
1215
|
* @param {(value: any, index: any, store: Store) => void} [options.onUpdate]
|
|
1196
|
-
* @param {(value: any, index: any, store: Store) => void} [options.onUpdateState]
|
|
1197
1216
|
*/
|
|
1198
|
-
constructor(schema: Schema.Field<M>, { parent, onUpdate,
|
|
1217
|
+
constructor(schema: Schema.Field<M>, { parent, onUpdate, index, new: isNew, addable }?: {
|
|
1199
1218
|
parent?: Store<any, any> | null | undefined;
|
|
1200
1219
|
index?: string | number | null | undefined;
|
|
1201
1220
|
new?: boolean | undefined;
|
|
1202
1221
|
addable?: boolean | undefined;
|
|
1203
1222
|
onUpdate?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1204
|
-
onUpdateState?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1205
1223
|
});
|
|
1206
1224
|
get children(): Store<any, any>[];
|
|
1207
1225
|
set selfAddable(v: boolean | null);
|