12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import 'package:fis_common/event/event_type.dart';
- class FormInfo {
- static FormInfo? _reportInfo;
- ///需要提交到Server的表单值
- Map<String, dynamic> _formValue = {};
- FormInfo._internal();
- ///ReportInfo全局单例
- static FormInfo get instance {
- _reportInfo ??= FormInfo._internal();
- return _reportInfo!;
- }
- ///需要联动的值改变事件
- FEventHandler<UpdateFormArgs> onValueChange = FEventHandler<UpdateFormArgs>();
- ///改变目标的值
- FEventHandler<TargetFormArgs> onChangeTargetValue =
- FEventHandler<TargetFormArgs>();
- Map<String, dynamic> get formValue => _formValue;
- set formValue(Map<String, dynamic> newValue) {
- _formValue = newValue;
- }
- }
- class UpdateFormArgs {
- final String sourceKey;
- final UpdateFormType type;
- final dynamic sourceValue;
- UpdateFormArgs({
- required this.sourceKey,
- required this.sourceValue,
- this.type = UpdateFormType.UpdateValue,
- });
- }
- class TargetFormArgs {
- final String targetKey;
- final String targetValue;
- ///是否禁用组件
- final bool isDisabledValue;
- ///是否隐藏组件(不显示)
- final bool isHidden;
- TargetFormArgs(
- this.targetKey, {
- this.targetValue = "",
- this.isDisabledValue = false,
- this.isHidden = false,
- });
- }
- enum UpdateFormType {
- Add,
- UpdateValue,
- Remove,
- }
|