Skip to content

Commit

Permalink
feat(script-component): "add script event function": if no scriptEven…
Browse files Browse the repository at this point in the history
…tFunction asset, warn
  • Loading branch information
yyc-git committed Apr 4, 2019
1 parent af77d66 commit bc26270
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
19 changes: 10 additions & 9 deletions src/core/atom_component/floatInput/FloatInput.re
Expand Up @@ -85,7 +85,8 @@ module Method = {
)
};

let handleBlurAction = (state, (onChangeFunc, onBlurFunc), canBeZero,languageType) =>
let handleBlurAction =
(state, (onChangeFunc, onBlurFunc), canBeZero, languageType) =>
switch (state.inputValue) {
| None
| Some("-")
Expand Down Expand Up @@ -123,12 +124,7 @@ module Method = {
triggerOnBlur(value, onBlurFunc)
),
_value => {
ConsoleUtils.warn(
LanguageUtils.getMessageLanguageDataByType(
"position-describe",
languageType,
),
)
ConsoleUtils.warn("shouldn't be zero")
|> StateLogicService.getEditorState;

ReasonReact.Update({
Expand Down Expand Up @@ -262,9 +258,14 @@ let reducer = ((onChangeFunc, onBlurFunc), canBeZero, action, state) => {
| Change(value) =>
Method.handleChangeAction(state, onChangeFunc, canBeZero, value)
| Blur =>
Method.handleBlurAction(state, (onChangeFunc, onBlurFunc), canBeZero,languageType)
Method.handleBlurAction(
state,
(onChangeFunc, onBlurFunc),
canBeZero,
languageType,
)
};
}
};

let render =
(
Expand Down
Expand Up @@ -345,7 +345,7 @@ module Method = {
</div>;

let addScriptEventFunction =
(({state, send}: ReasonReact.self('a, 'b, 'c)) as self) => {
(languageType, ({state, send}: ReasonReact.self('a, 'b, 'c)) as self) => {
/* TODO test */

let editorState = StateEditorService.getState();
Expand Down Expand Up @@ -391,7 +391,13 @@ module Method = {
),
);
} :
();
ConsoleUtils.warn(
LanguageUtils.getMessageLanguageDataByType(
"need-add-scriptEventFunction",
languageType,
),
)
|> StateLogicService.getEditorState;
};
};

Expand Down Expand Up @@ -482,7 +488,7 @@ let render =
}
<button
className="addable-btn"
onClick={_e => Method.addScriptEventFunction(self)}>
onClick={_e => Method.addScriptEventFunction(languageType, self)}>
{
DomHelper.textEl(
LanguageUtils.getInspectorLanguageDataByType(
Expand Down
8 changes: 8 additions & 0 deletions src/core/config/data/LanguageMessageData.re
Expand Up @@ -106,4 +106,12 @@ let message_language_array = [|
en: "the point light count is exceed max count!",
},
},

{
title: "need-add-scriptEventFunction",
language: {
zh: {j|请添加ScriptEventFunction资产|j},
en: "please add script event function asset",
},
},
|];

0 comments on commit bc26270

Please sign in to comment.