@farris/jit-engine 1.4.126 → 1.4.128

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.
Files changed (80) hide show
  1. package/README.md +5 -1
  2. package/lib/.DS_Store +0 -0
  3. package/lib/domstructure/.DS_Store +0 -0
  4. package/lib/domstructure/devkit/devkit.js +222 -220
  5. package/lib/domstructure/devkit/devkit.js.map +1 -1
  6. package/lib/domstructure/devkit/viewmodel/component/component.js +221 -221
  7. package/lib/domstructure/devkit/viewmodel/component/component.js.map +1 -1
  8. package/lib/domstructure/devkit/viewmodel/viewmodel.js +139 -138
  9. package/lib/domstructure/devkit/viewmodel/viewmodel.js.map +1 -1
  10. package/lib/domstructure/ui/.DS_Store +0 -0
  11. package/lib/domstructure/ui/common/basecomponent.js +163 -163
  12. package/lib/domstructure/ui/common/basecomponent.js.map +1 -1
  13. package/lib/domstructure/ui/data/collection/hierarchy/tree_grid.js +198 -198
  14. package/lib/domstructure/ui/data/collection/hierarchy/tree_grid.js.map +1 -1
  15. package/lib/domstructure/ui/farris-fileupload-preview/farris-file-upload-preview.js +3 -3
  16. package/lib/domstructure/ui/farris-fileupload-preview/farris-file-upload-preview.js.map +1 -1
  17. package/lib/domstructure/ui/list-filter/farris-list-filter.js +88 -78
  18. package/lib/domstructure/ui/list-filter/farris-list-filter.js.map +1 -1
  19. package/lib/template/.DS_Store +0 -0
  20. package/lib/template/ui/.DS_Store +0 -0
  21. package/lib/template/ui/kendo/adminorganization-selector.pug +108 -101
  22. package/lib/template/ui/kendo/checkbox.pug +133 -123
  23. package/lib/template/ui/kendo/checkboxgroup.pug +70 -63
  24. package/lib/template/ui/kendo/city-selector.pug +76 -69
  25. package/lib/template/ui/kendo/combobox.pug +77 -70
  26. package/lib/template/ui/kendo/datepicker.pug +77 -70
  27. package/lib/template/ui/kendo/employee-selector.pug +103 -96
  28. package/lib/template/ui/kendo/farris-checkbox-group.pug +103 -96
  29. package/lib/template/ui/kendo/farris-combo-list.pug +118 -111
  30. package/lib/template/ui/kendo/farris-combo-lookup.pug +105 -98
  31. package/lib/template/ui/kendo/farris-datepicker.pug +125 -118
  32. package/lib/template/ui/kendo/farris-ext-intergration.pug +86 -79
  33. package/lib/template/ui/kendo/farris-list-filter.pug +17 -12
  34. package/lib/template/ui/kendo/farris-number-range.pug +105 -98
  35. package/lib/template/ui/kendo/farris-number-spinner.pug +110 -103
  36. package/lib/template/ui/kendo/farris-switch.pug +95 -88
  37. package/lib/template/ui/kendo/farris-tags.pug +77 -70
  38. package/lib/template/ui/kendo/farris-time-picker.pug +109 -102
  39. package/lib/template/ui/kendo/farris-time-spinner.pug +78 -71
  40. package/lib/template/ui/kendo/image-upload.pug +89 -82
  41. package/lib/template/ui/kendo/input-group.pug +103 -96
  42. package/lib/template/ui/kendo/language-textbox.pug +99 -92
  43. package/lib/template/ui/kendo/light-lookup.pug +192 -185
  44. package/lib/template/ui/kendo/lookup-employee.pug +120 -113
  45. package/lib/template/ui/kendo/lookup.pug +120 -113
  46. package/lib/template/ui/kendo/multitextbox.pug +108 -101
  47. package/lib/template/ui/kendo/numericbox.pug +77 -70
  48. package/lib/template/ui/kendo/oa-relation.pug +24 -20
  49. package/lib/template/ui/kendo/organization-selector.pug +128 -121
  50. package/lib/template/ui/kendo/radiobox.pug +67 -60
  51. package/lib/template/ui/kendo/radioboxgroup.pug +101 -94
  52. package/lib/template/ui/kendo/richtextbox.pug +60 -53
  53. package/lib/template/ui/kendo/select.pug +53 -46
  54. package/lib/template/ui/kendo/switch.pug +74 -67
  55. package/lib/template/ui/kendo/textbox.pug +105 -98
  56. package/lib/template/ui/kendo/timebox.pug +54 -47
  57. package/lib/template/ui/kendo/tinymcerichtextbox.pug +66 -59
  58. package/lib/template/ui/kendo/treegrid.pug +43 -40
  59. package/lib/template/ui/mobileapprove/statictext-for-mobileapprove.pug +6 -4
  60. package/lib/utility/.DS_Store +0 -0
  61. package/lib/utility/devkit/component-parameter-collector/farris-list-filter-parameter-collector.js +183 -159
  62. package/lib/utility/devkit/component-parameter-collector/farris-list-filter-parameter-collector.js.map +1 -1
  63. package/lib/utility/devkit/form-file-executor.js +449 -444
  64. package/lib/utility/devkit/form-file-executor.js.map +1 -1
  65. package/lib/utility/internal-entity/component-parameter/component-listfilter-parameter.js +59 -59
  66. package/lib/utility/internal-entity/component-parameter/component-listfilter-parameter.js.map +1 -1
  67. package/lib/utility/mobile-approve/entity/static-text-for-mobileapprove.js +8 -2
  68. package/lib/utility/mobile-approve/entity/static-text-for-mobileapprove.js.map +1 -1
  69. package/lib/utility/template-generator/.DS_Store +0 -0
  70. package/lib/utility/template-generator/devkit/.DS_Store +0 -0
  71. package/lib/utility/template-generator/devkit/component-generator/component-import-generator.js +194 -189
  72. package/lib/utility/template-generator/devkit/component-generator/component-import-generator.js.map +1 -1
  73. package/lib/utility/template-generator/devkit/component-generator/component-listfilter-parameter-generator.js +259 -226
  74. package/lib/utility/template-generator/devkit/component-generator/component-listfilter-parameter-generator.js.map +1 -1
  75. package/lib/utility/template-generator/devkit/component-generator/component-provider-generator.js +185 -181
  76. package/lib/utility/template-generator/devkit/component-generator/component-provider-generator.js.map +1 -1
  77. package/lib/utility/template-generator/devkit/component-template-generator.js +537 -534
  78. package/lib/utility/template-generator/devkit/component-template-generator.js.map +1 -1
  79. package/package.json +1 -1
  80. package/lib/mobileapp/vue/static/.npmignore +0 -13
