@ibiz-template/vue3-components 0.4.3 → 0.4.5

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 (108) hide show
  1. package/dist/chart-ImL2qyp9.js +0 -1
  2. package/dist/ibiz-markdown-editor-BQsiQfa2.js +0 -1
  3. package/dist/index-UNZ1dtt_.js +0 -1
  4. package/dist/index-Ul84JXar.js +0 -1
  5. package/dist/index-zzHHP33g.js +13 -0
  6. package/dist/index.min.css +1 -1
  7. package/dist/index.system.min.js +1 -2
  8. package/dist/map-chart-7nfIdU3w.js +0 -1
  9. package/dist/wang-editor-f4440Xvw.js +0 -1
  10. package/dist/{xlsx-util-Mxa6HuaG.js → xlsx-util-FO177Hj_.js} +1 -2
  11. package/es/common/col/col.mjs +0 -3
  12. package/es/common/data-import2/data-import2.css +1 -1
  13. package/es/common/data-import2/data-import2.d.ts +48 -11
  14. package/es/common/data-import2/data-import2.mjs +133 -166
  15. package/es/common/data-import2-select/data-import2-select.css +1 -0
  16. package/es/common/data-import2-select/data-import2-select.d.ts +59 -0
  17. package/es/common/data-import2-select/data-import2-select.mjs +170 -0
  18. package/es/common/data-import2-table/data-import2-table.css +1 -0
  19. package/es/common/data-import2-table/data-import2-table.d.ts +56 -0
  20. package/es/common/data-import2-table/data-import2-table.mjs +104 -0
  21. package/es/common/index.mjs +4 -0
  22. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +2 -2
  23. package/es/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.mjs +1 -1
  24. package/es/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.provider.mjs +1 -1
  25. package/es/control/grid/row-edit-popover/row-edit-popover.css +1 -1
  26. package/es/control/tree/index.d.ts +1 -0
  27. package/es/control/tree/tree.css +1 -1
  28. package/es/control/tree/tree.d.ts +1 -0
  29. package/es/control/tree/tree.mjs +104 -54
  30. package/es/editor/index.mjs +9 -2
  31. package/es/index.mjs +0 -1
  32. package/es/panel-component/index.d.ts +0 -1
  33. package/es/panel-component/index.mjs +2 -4
  34. package/es/panel-component/panel-button/panel-button.controller.mjs +4 -1
  35. package/es/view-engine/index-view.engine.d.ts +0 -7
  36. package/es/view-engine/index-view.engine.mjs +0 -37
  37. package/lib/common/col/col.cjs +0 -3
  38. package/lib/common/data-import2/data-import2.cjs +132 -164
  39. package/lib/common/data-import2/data-import2.css +1 -1
  40. package/lib/common/data-import2-select/data-import2-select.cjs +172 -0
  41. package/lib/common/data-import2-select/data-import2-select.css +1 -0
  42. package/lib/common/data-import2-table/data-import2-table.cjs +106 -0
  43. package/lib/common/data-import2-table/data-import2-table.css +1 -0
  44. package/lib/common/index.cjs +4 -0
  45. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +1 -1
  46. package/lib/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.cjs +1 -1
  47. package/lib/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.provider.cjs +1 -1
  48. package/lib/control/grid/row-edit-popover/row-edit-popover.css +1 -1
  49. package/lib/control/tree/tree.cjs +102 -52
  50. package/lib/control/tree/tree.css +1 -1
  51. package/lib/editor/index.cjs +9 -2
  52. package/lib/index.cjs +15 -17
  53. package/lib/panel-component/index.cjs +29 -32
  54. package/lib/panel-component/panel-button/panel-button.controller.cjs +4 -1
  55. package/lib/view-engine/index-view.engine.cjs +0 -37
  56. package/package.json +10 -9
  57. package/dist/chart-ImL2qyp9.js.map +0 -1
  58. package/dist/ibiz-markdown-editor-BQsiQfa2.js.map +0 -1
  59. package/dist/index-1dtzc9-X.js +0 -14
  60. package/dist/index-1dtzc9-X.js.map +0 -1
  61. package/dist/index-UNZ1dtt_.js.map +0 -1
  62. package/dist/index-Ul84JXar.js.map +0 -1
  63. package/dist/index.system.min.js.map +0 -1
  64. package/dist/map-chart-7nfIdU3w.js.map +0 -1
  65. package/dist/wang-editor-f4440Xvw.js.map +0 -1
  66. package/dist/xlsx-util-Mxa6HuaG.js.map +0 -1
  67. package/es/_virtual/_commonjs-dynamic-modules.mjs +0 -5
  68. package/es/_virtual/pluralize.mjs +0 -3
  69. package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/format-path/format-path.mjs +0 -11
  70. package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/index.mjs +0 -4
  71. package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/merge-model/merge-model.mjs +0 -22
  72. package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/plural/plural.mjs +0 -30
  73. package/es/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/service-path-util/service-path-util.mjs +0 -187
  74. package/es/node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.mjs +0 -515
  75. package/es/panel-component/panel-container-group/index.d.ts +0 -28
  76. package/es/panel-component/panel-container-group/index.mjs +0 -20
  77. package/es/panel-component/panel-container-group/panel-container-group.controller.d.ts +0 -31
  78. package/es/panel-component/panel-container-group/panel-container-group.controller.mjs +0 -35
  79. package/es/panel-component/panel-container-group/panel-container-group.css +0 -1
  80. package/es/panel-component/panel-container-group/panel-container-group.d.ts +0 -28
  81. package/es/panel-component/panel-container-group/panel-container-group.mjs +0 -107
  82. package/es/panel-component/panel-container-group/panel-container-group.provider.d.ts +0 -15
  83. package/es/panel-component/panel-container-group/panel-container-group.provider.mjs +0 -21
  84. package/es/panel-component/panel-container-group/panel-container-group.state.d.ts +0 -12
  85. package/es/panel-component/panel-container-group/panel-container-group.state.mjs +0 -7
  86. package/es/panel-component/panel-tab-page/index.d.ts +0 -23
  87. package/es/panel-component/panel-tab-page/index.mjs +0 -12
  88. package/es/panel-component/panel-tab-page/panel-tab-page.d.ts +0 -25
  89. package/es/panel-component/panel-tab-page/panel-tab-page.mjs +0 -62
  90. package/es/panel-component/panel-tab-page/panel-tab-page.provider.d.ts +0 -13
  91. package/es/panel-component/panel-tab-page/panel-tab-page.provider.mjs +0 -21
  92. package/lib/_virtual/_commonjs-dynamic-modules.cjs +0 -7
  93. package/lib/_virtual/pluralize.cjs +0 -5
  94. package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/format-path/format-path.cjs +0 -13
  95. package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/index.cjs +0 -14
  96. package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/merge-model/merge-model.cjs +0 -24
  97. package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/plural/plural.cjs +0 -33
  98. package/lib/node_modules/.pnpm/@ibiz-template_model-helper@0.4.3_@ibiz-template_runtime@0.4.3_ramda@0.29.1/node_modules/@ibiz-template/model-helper/out/utils/service-path-util/service-path-util.cjs +0 -189
  99. package/lib/node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.cjs +0 -519
  100. package/lib/panel-component/panel-container-group/index.cjs +0 -27
  101. package/lib/panel-component/panel-container-group/panel-container-group.cjs +0 -109
  102. package/lib/panel-component/panel-container-group/panel-container-group.controller.cjs +0 -37
  103. package/lib/panel-component/panel-container-group/panel-container-group.css +0 -1
  104. package/lib/panel-component/panel-container-group/panel-container-group.provider.cjs +0 -23
  105. package/lib/panel-component/panel-container-group/panel-container-group.state.cjs +0 -9
  106. package/lib/panel-component/panel-tab-page/index.cjs +0 -17
  107. package/lib/panel-component/panel-tab-page/panel-tab-page.cjs +0 -64
  108. package/lib/panel-component/panel-tab-page/panel-tab-page.provider.cjs +0 -23
