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 () { _createItems: function () {
var self = this;
var o = this.options; var o = this.options;
return BI.map(o.items, function (idx, item) { return BI.map(o.items, function (idx, item) {
@ -51,6 +52,11 @@
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
this.validate(); 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); 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 { SignEditor } from "./case/editor/editor.sign";
import { StateEditor } from './case/editor/editor.state'; import { StateEditor } from './case/editor/editor.state';
import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
import { Form } from './component/form/form';
import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser"; import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser";
import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list"; import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list";
import { Action, ActionFactory } from "./core/action/action"; 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; SmallTextValueCombo: typeof SmallTextValueCombo;
BubbleCombo: typeof BubbleCombo; BubbleCombo: typeof BubbleCombo;
AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo; AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo;
Form: typeof Form;
IconTextItem: typeof IconTextItem; IconTextItem: typeof IconTextItem;
MultiSelectItem: typeof MultiSelectItem; MultiSelectItem: typeof MultiSelectItem;
AbstractLabel: typeof AbstractLabel; AbstractLabel: typeof AbstractLabel;
@ -508,6 +510,7 @@ export {
Switch, Switch,
HorizontalLayout, HorizontalLayout,
ShelterEditor, ShelterEditor,
Form,
TextTrigger, TextTrigger,
SelectTextTrigger, SelectTextTrigger,
DateInterval, DateInterval,

Loading…
Cancel
Save