@ibiz-template/runtime 0.1.14 → 0.1.16

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 (177) hide show
  1. package/dist/index.esm.js +675 -159
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/command/app/open-app-view/open-app-view.js +1 -1
  5. package/out/controller/common/base.controller.d.ts.map +1 -1
  6. package/out/controller/common/base.controller.js +2 -0
  7. package/out/controller/control/caption-bar/caption-bar.controller.js +1 -1
  8. package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
  9. package/out/controller/control/exp-bar/exp-bar.controller.js +2 -6
  10. package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts.map +1 -1
  11. package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.js +4 -2
  12. package/out/controller/control/grid/grid/grid.controller.d.ts +7 -0
  13. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  14. package/out/controller/control/grid/grid/grid.controller.js +24 -0
  15. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +1 -1
  16. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
  17. package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +30 -23
  18. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  19. package/out/controller/control/search-bar/search-bar.controller.js +1 -0
  20. package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
  21. package/out/controller/control/tree/tree.controller.js +0 -1
  22. package/out/controller/utils/event/controller-event.d.ts +7 -0
  23. package/out/controller/utils/event/controller-event.d.ts.map +1 -1
  24. package/out/controller/utils/event/controller-event.js +17 -0
  25. package/out/controller/utils/index.d.ts +1 -0
  26. package/out/controller/utils/index.d.ts.map +1 -1
  27. package/out/controller/utils/index.js +1 -0
  28. package/out/controller/utils/value-ex/value-ex.d.ts +47 -0
  29. package/out/controller/utils/value-ex/value-ex.d.ts.map +1 -0
  30. package/out/controller/utils/value-ex/value-ex.js +48 -0
  31. package/out/engine/md-view.engine.d.ts +10 -1
  32. package/out/engine/md-view.engine.d.ts.map +1 -1
  33. package/out/engine/md-view.engine.js +28 -8
  34. package/out/interface/common/i-modal/i-modal.d.ts +8 -0
  35. package/out/interface/common/i-modal/i-modal.d.ts.map +1 -1
  36. package/out/interface/controller/state/common/i-controller.state.d.ts +8 -0
  37. package/out/interface/controller/state/common/i-controller.state.d.ts.map +1 -1
  38. package/out/interface/controller/state/control/i-grid.state.d.ts +14 -0
  39. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  40. package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -0
  41. package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
  42. package/out/interface/service/code-list-item/code-list-item.d.ts +5 -0
  43. package/out/interface/service/code-list-item/code-list-item.d.ts.map +1 -1
  44. package/out/service/dto/method.dto.d.ts.map +1 -1
  45. package/out/service/dto/method.dto.js +3 -1
  46. package/out/service/service/code-list/code-list.service.d.ts.map +1 -1
  47. package/out/service/service/code-list/code-list.service.js +1 -0
  48. package/out/service/service/entity/method/method.d.ts.map +1 -1
  49. package/out/service/service/entity/method/method.js +3 -2
  50. package/out/ui-action/provider/backend-ui-action-provider.d.ts.map +1 -1
  51. package/out/ui-action/provider/backend-ui-action-provider.js +4 -2
  52. package/out/ui-action/uiaction-util.d.ts.map +1 -1
  53. package/out/ui-action/uiaction-util.js +1 -0
  54. package/out/utils/handlebars/handlebars.d.ts +11 -2
  55. package/out/utils/handlebars/handlebars.d.ts.map +1 -1
  56. package/out/utils/handlebars/handlebars.js +24 -2
  57. package/out/utils/handlebars/helpers/and/and.d.ts +16 -0
  58. package/out/utils/handlebars/helpers/and/and.d.ts.map +1 -0
  59. package/out/utils/handlebars/helpers/and/and.js +24 -0
  60. package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts +16 -0
  61. package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts.map +1 -0
  62. package/out/utils/handlebars/helpers/camel-case/camel-case.js +23 -0
  63. package/out/utils/handlebars/helpers/concat/concat.d.ts +16 -0
  64. package/out/utils/handlebars/helpers/concat/concat.d.ts.map +1 -0
  65. package/out/utils/handlebars/helpers/concat/concat.js +20 -0
  66. package/out/utils/handlebars/helpers/eq/eq.d.ts +16 -0
  67. package/out/utils/handlebars/helpers/eq/eq.d.ts.map +1 -0
  68. package/out/utils/handlebars/helpers/eq/eq.js +22 -0
  69. package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts +15 -0
  70. package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts.map +1 -0
  71. package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.js +32 -0
  72. package/out/utils/handlebars/helpers/gt/gt.d.ts +16 -0
  73. package/out/utils/handlebars/helpers/gt/gt.d.ts.map +1 -0
  74. package/out/utils/handlebars/helpers/gt/gt.js +22 -0
  75. package/out/utils/handlebars/helpers/gte/gte.d.ts +16 -0
  76. package/out/utils/handlebars/helpers/gte/gte.d.ts.map +1 -0
  77. package/out/utils/handlebars/helpers/gte/gte.js +22 -0
  78. package/out/utils/handlebars/helpers/helper-base.d.ts +29 -0
  79. package/out/utils/handlebars/helpers/helper-base.d.ts.map +1 -0
  80. package/out/utils/handlebars/helpers/helper-base.js +20 -0
  81. package/out/utils/handlebars/helpers/index.d.ts +9 -0
  82. package/out/utils/handlebars/helpers/index.d.ts.map +1 -0
  83. package/out/utils/handlebars/helpers/index.js +45 -0
  84. package/out/utils/handlebars/helpers/json/json.d.ts +16 -0
  85. package/out/utils/handlebars/helpers/json/json.d.ts.map +1 -0
  86. package/out/utils/handlebars/helpers/json/json.js +19 -0
  87. package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts +16 -0
  88. package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts.map +1 -0
  89. package/out/utils/handlebars/helpers/lower-case/lower-case.js +22 -0
  90. package/out/utils/handlebars/helpers/lt/lt.d.ts +16 -0
  91. package/out/utils/handlebars/helpers/lt/lt.d.ts.map +1 -0
  92. package/out/utils/handlebars/helpers/lt/lt.js +22 -0
  93. package/out/utils/handlebars/helpers/lte/lte.d.ts +16 -0
  94. package/out/utils/handlebars/helpers/lte/lte.d.ts.map +1 -0
  95. package/out/utils/handlebars/helpers/lte/lte.js +22 -0
  96. package/out/utils/handlebars/helpers/neq/neq.d.ts +16 -0
  97. package/out/utils/handlebars/helpers/neq/neq.d.ts.map +1 -0
  98. package/out/utils/handlebars/helpers/neq/neq.js +22 -0
  99. package/out/utils/handlebars/helpers/not/not.d.ts +16 -0
  100. package/out/utils/handlebars/helpers/not/not.d.ts.map +1 -0
  101. package/out/utils/handlebars/helpers/not/not.js +21 -0
  102. package/out/utils/handlebars/helpers/or/or.d.ts +16 -0
  103. package/out/utils/handlebars/helpers/or/or.d.ts.map +1 -0
  104. package/out/utils/handlebars/helpers/or/or.js +27 -0
  105. package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts +16 -0
  106. package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts.map +1 -0
  107. package/out/utils/handlebars/helpers/pascal-case/pascal-case.js +23 -0
  108. package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts +16 -0
  109. package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts.map +1 -0
  110. package/out/utils/handlebars/helpers/snake-case/snake-case.js +23 -0
  111. package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts +16 -0
  112. package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts.map +1 -0
  113. package/out/utils/handlebars/helpers/spinal-case/spinal-case.js +23 -0
  114. package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts +16 -0
  115. package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts.map +1 -0
  116. package/out/utils/handlebars/helpers/upper-case/upper-case.js +22 -0
  117. package/out/utils/handlebars/utils/helper/helper.d.ts +42 -0
  118. package/out/utils/handlebars/utils/helper/helper.d.ts.map +1 -0
  119. package/out/utils/handlebars/utils/helper/helper.js +69 -0
  120. package/out/utils/handlebars/utils/index.d.ts +2 -0
  121. package/out/utils/handlebars/utils/index.d.ts.map +1 -0
  122. package/out/utils/handlebars/utils/index.js +1 -0
  123. package/out/utils/modal/modal.d.ts +1 -0
  124. package/out/utils/modal/modal.d.ts.map +1 -1
  125. package/out/utils/modal/modal.js +5 -2
  126. package/out/utils/text-util/text-util.d.ts +12 -3
  127. package/out/utils/text-util/text-util.d.ts.map +1 -1
  128. package/out/utils/text-util/text-util.js +23 -4
  129. package/package.json +2 -2
  130. package/src/command/app/open-app-view/open-app-view.ts +1 -1
  131. package/src/controller/common/base.controller.ts +2 -0
  132. package/src/controller/control/caption-bar/caption-bar.controller.ts +1 -1
  133. package/src/controller/control/exp-bar/exp-bar.controller.ts +2 -6
  134. package/src/controller/control/form/form-detail/form-druipart/form-druipart.controller.ts +4 -2
  135. package/src/controller/control/grid/grid/grid.controller.ts +25 -0
  136. package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +33 -26
  137. package/src/controller/control/search-bar/search-bar.controller.ts +1 -0
  138. package/src/controller/control/tree/tree.controller.ts +0 -1
  139. package/src/controller/utils/event/controller-event.ts +18 -0
  140. package/src/controller/utils/index.ts +1 -0
  141. package/src/controller/utils/value-ex/value-ex.ts +83 -0
  142. package/src/engine/md-view.engine.ts +31 -8
  143. package/src/interface/common/i-modal/i-modal.ts +9 -0
  144. package/src/interface/controller/state/common/i-controller.state.ts +9 -0
  145. package/src/interface/controller/state/control/i-grid.state.ts +16 -0
  146. package/src/interface/controller/state/control/i-search-bar.state.ts +9 -0
  147. package/src/interface/service/code-list-item/code-list-item.ts +6 -0
  148. package/src/service/dto/method.dto.ts +3 -1
  149. package/src/service/service/code-list/code-list.service.ts +1 -0
  150. package/src/service/service/entity/method/method.ts +9 -2
  151. package/src/ui-action/provider/backend-ui-action-provider.ts +4 -2
  152. package/src/ui-action/uiaction-util.ts +1 -0
  153. package/src/utils/handlebars/handlebars.ts +25 -3
  154. package/src/utils/handlebars/helpers/and/and.ts +26 -0
  155. package/src/utils/handlebars/helpers/camel-case/camel-case.ts +25 -0
  156. package/src/utils/handlebars/helpers/concat/concat.ts +22 -0
  157. package/src/utils/handlebars/helpers/eq/eq.ts +28 -0
  158. package/src/utils/handlebars/helpers/eq-property-value/eq-property-value.ts +41 -0
  159. package/src/utils/handlebars/helpers/gt/gt.ts +28 -0
  160. package/src/utils/handlebars/helpers/gte/gte.ts +28 -0
  161. package/src/utils/handlebars/helpers/helper-base.ts +31 -0
  162. package/src/utils/handlebars/helpers/index.ts +46 -0
  163. package/src/utils/handlebars/helpers/json/json.ts +25 -0
  164. package/src/utils/handlebars/helpers/lower-case/lower-case.ts +24 -0
  165. package/src/utils/handlebars/helpers/lt/lt.ts +28 -0
  166. package/src/utils/handlebars/helpers/lte/lte.ts +28 -0
  167. package/src/utils/handlebars/helpers/neq/neq.ts +28 -0
  168. package/src/utils/handlebars/helpers/not/not.ts +26 -0
  169. package/src/utils/handlebars/helpers/or/or.ts +28 -0
  170. package/src/utils/handlebars/helpers/pascal-case/pascal-case.ts +25 -0
  171. package/src/utils/handlebars/helpers/snake-case/snake-case.ts +25 -0
  172. package/src/utils/handlebars/helpers/spinal-case/spinal-case.ts +25 -0
  173. package/src/utils/handlebars/helpers/upper-case/upper-case.ts +24 -0
  174. package/src/utils/handlebars/utils/helper/helper.ts +75 -0
  175. package/src/utils/handlebars/utils/index.ts +1 -0
  176. package/src/utils/modal/modal.ts +6 -2
  177. package/src/utils/text-util/text-util.ts +22 -4
