@ibiz-template/vue3-components 0.7.12 → 0.7.13-alpha.0

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 (28) hide show
  1. package/dist/{index-3xonNDdv.js → index-Ky5xo5V5.js} +3 -3
  2. package/dist/index.min.css +1 -1
  3. package/dist/index.system.min.js +1 -1
  4. package/dist/{xlsx-util-Zf9d2PeX.js → xlsx-util-OSsMvylt.js} +1 -1
  5. package/es/control/context-menu/context-menu.d.ts +1 -0
  6. package/es/control/context-menu/context-menu.mjs +8 -0
  7. package/es/control/context-menu/index.d.ts +1 -0
  8. package/es/control/toolbar/export-excel/export-excel.css +1 -1
  9. package/es/panel-component/auth-captcha/auth-captcha.controller.d.ts +20 -0
  10. package/es/panel-component/auth-captcha/auth-captcha.controller.mjs +70 -16
  11. package/es/panel-component/auth-captcha/auth-captcha.css +1 -1
  12. package/es/panel-component/auth-captcha/auth-captcha.d.ts +1 -0
  13. package/es/panel-component/auth-captcha/auth-captcha.mjs +12 -3
  14. package/es/panel-component/auth-captcha/auth-captcha.state.d.ts +7 -0
  15. package/es/panel-component/auth-captcha/auth-captcha.state.mjs +7 -0
  16. package/es/panel-component/auth-captcha/index.d.ts +1 -0
  17. package/es/panel-component/panel-button/panel-button.controller.mjs +7 -1
  18. package/es/view-engine/login-view.engine.d.ts +3 -1
  19. package/es/view-engine/login-view.engine.mjs +4 -3
  20. package/lib/control/context-menu/context-menu.cjs +8 -0
  21. package/lib/control/toolbar/export-excel/export-excel.css +1 -1
  22. package/lib/panel-component/auth-captcha/auth-captcha.cjs +12 -3
  23. package/lib/panel-component/auth-captcha/auth-captcha.controller.cjs +70 -16
  24. package/lib/panel-component/auth-captcha/auth-captcha.css +1 -1
  25. package/lib/panel-component/auth-captcha/auth-captcha.state.cjs +7 -0
  26. package/lib/panel-component/panel-button/panel-button.controller.cjs +7 -1
  27. package/lib/view-engine/login-view.engine.cjs +4 -3
  28. package/package.json +4 -4