@@ -1,139 +1,140 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ViewModel = void 0;
7
- const statemachine_1 = require("./statemachine/statemachine");
8
- const form_1 = require("./form/form");
9
- const command_1 = require("./command/command");
10
- const component_1 = require("./component");
11
- const service_1 = require("./service/service");
12
- const state_1 = require("./states/state");
13
- const utility_1 = require("../../../utility");
14
- const lodash_1 = __importDefault(require("lodash"));
15
- const i18n_resource_1 = require("../../i18n-resource");
16
- class ViewModel extends i18n_resource_1.I18nResource {
17
- constructor(param) {
18
- super(param);
19
- let obj;
20
- if (typeof param === 'string') {
21
- obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
22
- }
23
- else {
24
- obj = param;
25
- }
26
- if (!obj) {
27
- return;
28
- }
29
- const changeSetPolicy = obj["changeSetPolicy"];
30
- const enableServerSideChangeDetection = obj["enableServerSideChangeDetection"];
31
- const enableAif = obj["enableAif"];
32
- const pushMode = obj["pushMode"];
33
- const defaultFormRule = obj["defaultFormRule"];
34
- const keys = 'id,name,serviceRefs,commands,form,stateMachine,states,bindTo,component,children,dom,enableUnifiedSession,allowEmpty';
35
- Object.keys(obj).forEach(key => {
36
- if (keys.includes(key)) {
37
- switch (key) {
38
- case 'commands':
39
- if (obj[key] && obj[key].length) {
40
- this.commands = [];
41
- obj[key].forEach((item) => {
42
- if (obj["serviceRefs"]) {
43
- item["services"] = obj["serviceRefs"];
44
- }
45
- this.commands.push(new command_1.CommandConfig(item));
46
- });
47
- }
48
- break;
49
- case 'form':
50
- if (obj[key]) {
51
- obj[key][utility_1.DevkitConstant.ResourcePrefixKey] = this.resourcePrefix;
52
- this[key] = new form_1.FormConfig(obj[key]);
53
- }
54
- break;
55
- case 'stateMachine':
56
- if (obj[key]) {
57
- this[key] = new statemachine_1.StateMachine(obj[key]);
58
- }
59
- break;
60
- case 'states':
61
- this[key] = new state_1.States({ name: obj['name'] + 'UIState', stateList: obj[key] });
62
- break;
63
- case 'component':
64
- if (obj[key]) {
65
- if (obj['serviceRefs'] && obj['serviceRefs'].length && obj['commands'] && obj['commands'].length) {
66
- const services = [];
67
- obj['serviceRefs'].forEach((s) => {
68
- obj['commands'].forEach((c) => {
69
- if (c.handlers && c.handlers.length) {
70
- c.handlers.forEach((h) => {
71
- if (s['isCommon'] && (s['isCommon'] + '') == '0') {
72
- if (h.serviceName == s.alias && lodash_1.default.findIndex(services, function (o) { return o.alias == s.alias; }) < 0) {
73
- services.push(new service_1.Service(s));
74
- }
75
- }
76
- });
77
- }
78
- });
79
- });
80
- obj[key]['services'] = services;
81
- }
82
- obj[key]["changeSetPolicy"] = changeSetPolicy;
83
- obj[key]["enableServerSideChangeDetection"] = enableServerSideChangeDetection;
84
- obj[key]["enableAif"] = enableAif;
85
- obj[key]["pushMode"] = pushMode;
86
- obj[key]["defaultFormRule"] = defaultFormRule;
87
- obj[key]["jit_isRouteForm"] = obj['jit_isRouteForm'];
88
- obj[key]["metadataId"] = obj['metadataId'];
89
- this[key] = new component_1.ComponentConfig(obj[key]);
90
- }
91
- break;
92
- case 'serviceRefs':
93
- if (obj[key] && obj[key].length) {
94
- this.serviceRefs = [];
95
- obj[key].forEach((item) => {
96
- if (lodash_1.default.findIndex(this.serviceRefs, function (o) { return o.alias == item.alias; }) < 0) {
97
- this.serviceRefs.push(new service_1.Service(item));
98
- }
99
- });
100
- }
101
- break;
102
- case 'children':
103
- if (obj[key] && obj[key].length) {
104
- this.children = [];
105
- obj[key].forEach((item) => {
106
- this.children.push(item);
107
- });
108
- }
109
- break;
110
- case 'bindTo':
111
- if (obj[key]) {
112
- const ary = obj[key].split("/");
113
- const bindToArr = [];
114
- for (let i = 0; i < ary.length; i++) {
115
- if (ary[i]) {
116
- bindToArr[i] = utility_1.ToolHelper.tf(ary[i], utility_1.TfTypeEnum.Camel);
117
- }
118
- }
119
- this.originalBindTo = ary.join("/");
120
- this.bindTo = bindToArr.join("/");
121
- }
122
- break;
123
- case 'dom':
124
- this[key] = JSON.stringify(obj[key], null, 2);
125
- break;
126
- default:
127
- this[key] = obj[key];
128
- break;
129
- }
130
- }
131
- });
132
- if (!this.dom) {
133
- this.dom = "{}";
134
- }
135
- this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
136
- }
137
- }
138
- exports.ViewModel = ViewModel;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ViewModel = void 0;
7
+ const statemachine_1 = require("./statemachine/statemachine");
8
+ const form_1 = require("./form/form");
9
+ const command_1 = require("./command/command");
10
+ const component_1 = require("./component");
11
+ const service_1 = require("./service/service");
12
+ const state_1 = require("./states/state");
13
+ const utility_1 = require("../../../utility");
14
+ const lodash_1 = __importDefault(require("lodash"));
15
+ const i18n_resource_1 = require("../../i18n-resource");
16
+ class ViewModel extends i18n_resource_1.I18nResource {
17
+ constructor(param) {
18
+ super(param);
19
+ let obj;
20
+ if (typeof param === 'string') {
21
+ obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
22
+ }
23
+ else {
24
+ obj = param;
25
+ }
26
+ if (!obj) {
27
+ return;
28
+ }
29
+ const changeSetPolicy = obj["changeSetPolicy"];
30
+ const enableServerSideChangeDetection = obj["enableServerSideChangeDetection"];
31
+ const enableAif = obj["enableAif"];
32
+ const pushMode = obj["pushMode"];
33
+ const defaultFormRule = obj["defaultFormRule"];
34
+ const keys = 'id,name,serviceRefs,commands,form,stateMachine,states,bindTo,component,children,dom,enableUnifiedSession,allowEmpty';
35
+ Object.keys(obj).forEach(key => {
36
+ if (keys.includes(key)) {
37
+ switch (key) {
38
+ case 'commands':
39
+ if (obj[key] && obj[key].length) {
40
+ this.commands = [];
41
+ obj[key].forEach((item) => {
42
+ if (obj["serviceRefs"]) {
43
+ item["services"] = obj["serviceRefs"];
44
+ }
45
+ this.commands.push(new command_1.CommandConfig(item));
46
+ });
47
+ }
48
+ break;
49
+ case 'form':
50
+ if (obj[key]) {
51
+ obj[key][utility_1.DevkitConstant.ResourcePrefixKey] = this.resourcePrefix;
52
+ this[key] = new form_1.FormConfig(obj[key]);
53
+ }
54
+ break;
55
+ case 'stateMachine':
56
+ if (obj[key]) {
57
+ this[key] = new statemachine_1.StateMachine(obj[key]);
58
+ }
59
+ break;
60
+ case 'states':
61
+ this[key] = new state_1.States({ name: obj['name'] + 'UIState', stateList: obj[key] });
62
+ break;
63
+ case 'component':
64
+ if (obj[key]) {
65
+ if (obj['serviceRefs'] && obj['serviceRefs'].length && obj['commands'] && obj['commands'].length) {
66
+ const services = [];
67
+ obj['serviceRefs'].forEach((s) => {
68
+ obj['commands'].forEach((c) => {
69
+ if (c.handlers && c.handlers.length) {
70
+ c.handlers.forEach((h) => {
71
+ if (s['isCommon'] && (s['isCommon'] + '') == '0') {
72
+ if (h.serviceName == s.alias && lodash_1.default.findIndex(services, function (o) { return o.alias == s.alias; }) < 0) {
73
+ services.push(new service_1.Service(s));
74
+ }
75
+ }
76
+ });
77
+ }
78
+ });
79
+ });
80
+ obj[key]['services'] = services;
81
+ }
82
+ obj[key]["changeSetPolicy"] = changeSetPolicy;
83
+ obj[key]["enableServerSideChangeDetection"] = enableServerSideChangeDetection;
84
+ obj[key]["enableAif"] = enableAif;
85
+ obj[key]["pushMode"] = pushMode;
86
+ obj[key]["defaultFormRule"] = defaultFormRule;
87
+ obj[key]["persistSelectedRows"] = obj["persistSelectedRows"];
88
+ obj[key]["jit_isRouteForm"] = obj['jit_isRouteForm'];
89
+ obj[key]["metadataId"] = obj['metadataId'];
90
+ this[key] = new component_1.ComponentConfig(obj[key]);
91
+ }
92
+ break;
93
+ case 'serviceRefs':
94
+ if (obj[key] && obj[key].length) {
95
+ this.serviceRefs = [];
96
+ obj[key].forEach((item) => {
97
+ if (lodash_1.default.findIndex(this.serviceRefs, function (o) { return o.alias == item.alias; }) < 0) {
98
+ this.serviceRefs.push(new service_1.Service(item));
99
+ }
100
+ });
101
+ }
102
+ break;
103
+ case 'children':
104
+ if (obj[key] && obj[key].length) {
105
+ this.children = [];
106
+ obj[key].forEach((item) => {
107
+ this.children.push(item);
108
+ });
109
+ }
110
+ break;
111
+ case 'bindTo':
112
+ if (obj[key]) {
113
+ const ary = obj[key].split("/");
114
+ const bindToArr = [];
115
+ for (let i = 0; i < ary.length; i++) {
116
+ if (ary[i]) {
117
+ bindToArr[i] = utility_1.ToolHelper.tf(ary[i], utility_1.TfTypeEnum.Camel);
118
+ }
119
+ }
120
+ this.originalBindTo = ary.join("/");
121
+ this.bindTo = bindToArr.join("/");
122
+ }
123
+ break;
124
+ case 'dom':
125
+ this[key] = JSON.stringify(obj[key], null, 2);
126
+ break;
127
+ default:
128
+ this[key] = obj[key];
129
+ break;
130
+ }
131
+ }
132
+ });
133
+ if (!this.dom) {
134
+ this.dom = "{}";
135
+ }
136
+ this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
137
+ }
138
+ }
139
+ exports.ViewModel = ViewModel;
139
140
  //# sourceMappingURL=viewmodel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewmodel.js","sourceRoot":"","sources":["../../../../src/domstructure/devkit/viewmodel/viewmodel.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA2D;AAC3D,sCAAyC;AACzC,+CAAkD;AAClD,2CAA8C;AAC9C,+CAA4C;AAC5C,0CAAwC;AACxC,8CAA+F;AAC/F,oDAAuB;AACvB,uDAAmD;AAGnD,MAAa,SAAU,SAAQ,4BAAY;IAmBvC,YAAY,KAAmB;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,GAAQ,CAAC;QACb,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,GAAG,GAAG,oBAAU,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;SAClD;aAAM;YACH,GAAG,GAAG,KAAK,CAAC;SACf;QAED,IAAI,CAAC,GAAG,EAAE;YACN,OAAO;SACV;QAED,MAAM,eAAe,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/C,MAAM,+BAA+B,GAAG,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/E,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;QACjC,MAAM,eAAe,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAE/C,MAAM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, "__esModule", { value: true });
