@ibiz-template/vue3-components 0.7.1 → 0.7.2

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 (75) hide show
  1. package/dist/index-8RikZoLN.js +4 -0
  2. package/dist/index.min.css +1 -1
  3. package/dist/index.system.min.js +1 -1
  4. package/dist/{xlsx-util-X-Qzwu1f.js → xlsx-util-vcRxGFII.js} +1 -1
  5. package/es/common/data-import/data-import.d.ts +1 -3
  6. package/es/common/data-import/data-import.mjs +34 -77
  7. package/es/control/form/form/form.mjs +7 -9
  8. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.d.ts +40 -0
  9. package/es/control/grid/grid/grid.d.ts +1 -0
  10. package/es/control/grid/grid/grid.mjs +15 -3
  11. package/es/control/grid/grid/index.d.ts +3 -0
  12. package/es/control/tree-grid/index.d.ts +3 -0
  13. package/es/control/tree-grid/tree-grid.d.ts +3 -1
  14. package/es/control/tree-grid/tree-grid.mjs +15 -3
  15. package/es/control/tree-grid-ex/tree-grid-ex.mjs +7 -1
  16. package/es/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.css +1 -1
  17. package/es/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.mjs +7 -3
  18. package/es/editor/data-picker/ibiz-mpicker/ibiz-mpicker.mjs +5 -1
  19. package/es/editor/data-picker/ibiz-picker/ibiz-picker.css +1 -1
  20. package/es/editor/data-picker/ibiz-picker/ibiz-picker.mjs +7 -3
  21. package/es/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.mjs +5 -1
  22. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.css +1 -1
  23. package/es/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.mjs +18 -3
  24. package/es/editor/text-box/input/input.d.ts +1 -1
  25. package/es/index.mjs +1 -0
  26. package/es/panel-component/data-import/data-import-shell.css +0 -0
  27. package/es/panel-component/data-import/data-import-shell.d.ts +27 -0
  28. package/es/panel-component/data-import/data-import-shell.mjs +49 -0
  29. package/es/panel-component/data-import/data-import.provider.d.ts +15 -0
  30. package/es/panel-component/data-import/data-import.provider.mjs +21 -0
  31. package/es/panel-component/data-import/index.d.ts +24 -0
  32. package/es/panel-component/data-import/index.mjs +15 -0
  33. package/es/panel-component/index.d.ts +1 -0
  34. package/es/panel-component/index.mjs +5 -1
  35. package/es/panel-component/panel-index-view-search/panel-index-view-search.mjs +0 -1
  36. package/es/panel-component/user-action/index.d.ts +25 -0
  37. package/es/panel-component/user-action/index.mjs +14 -0
  38. package/es/panel-component/user-action/user-action-provider.d.ts +6 -0
  39. package/es/panel-component/user-action/user-action-provider.mjs +21 -0
  40. package/es/panel-component/user-action/user-action.css +1 -0
  41. package/es/panel-component/user-action/user-action.d.ts +28 -0
  42. package/es/panel-component/user-action/user-action.mjs +74 -0
  43. package/es/view-engine/app-data-upload-view.engine.d.ts +13 -0
  44. package/es/view-engine/app-data-upload-view.engine.mjs +7 -0
  45. package/es/view-engine/index-view.engine.mjs +13 -1
  46. package/es/view-engine/index.mjs +5 -0
  47. package/lib/common/data-import/data-import.cjs +33 -76
  48. package/lib/control/form/form/form.cjs +7 -9
  49. package/lib/control/grid/grid/grid.cjs +14 -2
  50. package/lib/control/tree-grid/tree-grid.cjs +14 -2
  51. package/lib/control/tree-grid-ex/tree-grid-ex.cjs +6 -0
  52. package/lib/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.cjs +7 -3
  53. package/lib/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.css +1 -1
  54. package/lib/editor/data-picker/ibiz-mpicker/ibiz-mpicker.cjs +5 -1
  55. package/lib/editor/data-picker/ibiz-picker/ibiz-picker.cjs +7 -3
  56. package/lib/editor/data-picker/ibiz-picker/ibiz-picker.css +1 -1
  57. package/lib/editor/data-picker/ibiz-picker-dropdown/ibiz-picker-dropdown.cjs +5 -1
  58. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.cjs +18 -3
  59. package/lib/editor/dropdown-list/ibiz-dropdown/ibiz-dropdown.css +1 -1
  60. package/lib/index.cjs +12 -10
  61. package/lib/panel-component/data-import/data-import-shell.cjs +51 -0
  62. package/lib/panel-component/data-import/data-import-shell.css +0 -0
  63. package/lib/panel-component/data-import/data-import.provider.cjs +23 -0
  64. package/lib/panel-component/data-import/index.cjs +20 -0
  65. package/lib/panel-component/index.cjs +31 -26
  66. package/lib/panel-component/panel-index-view-search/panel-index-view-search.cjs +0 -1
  67. package/lib/panel-component/user-action/index.cjs +19 -0
  68. package/lib/panel-component/user-action/user-action-provider.cjs +23 -0
  69. package/lib/panel-component/user-action/user-action.cjs +76 -0
  70. package/lib/panel-component/user-action/user-action.css +1 -0
  71. package/lib/view-engine/app-data-upload-view.engine.cjs +9 -0
  72. package/lib/view-engine/index-view.engine.cjs +12 -0
  73. package/lib/view-engine/index.cjs +5 -0
  74. package/package.json +6 -6
  75. package/dist/index-XRnHM6lw.js +0 -4