@@ -1,107 +0,0 @@
1
- import { isVNode, ref, computed, resolveComponent, createVNode, defineComponent } from 'vue';
2
- import { useNamespace } from '@ibiz-template/vue3-util';
3
- import { PanelContainerGroupController } from './panel-container-group.controller.mjs';
4
- import './panel-container-group.css';
5
-
6
- "use strict";
7
- function _isSlot(s) {
8
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9
- }
10
- const PanelContainerGroup = /* @__PURE__ */ defineComponent({
11
- name: "IBizPanelContainerGroup",
12
- props: {
13
- modelData: {
14
- type: Object,
15
- required: true
16
- },
17
- controller: {
18
- type: PanelContainerGroupController,
19
- required: true
20
- }
21
- },
22
- setup(props) {
23
- const ns = useNamespace("panel-container-group");
24
- const isCollapse = ref(!props.controller.defaultExpansion);
25
- const changeCollapse = () => {
26
- if (!props.controller.disableClose) {
27
- isCollapse.value = !isCollapse.value;
28
- }
29
- };
30
- const captionText = computed(() => {
31
- const {
32
- captionItemName,
33
- caption,
34
- capLanguageRes
35
- } = props.modelData;
36
- if (captionItemName) {
37
- return props.controller.data[captionItemName];
38
- }
39
- let text = caption;
40
- if (capLanguageRes) {
41
- text = ibiz.i18n.t(capLanguageRes.lanResTag, caption);
42
- }
43
- return text;
44
- });
45
- return {
46
- ns,
47
- captionText,
48
- changeCollapse,
49
- isCollapse
50
- };
51
- },
52
- render() {
53
- var _a, _b;
54
- let _slot;
55
- const classArr = [this.ns.b(), this.ns.m(this.modelData.id), ...this.controller.containerClass, this.ns.is("hidden", !this.controller.state.visible)];
56
- if (this.modelData.showCaption === true) {
57
- classArr.push(this.ns.m("show-header"));
58
- classArr.push(this.ns.b("collapse"));
59
- classArr.push(this.ns.is("collapse", this.isCollapse));
60
- if (this.controller.disableClose) {
61
- classArr.push(this.ns.bm("collapse", "disable-close"));
62
- }
63
- }
64
- const defaultSlots = ((_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) || [];
65
- const content = createVNode(resolveComponent("iBizRow"), {
66
- "slot": "content",
67
- "layout": this.modelData.layout
68
- }, _isSlot(_slot = defaultSlots.map((slot) => {
69
- const props = slot.props;
70
- if (!props || !props.controller) {
71
- return slot;
72
- }
73
- return createVNode(resolveComponent("iBizCol"), {
74
- "layoutPos": props.modelData.layoutPos,
75
- "state": props.controller.state
76
- }, _isSlot(slot) ? slot : {
77
- default: () => [slot]
78
- });
79
- })) ? _slot : {
80
- default: () => [_slot]
81
- });
82
- let header = null;
83
- if (this.modelData.showCaption) {
84
- header = createVNode("div", {
85
- "class": [this.ns.b("header")],
86
- "onClick": this.changeCollapse
87
- }, [createVNode("div", {
88
- "class": [this.ns.be("header", "left")]
89
- }, [createVNode("div", {
90
- "class": [this.ns.e("caption"), ...this.controller.labelClass]
91
- }, [this.captionText])]), createVNode("div", {
92
- "class": [this.ns.be("header", "right")]
93
- }, [this.modelData.titleBarCloseMode !== void 0 && this.modelData.titleBarCloseMode !== 0 && (this.isCollapse ? createVNode("ion-icon", {
94
- "name": "caret-forward-sharp"
95
- }, null) : createVNode("ion-icon", {
96
- "name": "caret-down-sharp"
97
- }, null))])]);
98
- }
99
- return createVNode("div", {
100
- "class": classArr
101
- }, [header, createVNode("div", {
102
- "class": [this.ns.b("content")]
103
- }, [content])]);
104
- }
105
- });
106
-
107
- export { PanelContainerGroup };
@@ -1,15 +0,0 @@
1
- import { IPanelItemProvider, PanelController, PanelItemController } from '@ibiz-template/runtime';
2
- import { IPanelContainer } from '@ibiz/model-core';
3
- /**
4
- * 面板分组容器适配器
5
- *
6
- * @author lxm
7
- * @date 2022-09-19 22:09:03
8
- * @export
9
- * @class PanelContainerGroupProvider
10
- * @implements {EditorProvider}
11
- */
12
- export declare class PanelContainerGroupProvider implements IPanelItemProvider {
13
- component: string;
14
- createController(panelItem: IPanelContainer, panel: PanelController, parent: PanelItemController | undefined): Promise<PanelItemController>;
15
- }
@@ -1,21 +0,0 @@
1
- import { PanelContainerGroupController } from './panel-container-group.controller.mjs';
2
-
3
- "use strict";
4
- var __defProp = Object.defineProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => {
7
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- return value;
9
- };
10
- class PanelContainerGroupProvider {
11
- constructor() {
12
- __publicField(this, "component", "IBizPanelContainerGroup");
13
- }
14
- async createController(panelItem, panel, parent) {
15
- const c = new PanelContainerGroupController(panelItem, panel, parent);
16
- await c.init();
17
- return c;
18
- }
19
- }
20
-
21
- export { PanelContainerGroupProvider };
@@ -1,12 +0,0 @@
1
- import { PanelItemState } from '@ibiz-template/runtime';
2
- /**
3
- * 面板分组容器状态
4
- *
5
- * @author lxm
6
- * @date 2023-02-07 06:04:27
7
- * @export
8
- * @class PanelContainerGroupState
9
- * @extends {PanelItemState}
10
- */
11
- export declare class PanelContainerGroupState extends PanelItemState {
12
- }
@@ -1,7 +0,0 @@
1
- import { PanelItemState } from '@ibiz-template/runtime';
2
-
3
- "use strict";
4
- class PanelContainerGroupState extends PanelItemState {
5
- }
6
-
7
- export { PanelContainerGroupState };
@@ -1,23 +0,0 @@
1
- export declare const IBizPanelTabPage: import("@ibiz-template/vue3-util").TypeWithInstall<import("vue").DefineComponent<{
2
- modelData: {
3
- type: import("vue").PropType<import("@ibiz/model-core").IPanelContainer>;
4
- required: true;
5
- };
6
- controller: {
7
- type: typeof import("@ibiz-template/runtime").PanelItemController;
8
- required: true;
9
- };
10
- }, {
11
- ns: import("@ibiz-template/core").Namespace;
12
- classArr: import("vue").ComputedRef<(string | false)[]>;
13
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
14
- modelData: {
15
- type: import("vue").PropType<import("@ibiz/model-core").IPanelContainer>;
16
- required: true;
17
- };
18
- controller: {
19
- type: typeof import("@ibiz-template/runtime").PanelItemController;
20
- required: true;
21
- };
22
- }>>, {}, {}>>;
23
- export default IBizPanelTabPage;
@@ -1,12 +0,0 @@
1
- import { registerPanelItemProvider } from '@ibiz-template/runtime';
2
- import { withInstall } from '@ibiz-template/vue3-util';
3
- import { PanelTabPage } from './panel-tab-page.mjs';
4
- import { PanelTabPageProvider } from './panel-tab-page.provider.mjs';
5
-
6
- "use strict";
7
- const IBizPanelTabPage = withInstall(PanelTabPage, function(v) {
8
- v.component(PanelTabPage.name, PanelTabPage);
9
- registerPanelItemProvider("TABPAGE", () => new PanelTabPageProvider());
10
- });
11
-
12
- export { IBizPanelTabPage, IBizPanelTabPage as default };
@@ -1,25 +0,0 @@
1
- import { PropType } from 'vue';
2
- import { IPanelContainer } from '@ibiz/model-core';
3
- import { PanelItemController } from '@ibiz-template/runtime';
4
- export declare const PanelTabPage: import("vue").DefineComponent<{
5
- modelData: {
6
- type: PropType<IPanelContainer>;
7
- required: true;
8
- };
9
- controller: {
10
- type: typeof PanelItemController;
11
- required: true;
12
- };
13
- }, {
14
- ns: import("@ibiz-template/core").Namespace;
15
- classArr: import("vue").ComputedRef<(string | false)[]>;
16
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
17
- modelData: {
18
- type: PropType<IPanelContainer>;
19
- required: true;
20
- };
21
- controller: {
22
- type: typeof PanelItemController;
23
- required: true;
24
- };
25
- }>>, {}, {}>;
@@ -1,62 +0,0 @@
1
- import { isVNode, computed, resolveComponent, createVNode, defineComponent } from 'vue';
2
- import { useNamespace } from '@ibiz-template/vue3-util';
3
- import { PanelItemController } from '@ibiz-template/runtime';
4
-
5
- "use strict";
6
- function _isSlot(s) {
7
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
8
- }
9
- const PanelTabPage = /* @__PURE__ */ defineComponent({
10
- name: "IBizPanelTabPage",
11
- props: {
12
- modelData: {
13
- // IPanelTabPage 不能使用 IPanelTabPage模型 否则会类型报错
14
- type: Object,
15
- required: true
16
- },
17
- controller: {
18
- type: PanelItemController,
19
- required: true
20
- }
21
- },
22
- setup(props) {
23
- const ns = useNamespace("panel-tab-page");
24
- const classArr = computed(() => {
25
- const {
26
- id
27
- } = props.modelData;
28
- const result = [ns.b(), ns.m(id)];
29
- result.push(...props.controller.containerClass);
30
- return result;
31
- });
32
- return {
33
- ns,
34
- classArr
35
- };
36
- },
37
- render() {
38
- var _a, _b;
39
- let _slot;
40
- const defaultSlots = ((_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) || [];
41
- return createVNode(resolveComponent("iBizRow"), {
42
- "class": [this.ns.b(), this.ns.m(this.modelData.codeName), this.classArr],
43
- "layout": this.modelData.layout
44
- }, _isSlot(_slot = defaultSlots.map((slot) => {
45
- const props = slot.props;
46
- if (!props || !props.controller) {
47
- return slot;
48
- }
49
- const c = props.controller;
50
- return createVNode(resolveComponent("iBizCol"), {
51
- "layoutPos": c.model.layoutPos,
52
- "state": c.state
53
- }, _isSlot(slot) ? slot : {
54
- default: () => [slot]
55
- });
56
- })) ? _slot : {
57
- default: () => [_slot]
58
- });
59
- }
60
- });
61
-
62
- export { PanelTabPage };
@@ -1,13 +0,0 @@
1
- import { IPanelItemProvider, PanelController, PanelItemController } from '@ibiz-template/runtime';
2
- import { IPanelItem } from '@ibiz/model-core';
3
- /**
4
- * 面板分页适配器
5
- *
6
- * @export
7
- * @class PanelTabPageController
8
- * @implements {IPanelItemProvider}
9
- */
10
- export declare class PanelTabPageProvider implements IPanelItemProvider {
11
- component: string;
12
- createController(panelItem: IPanelItem, panel: PanelController, parent: PanelItemController | undefined): Promise<PanelItemController>;
13
- }
@@ -1,21 +0,0 @@
1
- import { PanelItemController } from '@ibiz-template/runtime';
2
-
3
- "use strict";
4
- var __defProp = Object.defineProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => {
7
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- return value;
9
- };
10
- class PanelTabPageProvider {
11
- constructor() {
12
- __publicField(this, "component", "IBizPanelTabPage");
13
- }
14
- async createController(panelItem, panel, parent) {
15
- const c = new PanelItemController(panelItem, panel, parent);
16
- await c.init();
17
- return c;
18
- }
19
- }
20
-
21
- export { PanelTabPageProvider };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- function commonjsRequire(path) {
4
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
5
- }
6
-
7
- exports.commonjsRequire = commonjsRequire;
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- var pluralize = {exports: {}};
4
-
5
- exports.__module = pluralize;
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- function formatPath(path) {
4
- // 合成路径,需要判断模型路径是否从 PSSYSAPPS 开始
5
- if ((path === null || path === void 0 ? void 0 : path.indexOf('PSSYSAPPS/')) === 0) {
6
- // 合成路径
7
- const pos = path.indexOf('/');
8
- return path.substring(path.indexOf('/', pos + 1));
9
- }
10
- return path;
11
- }
12
-
13
- exports.formatPath = formatPath;
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var formatPath = require('./format-path/format-path.cjs');
4
- var mergeModel = require('./merge-model/merge-model.cjs');
5
- var plural = require('./plural/plural.cjs');
6
- var servicePathUtil = require('./service-path-util/service-path-util.cjs');
7
-
8
-
9
-
10
- exports.formatPath = formatPath.formatPath;
11
- exports.mergeModel = mergeModel.mergeModel;
12
- exports.plural = plural.plural;
13
- exports.pluralLower = plural.pluralLower;
14
- exports.ServicePathUtil = servicePathUtil.ServicePathUtil;
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- var ramda = require('ramda');
4
-
5
- /**
6
- * 将预置的模型合并到当前模型中
7
- *
8
- * @author chitanda
9
- * @date 2023-09-22 10:09:10
10
- * @export
11
- * @param {IModel[]} models
12
- * @param {IModel} m
13
- * @param {string} tag
14
- */
15
- function mergeModel(models, m, tag) {
16
- models.forEach(model => {
17
- const item = m[model[tag]];
18
- if (item) {
19
- Object.assign(model, ramda.mergeDeepLeft(model, item));
20
- }
21
- });
22
- }
23
-
24
- exports.mergeModel = mergeModel;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- var pluralize = require('../../../../../../../pluralize@8.0.0/node_modules/pluralize/pluralize.cjs');
4
-
5
- // 补充特殊转换规则
6
- pluralize.default.addPluralRule(/(matr|vert|ind)ix|ex$/, '$1ices');
7
- /**
8
- * 英文转复数写法
9
- *
10
- * @author chitanda
11
- * @date 2022-08-25 18:08:41
12
- * @export
13
- * @param {string} key
14
- * @return {*} {string}
15
- */
16
- function plural(key) {
17
- return pluralize.default(key);
18
- }
19
- /**
20
- * 英文转复数写法并转全小写
21
- *
22
- * @author chitanda
23
- * @date 2022-08-25 18:08:23
24
- * @export
25
- * @param {string} key
26
- * @return {*} {string}
27
- */
28
- function pluralLower(key) {
29
- return plural(key).toLowerCase();
30
- }
31
-
32
- exports.plural = plural;
33
- exports.pluralLower = pluralLower;
@@ -1,189 +0,0 @@
1
- 'use strict';
2
-
3
- var plural = require('../plural/plural.cjs');
4
-
5
- /**
6
- * 服务路径拼接工具
7
- *
8
- * @author chitanda
9
- * @date 2022-08-22 21:08:52
10
- * @export
11
- * @class ServicePathUtil
12
- */
13
- class ServicePathUtil {
14
- constructor(appDataEntities, allDERss) {
15
- this.appDataEntities = appDataEntities;
16
- this.allDERss = allDERss;
17
- /**
18
- * 应用实体关系
19
- *
20
- * @author chitanda
21
- * @date 2022-08-22 22:08:18
22
- * @protected
23
- * @type {Map<string, IAppDERS[]>} <应用实体 id, 应用实体父关系>
24
- */
25
- this.entityRsMap = new Map();
26
- /**
27
- * 实体资源路径
28
- *
29
- * @author chitanda
30
- * @date 2022-08-22 22:08:58
31
- * @protected
32
- * @type {Map<string, ServicePathItem[][]>}
33
- */
34
- this.entityRsPathMap = new Map();
35
- }
36
- /**
37
- * 根据应用主实体过滤从关系集合
38
- *
39
- * @author chitanda
40
- * @date 2023-04-20 17:04:34
41
- * @protected
42
- * @param {string} id
43
- * @return {*} {IAppDERS[]}
44
- */
45
- filterDERSs(id) {
46
- if (this.entityRsMap.has(id)) {
47
- return this.entityRsMap.get(id);
48
- }
49
- const items = this.allDERss.filter(item => {
50
- if (item.minorAppDataEntityId === id) {
51
- return item;
52
- }
53
- return null;
54
- });
55
- if (items.length > 0) {
56
- this.entityRsMap.set(id, items);
57
- }
58
- return items;
59
- }
60
- /**
61
- * 计算指定应用实体所有资源路径
62
- *
63
- * @author chitanda
64
- * @date 2023-04-22 13:04:27
65
- * @param {string} id
66
- * @return {*} {string[]}
67
- */
68
- calcRequestPaths(id) {
69
- const paths = this.calcPaths(id);
70
- return paths.map(path => {
71
- return path.map(item => `${item.plural}/\${${item.lower}}`).join('/');
72
- });
73
- }
74
- /**
75
- * 计算指定实体所有资源路径
76
- *
77
- * @author chitanda
78
- * @date 2023-04-22 13:04:36
79
- * @protected
80
- * @param {string} id
81
- * @return {*} {ServicePathItem[][]} 返回顺序为 [祖父实体,爷爷实体,父实体,当前实体]
82
- */
83
- calcPaths(id) {
84
- const entityRef = this.appDataEntities.find(item => item.id === id);
85
- if (!entityRef) {
86
- throw new Error(`未找到实体 ${id}`);
87
- }
88
- const { codeName } = entityRef;
89
- if (this.entityRsPathMap.has(codeName)) {
90
- return this.entityRsPathMap.get(codeName);
91
- }
92
- const deRss = this.filterDERSs(id);
93
- if (deRss) {
94
- // 已经计算过的应用实体标识
95
- const ids = [id];
96
- const arr = this.calcDeepPath(ids, deRss);
97
- this.deepFillPath(codeName, [codeName], arr);
98
- let paths = this.entityRsPathMap.get(codeName);
99
- if (paths) {
100
- paths = this.sortPath(paths);
101
- this.entityRsPathMap.set(codeName, paths);
102
- return paths;
103
- }
104
- }
105
- return [];
106
- }
107
- /**
108
- * 计算递归资源路径
109
- *
110
- * @author chitanda
111
- * @date 2023-08-23 14:08:39
112
- * @protected
113
- * @param {string[]} ids
114
- * @param {IAppDERS[]} deRss
115
- * @param {number} [num=0]
116
- * @return {*} {ServicePathDeep[]}
117
- */
118
- calcDeepPath(ids, deRss, num = 0) {
119
- if (num > 10) {
120
- throw new Error('服务路径计算超过最大层级 10');
121
- }
122
- num += 1;
123
- const arr = [];
124
- deRss.forEach(rs => {
125
- if (ids.includes(rs.majorAppDataEntityId)) {
126
- ibiz.log.warn('计算资源关系路径出现循环递归引用,触发实体:', rs.majorAppDataEntityId, '当前已计算过实体清单: ', ids);
127
- return;
128
- }
129
- const items = this.filterDERSs(rs.majorAppDataEntityId);
130
- arr.push([
131
- rs,
132
- this.calcDeepPath([...ids, rs.majorAppDataEntityId], items, num),
133
- ]);
134
- });
135
- return arr;
136
- }
137
- /**
138
- * 递归填充计算所有资源路径
139
- *
140
- * @author chitanda
141
- * @date 2022-08-22 22:08:04
142
- * @protected
143
- * @param {string} deCodeName
144
- * @param {string[]} pathNames
145
- * @param {ServicePathDeep[]} items
146
- */
147
- deepFillPath(deCodeName, pathNames, items) {
148
- items.forEach(item => {
149
- const [rs, children] = item;
150
- if (children.length > 0) {
151
- this.deepFillPath(deCodeName, [...pathNames, rs.majorDECodeName], children);
152
- }
153
- if (!this.entityRsPathMap.has(deCodeName)) {
154
- this.entityRsPathMap.set(deCodeName, []);
155
- }
156
- const arr = this.entityRsPathMap.get(deCodeName);
157
- arr.push([
158
- ...pathNames.map(pathName => {
159
- return {
160
- codeName: pathName,
161
- lower: pathName.toLowerCase(),
162
- plural: plural.pluralLower(pathName),
163
- };
164
- }),
165
- {
166
- codeName: rs.majorDECodeName,
167
- lower: rs.majorDECodeName.toLowerCase(),
168
- plural: plural.pluralLower(rs.majorDECodeName),
169
- },
170
- ].reverse());
171
- });
172
- }
173
- /**
174
- * 排序资源路径顺序
175
- *
176
- * @author chitanda
177
- * @date 2022-08-22 22:08:44
178
- * @protected
179
- * @param {ServicePathItem[][]} paths
180
- * @return {*} {ServicePathItem[][]}
181
- */
182
- sortPath(paths) {
183
- return paths.sort((a, b) => {
184
- return b.length - a.length;
185
- });
186
- }
187
- }
188
-
189
- exports.ServicePathUtil = ServicePathUtil;