mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 03:18:16 +08:00
Merge pull request #918 from CharlieLau/fix/tpl-register-spelling
fix(tpl): registerTplEnginer拼写问题
This commit is contained in:
commit
18bab52601
@ -14,20 +14,20 @@ import {
|
|||||||
clearStoresCache,
|
clearStoresCache,
|
||||||
updateEnv
|
updateEnv
|
||||||
} from './factory';
|
} from './factory';
|
||||||
import {wrapFetcher, buildApi} from './utils/api';
|
import { wrapFetcher, buildApi } from './utils/api';
|
||||||
import {
|
import {
|
||||||
filter,
|
filter,
|
||||||
reigsterTplEnginer,
|
registerTplEnginer,
|
||||||
evalExpression,
|
evalExpression,
|
||||||
evalJS,
|
evalJS,
|
||||||
setCustomEvalJs,
|
setCustomEvalJs,
|
||||||
setCustomEvalExpression
|
setCustomEvalExpression
|
||||||
} from './utils/tpl';
|
} from './utils/tpl';
|
||||||
import * as utils from './utils/helper';
|
import * as utils from './utils/helper';
|
||||||
import {resizeSensor} from './utils/resize-sensor';
|
import { resizeSensor } from './utils/resize-sensor';
|
||||||
import {setIconVendor} from './renderers/Form/IconPickerIcons';
|
import { setIconVendor } from './renderers/Form/IconPickerIcons';
|
||||||
import {Icon, registerIcon} from './components/icons';
|
import { Icon, registerIcon } from './components/icons';
|
||||||
import {RegisterStore} from './store';
|
import { RegisterStore } from './store';
|
||||||
import {
|
import {
|
||||||
setDefaultLocale,
|
setDefaultLocale,
|
||||||
getDefaultLocale,
|
getDefaultLocale,
|
||||||
@ -140,9 +140,9 @@ import './renderers/IFrame';
|
|||||||
import './renderers/QRCode';
|
import './renderers/QRCode';
|
||||||
import './renderers/Icon';
|
import './renderers/Icon';
|
||||||
import './renderers/Carousel';
|
import './renderers/Carousel';
|
||||||
import Scoped, {ScopedContext} from './Scoped';
|
import Scoped, { ScopedContext } from './Scoped';
|
||||||
|
|
||||||
import {FormItem} from './renderers/Form/Item';
|
import { FormItem } from './renderers/Form/Item';
|
||||||
|
|
||||||
// 兼容旧版本用法
|
// 兼容旧版本用法
|
||||||
import './compat';
|
import './compat';
|
||||||
@ -163,8 +163,8 @@ import {
|
|||||||
validate,
|
validate,
|
||||||
validateObject
|
validateObject
|
||||||
} from './utils/validations';
|
} from './utils/validations';
|
||||||
import {normalizeOptions} from './components/Select';
|
import { normalizeOptions } from './components/Select';
|
||||||
import {OptionsControl} from './renderers/Form/Options';
|
import { OptionsControl } from './renderers/Form/Options';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
classnames,
|
classnames,
|
||||||
@ -192,7 +192,7 @@ export {
|
|||||||
utils,
|
utils,
|
||||||
resizeSensor,
|
resizeSensor,
|
||||||
registerFilter,
|
registerFilter,
|
||||||
reigsterTplEnginer,
|
registerTplEnginer,
|
||||||
evalExpression,
|
evalExpression,
|
||||||
evalJS,
|
evalJS,
|
||||||
setCustomEvalJs,
|
setCustomEvalJs,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {reigsterTplEnginer, filter, Enginer} from './tpl';
|
import { registerTplEnginer, filter, Enginer } from './tpl';
|
||||||
import template from 'lodash/template';
|
import template from 'lodash/template';
|
||||||
import {getFilters} from './tpl-builtin';
|
import { getFilters } from './tpl-builtin';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ function lodashCompile(str: string, data: object) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function register(): Enginer & {name: string} {
|
export function register(): Enginer & { name: string } {
|
||||||
return {
|
return {
|
||||||
name: 'lodash',
|
name: 'lodash',
|
||||||
test: (str: string) => !!~str.indexOf('<%'),
|
test: (str: string) => !!~str.indexOf('<%'),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {createObject} from './helper';
|
import { createObject } from './helper';
|
||||||
import {register as registerBulitin, getFilters} from './tpl-builtin';
|
import { register as registerBulitin, getFilters } from './tpl-builtin';
|
||||||
import {register as registerLodash} from './tpl-lodash';
|
import { register as registerLodash } from './tpl-lodash';
|
||||||
|
|
||||||
export interface Enginer {
|
export interface Enginer {
|
||||||
test: (tpl: string) => boolean;
|
test: (tpl: string) => boolean;
|
||||||
@ -11,7 +11,7 @@ const enginers: {
|
|||||||
[propName: string]: Enginer;
|
[propName: string]: Enginer;
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
export function reigsterTplEnginer(name: string, enginer: Enginer) {
|
export function registerTplEnginer(name: string, enginer: Enginer) {
|
||||||
enginers[name] = enginer;
|
enginers[name] = enginer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ export function evalJS(js: string, data: object): any {
|
|||||||
[registerBulitin, registerLodash].forEach(fn => {
|
[registerBulitin, registerLodash].forEach(fn => {
|
||||||
const info = fn();
|
const info = fn();
|
||||||
|
|
||||||
reigsterTplEnginer(info.name, {
|
registerTplEnginer(info.name, {
|
||||||
test: info.test,
|
test: info.test,
|
||||||
compile: info.compile
|
compile: info.compile
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user