3
- exports.BaseComponent = void 0;
4
- const appearance_1 = require("./appearance");
5
- const border_1 = require("./border");
6
- const font_1 = require("./font");
7
- const margin_1 = require("./margin");
8
- const padding_1 = require("./padding");
9
- const size_1 = require("./size");
10
- const static_control_1 = require("../static-control");
11
- const utility_1 = require("../../../utility");
12
- const running_position_enum_1 = require("../../running-position-enum");
13
- const component_readonly_parameter_creator_1 = require("../../../utility/devkit/component-readonly-parameter-creator");
14
- const editor_type_enum_1 = require("../../editor-type-enum");
15
- class BaseComponent extends static_control_1.StaticControlAttribute {
16
- constructor(param) {
17
- super(param);
18
- this.editorType = editor_type_enum_1.EditorTypeEnum.Default;
19
- this.includeInLoopContainer = false;
20
- let obj;
21
- if (typeof param === 'string') {
22
- obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
23
- }
24
- else {
25
- obj = param;
26
- }
27
- if (!obj) {
28
- return;
29
- }
30
- this.externalComponentNameSpace = obj["externalComponentNameSpace"];
31
- this.id = obj["id"];
32
- const keys = 'visible,type,readonly,require,binding,appearance,border,font,margin,padding,size,tabindex,hasDefaultFocus,focusState,controlIndex,enableTitleTips,titleTipsTemplate,viewModel,useDisplayStyle,includeInLoopContainer';
33
- Object.keys(obj).forEach(key => {
34
- if (keys.includes(key)) {
35
- switch (key) {
36
- case 'appearance':
37
- this[key] = new appearance_1.Appearance(obj[key]);
38
- break;
39
- case "type":
40
- this.originalType = obj[key];
41
- break;
42
- case 'border':
43
- this[key] = new border_1.Border(obj[key]);
44
- break;
45
- case 'font':
46
- this[key] = new font_1.Font(obj[key]);
47
- break;
48
- case 'margin':
49
- this[key] = new margin_1.Margin(obj[key]);
50
- break;
51
- case 'padding':
52
- this[key] = new padding_1.Padding(obj[key]);
53
- break;
54
- case 'size':
55
- this[key] = new size_1.Size(obj[key]);
56
- break;
57
- case "visible":
58
- const visible = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
59
- this[key] = utility_1.ToolHelper.createBindingWithPosition(visible, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
60
- break;
61
- case "readonly":
62
- const readonly = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
63
- this[key] = utility_1.ToolHelper.createBindingWithPosition(readonly, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
64
- break;
65
- case "require":
66
- const require = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
67
- this[key] = utility_1.ToolHelper.createBindingWithPosition(require, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
68
- break;
69
- case "enableTitleTips":
70
- this[key] = utility_1.ToolHelper.createBinding(obj[key], false, this.externalComponentNameSpace, this.id);
71
- break;
72
- default:
73
- this[key] = obj[key];
74
- break;
75
- }
76
- }
77
- });
78
- if (!this.visible) {
79
- this.visible = utility_1.ToolHelper.createBindingWithPosition(true, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
80
- }
81
- if (!this.readonly) {
82
- this.readonly = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
83
- }
84
- if (!this.require) {
85
- this.require = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
86
- }
87
- if (this.readonly.isComposite) {
88
- this.readonly.value = "this.viewModel.calculateReadonlyByRules(" + component_readonly_parameter_creator_1.ComponentReadonlyParameterCreator.createTitleId(this.id) + ")";
89
- }
90
- if (this.id) {
91
- this.replacedId = utility_1.ToolHelper.replaceDotToXiaHuaXian(this.id);
92
- this.referenceId = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id);
93
- }
94
- if (!this.enableTitleTips || !this.enableTitleTips.value) {
95
- this.titleTipsTemplate = null;
96
- }
97
- this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
98
- this.titleTipsTemplateName = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.resourceId + "_TipsTemplate");
99
- if (obj.binding) {
100
- if (obj.visibleControlledByRules) {
101
- this.visiblePipeSuffix = `|elementVisibility:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
102
- }
103
- if (obj.requireControlledByRules) {
104
- this.requirePipeSuffix = `|elementRequired:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
105
- }
106
- if (obj.readonlyControlledByRules) {
107
- this.readonlyPipeSuffix = `|elementReadonly:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
108
- }
109
- }
110
- }
111
- toJSON() {
112
- const result = {
113
- "id": this.id,
114
- "type": "BaseComponent",
115
- "visible": this.visible,
116
- "readonly": this.readonly,
117
- "require": this.require,
118
- "appearance": null,
119
- "border": null,
120
- "font": null,
121
- "margin": null,
122
- "padding": null,
123
- "size": null,
124
- "tabindex": this.tabindex,
125
- "hasDefaultFocus": this.hasDefaultFocus,
126
- "focusState": this.focusState
127
- };
128
- const keys = 'appearance,border,font,margin,padding,size,visible,readonly,require';
129
- keys.split(',').forEach(key => {
130
- if (this[key]) {
131
- try {
132
- result[key] = this[key].toJSON();
133
- }
134
- catch (e) {
135
- console.log(key);
136
- throw e;
137
- }
138
- }
139
- });
140
- return Object.assign({}, super.toJSON(), result);
141
- }
142
- toString() {
143
- return JSON.stringify(this.toJSON());
144
- }
145
- toAbstractDom() {
146
- const abstractDOM = {
147
- "type": "BaseComponent",
148
- "visible": (this.visible !== undefined && this.visible !== null) ? this.visible : true
149
- };
150
- const keys = 'id,type,visible,size,readonly';
151
- keys.split(',').forEach(key => {
152
- if (this[key] !== null && this[key] !== undefined && this[key] !== '') {
153
- switch (key) {
154
- default:
155
- abstractDOM[key] = this[key];
156
- break;
157
- }
158
- }
159
- });
160
- return Object.assign({}, super.toAbstractDom(), abstractDOM);
161
- }
162
- }
163
- exports.BaseComponent = BaseComponent;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseComponent = void 0;
4
+ const appearance_1 = require("./appearance");
5
+ const border_1 = require("./border");
6
+ const font_1 = require("./font");
7
+ const margin_1 = require("./margin");
8
+ const padding_1 = require("./padding");
9
+ const size_1 = require("./size");
10
+ const static_control_1 = require("../static-control");
11
+ const utility_1 = require("../../../utility");
12
+ const running_position_enum_1 = require("../../running-position-enum");
13
+ const component_readonly_parameter_creator_1 = require("../../../utility/devkit/component-readonly-parameter-creator");
14
+ const editor_type_enum_1 = require("../../editor-type-enum");
15
+ class BaseComponent extends static_control_1.StaticControlAttribute {
16
+ constructor(param) {
17
+ super(param);
18
+ this.editorType = editor_type_enum_1.EditorTypeEnum.Default;
19
+ this.includeInLoopContainer = false;
20
+ let obj;
21
+ if (typeof param === 'string') {
22
+ obj = utility_1.ToolHelper.convertToJsonOrDefault(param);
23
+ }
24
+ else {
25
+ obj = param;
26
+ }
27
+ if (!obj) {
28
+ return;
29
+ }
30
+ this.externalComponentNameSpace = obj["externalComponentNameSpace"];
31
+ this.id = obj["id"];
32
+ const keys = 'visible,type,readonly,require,binding,appearance,border,font,margin,padding,size,tabindex,hasDefaultFocus,focusState,controlIndex,enableTitleTips,titleTipsTemplate,titleTipsPosition,viewModel,useDisplayStyle,includeInLoopContainer';
33
+ Object.keys(obj).forEach(key => {
34
+ if (keys.includes(key)) {
35
+ switch (key) {
36
+ case 'appearance':
37
+ this[key] = new appearance_1.Appearance(obj[key]);
38
+ break;
39
+ case "type":
40
+ this.originalType = obj[key];
41
+ break;
42
+ case 'border':
43
+ this[key] = new border_1.Border(obj[key]);
44
+ break;
45
+ case 'font':
46
+ this[key] = new font_1.Font(obj[key]);
47
+ break;
48
+ case 'margin':
49
+ this[key] = new margin_1.Margin(obj[key]);
50
+ break;
51
+ case 'padding':
52
+ this[key] = new padding_1.Padding(obj[key]);
53
+ break;
54
+ case 'size':
55
+ this[key] = new size_1.Size(obj[key]);
56
+ break;
57
+ case "visible":
58
+ const visible = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
59
+ this[key] = utility_1.ToolHelper.createBindingWithPosition(visible, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
60
+ break;
61
+ case "readonly":
62
+ const readonly = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
63
+ this[key] = utility_1.ToolHelper.createBindingWithPosition(readonly, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
64
+ break;
65
+ case "require":
66
+ const require = utility_1.ToolHelper.isEmptyValue(obj[key]) ? "''" : obj[key];
67
+ this[key] = utility_1.ToolHelper.createBindingWithPosition(require, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
68
+ break;
69
+ case "enableTitleTips":
70
+ this[key] = utility_1.ToolHelper.createBinding(obj[key], false, this.externalComponentNameSpace, this.id);
71
+ break;
72
+ default:
73
+ this[key] = obj[key];
74
+ break;
75
+ }
76
+ }
77
+ });
78
+ if (!this.visible) {
79
+ this.visible = utility_1.ToolHelper.createBindingWithPosition(true, true, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
80
+ }
81
+ if (!this.readonly) {
82
+ this.readonly = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
83
+ }
84
+ if (!this.require) {
85
+ this.require = utility_1.ToolHelper.createBindingWithPosition(false, false, this.externalComponentNameSpace, running_position_enum_1.RunningPositionEnum.card, this.id);
86
+ }
87
+ if (this.readonly.isComposite) {
88
+ this.readonly.value = "this.viewModel.calculateReadonlyByRules(" + component_readonly_parameter_creator_1.ComponentReadonlyParameterCreator.createTitleId(this.id) + ")";
89
+ }
90
+ if (this.id) {
91
+ this.replacedId = utility_1.ToolHelper.replaceDotToXiaHuaXian(this.id);
92
+ this.referenceId = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id);
93
+ }
94
+ if (!this.enableTitleTips || !this.enableTitleTips.value) {
95
+ this.titleTipsTemplate = null;
96
+ }
97
+ this.resourceId = utility_1.I18nResourceManager.generateI18nResourceId(this.id, this.resourcePrefix);
98
+ this.titleTipsTemplateName = utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.resourceId + "_TipsTemplate");
99
+ if (obj.binding) {
100
+ if (obj.visibleControlledByRules) {
101
+ this.visiblePipeSuffix = `|elementVisibility:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
102
+ }
103
+ if (obj.requireControlledByRules) {
104
+ this.requirePipeSuffix = `|elementRequired:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
105
+ }
106
+ if (obj.readonlyControlledByRules) {
107
+ this.readonlyPipeSuffix = `|elementReadonly:'${utility_1.ToolHelper.replaceHengXianAndDotToXiaHuaXian(this.id)}':tracker['${this.id}']`;
108
+ }
109
+ }
110
+ }
111
+ toJSON() {
112
+ const result = {
113
+ "id": this.id,
114
+ "type": "BaseComponent",
115
+ "visible": this.visible,
116
+ "readonly": this.readonly,
117
+ "require": this.require,
118
+ "appearance": null,
119
+ "border": null,
120
+ "font": null,
121
+ "margin": null,
122
+ "padding": null,
123
+ "size": null,
124
+ "tabindex": this.tabindex,
125
+ "hasDefaultFocus": this.hasDefaultFocus,
126
+ "focusState": this.focusState
127
+ };
128
+ const keys = 'appearance,border,font,margin,padding,size,visible,readonly,require';
129
+ keys.split(',').forEach(key => {
130
+ if (this[key]) {
131
+ try {
132
+ result[key] = this[key].toJSON();
133
+ }
134
+ catch (e) {
135
+ console.log(key);
136
+ throw e;
137
+ }
138
+ }
139
+ });
140
+ return Object.assign({}, super.toJSON(), result);
141
+ }
142
+ toString() {
143
+ return JSON.stringify(this.toJSON());
144
+ }
145
+ toAbstractDom() {
146
+ const abstractDOM = {
147
+ "type": "BaseComponent",
148
+ "visible": (this.visible !== undefined && this.visible !== null) ? this.visible : true
149
+ };
150
+ const keys = 'id,type,visible,size,readonly';
151
+ keys.split(',').forEach(key => {
152
+ if (this[key] !== null && this[key] !== undefined && this[key] !== '') {
153
+ switch (key) {
154
+ default:
155
+ abstractDOM[key] = this[key];
156
+ break;
157
+ }
158
+ }
159
+ });
160
+ return Object.assign({}, super.toAbstractDom(), abstractDOM);
161
+ }
162
+ }
163
+ exports.BaseComponent = BaseComponent;
164
164
  //# sourceMappingURL=basecomponent.js.map