@@ -26,7 +26,7 @@ export declare const IBizInput: import("vue").DefineComponent<{
26
26
  c: TextBoxEditorController;
27
27
  ns: import("@ibiz-template/core").Namespace;
28
28
  rows: import("vue").Ref<number>;
29
- type: import("vue").ComputedRef<"string" | "text" | "password" | "textarea">;
29
+ type: import("vue").ComputedRef<"string" | "text" | "textarea" | "password">;
30
30
  currentVal: import("vue").Ref<string>;
31
31
  readonlyText: import("vue").ComputedRef<string>;
32
32
  handleChange: (val: string | number) => void;
package/es/index.mjs CHANGED
@@ -98,6 +98,7 @@ export { SplitContainerController } from './panel-component/split-container/spli
98
98
  export { IBizSplitContainer } from './panel-component/split-container/index.mjs';
99
99
  export { IBizPanelIndexViewSearch } from './panel-component/panel-index-view-search/index.mjs';
100
100
  export { IBizIndexActions } from './panel-component/index-actions/index.mjs';
101
+ export { IBizUserAction } from './panel-component/user-action/index.mjs';
101
102
  export { View404 } from './view/404-view/404-view.mjs';
102
103
  export { LoginView } from './view/login-view/login-view.mjs';
103
104
  export { IBizWFStepTraceView } from './view/wf-step-trace-view/index.mjs';
@@ -0,0 +1,27 @@
1
+ import { PropType } from 'vue';
2
+ import { IPanelRawItem } from '@ibiz/model-core';
3
+ import { PanelItemController } from '@ibiz-template/runtime';
4
+ import './data-import-shell.scss';
5
+ export declare const DataImportShell: import("vue").DefineComponent<{
6
+ modelData: {
7
+ type: PropType<IPanelRawItem>;
8
+ required: true;
9
+ };
10
+ controller: {
11
+ type: typeof PanelItemController;
12
+ required: true;
13
+ };
14
+ }, {
15
+ ns: import("@ibiz-template/core").Namespace;
16
+ c: PanelItemController<import("@ibiz/model-core").IPanelItem>;
17
+ onDismiss: () => void;
18
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
+ modelData: {
20
+ type: PropType<IPanelRawItem>;
21
+ required: true;
22
+ };
23
+ controller: {
24
+ type: typeof PanelItemController;
25
+ required: true;
26
+ };
27
+ }>>, {}, {}>;
@@ -0,0 +1,49 @@
1
+ import { resolveComponent, h, defineComponent } from 'vue';
2
+ import { useNamespace } from '@ibiz-template/vue3-util';
3
+ import { PanelItemController } from '@ibiz-template/runtime';
4
+ import './data-import-shell.css';
5
+
6
+ "use strict";
7
+ const DataImportShell = /* @__PURE__ */ defineComponent({
8
+ name: "IBizDataImportShell",
9
+ props: {
10
+ modelData: {
11
+ type: Object,
12
+ required: true
13
+ },
14
+ controller: {
15
+ type: PanelItemController,
16
+ required: true
17
+ }
18
+ },
19
+ setup(prop) {
20
+ const ns = useNamespace("data-import-shell");
21
+ const c = prop.controller;
22
+ const onDismiss = () => {
23
+ c.panel.view.closeView();
24
+ };
25
+ return {
26
+ ns,
27
+ c,
28
+ onDismiss
29
+ };
30
+ },
31
+ render() {
32
+ const {
33
+ deDataImport,
34
+ appDataEntity
35
+ } = this.c.panel.view.state;
36
+ const classNames = [this.ns.b(), this.ns.m(this.modelData.id), ...this.controller.containerClass];
37
+ const importComponentName = deDataImport.enableCustomized ? "DataImport2" : "DataImport";
38
+ return h(resolveComponent(importComponentName), {
39
+ dismiss: this.onDismiss,
40
+ dataImport: deDataImport,
41
+ appDataEntity,
42
+ context: this.c.panel.context,
43
+ params: this.c.panel.params,
44
+ class: classNames
45
+ });
46
+ }
47
+ });
48
+
49
+ export { DataImportShell };
@@ -0,0 +1,15 @@
1
+ import { IPanelItemProvider, PanelController, PanelItemController } from '@ibiz-template/runtime';
2
+ import { IPanelItem } from '@ibiz/model-core';
3
+ /**
4
+ * 用户信息适配器
5
+ *
6
+ * @author lxm
7
+ * @date 2022-09-19 22:09:03
8
+ * @export
9
+ * @class DataImportProvider
10
+ * @implements {EditorProvider}
11
+ */
12
+ export declare class DataImportProvider implements IPanelItemProvider {
13
+ component: string;
14
+ createController(panelItem: IPanelItem, panel: PanelController, parent: PanelItemController | undefined): Promise<PanelItemController>;
15
+ }
@@ -0,0 +1,21 @@
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 DataImportProvider {
11
+ constructor() {
12
+ __publicField(this, "component", "IBizDataImportShell");
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 { DataImportProvider };
@@ -0,0 +1,24 @@
1
+ export declare const IBizDataImport: import("@ibiz-template/vue3-util").TypeWithInstall<import("vue").DefineComponent<{
2
+ modelData: {
3
+ type: import("vue").PropType<import("@ibiz/model-core").IPanelRawItem>;
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
+ c: import("@ibiz-template/runtime").PanelItemController<import("@ibiz/model-core").IPanelItem>;
13
+ onDismiss: () => void;
14
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
+ modelData: {
16
+ type: import("vue").PropType<import("@ibiz/model-core").IPanelRawItem>;
17
+ required: true;
18
+ };
19
+ controller: {
20
+ type: typeof import("@ibiz-template/runtime").PanelItemController;
21
+ required: true;
22
+ };
23
+ }>>, {}, {}>>;
24
+ export default IBizDataImport;
@@ -0,0 +1,15 @@
1
+ import { registerPanelItemProvider } from '@ibiz-template/runtime';
2
+ import { withInstall } from '@ibiz-template/vue3-util';
3
+ import { DataImportShell } from './data-import-shell.mjs';
4
+ import { DataImportProvider } from './data-import.provider.mjs';
5
+
6
+ "use strict";
7
+ const IBizDataImport = withInstall(DataImportShell, function(v) {
8
+ v.component(DataImportShell.name, DataImportShell);
9
+ registerPanelItemProvider(
10
+ "RAWITEM_DATA_IMPORT",
11
+ () => new DataImportProvider()
12
+ );
13
+ });
14
+
15
+ export { IBizDataImport, IBizDataImport as default };
@@ -7,6 +7,7 @@ export * from './panel-tab-panel';
7
7
  export * from './split-container';
8
8
  export * from './panel-index-view-search';
9
9
  export * from './index-actions';
10
+ export * from './user-action';
10
11
  export declare const IBizPanelComponents: {
11
12
  install: (v: App) => void;
12
13
  };
@@ -20,6 +20,8 @@ import { IBizViewMessage } from './view-message/index.mjs';
20
20
  import { IBizPanelStaticCarousel } from './panel-static-carousel/index.mjs';
21
21
  import { IBizCoopPos } from './coop-pos/index.mjs';
22
22
  import { IBizViewMsgPos } from './view-msg-pos/index.mjs';
23
+ import { IBizUserAction } from './user-action/index.mjs';
24
+ import { IBizDataImport } from './data-import/index.mjs';
23
25
  export { NavPosIndexState } from './nav-pos-index/nav-pos-index.state.mjs';
24
26
  export { NavPosIndexController } from './nav-pos-index/nav-pos-index.controller.mjs';
25
27
  export { PanelButtonController } from './panel-button/panel-button.controller.mjs';
@@ -65,7 +67,9 @@ const IBizPanelComponents = {
65
67
  v.use(IBizPanelContainerTabs);
66
68
  v.use(IBizCoopPos);
67
69
  v.use(IBizViewMsgPos);
70
+ v.use(IBizUserAction);
71
+ v.use(IBizDataImport);
68
72
  }
69
73
  };
70
74
 
71
- export { IBizAuthUserinfo, IBizIndexActions, IBizNavPosIndex, IBizPanelAppTitle, IBizPanelButton, IBizPanelComponents, IBizPanelIndexViewSearch, IBizPanelTabPanel, IBizSplitContainer, IBizPanelComponents as default };
75
+ export { IBizAuthUserinfo, IBizIndexActions, IBizNavPosIndex, IBizPanelAppTitle, IBizPanelButton, IBizPanelComponents, IBizPanelIndexViewSearch, IBizPanelTabPanel, IBizSplitContainer, IBizUserAction, IBizPanelComponents as default };
@@ -91,7 +91,6 @@ const PanelIndexViewSearch = /* @__PURE__ */ defineComponent({
91
91
  "class": this.ns.b("search"),
92
92
  "placeholder": ibiz.i18n.t("component.indexSearch.placeholder"),
93
93
  "onInput": this.onInput,
94
- "onChange": this.onSearch,
95
94
  "onKeyup": this.onEnter
96
95
  }, {
97
96
  prefix: () => {
@@ -0,0 +1,25 @@
1
+ export declare const IBizUserAction: import("@ibiz-template/vue3-util").TypeWithInstall<import("vue").DefineComponent<{
2
+ modelData: {
3
+ type: import("vue").PropType<import("@ibiz/model-core").IPanelRawItem>;
4
+ required: true;
5
+ };
6
+ controller: {
7
+ type: import("vue").PropType<import("@ibiz-template/runtime").PanelItemController<import("@ibiz/model-core").IPanelItem>>;
8
+ required: true;
9
+ };
10
+ }, {
11
+ ns: import("@ibiz-template/core").Namespace;
12
+ c: import("@ibiz-template/runtime").PanelItemController<import("@ibiz/model-core").IPanelItem>;
13
+ sysImage: import("@ibiz/model-core").ISysImage | undefined;
14
+ onClick: () => Promise<void>;
15
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
+ modelData: {
17
+ type: import("vue").PropType<import("@ibiz/model-core").IPanelRawItem>;
18
+ required: true;
19
+ };
20
+ controller: {
21
+ type: import("vue").PropType<import("@ibiz-template/runtime").PanelItemController<import("@ibiz/model-core").IPanelItem>>;
22
+ required: true;
23
+ };
24
+ }>>, {}, {}>>;
25
+ export default IBizUserAction;
@@ -0,0 +1,14 @@
1
+ import { withInstall } from '@ibiz-template/vue3-util';
2
+ import { registerPanelItemProvider } from '@ibiz-template/runtime';
3
+ import { UserAction } from './user-action.mjs';
4
+ import { UserActionProvider } from './user-action-provider.mjs';
5
+
6
+ "use strict";
7
+ const IBizUserAction = withInstall(UserAction, function(v) {
8
+ v.component(UserAction.name, UserAction);
9
+ registerPanelItemProvider("RAWITEM_SETTING", () => new UserActionProvider());
10
+ registerPanelItemProvider("RAWITEM_HELPER", () => new UserActionProvider());
11
+ registerPanelItemProvider("RAWITEM_CUSTOM", () => new UserActionProvider());
12
+ });
13
+
14
+ export { IBizUserAction, IBizUserAction as default };
@@ -0,0 +1,6 @@
1
+ import { IPanelItemProvider, PanelController, PanelItemController } from '@ibiz-template/runtime';
2
+ import { IPanelItem } from '@ibiz/model-core';
3
+ export declare class UserActionProvider implements IPanelItemProvider {
4
+ component: string;
5
+ createController(panelItem: IPanelItem, panel: PanelController, parent: PanelItemController | undefined): Promise<PanelItemController>;
6
+ }
@@ -0,0 +1,21 @@
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 UserActionProvider {
11
+ constructor() {
12
+ __publicField(this, "component", "IBizUserAction");
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 { UserActionProvider };
@@ -0,0 +1 @@
1
+ .ibiz-user-action{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ibiz-user-action__image{display:flex;place-items:center center;justify-content:center;width:28px;height:28px;margin-bottom:6px;cursor:pointer}
@@ -0,0 +1,28 @@
1
+ import { PropType } from 'vue';
2
+ import { PanelItemController } from '@ibiz-template/runtime';
3
+ import { IPanelRawItem } from '@ibiz/model-core';
4
+ import './user-action.scss';
5
+ export declare const UserAction: import("vue").DefineComponent<{
6
+ modelData: {
7
+ type: PropType<IPanelRawItem>;
8
+ required: true;
9
+ };
10
+ controller: {
11
+ type: PropType<PanelItemController<import("@ibiz/model-core").IPanelItem>>;
12
+ required: true;
13
+ };
14
+ }, {
15
+ ns: import("@ibiz-template/core").Namespace;
16
+ c: PanelItemController<import("@ibiz/model-core").IPanelItem>;
17
+ sysImage: import("@ibiz/model-core").ISysImage | undefined;
18
+ onClick: () => Promise<void>;
19
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
20
+ modelData: {
21
+ type: PropType<IPanelRawItem>;
22
+ required: true;
23
+ };
24
+ controller: {
25
+ type: PropType<PanelItemController<import("@ibiz/model-core").IPanelItem>>;
26
+ required: true;
27
+ };
28
+ }>>, {}, {}>;
@@ -0,0 +1,74 @@
1
+ import { resolveComponent, createVNode, defineComponent } from 'vue';
2
+ import { useNamespace } from '@ibiz-template/vue3-util';
3
+ import { AppFuncCommand } from '@ibiz-template/runtime';
4
+ import './user-action.css';
5
+
6
+ "use strict";
7
+ const UserAction = /* @__PURE__ */ defineComponent({
8
+ name: "IBizUserAction",
9
+ props: {
10
+ modelData: {
11
+ type: Object,
12
+ required: true
13
+ },
14
+ controller: {
15
+ type: Object,
16
+ required: true
17
+ }
18
+ },
19
+ setup(props) {
20
+ const ns = useNamespace("user-action");
21
+ const c = props.controller;
22
+ const imgConfig = {
23
+ SETTING: {
24
+ imagePath: "svg/setting.svg"
25
+ },
26
+ HELPER: {
27
+ imagePath: "svg/helper.svg"
28
+ },
29
+ CUSTOM: {
30
+ imagePath: "svg/custom-workbench.svg"
31
+ }
32
+ };
33
+ let sysImage = props.modelData.sysImage;
34
+ if (!sysImage && props.modelData && props.modelData.rawItem) {
35
+ const predefinedType = props.modelData.rawItem.predefinedType;
36
+ if (predefinedType) {
37
+ sysImage = imgConfig[predefinedType];
38
+ }
39
+ }
40
+ const onClick = async () => {
41
+ const id = props.modelData.id;
42
+ const menuC = c.panel.view.getController("appmenu");
43
+ if (menuC) {
44
+ const targetMenu = menuC.allAppMenuItems.find((item) => {
45
+ return item.id === id;
46
+ });
47
+ if (targetMenu) {
48
+ const tempContext = c.panel.context.clone();
49
+ const tempParam = c.panel.params;
50
+ tempContext.srfappid = targetMenu.appId || ibiz.env.appId;
51
+ await ibiz.commands.execute(AppFuncCommand.TAG, targetMenu.appFuncId, tempContext, tempParam, {});
52
+ }
53
+ }
54
+ };
55
+ return {
56
+ ns,
57
+ c,
58
+ sysImage,
59
+ onClick
60
+ };
61
+ },
62
+ render() {
63
+ return createVNode("div", {
64
+ "class": this.ns.b(),
65
+ "onClick": this.onClick,
66
+ "title": this.modelData.caption
67
+ }, [createVNode(resolveComponent("i-biz-icon"), {
68
+ "class": [this.ns.e("image")],
69
+ "icon": this.sysImage
70
+ }, null)]);
71
+ }
72
+ });
73
+
74
+ export { UserAction };
@@ -0,0 +1,13 @@
1
+ import { IAppDataUploadViewState, IViewEvent, ViewController, ViewEngineBase } from '@ibiz-template/runtime';
2
+ import { IAppView } from '@ibiz/model-core';
3
+ /**
4
+ * 应用数据上传视图引擎
5
+ * @author lxm
6
+ * @date 2024-04-15 04:03:03
7
+ * @export
8
+ * @class AppDataUploadViewEngine
9
+ * @extends {ViewEngineBase}
10
+ */
11
+ export declare class AppDataUploadViewEngine extends ViewEngineBase {
12
+ protected view: ViewController<IAppView, IAppDataUploadViewState, IViewEvent>;
13
+ }
@@ -0,0 +1,7 @@
1
+ import { ViewEngineBase } from '@ibiz-template/runtime';
2
+
3
+ "use strict";
4
+ class AppDataUploadViewEngine extends ViewEngineBase {
5
+ }
6
+
7
+ export { AppDataUploadViewEngine };
@@ -1,4 +1,4 @@
1
- import { ViewEngineBase, ViewCallTag } from '@ibiz-template/runtime';
1
+ import { ViewEngineBase, OpenAppViewCommand, ViewCallTag } from '@ibiz-template/runtime';
2
2
 
3
3
  "use strict";
4
4
  class IndexViewEngine extends ViewEngineBase {
@@ -30,6 +30,18 @@ class IndexViewEngine extends ViewEngineBase {
30
30
  }
31
31
  async onMounted() {
32
32
  await super.onMounted();
33
+ if (!this.isExistAndInLayout("appmenu")) {
34
+ const { model, context, params } = this.view;
35
+ const { defAppViewId } = model;
36
+ if (defAppViewId) {
37
+ ibiz.commands.execute(
38
+ OpenAppViewCommand.TAG,
39
+ defAppViewId,
40
+ context,
41
+ params
42
+ );
43
+ }
44
+ }
33
45
  if (window.innerWidth <= 1200) {
34
46
  this.toggleCollapse();
35
47
  }
@@ -44,6 +44,7 @@ import { GanttViewEngine } from './gantt-view.engine.mjs';
44
44
  import { DEIndexViewEngine } from './de-index-view-engine.mjs';
45
45
  import { SubAppRefViewEngine } from './sub-app-ref-view.engine.mjs';
46
46
  import { TabSearchViewEngine } from './tab-search-view.engine.mjs';
47
+ import { AppDataUploadViewEngine } from './app-data-upload-view.engine.mjs';
47
48
 
48
49
  "use strict";
49
50
  const IBizViewEngine = {
@@ -236,6 +237,10 @@ const IBizViewEngine = {
236
237
  "VIEW_DESUBAPPREFVIEW",
237
238
  (c) => new SubAppRefViewEngine(c)
238
239
  );
240
+ ibiz.engine.register(
241
+ "VIEW_APPDATAUPLOADVIEW",
242
+ (c) => new AppDataUploadViewEngine(c)
243
+ );
239
244
  ibiz.engine.register(
240
245
  "VIEW_GridView9",
241
246
  (c) => new GridViewEngine(c)
@@ -35,7 +35,6 @@ const DataImport = /* @__PURE__ */ vue.defineComponent({
35
35
  },
36
36
  setup(props) {
37
37
  const ns = vue3Util.useNamespace("data-import");
38
- const inputUpLoad = vue.ref();
39
38
  const message = vue.ref({
40
39
  state: "ready",
41
40
  message: ""
@@ -45,86 +44,50 @@ const DataImport = /* @__PURE__ */ vue.defineComponent({
45
44
  const onCancelButtonClick = () => {
46
45
  props.dismiss();
47
46
  };
48
- const onFileChange = async ($event) => {
49
- const obj = $event.target;
50
- if (!obj.files) {
47
+ const onLinkClick = async () => {
48
+ runtime.downloadImportTemplate(props.appDataEntity, props.dataImport);
49
+ };
50
+ const selectFile = async () => {
51
+ isLoading.value = true;
52
+ const result = await runtime.selectAndImport({
53
+ appDataEntity: props.appDataEntity,
54
+ dataImport: props.dataImport,
55
+ context: props.context
56
+ });
57
+ if (result.cancel) {
58
+ isLoading.value = false;
51
59
  return;
52
60
  }
53
- errorMessage.value = "";
54
- const selectedFile = obj.files[0];
55
- obj.value = null;
56
- let result;
57
- isLoading.value = true;
58
- try {
59
- if (ibiz.env.enableMqtt) {
60
- runtime.asyncImportData(selectedFile, props.appDataEntity, props.dataImport, props.context);
61
- ibiz.notification.info({
62
- desc: ibiz.i18n.t("component.dataImport.startImport")
61
+ if (!result.isAsync) {
62
+ if (result.errorMessage) {
63
+ errorMessage.value = result.errorMessage;
64
+ } else {
65
+ const {
66
+ success,
67
+ total,
68
+ message: _message
69
+ } = result;
70
+ const totalNum = total ? Number(total) : 0;
71
+ const successNum = success ? Number(success) : 0;
72
+ const errorNum = total - success;
73
+ message.value.state = _message ? "error" : "over";
74
+ message.value.message = _message || ibiz.i18n.t("component.dataImport.importSuccess", {
75
+ totalNum,
76
+ successNum,
77
+ errorNum
63
78
  });
64
- onCancelButtonClick();
65
- return;
66
- }
67
- result = await runtime.importData(selectedFile, props.appDataEntity, props.dataImport, props.context);
68
- ibiz.mc.command.send({
69
- srfdecodename: props.appDataEntity.codeName
70
- }, "OBJECTCREATED", "DATAIMPORT");
71
- const {
72
- success,
73
- total,
74
- message: _message
75
- } = result;
76
- const totalNum = total ? Number(total) : 0;
77
- const successNum = success ? Number(success) : 0;
78
- const errorNum = total - success;
79
- message.value.state = _message ? "error" : "over";
80
- message.value.message = _message || ibiz.i18n.t("component.dataImport.importSuccess", {
81
- totalNum,
82
- successNum,
83
- errorNum
84
- });
85
- } catch (error) {
86
- if (error instanceof Error) {
87
- errorMessage.value = error.message;
88
79
  }
89
- } finally {
90
- isLoading.value = false;
91
80
  }
92
- };
93
- const onLinkClick = async () => {
94
- var _a, _b;
95
- let templateUrl = "".concat(props.appDataEntity.codeName2.toLowerCase(), "/importtemplate");
96
- if ((_a = props.dataImport) == null ? void 0 : _a.codeName) {
97
- templateUrl += "?srfimporttag=".concat(props.dataImport.codeName);
81
+ isLoading.value = false;
82
+ if (result.isAsync) {
83
+ onCancelButtonClick();
98
84
  }
99
- const res = await ibiz.net.request(templateUrl, {
100
- responseType: "blob"
101
- });
102
- if (res.status === 200) {
103
- let fileName = ((_b = res.headers["content-disposition"].split(";").find((str) => str.indexOf("filename=") !== -1)) == null ? void 0 : _b.slice(9)) || "";
104
- fileName = decodeURIComponent(fileName);
105
- const blob = new Blob([res.data], {
106
- type: "application/vnd.ms-excel"
107
- });
108
- const elink = document.createElement("a");
109
- elink.download = fileName;
110
- elink.style.display = "none";
111
- elink.href = URL.createObjectURL(blob);
112
- document.body.appendChild(elink);
113
- elink.click();
114
- URL.revokeObjectURL(elink.href);
115
- document.body.removeChild(elink);
116
- }
117
- };
118
- const selectFile = () => {
119
- inputUpLoad.value.click();
120
85
  };
121
86
  return {
122
87
  ns,
123
88
  onLinkClick,
124
89
  selectFile,
125
90
  onCancelButtonClick,
126
- onFileChange,
127
- inputUpLoad,
128
91
  isLoading,
129
92
  message,
130
93
  errorMessage
@@ -134,13 +97,7 @@ const DataImport = /* @__PURE__ */ vue.defineComponent({
134
97
  let _slot, _slot2;
135
98
  return vue.withDirectives(vue.createVNode("div", {
136
99
  "class": this.ns.b()
137
- }, [vue.createVNode("input", {
138
- "ref": "inputUpLoad",
139
- "type": "file",
140
- "style": "display: none",
141
- "accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
142
- "onChange": this.onFileChange
143
- }, null), vue.createVNode("div", {
100
+ }, [vue.createVNode("div", {
144
101
  "class": this.ns.e("caption")
145
102
  }, [ibiz.i18n.t("component.dataImport.importData")]), this.message.state === "ready" ? vue.createVNode("div", {
146
103
  "class": this.ns.b("upload"),
@@ -43,16 +43,11 @@ const FormControl = /* @__PURE__ */ vue.defineComponent({
43
43
  return;
44
44
  }
45
45
  const detailId = detail.id;
46
- const detailProps = {
47
- modelData: detail,
48
- controller: c.details[detailId],
49
- key: detail.id,
50
- attrs: renderAttrs(detail)
51
- };
52
46
  if (slots[detailId]) {
53
47
  return vue.renderSlot(slots, detailId, {
54
- ...slotProps,
55
- ...detailProps
48
+ model: detail,
49
+ data: c.state.data,
50
+ value: c.state.data[detailId]
56
51
  });
57
52
  }
58
53
  const childSlots = {};
@@ -75,7 +70,10 @@ const FormControl = /* @__PURE__ */ vue.defineComponent({
75
70
  }
76
71
  const component = vue.resolveComponent(provider.component);
77
72
  return vue.h(component, {
78
- ...detailProps
73
+ modelData: detail,
74
+ controller: c.details[detailId],
75
+ key: detail.id,
76
+ attrs: renderAttrs(detail)
79
77
  }, childSlots);
80
78
  };
81
79
  const FormDetail = (_props) => {