@dazhicheng/ui 1.5.243 → 1.5.244

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.
@@ -0,0 +1,23 @@
1
+ /** 航司基础信息 */
2
+ export type BasicAirlineItem = {
3
+ airlineCode?: string;
4
+ airlineNameCn?: string;
5
+ [key: string]: any;
6
+ };
7
+ /** 机场区域完整信息 */
8
+ export type AirportRegionItem = {
9
+ airportCode?: string;
10
+ airportName?: string;
11
+ [key: string]: any;
12
+ };
13
+ /** 获取所有航司信息列表 GET /basicAirline/getAll */
14
+ export declare function getAllBasicAirline(options?: {
15
+ [key: string]: any;
16
+ }): Promise<BasicAirlineItem[]>;
17
+ /** 根据代码查询区域机场完整层级信息 POST /airportRegionLevel/getByCode */
18
+ export declare function getByCodeAirportRegionLevel(body: {
19
+ type?: number;
20
+ codes?: string[];
21
+ }, options?: {
22
+ [key: string]: any;
23
+ }): Promise<AirportRegionItem[]>;
@@ -0,0 +1,16 @@
1
+ import { request as t } from "../utils/xhr.js";
2
+ async function r(e) {
3
+ return t.get({
4
+ url: "/basic/basicAirline/getAll"
5
+ });
6
+ }
7
+ async function n(e, i) {
8
+ return t.post({
9
+ url: "/basic/airportRegionLevel/getByCode",
10
+ data: e
11
+ });
12
+ }
13
+ export {
14
+ r as getAllBasicAirline,
15
+ n as getByCodeAirportRegionLevel
16
+ };
@@ -1,7 +1,7 @@
1
1
  import o from "./TtArea.vue3.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-116cb5cb"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b814e001"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import r from "./DrawerHeader.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ o(r, [["__scopeId", "data-v-6cdf82e0"]]);
4
+ const c = /* @__PURE__ */ o(r, [["__scopeId", "data-v-9b698cc3"]]);
5
5
  export {
6
- f as default
6
+ c as default
7
7
  };
