@ibiz-template/runtime 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +606 -136
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/common/base.controller.d.ts.map +1 -1
- package/out/controller/common/base.controller.js +2 -0
- package/out/controller/common/editor/editor.controller.d.ts +1 -1
- package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
- package/out/controller/common/editor/editor.controller.js +3 -1
- package/out/controller/control/caption-bar/caption-bar.controller.js +1 -1
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.js +4 -2
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +16 -14
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +1 -0
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +0 -1
- package/out/controller/utils/event/controller-event.d.ts +7 -0
- package/out/controller/utils/event/controller-event.d.ts.map +1 -1
- package/out/controller/utils/event/controller-event.js +17 -0
- package/out/controller/utils/index.d.ts +1 -0
- package/out/controller/utils/index.d.ts.map +1 -1
- package/out/controller/utils/index.js +1 -0
- package/out/controller/utils/value-ex/value-ex.d.ts +47 -0
- package/out/controller/utils/value-ex/value-ex.d.ts.map +1 -0
- package/out/controller/utils/value-ex/value-ex.js +48 -0
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +16 -5
- package/out/interface/common/i-modal/i-modal.d.ts +8 -0
- package/out/interface/common/i-modal/i-modal.d.ts.map +1 -1
- package/out/interface/controller/state/common/i-controller.state.d.ts +8 -0
- package/out/interface/controller/state/common/i-controller.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -0
- package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +3 -1
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +5 -4
- package/out/ui-action/provider/backend-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/backend-ui-action-provider.js +6 -3
- package/out/ui-action/uiaction-util.d.ts.map +1 -1
- package/out/ui-action/uiaction-util.js +1 -0
- package/out/utils/handlebars/handlebars.d.ts +11 -2
- package/out/utils/handlebars/handlebars.d.ts.map +1 -1
- package/out/utils/handlebars/handlebars.js +24 -2
- package/out/utils/handlebars/helpers/and/and.d.ts +16 -0
- package/out/utils/handlebars/helpers/and/and.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/and/and.js +24 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.js +23 -0
- package/out/utils/handlebars/helpers/concat/concat.d.ts +16 -0
- package/out/utils/handlebars/helpers/concat/concat.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/concat/concat.js +20 -0
- package/out/utils/handlebars/helpers/eq/eq.d.ts +16 -0
- package/out/utils/handlebars/helpers/eq/eq.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/eq/eq.js +22 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts +15 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.js +32 -0
- package/out/utils/handlebars/helpers/gt/gt.d.ts +16 -0
- package/out/utils/handlebars/helpers/gt/gt.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/gt/gt.js +22 -0
- package/out/utils/handlebars/helpers/gte/gte.d.ts +16 -0
- package/out/utils/handlebars/helpers/gte/gte.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/gte/gte.js +22 -0
- package/out/utils/handlebars/helpers/helper-base.d.ts +29 -0
- package/out/utils/handlebars/helpers/helper-base.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/helper-base.js +20 -0
- package/out/utils/handlebars/helpers/index.d.ts +9 -0
- package/out/utils/handlebars/helpers/index.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/index.js +45 -0
- package/out/utils/handlebars/helpers/json/json.d.ts +16 -0
- package/out/utils/handlebars/helpers/json/json.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/json/json.js +19 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.js +22 -0
- package/out/utils/handlebars/helpers/lt/lt.d.ts +16 -0
- package/out/utils/handlebars/helpers/lt/lt.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lt/lt.js +22 -0
- package/out/utils/handlebars/helpers/lte/lte.d.ts +16 -0
- package/out/utils/handlebars/helpers/lte/lte.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lte/lte.js +22 -0
- package/out/utils/handlebars/helpers/neq/neq.d.ts +16 -0
- package/out/utils/handlebars/helpers/neq/neq.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/neq/neq.js +22 -0
- package/out/utils/handlebars/helpers/not/not.d.ts +16 -0
- package/out/utils/handlebars/helpers/not/not.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/not/not.js +21 -0
- package/out/utils/handlebars/helpers/or/or.d.ts +16 -0
- package/out/utils/handlebars/helpers/or/or.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/or/or.js +27 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.js +23 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.js +23 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.js +23 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.js +22 -0
- package/out/utils/handlebars/utils/helper/helper.d.ts +42 -0
- package/out/utils/handlebars/utils/helper/helper.d.ts.map +1 -0
- package/out/utils/handlebars/utils/helper/helper.js +69 -0
- package/out/utils/handlebars/utils/index.d.ts +2 -0
- package/out/utils/handlebars/utils/index.d.ts.map +1 -0
- package/out/utils/handlebars/utils/index.js +1 -0
- package/out/utils/modal/modal.d.ts +1 -0
- package/out/utils/modal/modal.d.ts.map +1 -1
- package/out/utils/modal/modal.js +5 -2
- package/package.json +3 -3
- package/src/controller/common/base.controller.ts +2 -0
- package/src/controller/common/editor/editor.controller.ts +5 -2
- package/src/controller/control/caption-bar/caption-bar.controller.ts +1 -1
- package/src/controller/control/form/form-detail/form-druipart/form-druipart.controller.ts +4 -2
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +17 -14
- package/src/controller/control/search-bar/search-bar.controller.ts +1 -0
- package/src/controller/control/tree/tree.controller.ts +0 -1
- package/src/controller/utils/event/controller-event.ts +18 -0
- package/src/controller/utils/index.ts +1 -0
- package/src/controller/utils/value-ex/value-ex.ts +83 -0
- package/src/engine/md-view.engine.ts +17 -5
- package/src/interface/common/i-modal/i-modal.ts +9 -0
- package/src/interface/controller/state/common/i-controller.state.ts +9 -0
- package/src/interface/controller/state/control/i-search-bar.state.ts +9 -0
- package/src/service/dto/method.dto.ts +3 -1
- package/src/service/service/entity/method/method.ts +11 -4
- package/src/ui-action/provider/backend-ui-action-provider.ts +6 -3
- package/src/ui-action/uiaction-util.ts +1 -0
- package/src/utils/handlebars/handlebars.ts +25 -3
- package/src/utils/handlebars/helpers/and/and.ts +26 -0
- package/src/utils/handlebars/helpers/camel-case/camel-case.ts +25 -0
- package/src/utils/handlebars/helpers/concat/concat.ts +22 -0
- package/src/utils/handlebars/helpers/eq/eq.ts +28 -0
- package/src/utils/handlebars/helpers/eq-property-value/eq-property-value.ts +41 -0
- package/src/utils/handlebars/helpers/gt/gt.ts +28 -0
- package/src/utils/handlebars/helpers/gte/gte.ts +28 -0
- package/src/utils/handlebars/helpers/helper-base.ts +31 -0
- package/src/utils/handlebars/helpers/index.ts +46 -0
- package/src/utils/handlebars/helpers/json/json.ts +25 -0
- package/src/utils/handlebars/helpers/lower-case/lower-case.ts +24 -0
- package/src/utils/handlebars/helpers/lt/lt.ts +28 -0
- package/src/utils/handlebars/helpers/lte/lte.ts +28 -0
- package/src/utils/handlebars/helpers/neq/neq.ts +28 -0
- package/src/utils/handlebars/helpers/not/not.ts +26 -0
- package/src/utils/handlebars/helpers/or/or.ts +28 -0
- package/src/utils/handlebars/helpers/pascal-case/pascal-case.ts +25 -0
- package/src/utils/handlebars/helpers/snake-case/snake-case.ts +25 -0
- package/src/utils/handlebars/helpers/spinal-case/spinal-case.ts +25 -0
- package/src/utils/handlebars/helpers/upper-case/upper-case.ts +24 -0
- package/src/utils/handlebars/utils/helper/helper.ts +75 -0
- package/src/utils/handlebars/utils/index.ts +1 -0
- package/src/utils/modal/modal.ts +6 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HelperAnd } from './and/and';
|
|
2
|
+
import { HelperCamelCase } from './camel-case/camel-case';
|
|
3
|
+
import { HelperConcat } from './concat/concat';
|
|
4
|
+
import { HelperEq } from './eq/eq';
|
|
5
|
+
import { HelperGt } from './gt/gt';
|
|
6
|
+
import { HelperGte } from './gte/gte';
|
|
7
|
+
import { HelperEqPropertyValue } from './eq-property-value/eq-property-value';
|
|
8
|
+
import { HelperJson } from './json/json';
|
|
9
|
+
import { HelperLowerCase } from './lower-case/lower-case';
|
|
10
|
+
import { HelperLt } from './lt/lt';
|
|
11
|
+
import { HelperLte } from './lte/lte';
|
|
12
|
+
import { HelperNeq } from './neq/neq';
|
|
13
|
+
import { HelperNot } from './not/not';
|
|
14
|
+
import { HelperOr } from './or/or';
|
|
15
|
+
import { HelperPascalCase } from './pascal-case/pascal-case';
|
|
16
|
+
import { HelperSnakeCase } from './snake-case/snake-case';
|
|
17
|
+
import { HelperSpinalCase } from './spinal-case/spinal-case';
|
|
18
|
+
import { HelperUpperCase } from './upper-case/upper-case';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 安装自定义助手
|
|
22
|
+
*
|
|
23
|
+
* @author chitanda
|
|
24
|
+
* @date 2021-12-24 14:12:05
|
|
25
|
+
* @export
|
|
26
|
+
*/
|
|
27
|
+
export function installHelpers(hsb: IData): void {
|
|
28
|
+
new HelperAnd(hsb);
|
|
29
|
+
new HelperCamelCase(hsb);
|
|
30
|
+
new HelperConcat(hsb);
|
|
31
|
+
new HelperEq(hsb);
|
|
32
|
+
new HelperGt(hsb);
|
|
33
|
+
new HelperGte(hsb);
|
|
34
|
+
new HelperJson(hsb);
|
|
35
|
+
new HelperLowerCase(hsb);
|
|
36
|
+
new HelperLt(hsb);
|
|
37
|
+
new HelperLte(hsb);
|
|
38
|
+
new HelperNeq(hsb);
|
|
39
|
+
new HelperNot(hsb);
|
|
40
|
+
new HelperOr(hsb);
|
|
41
|
+
new HelperPascalCase(hsb);
|
|
42
|
+
new HelperSnakeCase(hsb);
|
|
43
|
+
new HelperSpinalCase(hsb);
|
|
44
|
+
new HelperUpperCase(hsb);
|
|
45
|
+
new HelperEqPropertyValue(hsb);
|
|
46
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* json 转 string
|
|
5
|
+
*
|
|
6
|
+
* @description 用法 {{json xxx 2}},支持第二个参数传递格式化。效果: 将 json 对象转为 json 字符串
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2021-12-24 15:12:59
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperJson
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperJson extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'jsonStringify');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(obj: Record<string, unknown> | unknown[], space: number): string {
|
|
19
|
+
return JSON.stringify(
|
|
20
|
+
obj,
|
|
21
|
+
null,
|
|
22
|
+
typeof space === 'number' ? space : undefined,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 字符串转换小写
|
|
5
|
+
*
|
|
6
|
+
* @description 用法 {{lowerCase word}}, 效果: MyName => myname
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2021-12-24 15:12:35
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperLowerCase
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperLowerCase extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'lowerCase');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(param: string): string {
|
|
19
|
+
if (!param) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
return param.toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { lt } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 小于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word < word2, 用法 {{#lt word word2}}xxx{{else}}yyy{{/lt}}、{{lt word word2}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 15:12:53
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperLt
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperLt extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'lt');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = lt(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { lte } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 小于等于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word <= word2, 用法 {{#lte word word2}}xxx{{else}}yyy{{/lte}}、{{lte word word2}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 15:12:18
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperLte
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperLte extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'lte');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = lte(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { eq } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 不等于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word !== word2, 用法 {{#neq word 'xxx'}}xxx{{else}}yyy{{/neq}}、{{neq word 'xxx'}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 15:12:21
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperNeq
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperNeq extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'neq');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = !eq(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HelperUtil } from '../../utils';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 参数不存在或者为空时返回 true
|
|
6
|
+
*
|
|
7
|
+
* @description 判断: 参数为 null、undefined、空字符串、空数组、空对象时返回 true, 用法: {{#not value}}xxx{{else}}yyy{{/not}}、{{not value}} 返回值为 boolean 类型
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-29 15:12:38
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperNot
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperNot extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'not');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(
|
|
20
|
+
param: unknown,
|
|
21
|
+
options: Handlebars.HelperOptions,
|
|
22
|
+
): string | boolean {
|
|
23
|
+
const bol = Handlebars.Utils.isEmpty(param);
|
|
24
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 或者条件
|
|
5
|
+
*
|
|
6
|
+
* @description 判断: word word2 word3 其中任意一个值在判断中为 true, 用法 {{#or word word2 word3}}xxx{{else}}yyy{{/or}}、{{or word word2 word3}} 返回值为 boolean 类型
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2021-12-29 10:12:00
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperOr
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperOr extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'or');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(...args: unknown[] | Handlebars.HelperOptions[]): string {
|
|
19
|
+
const options = args[args.length - 1] as Handlebars.HelperOptions;
|
|
20
|
+
args.pop();
|
|
21
|
+
const item = (args as unknown[]).find(itemArg => !!itemArg);
|
|
22
|
+
if (options.fn) {
|
|
23
|
+
const data = options.data?.root || {};
|
|
24
|
+
return item ? options.fn(data) : options.inverse(data);
|
|
25
|
+
}
|
|
26
|
+
return (item as string) || '';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { upperFirst } from 'lodash-es';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 首字母转大写
|
|
6
|
+
*
|
|
7
|
+
* @description 用法 {{pascalCase word}},效果: myName => MyName
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-24 15:12:13
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperPascalCase
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperPascalCase extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'pascalCase');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(param: string): string {
|
|
20
|
+
if (!param) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return upperFirst(param);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { snakeCase } from 'lodash-es';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 驼峰转蛇形命名法
|
|
6
|
+
*
|
|
7
|
+
* @description 用法 {{snakeCase word}},效果: myName => my_name
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-24 15:12:06
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperSnakeCase
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperSnakeCase extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'snakeCase');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(param: string): string {
|
|
20
|
+
if (!param) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return snakeCase(param);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { kebabCase } from 'lodash-es';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 驼峰命名法转为横线命名法
|
|
6
|
+
*
|
|
7
|
+
* @description 用法 {{spinalCase word}},效果: myName => my-name
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-24 15:12:37
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperSpinalCase
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperSpinalCase extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'spinalCase');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(param: string): string {
|
|
20
|
+
if (!param) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return kebabCase(param);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 字符串转大写
|
|
5
|
+
*
|
|
6
|
+
* @description 用法 {{upperCase word}},效果: myName => MYNAME
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2021-12-24 15:12:21
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperUpCase
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperUpperCase extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'upperCase');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(param: string): string {
|
|
19
|
+
if (!param) {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
return param.toUpperCase();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 助手工具类
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2021-12-29 17:12:32
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperUtil
|
|
8
|
+
*/
|
|
9
|
+
export class HelperUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 当前所有助手 tag 名称
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2021-12-30 10:12:39
|
|
15
|
+
* @protected
|
|
16
|
+
* @type {string[]}
|
|
17
|
+
*/
|
|
18
|
+
protected static helperNames: string[] = [
|
|
19
|
+
'lookup',
|
|
20
|
+
'log',
|
|
21
|
+
'and',
|
|
22
|
+
'camelCase',
|
|
23
|
+
'concat',
|
|
24
|
+
'eq',
|
|
25
|
+
'gt',
|
|
26
|
+
'get',
|
|
27
|
+
'lowerCase',
|
|
28
|
+
'lt',
|
|
29
|
+
'lte',
|
|
30
|
+
'neq',
|
|
31
|
+
'not',
|
|
32
|
+
'or',
|
|
33
|
+
'pascalCase',
|
|
34
|
+
'pluralize',
|
|
35
|
+
'snakeCase',
|
|
36
|
+
'spinalCase',
|
|
37
|
+
'upperCase',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 判断字符串是否为助手
|
|
42
|
+
*
|
|
43
|
+
* @author chitanda
|
|
44
|
+
* @date 2021-12-30 10:12:26
|
|
45
|
+
* @static
|
|
46
|
+
* @param {string} name
|
|
47
|
+
* @return {*} {boolean}
|
|
48
|
+
*/
|
|
49
|
+
static isHelperName(name: string): boolean {
|
|
50
|
+
return this.helperNames.includes(name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 判断类助手统一结果调用处理
|
|
55
|
+
*
|
|
56
|
+
* @author chitanda
|
|
57
|
+
* @date 2021-12-29 17:12:23
|
|
58
|
+
* @static
|
|
59
|
+
* @param {unknown} context 执行上下文
|
|
60
|
+
* @param {boolean} bol 判断结果
|
|
61
|
+
* @param {Handlebars.HelperOptions} options
|
|
62
|
+
* @return {*} {(string | boolean)}
|
|
63
|
+
*/
|
|
64
|
+
static handleJudgmentExecute(
|
|
65
|
+
context: unknown,
|
|
66
|
+
bol: boolean,
|
|
67
|
+
options: Handlebars.HelperOptions,
|
|
68
|
+
): string | boolean {
|
|
69
|
+
if (options.fn) {
|
|
70
|
+
return bol ? options.fn(context) : options.inverse(context);
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line no-return-assign
|
|
73
|
+
return bol ? (options.hash.yes = true) : (options.hash.no = false);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HelperUtil } from './helper/helper';
|
package/src/utils/modal/modal.ts
CHANGED
|
@@ -21,6 +21,8 @@ export class Modal implements IModal {
|
|
|
21
21
|
|
|
22
22
|
viewUsage: number = 4;
|
|
23
23
|
|
|
24
|
+
ignoreDismissCheck: boolean = false;
|
|
25
|
+
|
|
24
26
|
hooks = {
|
|
25
27
|
shouldDismiss: new AsyncSeriesHook<[], { allowClose: boolean }>(),
|
|
26
28
|
beforeDismiss: new AsyncSeriesHook<[], IModalData>(),
|
|
@@ -62,8 +64,10 @@ export class Modal implements IModal {
|
|
|
62
64
|
|
|
63
65
|
async dismiss(data: IModalData = { ok: false, data: [] }): Promise<boolean> {
|
|
64
66
|
const context = { allowClose: true };
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
if (this.ignoreDismissCheck !== true) {
|
|
68
|
+
// 判断是否执行关闭
|
|
69
|
+
await this.hooks.shouldDismiss.call(context);
|
|
70
|
+
}
|
|
67
71
|
if (!context.allowClose) {
|
|
68
72
|
ibiz.log.debug('shouldDismiss结果为false,关闭中断。');
|
|
69
73
|
return false;
|