@@ -37,6 +37,7 @@ export declare const ContextMenuControl: import("vue").DefineComponent<{
37
37
  expandDetails: Ref<IDETBUIActionItem[]>;
38
38
  groupDetails: Ref<IDETBUIActionItem[]>;
39
39
  groupButtonRef: Ref<any>;
40
+ dropdownRef: Ref<any>;
40
41
  popoverVisible: Ref<boolean>;
41
42
  handleClick: (detail: IDETBUIActionItem, e: MouseEvent) => Promise<void>;
42
43
  calcActionItemClass: (item: IDETBUIActionItem) => string[];
@@ -53,6 +53,7 @@ const ContextMenuControl = /* @__PURE__ */ defineComponent({
53
53
  const expandDetails = ref([]);
54
54
  const groupDetails = ref([]);
55
55
  const groupButtonRef = ref();
56
+ const dropdownRef = ref();
56
57
  const popoverVisible = ref(false);
57
58
  if (actionDetails) {
58
59
  actionDetails == null ? void 0 : actionDetails.forEach((detail) => {
@@ -86,6 +87,11 @@ const ContextMenuControl = /* @__PURE__ */ defineComponent({
86
87
  await c.calcButtonState(props.nodeData._deData || (props.nodeData.srfkey ? props.nodeData : void 0), props.nodeModel.appDataEntityId);
87
88
  });
88
89
  const handleClick = async (detail, e) => {
90
+ if (props.mode === "buttons") {
91
+ popoverVisible.value = false;
92
+ } else if (dropdownRef.value) {
93
+ dropdownRef.value.handleClose();
94
+ }
89
95
  e.stopPropagation();
90
96
  emit("action-click", detail, e);
91
97
  };
@@ -95,6 +101,7 @@ const ContextMenuControl = /* @__PURE__ */ defineComponent({
95
101
  expandDetails,
96
102
  groupDetails,
97
103
  groupButtonRef,
104
+ dropdownRef,
98
105
  popoverVisible,
99
106
  handleClick,
100
107
  calcActionItemClass,
@@ -164,6 +171,7 @@ const ContextMenuControl = /* @__PURE__ */ defineComponent({
164
171
  })]]);
165
172
  }
166
173
  return createVNode(resolveComponent("el-dropdown"), {
174
+ "ref": "dropdownRef",
167
175
  "onCommand": (command) => this.handleClick(command, new MouseEvent("click")),
168
176
  "class": [this.ns.b(), this.ns.m("dropdown")]
169
177
  }, {
@@ -33,6 +33,7 @@ export declare const IBizContextMenuControl: import("@ibiz-template/vue3-util").
33
33
  expandDetails: import("vue").Ref<import("@ibiz/model-core").IDETBUIActionItem[]>;
34
34
  groupDetails: import("vue").Ref<import("@ibiz/model-core").IDETBUIActionItem[]>;
35
35
  groupButtonRef: import("vue").Ref<any>;
36
+ dropdownRef: import("vue").Ref<any>;
36
37
  popoverVisible: import("vue").Ref<boolean>;
37
38
  handleClick: (detail: import("@ibiz/model-core").IDETBUIActionItem, e: MouseEvent) => Promise<void>;
38
39
  calcActionItemClass: (item: import("@ibiz/model-core").IDETBUIActionItem) => string[];
@@ -1 +1 @@
1
- .ibiz-export-excel{width:270px}.ibiz-export-excel__custom{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__custom>*+*{margin-left:10px}.ibiz-export-excel__custom.el-dropdown-menu__item:focus{color:var(--el-text-color-regular);background-color:transparent}.ibiz-export-excel__custom .el-input{--el-input-text-color:var(--ibiz-color-white)}.ibiz-export-excel__button{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-base)}.ibiz-export-excel__button>span{display:flex;align-items:center;justify-content:center;font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-export-excel-submenu-button{justify-content:flex-start;width:100%;height:36px;padding:0 10px;border-radius:0}.ibiz-export-excel-submenu-button>span{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title{padding:0}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu.hover{color:var(--ibiz-color-primary-hover-text);background-color:var(--ibiz-color-primary-hover)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .ibiz-export-excel-submenu-popper{width:270px;color:var(--ibiz-color-primary-text);background-color:var(--ibiz-color-primary)}
1
+ .ibiz-export-excel{width:270px}.ibiz-export-excel__custom{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__custom>*+*{margin-left:10px}.ibiz-export-excel__custom.el-dropdown-menu__item:focus{color:var(--el-text-color-regular);background-color:transparent}.ibiz-export-excel__custom .el-input{--el-input-text-color:var(--ibiz-color-white)}.ibiz-export-excel__button{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-base)}.ibiz-export-excel__button>span{display:flex;align-items:center;justify-content:center;font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-export-excel-submenu-button{justify-content:flex-start;width:100%;height:36px;padding:0 10px;border-radius:0}.ibiz-export-excel-submenu-button>span{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title{padding:0}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu.hover{color:var(--ibiz-color-primary-hover-text);background-color:var(--ibiz-color-primary-hover)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .ibiz-export-excel-submenu-popper{width:270px;color:var(--ibiz-color-primary-text);background-color:var(--ibiz-color-primary)}
@@ -10,6 +10,13 @@ import { AuthCaptchaState } from './auth-captcha.state';
10
10
  */
11
11
  export declare class AuthCaptchaController extends PanelItemController<IPanelRawItem> {
12
12
  state: AuthCaptchaState;
13
+ /**
14
+ * 验证码数据
15
+ *
16
+ * @private
17
+ * @memberof AuthCaptchaController
18
+ */
19
+ private captcha;
13
20
  protected createState(): AuthCaptchaState;
14
21
  /**
15
22
  * 面板状态变更通知
@@ -27,6 +34,19 @@ export declare class AuthCaptchaController extends PanelItemController<IPanelRaw
27
34
  * @memberof AuthCaptchaController
28
35
  */
29
36
  protected onInit(): Promise<void>;
37
+ /**
38
+ * 值校验
39
+ *
40
+ * @return {*} {Promise<boolean>}
41
+ * @memberof AuthCaptchaController
42
+ */
43
+ validate(): Promise<boolean>;
44
+ /**
45
+ * 值改变
46
+ *
47
+ * @memberof AuthCaptchaController
48
+ */
49
+ onChange(): void;
30
50
  /**
31
51
  * 加载验证码
32
52
  *
@@ -1,9 +1,29 @@
1
+ import { reactive } from 'vue';
1
2
  import { PanelItemController } from '@ibiz-template/runtime';
2
3
  import axios from 'axios';
3
4
  import { AuthCaptchaState } from './auth-captcha.state.mjs';
4
5
 
5
6
  "use strict";
7
+ var __defProp = Object.defineProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __publicField = (obj, key, value) => {
10
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
+ return value;
12
+ };
6
13
  class AuthCaptchaController extends PanelItemController {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ * 验证码数据
18
+ *
19
+ * @private
20
+ * @memberof AuthCaptchaController
21
+ */
22
+ __publicField(this, "captcha", reactive({
23
+ "Captcha-State": "",
24
+ "Captcha-Code": ""
25
+ }));
26
+ }
7
27
  createState() {
8
28
  var _a;
9
29
  return new AuthCaptchaState((_a = this.parent) == null ? void 0 : _a.state);
@@ -17,17 +37,7 @@ class AuthCaptchaController extends PanelItemController {
17
37
  */
18
38
  async panelStateNotify(_state) {
19
39
  super.panelStateNotify(_state);
20
- const that = this;
21
- Object.defineProperty(that.panel.state.data, "captcha", {
22
- enumerable: true,
23
- configurable: true,
24
- get() {
25
- return {
26
- captcha_state: that.state.state,
27
- captcha_code: that.state.code
28
- };
29
- }
30
- });
40
+ this.data.captcha = this.captcha;
31
41
  }
32
42
  /**
33
43
  * 初始化
@@ -39,6 +49,43 @@ class AuthCaptchaController extends PanelItemController {
39
49
  async onInit() {
40
50
  super.onInit();
41
51
  await this.loadCaptcha();
52
+ const view = this.panel.view;
53
+ view.hooks.beforeLogin.tapPromise(async (context) => {
54
+ if (!context.parentId || context.parentId === this.dataParent.model.id) {
55
+ context.validate = context.validate && await this.validate();
56
+ }
57
+ });
58
+ view.hooks.afterLogin.tap((context) => {
59
+ if (!context.ok) {
60
+ this.loadCaptcha();
61
+ this.state.code = "";
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * 值校验
67
+ *
68
+ * @return {*} {Promise<boolean>}
69
+ * @memberof AuthCaptchaController
70
+ */
71
+ async validate() {
72
+ if (this.state.code) {
73
+ this.state.error = void 0;
74
+ return true;
75
+ }
76
+ this.state.error = "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801";
77
+ return false;
78
+ }
79
+ /**
80
+ * 值改变
81
+ *
82
+ * @memberof AuthCaptchaController
83
+ */
84
+ onChange() {
85
+ Object.assign(this.captcha, {
86
+ "Captcha-State": this.state.state,
87
+ "Captcha-Code": this.state.code
88
+ });
42
89
  }
43
90
  /**
44
91
  * 加载验证码
@@ -57,12 +104,19 @@ class AuthCaptchaController extends PanelItemController {
57
104
  },
58
105
  data: {}
59
106
  };
60
- const res = await axios(requestConfig);
61
- if (res.status === 200 && res.data) {
62
- this.state.state = res.data.state;
63
- this.state.image = res.data.image;
107
+ try {
108
+ const res = await axios(requestConfig);
109
+ if (res.status === 200 && res.data) {
110
+ this.state.state = res.data.state;
111
+ this.state.image = res.data.image;
112
+ }
113
+ } catch (error) {
114
+ this.state.state = "";
115
+ this.state.image = "";
116
+ } finally {
117
+ this.state.loading = false;
118
+ this.onChange();
64
119
  }
65
- this.state.loading = false;
66
120
  }
67
121
  }
68
122
 
@@ -1 +1 @@
1
- .ibiz-auth-captcha{display:flex}.ibiz-auth-captcha__captcha{width:calc(100% - 120px)}.ibiz-auth-captcha__image{flex-shrink:0;width:120px;height:100%;cursor:pointer}.ibiz-auth-captcha__image--hint{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
1
+ .ibiz-auth-captcha{display:flex;position:relative}.ibiz-auth-captcha__captcha{width:calc(100% - 120px)}.ibiz-auth-captcha__image{flex-shrink:0;width:120px;height:100%;cursor:pointer}.ibiz-auth-captcha__image--hint{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--ibiz-color-text-3);background-color:var(--ibiz-color-fill-0)}.ibiz-auth-captcha__error{left:0;top:100%;line-height:1;font-size:12px;padding-top:2px;position:absolute;color:var(--ibiz-color-danger)}.ibiz-auth-captcha.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--ibiz-color-danger) inset}
@@ -16,6 +16,7 @@ export declare const AuthCaptcha: import("vue").DefineComponent<{
16
16
  ns: import("@ibiz-template/core").Namespace;
17
17
  classArr: import("vue").ComputedRef<(string | false)[]>;
18
18
  onClick: () => void;
19
+ onChange: () => void;
19
20
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
20
21
  modelData: {
21
22
  type: PropType<IPanelRawItem>;
@@ -21,7 +21,7 @@ const AuthCaptcha = /* @__PURE__ */ defineComponent({
21
21
  const c = props.controller;
22
22
  const classArr = computed(() => {
23
23
  let result = [ns.b(), ns.m(c.model.id)];
24
- result = [...result, ...props.controller.containerClass, ns.is("hidden", !props.controller.state.visible)];
24
+ result = [...result, ...props.controller.containerClass, ns.is("hidden", !props.controller.state.visible), ns.is("error", !!c.state.error)];
25
25
  return result;
26
26
  });
27
27
  const onClick = () => {
@@ -29,11 +29,16 @@ const AuthCaptcha = /* @__PURE__ */ defineComponent({
29
29
  c.loadCaptcha();
30
30
  }
31
31
  };
32
+ const onChange = () => {
33
+ c.onChange();
34
+ c.validate();
35
+ };
32
36
  return {
33
37
  c,
34
38
  ns,
35
39
  classArr,
36
- onClick
40
+ onClick,
41
+ onChange
37
42
  };
38
43
  },
39
44
  render() {
@@ -43,6 +48,8 @@ const AuthCaptcha = /* @__PURE__ */ defineComponent({
43
48
  "modelValue": this.c.state.code,
44
49
  "onUpdate:modelValue": ($event) => this.c.state.code = $event,
45
50
  "class": this.ns.e("captcha"),
51
+ "onInput": this.onChange,
52
+ "onBlur": this.onChange,
46
53
  "placeholder": "\u9A8C\u8BC1\u7801"
47
54
  }, null), withDirectives(createVNode(resolveComponent("el-image"), {
48
55
  "src": this.c.state.image,
@@ -56,7 +63,9 @@ const AuthCaptcha = /* @__PURE__ */ defineComponent({
56
63
  "class": [this.ns.em("image", "hint"), this.ns.is("loading", this.c.state.loading)]
57
64
  }, [this.c.state.loading ? "\u52A0\u8F7D\u4E2D..." : "\u52A0\u8F7D\u5931\u8D25"]);
58
65
  }
59
- }), [[resolveDirective("loading"), this.c.state.loading]])]);
66
+ }), [[resolveDirective("loading"), this.c.state.loading]]), this.c.state.error && createVNode("div", {
67
+ "class": this.ns.e("error")
68
+ }, [this.c.state.error])]);
60
69
  }
61
70
  });
62
71
 
@@ -35,4 +35,11 @@ export declare class AuthCaptchaState extends PanelItemState {
35
35
  * @memberof AuthCaptchaState
36
36
  */
37
37
  loading: boolean;
38
+ /**
39
+ * 错误信息
40
+ *
41
+ * @type {string}
42
+ * @memberof AuthCaptchaState
43
+ */
44
+ error?: string;
38
45
  }
@@ -38,6 +38,13 @@ class AuthCaptchaState extends PanelItemState {
38
38
  * @memberof AuthCaptchaState
39
39
  */
40
40
  __publicField(this, "loading", false);
41
+ /**
42
+ * 错误信息
43
+ *
44
+ * @type {string}
45
+ * @memberof AuthCaptchaState
46
+ */
47
+ __publicField(this, "error");
41
48
  }
42
49
  }
43
50
 
@@ -12,6 +12,7 @@ export declare const IBizAuthCaptcha: import("@ibiz-template/vue3-util").TypeWit
12
12
  ns: import("@ibiz-template/core").Namespace;
13
13
  classArr: import("vue").ComputedRef<(string | false)[]>;
14
14
  onClick: () => void;
15
+ onChange: () => void;
15
16
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
17
  modelData: {
17
18
  type: import("vue").PropType<import("@ibiz/model-core").IPanelRawItem>;
@@ -99,13 +99,19 @@ class PanelButtonController extends PanelItemController {
99
99
  }
100
100
  event.stopPropagation();
101
101
  event.preventDefault();
102
+ const view = this.panel.view;
103
+ if (actionType === "UIACTION" && uiactionId === "login" && view.model.viewType === "APPLOGINVIEW" && !await view.validate(
104
+ this.dataParent.model.id
105
+ )) {
106
+ return;
107
+ }
102
108
  await UIActionUtil.execAndResolved(
103
109
  uiactionId,
104
110
  {
105
111
  context: this.panel.context,
106
112
  params: this.panel.params,
107
113
  data: [this.data],
108
- view: this.panel.view,
114
+ view,
109
115
  event,
110
116
  noWaitRoute: true
111
117
  },
@@ -1,7 +1,9 @@
1
- import { ViewController, ViewEngineBase } from '@ibiz-template/runtime';
1
+ import { ViewController, ViewEngineBase, AppLoginViewController, IViewState, IViewEvent } from '@ibiz-template/runtime';
2
2
  import { RouteLocationNormalizedLoaded } from 'vue-router';
3
+ import { IAppView } from '@ibiz/model-core';
3
4
  export declare class LoginViewEngine extends ViewEngineBase {
4
5
  route: RouteLocationNormalizedLoaded;
6
+ protected view: AppLoginViewController<IAppView, IViewState, IViewEvent>;
5
7
  get AppLoginView(): ViewController;
6
8
  onMounted(): Promise<void>;
7
9
  onDestroyed(): Promise<void>;
@@ -50,19 +50,19 @@ class LoginViewEngine extends ViewEngineBase {
50
50
  async login(args) {
51
51
  let rememberme;
52
52
  const headers = {};
53
+ const data = args.data[0] || {};
53
54
  if (this.AppLoginView.layoutPanel) {
54
55
  const panelData = this.AppLoginView.layoutPanel.data;
55
56
  if (typeof panelData.isRemember === "boolean") {
56
57
  rememberme = panelData.isRemember;
57
58
  }
58
- if (panelData.captcha) {
59
- Object.assign(headers, panelData.captcha);
59
+ if (data.captcha) {
60
+ Object.assign(headers, data.captcha);
60
61
  }
61
62
  if (panelData.srfheaders) {
62
63
  Object.assign(headers, panelData.srfheaders);
63
64
  }
64
65
  }
65
- const data = args.data[0] || {};
66
66
  let username = data.username;
67
67
  if (notNilEmpty(data.orgid)) {
68
68
  username = "".concat(data.username, "@").concat(data.orgid);
@@ -73,6 +73,7 @@ class LoginViewEngine extends ViewEngineBase {
73
73
  rememberme,
74
74
  headers
75
75
  );
76
+ this.view.hooks.afterLogin.call({ ok: bol });
76
77
  if (bol === true) {
77
78
  window.location.hash = this.route.query.ru || "/";
78
79
  window.location.reload();
@@ -55,6 +55,7 @@ const ContextMenuControl = /* @__PURE__ */ vue.defineComponent({
55
55
  const expandDetails = vue.ref([]);
56
56
  const groupDetails = vue.ref([]);
57
57
  const groupButtonRef = vue.ref();
58
+ const dropdownRef = vue.ref();
58
59
  const popoverVisible = vue.ref(false);
59
60
  if (actionDetails) {
60
61
  actionDetails == null ? void 0 : actionDetails.forEach((detail) => {
@@ -88,6 +89,11 @@ const ContextMenuControl = /* @__PURE__ */ vue.defineComponent({
88
89
  await c.calcButtonState(props.nodeData._deData || (props.nodeData.srfkey ? props.nodeData : void 0), props.nodeModel.appDataEntityId);
89
90
  });
90
91
  const handleClick = async (detail, e) => {
92
+ if (props.mode === "buttons") {
93
+ popoverVisible.value = false;
94
+ } else if (dropdownRef.value) {
95
+ dropdownRef.value.handleClose();
96
+ }
91
97
  e.stopPropagation();
92
98
  emit("action-click", detail, e);
93
99
  };
@@ -97,6 +103,7 @@ const ContextMenuControl = /* @__PURE__ */ vue.defineComponent({
97
103
  expandDetails,
98
104
  groupDetails,
99
105
  groupButtonRef,
106
+ dropdownRef,
100
107
  popoverVisible,
101
108
  handleClick,
102
109
  calcActionItemClass,
@@ -166,6 +173,7 @@ const ContextMenuControl = /* @__PURE__ */ vue.defineComponent({
166
173
  })]]);
167
174
  }
168
175
  return vue.createVNode(vue.resolveComponent("el-dropdown"), {
176
+ "ref": "dropdownRef",
169
177
  "onCommand": (command) => this.handleClick(command, new MouseEvent("click")),
170
178
  "class": [this.ns.b(), this.ns.m("dropdown")]
171
179
  }, {
@@ -1 +1 @@
1
- .ibiz-export-excel{width:270px}.ibiz-export-excel__custom{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__custom>*+*{margin-left:10px}.ibiz-export-excel__custom.el-dropdown-menu__item:focus{color:var(--el-text-color-regular);background-color:transparent}.ibiz-export-excel__custom .el-input{--el-input-text-color:var(--ibiz-color-white)}.ibiz-export-excel__button{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-base)}.ibiz-export-excel__button>span{display:flex;align-items:center;justify-content:center;font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-export-excel-submenu-button{justify-content:flex-start;width:100%;height:36px;padding:0 10px;border-radius:0}.ibiz-export-excel-submenu-button>span{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title{padding:0}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu.hover{color:var(--ibiz-color-primary-hover-text);background-color:var(--ibiz-color-primary-hover)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .ibiz-export-excel-submenu-popper{width:270px;color:var(--ibiz-color-primary-text);background-color:var(--ibiz-color-primary)}
1
+ .ibiz-export-excel{width:270px}.ibiz-export-excel__custom{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__custom>*+*{margin-left:10px}.ibiz-export-excel__custom.el-dropdown-menu__item:focus{color:var(--el-text-color-regular);background-color:transparent}.ibiz-export-excel__custom .el-input{--el-input-text-color:var(--ibiz-color-white)}.ibiz-export-excel__button{display:flex;align-items:center;justify-content:center;padding:var(--ibiz-spacing-tight) var(--ibiz-spacing-base)}.ibiz-export-excel__button>span{display:flex;align-items:center;justify-content:center;font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel__button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-export-excel-submenu-button{justify-content:flex-start;width:100%;height:36px;padding:0 10px;border-radius:0}.ibiz-export-excel-submenu-button>span{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon{display:flex;align-items:center;justify-content:center;width:var(--ibiz-control-toolbar-icon-max-width);height:var(--ibiz-control-toolbar-icon-max-height)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon .ibiz-icon{display:flex;align-items:center;justify-content:center}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon i{font-size:var(--ibiz-font-size-regular)}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon img{display:inline-block;width:100%;height:100%}.ibiz-export-excel-submenu-button>span .ibiz-toolbar-item-icon+.ibiz-toolbar-item-text{margin:var(--ibiz-control-toolbar-text-margin)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .el-sub-menu__title{padding:0}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu.hover{color:var(--ibiz-color-primary-hover-text);background-color:var(--ibiz-color-primary-hover)}.ibiz-control-toolbar-submenu-popper .ibiz-export-excel-submenu .ibiz-export-excel-submenu-popper{width:270px;color:var(--ibiz-color-primary-text);background-color:var(--ibiz-color-primary)}
@@ -23,7 +23,7 @@ const AuthCaptcha = /* @__PURE__ */ vue.defineComponent({
23
23
  const c = props.controller;
24
24
  const classArr = vue.computed(() => {
25
25
  let result = [ns.b(), ns.m(c.model.id)];
26
- result = [...result, ...props.controller.containerClass, ns.is("hidden", !props.controller.state.visible)];
26
+ result = [...result, ...props.controller.containerClass, ns.is("hidden", !props.controller.state.visible), ns.is("error", !!c.state.error)];
27
27
  return result;
28
28
  });
29
29
  const onClick = () => {
@@ -31,11 +31,16 @@ const AuthCaptcha = /* @__PURE__ */ vue.defineComponent({
31
31
  c.loadCaptcha();
32
32
  }
33
33
  };
34
+ const onChange = () => {
35
+ c.onChange();
36
+ c.validate();
37
+ };
34
38
  return {
35
39
  c,
36
40
  ns,
37
41
  classArr,
38
- onClick
42
+ onClick,
43
+ onChange
39
44
  };
40
45
  },
41
46
  render() {
@@ -45,6 +50,8 @@ const AuthCaptcha = /* @__PURE__ */ vue.defineComponent({
45
50
  "modelValue": this.c.state.code,
46
51
  "onUpdate:modelValue": ($event) => this.c.state.code = $event,
47
52
  "class": this.ns.e("captcha"),
53
+ "onInput": this.onChange,
54
+ "onBlur": this.onChange,
48
55
  "placeholder": "\u9A8C\u8BC1\u7801"
49
56
  }, null), vue.withDirectives(vue.createVNode(vue.resolveComponent("el-image"), {
50
57
  "src": this.c.state.image,
@@ -58,7 +65,9 @@ const AuthCaptcha = /* @__PURE__ */ vue.defineComponent({
58
65
  "class": [this.ns.em("image", "hint"), this.ns.is("loading", this.c.state.loading)]
59
66
  }, [this.c.state.loading ? "\u52A0\u8F7D\u4E2D..." : "\u52A0\u8F7D\u5931\u8D25"]);
60
67
  }
61
- }), [[vue.resolveDirective("loading"), this.c.state.loading]])]);
68
+ }), [[vue.resolveDirective("loading"), this.c.state.loading]]), this.c.state.error && vue.createVNode("div", {
69
+ "class": this.ns.e("error")
70
+ }, [this.c.state.error])]);
62
71
  }
63
72
  });
64
73
 
@@ -1,11 +1,31 @@
1
1
  'use strict';
2
2
 
3
+ var vue = require('vue');
3
4
  var runtime = require('@ibiz-template/runtime');
4
5
  var axios = require('axios');
5
6
  var authCaptcha_state = require('./auth-captcha.state.cjs');
6
7
 
7
8
  "use strict";
9
+ var __defProp = Object.defineProperty;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __publicField = (obj, key, value) => {
12
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
+ return value;
14
+ };
8
15
  class AuthCaptchaController extends runtime.PanelItemController {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * 验证码数据
20
+ *
21
+ * @private
22
+ * @memberof AuthCaptchaController
23
+ */
24
+ __publicField(this, "captcha", vue.reactive({
25
+ "Captcha-State": "",
26
+ "Captcha-Code": ""
27
+ }));
28
+ }
9
29
  createState() {
10
30
  var _a;
11
31
  return new authCaptcha_state.AuthCaptchaState((_a = this.parent) == null ? void 0 : _a.state);
@@ -19,17 +39,7 @@ class AuthCaptchaController extends runtime.PanelItemController {
19
39
  */
20
40
  async panelStateNotify(_state) {
21
41
  super.panelStateNotify(_state);
22
- const that = this;
23
- Object.defineProperty(that.panel.state.data, "captcha", {
24
- enumerable: true,
25
- configurable: true,
26
- get() {
27
- return {
28
- captcha_state: that.state.state,
29
- captcha_code: that.state.code
30
- };
31
- }
32
- });
42
+ this.data.captcha = this.captcha;
33
43
  }
34
44
  /**
35
45
  * 初始化
@@ -41,6 +51,43 @@ class AuthCaptchaController extends runtime.PanelItemController {
41
51
  async onInit() {
42
52
  super.onInit();
43
53
  await this.loadCaptcha();
54
+ const view = this.panel.view;
55
+ view.hooks.beforeLogin.tapPromise(async (context) => {
56
+ if (!context.parentId || context.parentId === this.dataParent.model.id) {
57
+ context.validate = context.validate && await this.validate();
58
+ }
59
+ });
60
+ view.hooks.afterLogin.tap((context) => {
61
+ if (!context.ok) {
62
+ this.loadCaptcha();
63
+ this.state.code = "";
64
+ }
65
+ });
66
+ }
67
+ /**
68
+ * 值校验
69
+ *
70
+ * @return {*} {Promise<boolean>}
71
+ * @memberof AuthCaptchaController
72
+ */
73
+ async validate() {
74
+ if (this.state.code) {
75
+ this.state.error = void 0;
76
+ return true;
77
+ }
78
+ this.state.error = "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801";
79
+ return false;
80
+ }
81
+ /**
82
+ * 值改变
83
+ *
84
+ * @memberof AuthCaptchaController
85
+ */
86
+ onChange() {
87
+ Object.assign(this.captcha, {
88
+ "Captcha-State": this.state.state,
89
+ "Captcha-Code": this.state.code
90
+ });
44
91
  }
45
92
  /**
46
93
  * 加载验证码
@@ -59,12 +106,19 @@ class AuthCaptchaController extends runtime.PanelItemController {
59
106
  },
60
107
  data: {}
61
108
  };
62
- const res = await axios(requestConfig);
63
- if (res.status === 200 && res.data) {
64
- this.state.state = res.data.state;
65
- this.state.image = res.data.image;
109
+ try {
110
+ const res = await axios(requestConfig);
111
+ if (res.status === 200 && res.data) {
112
+ this.state.state = res.data.state;
113
+ this.state.image = res.data.image;
114
+ }
115
+ } catch (error) {
116
+ this.state.state = "";
117
+ this.state.image = "";
118
+ } finally {
119
+ this.state.loading = false;
120
+ this.onChange();
66
121
  }
67
- this.state.loading = false;
68
122
  }
69
123
  }
70
124
 
@@ -1 +1 @@
1
- .ibiz-auth-captcha{display:flex}.ibiz-auth-captcha__captcha{width:calc(100% - 120px)}.ibiz-auth-captcha__image{flex-shrink:0;width:120px;height:100%;cursor:pointer}.ibiz-auth-captcha__image--hint{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
1
+ .ibiz-auth-captcha{display:flex;position:relative}.ibiz-auth-captcha__captcha{width:calc(100% - 120px)}.ibiz-auth-captcha__image{flex-shrink:0;width:120px;height:100%;cursor:pointer}.ibiz-auth-captcha__image--hint{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--ibiz-color-text-3);background-color:var(--ibiz-color-fill-0)}.ibiz-auth-captcha__error{left:0;top:100%;line-height:1;font-size:12px;padding-top:2px;position:absolute;color:var(--ibiz-color-danger)}.ibiz-auth-captcha.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--ibiz-color-danger) inset}
@@ -40,6 +40,13 @@ class AuthCaptchaState extends runtime.PanelItemState {
40
40
  * @memberof AuthCaptchaState
41
41
  */
42
42
  __publicField(this, "loading", false);
43
+ /**
44
+ * 错误信息
45
+ *
46
+ * @type {string}
47
+ * @memberof AuthCaptchaState
48
+ */
49
+ __publicField(this, "error");
43
50
  }
44
51
  }
45
52
 
@@ -101,13 +101,19 @@ class PanelButtonController extends runtime.PanelItemController {
101
101
  }
102
102
  event.stopPropagation();
103
103
  event.preventDefault();
104
+ const view = this.panel.view;
105
+ if (actionType === "UIACTION" && uiactionId === "login" && view.model.viewType === "APPLOGINVIEW" && !await view.validate(
106
+ this.dataParent.model.id
107
+ )) {
108
+ return;
109
+ }
104
110
  await runtime.UIActionUtil.execAndResolved(
105
111
  uiactionId,
106
112
  {
107
113
  context: this.panel.context,
108
114
  params: this.panel.params,
109
115
  data: [this.data],
110
- view: this.panel.view,
116
+ view,
111
117
  event,
112
118
  noWaitRoute: true
113
119
  },