@kengic/vue 0.6.10-beta.9 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -6991,7 +6991,7 @@ const useKgAppSelectStore = () => (store$8 || (store$8 = defineStore("KgAppSelec
6991
6991
  }
6992
6992
  },
6993
6993
  emit(e, t) {
6994
- let r;
6994
+ let r, a = Promise.resolve(!1);
6995
6995
  switch (e) {
6996
6996
  case "gotoApp":
6997
6997
  r = this.gotoAppListenersMap.get("0");
@@ -7000,13 +7000,10 @@ const useKgAppSelectStore = () => (store$8 || (store$8 = defineStore("KgAppSelec
7000
7000
  r = this.gotoPathListenersMap.get("0");
7001
7001
  break;
7002
7002
  }
7003
- if (r) {
7004
- let a = Promise.resolve(!1);
7003
+ if (r)
7005
7004
  for (let n = 0; n < r.length; n++)
7006
7005
  a = r[n](t != null ? t : null);
7007
- return a;
7008
- }
7009
- return Promise.resolve(!1);
7006
+ return a;
7010
7007
  },
7011
7008
  async gotoApp(e) {
7012
7009
  const t = useKg();
@@ -9962,7 +9959,7 @@ const useKgFormStore = () => (store$6 || (store$6 = defineStore("KgForm", {
9962
9959
  }
9963
9960
  },
9964
9961
  emit(e, t, r) {
9965
- let a;
9962
+ let a, n = Promise.resolve(!1);
9966
9963
  switch (t) {
9967
9964
  case "lookupBeforeOk":
9968
9965
  a = this.lookupBeforeOkListenersMap.get(e);
@@ -9971,13 +9968,10 @@ const useKgFormStore = () => (store$6 || (store$6 = defineStore("KgForm", {
9971
9968
  a = this.lookupOkListenersMap.get(e);
9972
9969
  break;
9973
9970
  }
9974
- if (a) {
9975
- let n = Promise.resolve(!1);
9971
+ if (a)
9976
9972
  for (let o = 0; o < a.length; o++)
9977
9973
  n = a[o](r != null ? r : null);
9978
- return n;
9979
- }
9980
- return Promise.resolve(!1);
9974
+ return n;
9981
9975
  }
9982
9976
  }
9983
9977
  }).bind(null, pinia())), store$6);
@@ -10156,7 +10150,7 @@ const useKgSubmitStore = () => (store$5 || (store$5 = defineStore("KgSubmit", {
10156
10150
  }
10157
10151
  },
10158
10152
  emit(e, t, r) {
10159
- let a;
10153
+ let a, n = Promise.resolve(!1);
10160
10154
  switch (t) {
10161
10155
  case "open":
10162
10156
  a = this.openListenersMap.get(e);
@@ -10184,15 +10178,14 @@ const useKgSubmitStore = () => (store$5 || (store$5 = defineStore("KgSubmit", {
10184
10178
  break;
10185
10179
  }
10186
10180
  if (a) {
10187
- const n = [];
10188
- let o = Promise.resolve(!1);
10181
+ const o = [];
10189
10182
  for (let i = 0; i < a.length; i++) {
10190
10183
  const s = a[i];
10191
- s.once && !s.invoked && (s.invoked = !0, n.push(s)), o = s(r);
10184
+ s.once && !s.invoked && (s.invoked = !0, o.push(s)), n = s(r);
10192
10185
  }
10193
- return n.forEach((i) => this.removeEventListener(e, t, i)), o;
10186
+ o.forEach((i) => this.removeEventListener(e, t, i));
10194
10187
  }
10195
- return Promise.resolve(!1);
10188
+ return n;
10196
10189
  },
10197
10190
  setIsLoading(e, t) {
10198
10191
  this.isLoadingMap.set(e, t);
@@ -11061,9 +11054,9 @@ const useKgTableStore = () => (store$4 || (store$4 = defineStore("KgTable", {
11061
11054
  getSelectedRowKeys(e) {
11062
11055
  return (t) => {
11063
11056
  if (!t)
11064
- return KgLogger.error("formID \u4E3A\u7A7A."), null;
11057
+ return KgLogger.error("formID \u4E3A\u7A7A."), ref([]);
11065
11058
  let r = e.selectedRowKeysMap.get(t);
11066
- return r || (r = ref([]), e.selectedRowKeysMap.set(t, r)), r != null ? r : null;
11059
+ return r || (r = ref([]), e.selectedRowKeysMap.set(t, r)), r;
11067
11060
  };
11068
11061
  },
11069
11062
  getSelectedRows(e) {
@@ -11160,7 +11153,7 @@ const useKgTableStore = () => (store$4 || (store$4 = defineStore("KgTable", {
11160
11153
  }
11161
11154
  },
11162
11155
  emit(e, t, r) {
11163
- let a;
11156
+ let a, n = Promise.resolve(!1);
11164
11157
  switch (t) {
11165
11158
  case "rowDoubleClick":
11166
11159
  a = this.rowDoubleClickListenersMap.get(e);
@@ -11173,25 +11166,21 @@ const useKgTableStore = () => (store$4 || (store$4 = defineStore("KgTable", {
11173
11166
  break;
11174
11167
  }
11175
11168
  if (a) {
11176
- const n = [];
11177
- let o = Promise.resolve(!1);
11169
+ const o = [];
11178
11170
  for (let i = 0; i < a.length; i++) {
11179
11171
  const s = a[i];
11180
- s.once && !s.invoked && (s.invoked = !0, n.push(s)), o = s(r);
11172
+ s.once && !s.invoked && (s.invoked = !0, o.push(s)), n = s(r);
11181
11173
  }
11182
- return n.forEach((i) => this.removeEventListener(e, t, i)), o;
11174
+ o.forEach((i) => this.removeEventListener(e, t, i));
11183
11175
  }
11184
- return Promise.resolve(!1);
11176
+ return n;
11185
11177
  },
11186
11178
  setSelectedRows(e, t) {
11187
- var n, o;
11179
+ var o, i;
11188
11180
  const r = useKgVar(e);
11189
11181
  this.selectedRowsMap.set(e, unref(toRaw(t)));
11190
- const a = this.getSelectedRowKeys(e);
11191
- if (a) {
11192
- const i = (o = (n = r.varGridConfig.value) == null ? void 0 : n.id_clm) != null ? o : "id";
11193
- a.value = t.map((s) => s[i]);
11194
- }
11182
+ const a = (i = (o = r.varGridConfig.value) == null ? void 0 : o.id_clm) != null ? i : "id", n = this.getSelectedRowKeys(e);
11183
+ n.value = t.map((s) => s[a]);
11195
11184
  },
11196
11185
  setRowSelect(e, t, r) {
11197
11186
  },
@@ -11972,11 +11961,9 @@ const KgTable$1 = "", getProps$g = () => ({
11972
11961
  }) {
11973
11962
  var fe;
11974
11963
  const a = inject("$dayjs", dayjs), n = inject(DI_KG_VAR__KG_SLOTS, null), o = inject(DI_KG_VAR__KG_PROPS, null), i = useKg(), s = useKgVar(), l = useKgSearch(), c = useKgButton(), u = useKgTable(), d = useKgSubmit();
11975
- l.onSearch((K) => {
11976
- G(K);
11977
- }), l.onReset(() => {
11978
- G(!0);
11979
- }), u.store.$onAction(async ({
11964
+ l.onSearch(async ({
11965
+ resetPageIndex: K
11966
+ }) => (G(K), !1)), l.onReset(async () => (G(!0), !1)), u.store.$onAction(async ({
11980
11967
  name: K,
11981
11968
  args: U
11982
11969
  }) => {
@@ -12521,7 +12508,7 @@ const useKgButtonStore = () => (store$3 || (store$3 = defineStore("KgButton", {
12521
12508
  }
12522
12509
  },
12523
12510
  emit(e, t, r) {
12524
- let a;
12511
+ let a, n = Promise.resolve(!1);
12525
12512
  switch (t) {
12526
12513
  case "click":
12527
12514
  a = this.clickListenersMap.get(e);
@@ -12539,13 +12526,10 @@ const useKgButtonStore = () => (store$3 || (store$3 = defineStore("KgButton", {
12539
12526
  a = this.submitCancelListenersMap.get(e);
12540
12527
  break;
12541
12528
  }
12542
- if (a) {
12543
- let n = Promise.resolve(!1);
12529
+ if (a)
12544
12530
  for (let o = 0; o < a.length; o++)
12545
12531
  n = a[o](r != null ? r : null);
12546
- return n;
12547
- }
12548
- return Promise.resolve(!1);
12532
+ return n;
12549
12533
  },
12550
12534
  click(e, t, r, a) {
12551
12535
  }
@@ -13380,36 +13364,31 @@ const useKgSearchStore = () => (store$2 || (store$2 = defineStore("KgSearch", {
13380
13364
  }
13381
13365
  },
13382
13366
  emit(e, t, r) {
13383
- const n = [...useKgVar(e).store.getVarGridConfigMap.values()].filter((o) => (o == null ? void 0 : o.prf_frm_id) === e).map((o) => o == null ? void 0 : o.frm_id).filter((o) => !!o);
13384
- for (let o of [e, ...n])
13367
+ const n = [...useKgVar(e).store.getVarGridConfigMap.values()].filter((i) => (i == null ? void 0 : i.prf_frm_id) === e).map((i) => i == null ? void 0 : i.frm_id).filter((i) => !!i);
13368
+ let o = Promise.resolve(!1);
13369
+ for (let i of [e, ...n]) {
13370
+ let s;
13385
13371
  switch (t) {
13386
13372
  case "search":
13387
- {
13388
- const i = this.onSearchListenersMap.get(o);
13389
- i && i.forEach((s) => s(r == null ? void 0 : r.resetPageIndex));
13390
- }
13373
+ s = this.onSearchListenersMap.get(i);
13391
13374
  break;
13392
13375
  case "reset":
13393
- {
13394
- const i = this.onResetListenersMap.get(o);
13395
- i && i.forEach((s) => s({}));
13396
- }
13376
+ s = this.onResetListenersMap.get(i);
13397
13377
  break;
13398
13378
  case "ready":
13399
- {
13400
- const i = this.onReadyListenersMap.get(o);
13401
- if (i) {
13402
- const s = [];
13403
- Promise.resolve(!1);
13404
- for (let l = 0; l < i.length; l++) {
13405
- const c = i[l];
13406
- c.once && !c.invoked && (c.invoked = !0, s.push(c)), c(r);
13407
- }
13408
- s.forEach((l) => this.removeEventListener(o, "ready", l));
13409
- }
13410
- }
13379
+ s = this.onReadyListenersMap.get(i);
13411
13380
  break;
13412
13381
  }
13382
+ if (s) {
13383
+ const l = [];
13384
+ for (let c = 0; c < s.length; c++) {
13385
+ const u = s[c];
13386
+ u.once && !u.invoked && (u.invoked = !0, l.push(u)), o = u(r);
13387
+ }
13388
+ l.forEach((c) => this.removeEventListener(i, t, c));
13389
+ }
13390
+ }
13391
+ return o;
13413
13392
  },
13414
13393
  setIsReady(e, t) {
13415
13394
  !e || this.isReadyMap.set(e, !!t);
@@ -13966,16 +13945,16 @@ function _useFormModel(e, t) {
13966
13945
  } = _useCommon();
13967
13946
  let s;
13968
13947
  const l = ref({});
13969
- return watch(a.currentVarProfileDetails, (c) => {
13948
+ return watch(a.currentVarProfileDetails, async (c) => {
13970
13949
  l.value = {}, c != null && c.length && (c.forEach((u) => {
13971
13950
  var m, v;
13972
13951
  const d = (m = u.var_nam) != null ? m : "";
13973
13952
  l.value[d] = KgVarUtil.transformValueByControlType(a.formID, d, r, (v = u.dft_val) != null ? v : void 0, "R");
13974
- }), t.value.kgHeight = i.value, n.store.setModel(a.formID, l.value), o.value ? (s == null || s(), s = watch(e, (u) => {
13975
- u && (n.store.emit(a.formID, "ready"), n.store.setIsReady(a.formID, !0));
13953
+ }), t.value.kgHeight = i.value, n.store.setModel(a.formID, l.value), o.value ? (s == null || s(), s = watch(e, async (u) => {
13954
+ u && (await n.store.emit(a.formID, "ready", {}), n.store.setIsReady(a.formID, !0));
13976
13955
  }, {
13977
13956
  immediate: !0
13978
- })) : (n.store.emit(a.formID, "ready"), n.store.setIsReady(a.formID, !0)));
13957
+ })) : (await n.store.emit(a.formID, "ready", {}), n.store.setIsReady(a.formID, !0)));
13979
13958
  }, {
13980
13959
  immediate: !0
13981
13960
  }), {
@@ -14025,29 +14004,29 @@ const KgSearch$1 = "", getProps$9 = () => ({}), KgSearch = defineComponent({
14025
14004
  onUnmounted(() => {
14026
14005
  n.store.dispose(a.formID);
14027
14006
  });
14028
- function M(O = !1) {
14029
- T.value || (i.value ? m.value && m.value.validate().then(() => {
14030
- n.store.emit(a.formID, "search", {
14007
+ async function M(O = !1) {
14008
+ T.value || (i.value ? m.value && m.value.validate().then(async () => {
14009
+ await n.store.emit(a.formID, "search", {
14031
14010
  resetPageIndex: O
14032
14011
  });
14033
14012
  }).catch((R) => {
14034
14013
  KgLogger.debug(`${a.formID} | KgSearch | onSearch() | \u8868\u5355\u9A8C\u8BC1\u5931\u8D25.`, {
14035
14014
  e: R
14036
14015
  });
14037
- }) : n.store.emit(a.formID, "search", {
14016
+ }) : await n.store.emit(a.formID, "search", {
14038
14017
  resetPageIndex: O
14039
14018
  }));
14040
14019
  }
14041
14020
  n.store.setSearchFn(a.formID, M);
14042
- function A() {
14021
+ async function A() {
14043
14022
  var O;
14044
- (O = m.value) == null || O.resetFields(), i.value ? m.value && m.value.validate().then(() => {
14045
- n.store.emit(a.formID, "reset");
14023
+ (O = m.value) == null || O.resetFields(), i.value ? m.value && m.value.validate().then(async () => {
14024
+ await n.store.emit(a.formID, "reset", {});
14046
14025
  }).catch((R) => {
14047
14026
  KgLogger.debug("[KgSearch] \u8868\u5355\u9A8C\u8BC1\u5931\u8D25", {
14048
14027
  e: R
14049
14028
  });
14050
- }) : n.store.emit(a.formID, "reset");
14029
+ }) : await n.store.emit(a.formID, "reset", {});
14051
14030
  }
14052
14031
  n.store.setResetFn(a.formID, A);
14053
14032
  function w() {
@@ -7,17 +7,17 @@ import { IKgEventCb } from '../../consts';
7
7
  * 'ready': 查询字段初始完成, 查询组件渲染完成
8
8
  */
9
9
  export declare type IKgSearchEvent = 'search' | 'reset' | 'ready';
10
- /** 事件参数. */
11
- export declare type IKgSearchEventParam = {
10
+ /** 事件监听函数: search. */
11
+ export declare type IKgSearchSearchCbParam = {
12
12
  /** 是否从第一页开始查询. */
13
13
  resetPageIndex?: boolean;
14
14
  };
15
- /** 事件监听函数: search. */
16
- export declare type IKgSearchSearchCb = ((resetPageIndex?: boolean) => void) & IKgEventCb;
17
- /** 事件监听函数: 'reset'. */
18
- export declare type IKgSearchResetCb = ((param: any) => void) & IKgEventCb;
19
- /** 事件监听函数: 'ready'. */
20
- export declare type IKgSearchReadyCb = ((param: any) => void) & IKgEventCb;
15
+ export declare type IKgSearchSearchCb = ((param: IKgSearchSearchCbParam) => Promise<boolean>) & IKgEventCb;
16
+ /** 事件监听函数: reset. */
17
+ export declare type IKgSearchResetCb = ((param: any) => Promise<boolean>) & IKgEventCb;
18
+ /** 事件监听函数: ready. */
19
+ export declare type IKgSearchReadyCb = ((param: any) => Promise<boolean>) & IKgEventCb;
20
+ export declare type IKgSearchCbParam = IKgSearchSearchCbParam;
21
21
  export declare type IKgSearchCb = IKgSearchSearchCb | IKgSearchResetCb | IKgSearchReadyCb;
22
22
  /** 查询方法. */
23
23
  export declare type IKgSearchSearchFn = (resetPageIndex?: boolean) => void;
@@ -55,7 +55,7 @@ export declare type IKgSearchStoreDefinition = StoreDefinition<'KgSearch', IKgSe
55
55
  * @param event 事件名称.
56
56
  * @param param 事件参数.
57
57
  */
58
- emit(formID: string, event: IKgSearchEvent, param?: IKgSearchEventParam): void;
58
+ emit(formID: string, event: IKgSearchEvent, param: IKgSearchCbParam): Promise<boolean>;
59
59
  /**
60
60
  * 设置是否就绪.
61
61
  * @param formID 界面标识.
@@ -119,7 +119,7 @@ export declare type IKgSubmitStoreDefinition = StoreDefinition<'KgSubmit', IKgSu
119
119
  * 触发事件.
120
120
  * @param formID 界面标识.
121
121
  * @param event 事件名称.
122
- * @param param 数据.
122
+ * @param param 事件参数.
123
123
  */
124
124
  emit(formID: string, event: IKgSubmitEvent, param: IKgSubmitCbParam): Promise<boolean>;
125
125
  setIsLoading(formID: string, value: boolean): void;
@@ -57,7 +57,7 @@ export interface IKgTableState {
57
57
  }
58
58
  export declare type IKgTableStoreDefinition = StoreDefinition<'KgTable', IKgTableState, {
59
59
  /** 当前勾选的所有行的主键. */
60
- getSelectedRowKeys(): (formID?: string | null) => Ref<Array<Key>> | null;
60
+ getSelectedRowKeys(): (formID?: string | null) => Ref<Array<Key>>;
61
61
  /** 当前勾选的所有行. */
62
62
  getSelectedRows(): (formID?: string | null) => Array<IKgTableRow> | null;
63
63
  /** 当前勾选的第一行. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.6.10-beta.9",
3
+ "version": "0.6.10",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "rimraf dist && vue-tsc && vite build --mode development",