Browse Source

BI-95364 fix:提供checkvalid事件

es6
Claire 3 years ago
parent
commit
54aadf93d8
  1. 8
      src/component/form/form.js
  2. 15
      typescript/component/form/form.ts
  3. 3
      typescript/index.ts

8
src/component/form/form.js

@ -35,6 +35,7 @@
},
_createItems: function () {
var self = this;
var o = this.options;
return BI.map(o.items, function (idx, item) {
@ -51,6 +52,11 @@
eventName: "EVENT_CHANGE",
action: function () {
this.validate();
if (self.isAllValid()) {
self.fireEvent("EVENT_VALID");
} else {
self.fireEvent("EVENT_ERROR");
}
}
}]
};
@ -88,4 +94,6 @@
}
});
BI.Form.EVENT_VALID = "EVENT_VALID";
BI.Form.EVENT_ERROR = "EVENT_ERROR";
BI.shortcut("bi.custom_form", BI.Form);

15
typescript/component/form/form.ts

@ -0,0 +1,15 @@
import { Widget } from "../../core/widget";
export declare class Form extends Widget {
static xtype: string;
static EVENT_VALID: string;
static EVENT_ERROR: string;
isAllValid(): boolean;
validateWithNoTip(): boolean[];
validate(): boolean[];
getValue<T>(): T[];
}

3
typescript/index.ts

@ -25,6 +25,7 @@ import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.se
import { SignEditor } from "./case/editor/editor.sign";
import { StateEditor } from './case/editor/editor.state';
import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
import { Form } from './component/form/form';
import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser";
import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list";
import { Action, ActionFactory } from "./core/action/action";
@ -216,6 +217,7 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
SmallTextValueCombo: typeof SmallTextValueCombo;
BubbleCombo: typeof BubbleCombo;
AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo;
Form: typeof Form;
IconTextItem: typeof IconTextItem;
MultiSelectItem: typeof MultiSelectItem;
AbstractLabel: typeof AbstractLabel;
@ -508,6 +510,7 @@ export {
Switch,
HorizontalLayout,
ShelterEditor,
Form,
TextTrigger,
SelectTextTrigger,
DateInterval,

Loading…
Cancel
Save