@@ -0,0 +1,69 @@
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
+ * 判断字符串是否为助手
12
+ *
13
+ * @author chitanda
14
+ * @date 2021-12-30 10:12:26
15
+ * @static
16
+ * @param {string} name
17
+ * @return {*} {boolean}
18
+ */
19
+ static isHelperName(name) {
20
+ return this.helperNames.includes(name);
21
+ }
22
+ /**
23
+ * 判断类助手统一结果调用处理
24
+ *
25
+ * @author chitanda
26
+ * @date 2021-12-29 17:12:23
27
+ * @static
28
+ * @param {unknown} context 执行上下文
29
+ * @param {boolean} bol 判断结果
30
+ * @param {Handlebars.HelperOptions} options
31
+ * @return {*} {(string | boolean)}
32
+ */
33
+ static handleJudgmentExecute(context, bol, options) {
34
+ if (options.fn) {
35
+ return bol ? options.fn(context) : options.inverse(context);
36
+ }
37
+ // eslint-disable-next-line no-return-assign
38
+ return bol ? (options.hash.yes = true) : (options.hash.no = false);
39
+ }
40
+ }
41
+ /**
42
+ * 当前所有助手 tag 名称
43
+ *
44
+ * @author chitanda
45
+ * @date 2021-12-30 10:12:39
46
+ * @protected
47
+ * @type {string[]}
48
+ */
49
+ HelperUtil.helperNames = [
50
+ 'lookup',
51
+ 'log',
52
+ 'and',
53
+ 'camelCase',
54
+ 'concat',
55
+ 'eq',
56
+ 'gt',
57
+ 'get',
58
+ 'lowerCase',
59
+ 'lt',
60
+ 'lte',
61
+ 'neq',
62
+ 'not',
63
+ 'or',
64
+ 'pascalCase',
65
+ 'pluralize',
66
+ 'snakeCase',
67
+ 'spinalCase',
68
+ 'upperCase',
69
+ ];
@@ -0,0 +1,2 @@
1
+ export { HelperUtil } from './helper/helper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/handlebars/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ export { HelperUtil } from './helper/helper';
@@ -16,6 +16,7 @@ export declare class Modal implements IModal {
16
16
  mode: ViewMode;
17
17
  routeDepth?: number;
18
18
  viewUsage: number;
19
+ ignoreDismissCheck: boolean;
19
20
  hooks: {
20
21
  shouldDismiss: AsyncSeriesHook<[], {
21
22
  allowClose: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/utils/modal/modal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErD,KAAK,eAAe,GAAG;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC,CAAC;AACF,qBAAa,KAAM,YAAW,MAAM;IAClC,IAAI,EAAE,QAAQ,CAAkB;IAEhC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAK;IAEtB,KAAK;;wBACkD,OAAO;;;MAE5D;gBAEU,IAAI,EAAE,eAAe;IAejC;;;;OAIG;IACH,QAAQ,SAAU,UAAU,KAAG,IAAI,CAEjC;IAEF;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAIlD,OAAO,CAAC,IAAI,GAAE,UAAoC,GAAG,OAAO,CAAC,OAAO,CAAC;IAkB3E;;;;;OAKG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAI1B"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/utils/modal/modal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErD,KAAK,eAAe,GAAG;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC,CAAC;AACF,qBAAa,KAAM,YAAW,MAAM;IAClC,IAAI,EAAE,QAAQ,CAAkB;IAEhC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,EAAE,MAAM,CAAK;IAEtB,kBAAkB,EAAE,OAAO,CAAS;IAEpC,KAAK;;wBACkD,OAAO;;;MAE5D;gBAEU,IAAI,EAAE,eAAe;IAejC;;;;OAIG;IACH,QAAQ,SAAU,UAAU,KAAG,IAAI,CAEjC;IAEF;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAIlD,OAAO,CAAC,IAAI,GAAE,UAAoC,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB3E;;;;;OAKG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAI1B"}
@@ -5,6 +5,7 @@ export class Modal {
5
5
  constructor(opts) {
6
6
  this.mode = ViewMode.EMBED;
7
7
  this.viewUsage = 4;
8
+ this.ignoreDismissCheck = false;
8
9
  this.hooks = {
9
10
  shouldDismiss: new AsyncSeriesHook(),
10
11
  beforeDismiss: new AsyncSeriesHook(),
@@ -41,8 +42,10 @@ export class Modal {
41
42
  }
42
43
  async dismiss(data = { ok: false, data: [] }) {
43
44
  const context = { allowClose: true };
44
- // 判断是否执行关闭
45
- await this.hooks.shouldDismiss.call(context);
45
+ if (this.ignoreDismissCheck !== true) {
46
+ // 判断是否执行关闭
47
+ await this.hooks.shouldDismiss.call(context);
48
+ }
46
49
  if (!context.allowClose) {
47
50
  ibiz.log.debug('shouldDismiss结果为false,关闭中断。');
48
51
  return false;
@@ -7,6 +7,15 @@
7
7
  * @class TextUtil
8
8
  */
9
9
  export declare class TextUtil {
10
+ /**
11
+ * input元素,用于存储拷贝的文本
12
+ *
13
+ * @author zhanghengfeng
14
+ * @date 2023-08-31 20:08:06
15
+ * @private
16
+ * @type {(HTMLInputElement | null)}
17
+ */
18
+ private inputElement;
10
19
  /**
11
20
  * 值格式化
12
21
  *
@@ -21,10 +30,10 @@ export declare class TextUtil {
21
30
  * 拷贝文本
22
31
  *
23
32
  * @author zhanghengfeng
24
- * @date 2023-08-28 14:08:57
33
+ * @date 2023-08-31 11:08:51
25
34
  * @param {string} value
26
- * @return {*} {Promise<void>}
35
+ * @return {*} {boolean}
27
36
  */
28
- copy(value: string): Promise<void>;
37
+ copy(value: string): boolean;
29
38
  }
30
39
  //# sourceMappingURL=text-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-util.d.ts","sourceRoot":"","sources":["../../../src/utils/text-util/text-util.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,QAAQ;IACnB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5C;;;;;;;OAOG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGzC"}
1
+ {"version":3,"file":"text-util.d.ts","sourceRoot":"","sources":["../../../src/utils/text-util/text-util.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,QAAQ;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY,CAAiC;IAErD;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5C;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAW7B"}
@@ -7,6 +7,17 @@
7
7
  * @class TextUtil
8
8
  */
9
9
  export class TextUtil {
10
+ constructor() {
11
+ /**
12
+ * input元素,用于存储拷贝的文本
13
+ *
14
+ * @author zhanghengfeng
15
+ * @date 2023-08-31 20:08:06
16
+ * @private
17
+ * @type {(HTMLInputElement | null)}
18
+ */
19
+ this.inputElement = null;
20
+ }
10
21
  /**
11
22
  * 值格式化
12
23
  *
@@ -23,11 +34,19 @@ export class TextUtil {
23
34
  * 拷贝文本
24
35
  *
25
36
  * @author zhanghengfeng
26
- * @date 2023-08-28 14:08:57
37
+ * @date 2023-08-31 11:08:51
27
38
  * @param {string} value
28
- * @return {*} {Promise<void>}
39
+ * @return {*} {boolean}
29
40
  */
30
- async copy(value) {
31
- return navigator.clipboard.writeText(value);
41
+ copy(value) {
42
+ if (!this.inputElement) {
43
+ this.inputElement = document.createElement('input');
44
+ this.inputElement.style.position = 'absolute';
45
+ this.inputElement.style.left = '-9999px';
46
+ document.body.appendChild(this.inputElement);
47
+ }
48
+ this.inputElement.value = value;
49
+ this.inputElement.select();
50
+ return document.execCommand('copy');
32
51
  }
33
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -57,5 +57,5 @@
57
57
  "qx-util": "^0.4.8",
58
58
  "ramda": "^0.29.0"
59
59
  },
60
- "gitHead": "ea26f98a8968882f3097e022ccbe3b99e21f1ef6"
60
+ "gitHead": "f81037350c49620b4172e520bc4b156d97e9d718"
61
61
  }
@@ -62,7 +62,7 @@ export class OpenAppViewCommand {
62
62
  case 'INDEXVIEWTAB':
63
63
  if (opts.noWaitRoute) {
64
64
  this.openIndexViewTab(appView, context, params);
65
- return;
65
+ return { ok: true };
66
66
  }
67
67
  return this.openIndexViewTab(appView, context, params);
68
68
  case 'POPUP':
@@ -72,6 +72,7 @@ export class BaseController<
72
72
  protected initState(): void {
73
73
  this.state.isCreated = false;
74
74
  this.state.isMounted = false;
75
+ this.state.isDestroyed = false;
75
76
  }
76
77
 
77
78
  /**
@@ -199,6 +200,7 @@ export class BaseController<
199
200
  */
200
201
  async destroyed(): Promise<void> {
201
202
  await this.onDestroyed();
203
+ this.state.isDestroyed = true;
202
204
  ibiz.log.debug(`${this.constructor.name}:${this.name} onDestroyed`);
203
205
  await this._evt.emit('onDestroyed', undefined);
204
206
  this.evt.destroy();
@@ -35,7 +35,7 @@ export class CaptionBarController
35
35
  await super.onCreated();
36
36
 
37
37
  this.view.evt.on('onViewInfoChange', ({ caption: _caption, dataInfo }) => {
38
- this.state.caption = `${this.state.caption}${
38
+ this.state.caption = `${this.view.model.caption}${
39
39
  dataInfo ? `-${dataInfo}` : ''
40
40
  }`;
41
41
  });
@@ -209,12 +209,8 @@ export class ExpBarControlController<
209
209
  this.xDataController.evt.on('onLoadSuccess', event => {
210
210
  this.xDataLoadSuccess(event);
211
211
  });
212
- this.xDataController.evt.on('onBeforeLoad', () => {
213
- const searchParams: IParams = {};
214
- if (this.state.query) {
215
- searchParams.query = this.state.query;
216
- }
217
- this.xDataController.state.searchParams = searchParams;
212
+ this.xDataController.evt.on('onRemoveSuccess', () => {
213
+ this.defaultNavByFirstItem();
218
214
  });
219
215
  }
220
216
 
@@ -119,8 +119,10 @@ export class FormDRUIPartController extends FormDetailController<IDEFormDRUIPart
119
119
  this.isNewData = state === FormNotifyState.DRAFT;
120
120
  this.state.showMask = this.isNewData;
121
121
 
122
- // 表单数据加载变更后,计算关系界面参数
123
- this.calcViewParams();
122
+ if (state === FormNotifyState.LOAD || state === FormNotifyState.DRAFT) {
123
+ // 表单数据加载变更后,计算关系界面参数
124
+ this.calcViewParams();
125
+ }
124
126
  }
125
127
 
126
128
  /**
@@ -567,11 +567,36 @@ export class GridController
567
567
  key: column.codeName!,
568
568
  caption: column.caption!,
569
569
  hidden: !!column.hideDefault,
570
+ uaColumn: column.columnType === 'UAGRIDCOLUMN',
570
571
  });
571
572
  }
572
573
  },
573
574
  { childrenFields: ['degridColumns'] },
574
575
  );
576
+ this.calcColumnFixed();
577
+ }
578
+
579
+ /**
580
+ * 计算列的固定状态
581
+ * @author lxm
582
+ * @date 2023-08-31 05:12:27
583
+ * @protected
584
+ */
585
+ protected calcColumnFixed(): void {
586
+ const showColumns = this.state.columnStates.filter(
587
+ column => !column.hidden,
588
+ );
589
+ const allNum = showColumns.length;
590
+ const { frozenFirstColumn, frozenLastColumn } = this.model;
591
+ showColumns.forEach((column, index) => {
592
+ if (column.uaColumn) {
593
+ column.fixed = index + 1 <= Math.floor(allNum / 2) ? 'left' : 'right';
594
+ } else if (frozenFirstColumn && index < frozenFirstColumn) {
595
+ column.fixed = 'left';
596
+ } else if (frozenLastColumn && index >= allNum - frozenLastColumn) {
597
+ column.fixed = 'right';
598
+ }
599
+ });
575
600
  }
576
601
 
577
602
  /**
@@ -6,7 +6,9 @@ import { clone } from 'ramda';
6
6
  import { OpenAppViewCommand } from '../../../../../command';
7
7
  import { CodeListItem, IModalData } from '../../../../../interface';
8
8
  import { parseUserParams } from '../../../../../model';
9
+ import { UIActionUtil } from '../../../../../ui-action';
9
10
  import { convertNavData, getWFContext } from '../../../../../utils';
11
+ import { ValueExUtil } from '../../../../utils';
10
12
  import { GridColumnController } from '../../grid/grid-column.controller';
11
13
  import { GridRowState } from '../../grid/grid-row.state';
12
14
 
@@ -156,20 +158,15 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
156
158
  * @param {MouseEvent} event 鼠标事件
157
159
  * @returns {*} {Promise<void>}
158
160
  */
159
- async triggerAction(_row: GridRowState, _event: MouseEvent): Promise<void> {
160
- // if (this.model.viewLogic) {
161
- // await executeViewLogic(
162
- // this.model.viewLogic,
163
- // this.context,
164
- // [row.data],
165
- // this.params,
166
- // {
167
- // event,
168
- // neuron: this.grid.nerve.self,
169
- // view: this.grid.ctx.view,
170
- // },
171
- // );
172
- // }
161
+ async triggerAction(row: GridRowState, event: MouseEvent): Promise<void> {
162
+ const actionId = this.model.deuiactionId;
163
+ await UIActionUtil.execAndResolved(actionId!, {
164
+ context: this.context,
165
+ params: this.params,
166
+ data: [row.data],
167
+ view: this.grid.view,
168
+ event,
169
+ });
173
170
  }
174
171
 
175
172
  /**
@@ -209,7 +206,7 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
209
206
  * @return {*} {(string | undefined)}
210
207
  */
211
208
  calcFieldAgg(items: IData[]): string | undefined {
212
- const { aggField, aggMode, aggValueFormat } = this.model;
209
+ const { aggField, aggMode, aggValueFormat, unitName } = this.model;
213
210
  // 无聚合配置的列,返回undefined
214
211
  if (aggMode === 'NONE') {
215
212
  return;
@@ -253,20 +250,24 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
253
250
  `暂未支持聚合模式${this.grid.model.aggMode}`,
254
251
  );
255
252
  }
256
- if (!aggValueFormat) {
257
- return `${aggValue}`;
258
- }
253
+
254
+ let value = `${aggValue}`;
259
255
 
260
256
  // 聚合值格式化
261
- const formatValue: string = '';
262
- switch (aggValueFormat) {
263
- default:
264
- throw new ModelError(
265
- this.model,
266
- `暂未支持${aggValueFormat}的聚合值格式化`,
267
- );
257
+ if (aggValueFormat) {
258
+ try {
259
+ value = ibiz.util.text.format(`${aggValue}`, aggValueFormat);
260
+ } catch (error) {
261
+ ibiz.log.error(`${aggValue} 值格式化错误`);
262
+ }
268
263
  }
269
- return formatValue;
264
+
265
+ // 添加单位
266
+ if (value && unitName) {
267
+ value += unitName;
268
+ }
269
+
270
+ return value;
270
271
  }
271
272
 
272
273
  /**
@@ -277,6 +278,12 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
277
278
  * @return {*} {string}
278
279
  */
279
280
  formatValue(value: unknown = ''): string {
281
+ // 根据数据类型增强转换显示文本
282
+ if (this.model.valueType) {
283
+ return ValueExUtil.toText(this.model, value);
284
+ }
285
+
286
+ // 根据格式化配置格式化显示
280
287
  const strVal = `${value}`;
281
288
  if (!this.valueFormat) {
282
289
  return strVal;
@@ -30,6 +30,7 @@ export class SearchBarController
30
30
  protected initState(): void {
31
31
  super.initState();
32
32
  this.state.query = '';
33
+ this.state.selectedGroupItem = null;
33
34
  this.state.visible = !!(
34
35
  this.model.enableQuickSearch ||
35
36
  this.model.enableGroup ||
@@ -116,7 +116,6 @@ export class TreeController
116
116
 
117
117
  // 有父节点绑定到父节点数据上,无父节点替换rootNodes
118
118
  if (parentNode) {
119
- // nodes.splice(0, 10);
120
119
  parentNode.children = nodes;
121
120
  } else {
122
121
  this.state.rootNodes = nodes;
@@ -39,6 +39,14 @@ export type EventTypeObjec<T> = {
39
39
  * @template A 能力行为接口
40
40
  */
41
41
  export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
42
+ /**
43
+ * 是否已经销毁
44
+ * @author lxm
45
+ * @date 2023-08-30 02:54:14
46
+ * @type {boolean}
47
+ */
48
+ isDestroyed: boolean = false;
49
+
42
50
  /**
43
51
  * 事件对象
44
52
  *
@@ -60,6 +68,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
60
68
  name: K,
61
69
  args: EventTypeObjec<E>[K]['emitArgs'],
62
70
  ): Promise<void> {
71
+ if (this.isDestroyed) {
72
+ return;
73
+ }
63
74
  // 自动补全其他事件对象参数
64
75
  await this.evt.asyncEmit(name as string, {
65
76
  ...this.getBaseArgs(),
@@ -80,6 +91,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
80
91
  name: K,
81
92
  fn: (event: EventTypeObjec<E>[K]['event']) => void | Promise<void>,
82
93
  ): void {
94
+ if (this.isDestroyed) {
95
+ return;
96
+ }
83
97
  this.evt.on(name as string, fn);
84
98
  }
85
99
 
@@ -92,6 +106,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
92
106
  onAll(
93
107
  fn: (eventName: string, event: EventBase) => void | Promise<void>,
94
108
  ): void {
109
+ if (this.isDestroyed) {
110
+ return;
111
+ }
95
112
  this.evt.onAll(fn as any);
96
113
  }
97
114
 
@@ -112,5 +129,6 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
112
129
  destroy(): void {
113
130
  this.getBaseArgs = undefined as any;
114
131
  this.evt.reset();
132
+ this.isDestroyed = true;
115
133
  }
116
134
  }
@@ -4,3 +4,4 @@ export * from './button-state';
4
4
  export * from './event';
5
5
  export * from './util/util';
6
6
  export * from './value-rule/value-rule';
7
+ export * from './value-ex/value-ex';
@@ -0,0 +1,83 @@
1
+ import { RuntimeError } from '@ibiz-template/core';
2
+ import { isNil, mergeLeft } from 'ramda';
3
+
4
+ export type ValueExOptions = {
5
+ /**
6
+ * 值类型
7
+ */
8
+ valueType?: string | 'SIMPLE' | 'SIMPLES' | 'OBJECT' | 'OBJECTS';
9
+
10
+ /**
11
+ * 对象标识属性
12
+ */
13
+ objectIdField?: string;
14
+
15
+ /**
16
+ * 对象名称属性(显示文本)
17
+ */
18
+ objectNameField?: string;
19
+
20
+ /**
21
+ * 对象值属性
22
+ */
23
+ objectValueField?: string;
24
+
25
+ /**
26
+ * 多项值分隔符
27
+ */
28
+ valueSeparator?: string;
29
+
30
+ /**
31
+ * 多项文本分隔符
32
+ */
33
+ textSeparator?: string;
34
+ };
35
+
36
+ export class ValueExUtil {
37
+ /**
38
+ * 合并默认值
39
+ * @author lxm
40
+ * @date 2023-08-30 02:06:58
41
+ * @static
42
+ * @param {ValueExOptions} options
43
+ * @return {*} {ValueExOptions}
44
+ */
45
+ static mergeDefault(options: ValueExOptions): ValueExOptions {
46
+ return mergeLeft(options, {
47
+ textSeparator: ',',
48
+ valueSeparator: ',',
49
+ });
50
+ }
51
+
52
+ /**
53
+ * 转成显示用的文本
54
+ * @author lxm
55
+ * @date 2023-08-30 01:55:38
56
+ * @param {ValueExOptions} options
57
+ * @param {unknown} value
58
+ * @return {*} {string}
59
+ */
60
+ static toText(options: ValueExOptions, value: unknown): string {
61
+ if (isNil(value) || value === '') {
62
+ return '';
63
+ }
64
+ const { valueType, objectNameField, textSeparator } =
65
+ this.mergeDefault(options);
66
+ if (['OBJECTS', 'OBJECT'].includes(valueType!)) {
67
+ if (!objectNameField) {
68
+ throw new RuntimeError('缺少objectNameField');
69
+ }
70
+ const textKey = objectNameField.toLowerCase();
71
+ if (valueType === 'OBJECTS') {
72
+ return (value as IData[])
73
+ .map(item => item[textKey] || '---')
74
+ .join(textSeparator);
75
+ }
76
+ return (value as IData)[textKey];
77
+ }
78
+ if (valueType === 'SIMPLES') {
79
+ return (value as string[]).join(textSeparator);
80
+ }
81
+ return `${value}`;
82
+ }
83
+ }
@@ -10,6 +10,7 @@ import {
10
10
  MDCtrlRemoveParams,
11
11
  ISearchBarController,
12
12
  MDCtrlLoadParams,
13
+ EventBase,
13
14
  } from '../interface';
14
15
  import { calcDeCodeNameById } from '../model';
15
16
  import { ViewEngineBase } from './view-base.engine';
@@ -82,9 +83,7 @@ export class MDViewEngine extends ViewEngineBase {
82
83
  async onMounted(): Promise<void> {
83
84
  await super.onMounted();
84
85
  const { model } = this.view;
85
- this.xdataControl.evt.on('onActive', async event => {
86
- await this.openData(event);
87
- });
86
+ this.xdataControl.evt.on('onActive', this.onXDataActive.bind(this));
88
87
  this.xdataControl.evt.on('onSelectionChange', async event => {
89
88
  // 更新工具栏状态
90
89
  this.toolbar?.calcButtonState(
@@ -135,6 +134,18 @@ export class MDViewEngine extends ViewEngineBase {
135
134
  }
136
135
  }
137
136
 
137
+ /**
138
+ * 多数据部件激活事件处理
139
+ * @author lxm
140
+ * @date 2023-08-31 02:53:37
141
+ * @protected
142
+ * @param {EventBase} event
143
+ * @return {*} {Promise<void>}
144
+ */
145
+ protected async onXDataActive(event: EventBase): Promise<void> {
146
+ await this.openData(event);
147
+ }
148
+
138
149
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
139
150
  async call(key: string, args: any): Promise<IData | null | undefined> {
140
151
  if (key === SysUIActionTag.TOGGLE_FILTER) {
@@ -316,11 +327,23 @@ export class MDViewEngine extends ViewEngineBase {
316
327
  Object.assign(params, filteredParams);
317
328
  }
318
329
  // 有搜索栏的整合相关参数
319
- if (this.searchBar && this.searchBar.state.query) {
320
- const addParams = {
321
- query: this.searchBar.state.query,
322
- };
323
- Object.assign(params, addParams);
330
+ if (this.searchBar) {
331
+ // 快速搜索
332
+ if (this.searchBar.state.query) {
333
+ const addParams = {
334
+ query: this.searchBar.state.query,
335
+ };
336
+ Object.assign(params, addParams);
337
+ }
338
+ // 快速分组
339
+ if (this.searchBar.state.selectedGroupItem?.data) {
340
+ // eslint-disable-next-line no-new-func
341
+ const func = new Function(
342
+ `return (${this.searchBar.state.selectedGroupItem.data});`,
343
+ );
344
+ const addParams = func() as IData;
345
+ Object.assign(params, addParams);
346
+ }
324
347
  }
325
348
  return params;
326
349
  }
@@ -30,6 +30,15 @@ export interface IModal {
30
30
  */
31
31
  mode: ViewMode;
32
32
 
33
+ /**
34
+ * 是否忽略关闭检查,用于强制关闭视图
35
+ *
36
+ * @author chitanda
37
+ * @date 2023-08-30 16:08:45
38
+ * @type {boolean}
39
+ */
40
+ ignoreDismissCheck: boolean;
41
+
33
42
  /**
34
43
  * 路由绘制的视图才有,用于表示所在路由层级
35
44
  *
@@ -22,4 +22,13 @@ export interface IControllerState {
22
22
  * @type {boolean}
23
23
  */
24
24
  isMounted: boolean;
25
+
26
+ /**
27
+ * 控制器是否走完destroy生命周期
28
+ *
29
+ * @author lxm
30
+ * @date 2022-08-18 22:08:23
31
+ * @type {boolean}
32
+ */
33
+ isDestroyed: boolean;
25
34
  }