@@ -2,7 +2,7 @@ import o from "./index.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d731bb93"]]);
5
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-6dba01d4"]]);
6
6
  export {
7
- a as default
7
+ _ as default
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./loading.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7e6228e4"]]);
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5d760747"]]);
5
5
  export {
6
- r as default
6
+ a as default
7
7
  };
@@ -75,8 +75,8 @@ declare function __VLS_template(): {
75
75
  $refs: {
76
76
  [x: string]: unknown;
77
77
  } & {
78
- vxelist: (import('vxe-pc-ui').VxeListMethods<any> & {
79
- $props: import('vxe-pc-ui').VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps<any>;
78
+ vxelist: (import('vxe-pc-ui').VxeListMethods & {
79
+ $props: import('vxe-pc-ui').VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps;
80
80
  $slots: import('vxe-pc-ui').VxeListSlots;
81
81
  }) | null;
82
82
  table: HTMLTableElement;
@@ -570,8 +570,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
570
570
  $refs: {
571
571
  [x: string]: unknown;
572
572
  } & {
573
- vxelist: (import('vxe-pc-ui').VxeListMethods<any> & {
574
- $props: import('vxe-pc-ui').VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps<any>;
573
+ vxelist: (import('vxe-pc-ui').VxeListMethods & {
574
+ $props: import('vxe-pc-ui').VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps;
575
575
  $slots: import('vxe-pc-ui').VxeListSlots;
576
576
  }) | null;
577
577
  table: HTMLTableElement;
@@ -32,8 +32,8 @@ declare function __VLS_template(): {
32
32
  empty: () => VNode;
33
33
  };
34
34
  refs: {
35
- vxelist: (import('vxe-pc-ui').VxeListMethods<any> & {
36
- $props: VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps<any>;
35
+ vxelist: (import('vxe-pc-ui').VxeListMethods & {
36
+ $props: VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps;
37
37
  $slots: import('vxe-pc-ui').VxeListSlots;
38
38
  }) | null;
39
39
  table: HTMLTableElement;
@@ -234,8 +234,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
234
234
  hasNextPage: boolean;
235
235
  showCheckbox: boolean;
236
236
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
237
- vxelist: (import('vxe-pc-ui').VxeListMethods<any> & {
238
- $props: VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps<any>;
237
+ vxelist: (import('vxe-pc-ui').VxeListMethods & {
238
+ $props: VxeListProps<any> & import('vxe-pc-ui').VxeListEventProps;
239
239
  $slots: import('vxe-pc-ui').VxeListSlots;
240
240
  }) | null;
241
241
  table: HTMLTableElement;
@@ -412,15 +412,14 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
412
412
  pagerConfig: import("vxe-table").VxeGridPropTypes.PagerConfig | undefined;
413
413
  showPager: any;
414
414
  showCheckbox: any;
415
- showRadio: any;
416
- radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
417
- checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
418
- menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
419
415
  columns: import('vue').MaybeRef<import("vxe-table").VxeTableDefines.ColumnOptions<any>[]> | undefined;
420
416
  toolbarConfig: import("vxe-table").VxeGridPropTypes.ToolbarConfig | undefined;
421
417
  zoomConfig: import("vxe-table").VxeGridPropTypes.ZoomConfig | undefined;
422
418
  showOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
423
419
  showHeaderOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
420
+ radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
421
+ checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
422
+ menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
424
423
  mouseConfig: import("vxe-table").VxeTablePropTypes.MouseConfig;
425
424
  keyboardConfig: import("vxe-table").VxeTablePropTypes.KeyboardConfig<any>;
426
425
  emptyText: string;
@@ -437,6 +436,7 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
437
436
  showRefresh: boolean;
438
437
  columnsKey: string | (() => string);
439
438
  showExpand: any;
439
+ showRadio: any;
440
440
  showIndex: any;
441
441
  isCellResize: any;
442
442
  isColumnsDrag: any;
@@ -1044,15 +1044,14 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
1044
1044
  pagerConfig: import("vxe-table").VxeGridPropTypes.PagerConfig | undefined;
1045
1045
  showPager: any;
1046
1046
  showCheckbox: any;
1047
- showRadio: any;
1048
- radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
1049
- checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
1050
- menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
1051
1047
  columns: import('vue').MaybeRef<import("vxe-table").VxeTableDefines.ColumnOptions<any>[]> | undefined;
1052
1048
  toolbarConfig: import("vxe-table").VxeGridPropTypes.ToolbarConfig | undefined;
1053
1049
  zoomConfig: import("vxe-table").VxeGridPropTypes.ZoomConfig | undefined;
1054
1050
  showOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
1055
1051
  showHeaderOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
1052
+ radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
1053
+ checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
1054
+ menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
1056
1055
  mouseConfig: import("vxe-table").VxeTablePropTypes.MouseConfig;
1057
1056
  keyboardConfig: import("vxe-table").VxeTablePropTypes.KeyboardConfig<any>;
1058
1057
  emptyText: string;
@@ -1069,6 +1068,7 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
1069
1068
  showRefresh: boolean;
1070
1069
  columnsKey: string | (() => string);
1071
1070
  showExpand: any;
1071
+ showRadio: any;
1072
1072
  showIndex: any;
1073
1073
  isCellResize: any;
1074
1074
  isColumnsDrag: any;
@@ -1409,15 +1409,14 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
1409
1409
  pagerConfig: import("vxe-table").VxeGridPropTypes.PagerConfig | undefined;
1410
1410
  showPager: any;
1411
1411
  showCheckbox: any;
1412
- showRadio: any;
1413
- radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
1414
- checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
1415
- menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
1416
1412
  columns: import('vue').MaybeRef<import("vxe-table").VxeTableDefines.ColumnOptions<any>[]> | undefined;
1417
1413
  toolbarConfig: import("vxe-table").VxeGridPropTypes.ToolbarConfig | undefined;
1418
1414
  zoomConfig: import("vxe-table").VxeGridPropTypes.ZoomConfig | undefined;
1419
1415
  showOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
1420
1416
  showHeaderOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
1417
+ radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
1418
+ checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
1419
+ menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
1421
1420
  mouseConfig: import("vxe-table").VxeTablePropTypes.MouseConfig;
1422
1421
  keyboardConfig: import("vxe-table").VxeTablePropTypes.KeyboardConfig<any>;
1423
1422
  emptyText: string;
@@ -1434,6 +1433,7 @@ export declare const TtTable: import('../../../../utils/src').SFCWithInstall<{
1434
1433
  showRefresh: boolean;
1435
1434
  columnsKey: string | (() => string);
1436
1435
  showExpand: any;
1436
+ showRadio: any;
1437
1437
  showIndex: any;
1438
1438
  isCellResize: any;
1439
1439
  isColumnsDrag: any;
@@ -58,14 +58,15 @@ import "../tt-log/index.js";
58
58
  /* empty css */
59
59
  import "../tt-loading/index.js";
60
60
  import "vue-router";
61
+ import "../../hooks/basicDataCodes.js";
61
62
  import "numeral";
62
63
  import "sortablejs";
63
64
  /* empty css */
64
65
  import "./src/emits.js";
65
66
  import "./src/props.js";
66
- const _t = t(o), ut = t(r), Bt = t(m);
67
+ const ut = t(o), Bt = t(r), ht = t(m);
67
68
  export {
68
- Bt as TtTable,
69
- _t as TtTableAction,
70
- ut as TtTableButton
69
+ ht as TtTable,
70
+ ut as TtTableAction,
71
+ Bt as TtTableButton
71
72
  };
@@ -809,15 +809,14 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
809
809
  pagerConfig: import("vxe-table").VxeGridPropTypes.PagerConfig | undefined;
810
810
  showPager: any;
811
811
  showCheckbox: any;
812
- showRadio: any;
813
- radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
814
- checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
815
- menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
816
812
  columns: import('vue').MaybeRef<VxeTableDefines.ColumnOptions<any>[]> | undefined;
817
813
  toolbarConfig: import("vxe-table").VxeGridPropTypes.ToolbarConfig | undefined;
818
814
  zoomConfig: import("vxe-table").VxeGridPropTypes.ZoomConfig | undefined;
819
815
  showOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
820
816
  showHeaderOverflow: import("vxe-table").VxeTablePropTypes.ShowOverflow | undefined;
817
+ radioConfig: import("vxe-table").VxeTablePropTypes.RadioConfig<import("vxe-table").VxeTablePropTypes.Row>;
818
+ checkboxConfig: import("vxe-table").VxeTablePropTypes.CheckboxConfig<import("vxe-table").VxeTablePropTypes.Row>;
819
+ menuConfig: import("vxe-table").VxeTablePropTypes.MenuConfig<any>;
821
820
  mouseConfig: import("vxe-table").VxeTablePropTypes.MouseConfig;
822
821
  keyboardConfig: import("vxe-table").VxeTablePropTypes.KeyboardConfig<any>;
823
822
  emptyText: string;
@@ -834,6 +833,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
834
833
  showRefresh: boolean;
835
834
  columnsKey: string | (() => string);
836
835
  showExpand: any;
836
+ showRadio: any;
837
837
  showIndex: any;
838
838
  isCellResize: any;
839
839
  isColumnsDrag: any;
@@ -58,6 +58,7 @@ import "../../tt-log/index.js";
58
58
  import "../../tt-loading/index.js";
59
59
  import "../index.js";
60
60
  import "vue-router";
61
+ import "../../../hooks/basicDataCodes.js";
61
62
  import "numeral";
62
63
  import Ue from "./components/TableColumnModal.vue2.js";
63
64
  /* empty css */
@@ -73,7 +74,7 @@ import { useTableSlot as Ze } from "./hooks/useTableSlot.js";
73
74
  import { tableFormProps as et } from "./props.js";
74
75
  import { getDefaultState as tt } from "./utils/table-api.js";
75
76
  import { TableFormApi as ot } from "./utils/table-form-api.js";
76
- const rt = ["data-testid"], st = ["data-testid"], Mo = /* @__PURE__ */ Me({
77
+ const rt = ["data-testid"], st = ["data-testid"], Eo = /* @__PURE__ */ Me({
77
78
  name: "TtTableForm",
78
79
  __name: "TableForm",
79
80
  props: et,
@@ -380,5 +381,5 @@ const rt = ["data-testid"], st = ["data-testid"], Mo = /* @__PURE__ */ Me({
380
381
  }
381
382
  });
382
383
  export {
383
- Mo as default
384
+ Eo as default
384
385
  };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 基础数据 code 常量,页面传入 hooks 时使用。
3
+ */
4
+ export declare const CODES: {
5
+ readonly AIRLINE: "airline";
6
+ readonly AIRPORT: "airport";
7
+ };
8
+ export type BasicDataCode = (typeof CODES)[keyof typeof CODES];
9
+ export type BasicDataOption = {
10
+ label: string;
11
+ value: string | number;
12
+ [key: string]: any;
13
+ };
14
+ export type BasicDataCodeRegistryItem = {
15
+ /** 默认表单字段名 */
16
+ defaultFieldName: string;
17
+ /** 默认标签 */
18
+ defaultLabel: string;
19
+ /** 排除字段默认标签 */
20
+ defaultExcludeLabel: string;
21
+ /** 默认是否多选 */
22
+ defaultMultiple: boolean;
23
+ /** 默认是否展示「全部」 */
24
+ defaultShowAll: boolean;
25
+ /** 拉取并归一化为 label/value 选项 */
26
+ fetchOptions: () => Promise<BasicDataOption[]>;
27
+ };
28
+ /**
29
+ * code → 接口与默认展示配置。
30
+ * 后续扩展航线/舱位等,只需在此追加。
31
+ */
32
+ export declare const CODE_REGISTRY: Record<BasicDataCode, BasicDataCodeRegistryItem>;
@@ -0,0 +1,47 @@
1
+ import { getByCodeAirportRegionLevel as r, getAllBasicAirline as t } from "../api/basicData.js";
2
+ const a = {
3
+ AIRLINE: "airline",
4
+ AIRPORT: "airport"
5
+ };
6
+ function o(l = []) {
7
+ return (l || []).filter((e) => e == null ? void 0 : e.airlineCode).map((e) => ({
8
+ ...e,
9
+ label: `${e.airlineCode}(${e.airlineNameCn || ""})`,
10
+ value: e.airlineCode
11
+ }));
12
+ }
13
+ function n(l = []) {
14
+ return (l || []).filter((e) => e == null ? void 0 : e.airportCode).map((e) => ({
15
+ ...e,
16
+ label: `${e.airportCode}(${e.airportName || ""})`,
17
+ value: e.airportCode
18
+ }));
19
+ }
20
+ const u = {
21
+ [a.AIRLINE]: {
22
+ defaultFieldName: "airlineCodes",
23
+ defaultLabel: "航司",
24
+ defaultExcludeLabel: "排除航司",
25
+ defaultMultiple: !0,
26
+ defaultShowAll: !0,
27
+ async fetchOptions() {
28
+ const l = await t();
29
+ return o(l || []);
30
+ }
31
+ },
32
+ [a.AIRPORT]: {
33
+ defaultFieldName: "airportCodes",
34
+ defaultLabel: "机场",
35
+ defaultExcludeLabel: "排除机场",
36
+ defaultMultiple: !0,
37
+ defaultShowAll: !1,
38
+ async fetchOptions() {
39
+ const l = await r({ type: 5 });
40
+ return n(l || []);
41
+ }
42
+ }
43
+ };
44
+ export {
45
+ a as CODES,
46
+ u as CODE_REGISTRY
47
+ };
@@ -0,0 +1,21 @@
1
+ import { MaybeRef, Ref } from 'vue';
2
+ import { BasicDataCode, BasicDataOption } from './basicDataCodes';
3
+ export type BasicDataOptionsMap = Partial<Record<BasicDataCode, BasicDataOption[]>>;
4
+ export interface UseBasicDataOptionsParams {
5
+ codes: BasicDataCode[];
6
+ /** 外部数据源。未传时按 codes 走 CODE_REGISTRY 请求。 */
7
+ dataSource?: MaybeRef<BasicDataOptionsMap | undefined>;
8
+ }
9
+ /**
10
+ * 按基础数据 code 拉取并缓存 options。
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const { dataSource } = useBasicDataOptions({ codes: [CODES.AIRLINE, CODES.AIRPORT] });
15
+ * dataSource.value.airline
16
+ * ```
17
+ */
18
+ export declare function useBasicDataOptions(options: UseBasicDataOptionsParams): {
19
+ dataSource: Ref<Record<BasicDataCode, BasicDataOption[]>>;
20
+ reload: () => Promise<void>;
21
+ };
@@ -0,0 +1,91 @@
1
+ import { ref as P, watchEffect as R, unref as D, watch as q, computed as v } from "vue";
2
+ import { useRoute as x } from "vue-router";
3
+ import { CODE_REGISTRY as E } from "./basicDataCodes.js";
4
+ const c = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
5
+ function V(s) {
6
+ const d = x(), y = P({});
7
+ function i(r = {}) {
8
+ y.value = s.codes.reduce(
9
+ (e, t) => (e[t] = r[t] || [], e),
10
+ {}
11
+ );
12
+ }
13
+ async function C(r) {
14
+ return (await Promise.allSettled(
15
+ r.map(async (t) => {
16
+ const a = await E[t].fetchOptions();
17
+ return [t, a];
18
+ })
19
+ )).reduce((t, n, a) => {
20
+ const l = r[a];
21
+ return n.status === "fulfilled" ? t[n.value[0]] = n.value[1] : t[l] = [], t;
22
+ }, {});
23
+ }
24
+ async function m(r = !1) {
25
+ const e = d.path, t = D(s.dataSource);
26
+ if (t) {
27
+ const g = { ...c.get(e) || {}, ...t };
28
+ c.set(e, g), i(g);
29
+ return;
30
+ }
31
+ const n = c.get(e) || {};
32
+ let a = r ? [...s.codes] : s.codes.filter((u) => !Object.prototype.hasOwnProperty.call(n, u));
33
+ if (!a.length) {
34
+ i(n);
35
+ return;
36
+ }
37
+ const l = r ? void 0 : h.get(e);
38
+ if (l) {
39
+ const u = await l, o = { ...c.get(e) || {}, ...u };
40
+ if (c.set(e, o), a = s.codes.filter((O) => !Object.prototype.hasOwnProperty.call(o, O)), !a.length) {
41
+ i(o);
42
+ return;
43
+ }
44
+ }
45
+ const w = C(a), p = (f.get(e) || 0) + 1;
46
+ f.set(e, p), h.set(e, w);
47
+ try {
48
+ const u = await w;
49
+ if (f.get(e) !== p) return;
50
+ const o = { ...c.get(e) || {}, ...u };
51
+ c.set(e, o), i(o);
52
+ } finally {
53
+ f.get(e) === p && h.delete(e);
54
+ }
55
+ }
56
+ async function S() {
57
+ const r = d.path;
58
+ h.clear(), c.clear(), f.clear(), c.delete(r), await m(!0);
59
+ }
60
+ return R(() => {
61
+ const r = D(s.dataSource);
62
+ if (!r) return;
63
+ const e = d.path, n = { ...c.get(e) || {}, ...r };
64
+ c.set(e, n), i(n);
65
+ }), q(
66
+ () => d.path,
67
+ () => {
68
+ m();
69
+ },
70
+ { immediate: !0 }
71
+ ), {
72
+ dataSource: v(() => {
73
+ const r = s.codes.reduce(
74
+ (e, t) => (e[t] = y.value[t] || [], e),
75
+ {}
76
+ );
77
+ return new Proxy(r, {
78
+ get(e, t) {
79
+ return typeof t != "string" ? [] : r[t] || [];
80
+ },
81
+ set() {
82
+ return !1;
83
+ }
84
+ });
85
+ }),
86
+ reload: S
87
+ };
88
+ }
89
+ export {
90
+ V as useBasicDataOptions
91
+ };
@@ -0,0 +1,89 @@
1
+ import { TtFormSchema } from '../components/tt-form';
2
+ import { Recordable } from '../../../utils/src';
3
+ import { MaybeRef, Ref } from 'vue';
4
+ import { BasicDataCode, BasicDataOption } from './basicDataCodes';
5
+ import { BasicDataOptionsMap } from './useBasicDataOptions';
6
+ type FieldComponentProps = Recordable | ((values: Recordable, actions: any, options: BasicDataOption[]) => Recordable);
7
+ export interface PanelSelectFieldOnChangeContext {
8
+ values: Recordable;
9
+ actions: any;
10
+ fieldName: string;
11
+ code: BasicDataCode;
12
+ options: BasicDataOption[];
13
+ currentOption: BasicDataOption[] | BasicDataOption | undefined;
14
+ }
15
+ export interface PanelSelectExcludeConfig {
16
+ /** 排除字段名 */
17
+ fieldName: string;
18
+ /** 排除字段标签,默认取 CODE_REGISTRY.defaultExcludeLabel */
19
+ label?: string;
20
+ /** 返回解构 key,默认 exclude + Pascal(主字段 key) */
21
+ key?: string;
22
+ /** 排除字段是否展示「全部」,默认 false */
23
+ showAll?: boolean;
24
+ showAllField?: string | number;
25
+ multiple?: boolean;
26
+ componentProps?: FieldComponentProps;
27
+ dependencies?: TtFormSchema["dependencies"];
28
+ onChange?: (value: unknown, context: PanelSelectFieldOnChangeContext) => void;
29
+ rules?: TtFormSchema["rules"];
30
+ }
31
+ export interface PanelSelectFieldConfig {
32
+ code: BasicDataCode;
33
+ /** 返回解构名,默认用 code;同 code 多字段时必传不同 key */
34
+ key?: string;
35
+ fieldName?: string;
36
+ label?: string;
37
+ multiple?: boolean;
38
+ showAll?: boolean;
39
+ showAllField?: string | number;
40
+ componentProps?: FieldComponentProps;
41
+ dependencies?: TtFormSchema["dependencies"];
42
+ onChange?: (value: unknown, context: PanelSelectFieldOnChangeContext) => void;
43
+ rules?: TtFormSchema["rules"];
44
+ /** 与另一字段互斥:填对方的 fieldName */
45
+ mutexWith?: string;
46
+ /** 同 code 数据源的排除字段联动 */
47
+ exclude?: PanelSelectExcludeConfig;
48
+ /** 自定义过滤完整 options */
49
+ customOptions?: (values: Recordable, options: BasicDataOption[]) => BasicDataOption[];
50
+ }
51
+ export interface UsePanelSelectSchemasOptions {
52
+ dataSource?: MaybeRef<BasicDataOptionsMap | undefined>;
53
+ }
54
+ /**
55
+ * 基础数据 PanelSelect schema hooks。
56
+ *
57
+ * - 按 CODES 拉取 options
58
+ * - 默认组件 TtPanelSelect
59
+ * - 支持 exclude 排除联动、mutexWith 互斥过滤
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const { airline, excludeAirline, depAirport, arrAirport } = usePanelSelectSchemas([
64
+ * {
65
+ * code: CODES.AIRLINE,
66
+ * fieldName: 'airlineCodes',
67
+ * exclude: { fieldName: 'excludeAirlineCodes', label: '排除航司' },
68
+ * },
69
+ * {
70
+ * code: CODES.AIRPORT,
71
+ * key: 'depAirport',
72
+ * fieldName: 'depAirport',
73
+ * label: '出发',
74
+ * mutexWith: 'arrAirport',
75
+ * },
76
+ * {
77
+ * code: CODES.AIRPORT,
78
+ * key: 'arrAirport',
79
+ * fieldName: 'arrAirport',
80
+ * label: '到达',
81
+ * mutexWith: 'depAirport',
82
+ * },
83
+ * ]);
84
+ * ```
85
+ */
86
+ export declare function usePanelSelectSchemas(fields: PanelSelectFieldConfig[], options?: UsePanelSelectSchemasOptions): Record<string, TtFormSchema> & {
87
+ dataSource: Ref<Record<BasicDataCode, BasicDataOption[]>>;
88
+ };
89
+ export {};