@aplus-frontend/ui 6.38.0 → 6.39.1

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 (131) hide show
  1. package/es/index.mjs +110 -104
  2. package/es/src/ag-grid/hooks/use-columns-def.mjs +73 -71
  3. package/es/src/ag-grid/index.vue.mjs +201 -200
  4. package/es/src/ag-grid/interface.d.ts +14 -0
  5. package/es/src/ap-form/drawer-form/index.vue.d.ts +4 -0
  6. package/es/src/ap-form/modal-form/index.vue.d.ts +9 -1
  7. package/es/src/ap-modal/utils/createModal.mjs +34 -36
  8. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +72 -71
  9. package/es/src/ap-table/interface.d.ts +6 -0
  10. package/es/src/business/ag-grid-modal/constants.d.ts +4 -0
  11. package/es/src/business/ag-grid-modal/constants.mjs +6 -0
  12. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-instance.d.ts +33 -0
  13. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-instance.mjs +50 -0
  14. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.d.ts +3 -0
  15. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.mjs +95 -0
  16. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.d.ts +2 -0
  17. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.mjs +165 -0
  18. package/es/src/business/ag-grid-modal/hooks/use-modal-title.d.ts +24 -0
  19. package/es/src/business/ag-grid-modal/hooks/use-modal-title.mjs +49 -0
  20. package/es/src/business/ag-grid-modal/index.d.ts +3 -0
  21. package/es/src/business/ag-grid-modal/index.mjs +8 -0
  22. package/es/src/business/ag-grid-modal/interface.d.ts +141 -0
  23. package/es/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +44 -0
  24. package/es/src/business/ag-grid-modal/modal-layout/index.vue.mjs +4 -0
  25. package/es/src/business/ag-grid-modal/modal-layout/index.vue2.mjs +106 -0
  26. package/es/src/business/ag-grid-modal/selected-items/default.vue.d.ts +25 -0
  27. package/es/src/business/ag-grid-modal/selected-items/default.vue.mjs +4 -0
  28. package/es/src/business/ag-grid-modal/selected-items/default.vue2.mjs +33 -0
  29. package/es/src/business/ag-grid-modal/selected-items/index.d.ts +36 -0
  30. package/es/src/business/ag-grid-modal/selected-items/index.mjs +8 -0
  31. package/es/src/business/ag-grid-modal/selected-items/style/css.d.ts +0 -0
  32. package/es/src/business/ag-grid-modal/selected-items/style/css.js +1 -0
  33. package/es/src/business/ag-grid-modal/selected-items/style/index.d.ts +0 -0
  34. package/es/src/business/ag-grid-modal/selected-items/style/index.js +1 -0
  35. package/es/src/business/ag-grid-modal/style/css.d.ts +0 -0
  36. package/es/src/business/ag-grid-modal/style/css.js +1 -0
  37. package/es/src/business/ag-grid-modal/style/index.d.ts +0 -0
  38. package/es/src/business/ag-grid-modal/style/index.js +1 -0
  39. package/es/src/business/ag-grid-modal/utils.d.ts +54 -0
  40. package/es/src/business/ag-grid-modal/utils.mjs +72 -0
  41. package/es/src/business/ag-grid-modal/wrapper/index.vue.d.ts +23 -0
  42. package/es/src/business/ag-grid-modal/wrapper/index.vue.mjs +4 -0
  43. package/es/src/business/ag-grid-modal/wrapper/index.vue2.mjs +25 -0
  44. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -0
  45. package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +1 -0
  46. package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +1 -0
  47. package/es/src/business/ap-table-modal/index.d.ts +3 -0
  48. package/es/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
  49. package/es/src/business/ap-table-modal/table-modal.vue2.mjs +23 -23
  50. package/es/src/business/hooks/usePageListApTable.d.ts +1 -0
  51. package/es/src/business/index.d.ts +1 -0
  52. package/es/src/business/index.mjs +55 -54
  53. package/es/src/index.mjs +95 -89
  54. package/es/src/path-map.mjs +4 -1
  55. package/es/src/version.d.ts +1 -1
  56. package/es/src/version.mjs +1 -1
  57. package/lib/index.js +1 -1
  58. package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
  59. package/lib/src/ag-grid/index.vue.js +1 -1
  60. package/lib/src/ag-grid/interface.d.ts +14 -0
  61. package/lib/src/ap-form/drawer-form/index.vue.d.ts +4 -0
  62. package/lib/src/ap-form/modal-form/index.vue.d.ts +9 -1
  63. package/lib/src/ap-modal/utils/createModal.js +1 -1
  64. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  65. package/lib/src/ap-table/interface.d.ts +6 -0
  66. package/lib/src/business/ag-grid-modal/constants.d.ts +4 -0
  67. package/lib/src/business/ag-grid-modal/constants.js +1 -0
  68. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-instance.d.ts +33 -0
  69. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-instance.js +1 -0
  70. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.d.ts +3 -0
  71. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.js +1 -0
  72. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.d.ts +2 -0
  73. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.js +1 -0
  74. package/lib/src/business/ag-grid-modal/hooks/use-modal-title.d.ts +24 -0
  75. package/lib/src/business/ag-grid-modal/hooks/use-modal-title.js +1 -0
  76. package/lib/src/business/ag-grid-modal/index.d.ts +3 -0
  77. package/lib/src/business/ag-grid-modal/index.js +1 -0
  78. package/lib/src/business/ag-grid-modal/interface.d.ts +141 -0
  79. package/lib/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +44 -0
  80. package/lib/src/business/ag-grid-modal/modal-layout/index.vue.js +1 -0
  81. package/lib/src/business/ag-grid-modal/modal-layout/index.vue2.js +1 -0
  82. package/lib/src/business/ag-grid-modal/selected-items/default.vue.d.ts +25 -0
  83. package/lib/src/business/ag-grid-modal/selected-items/default.vue.js +1 -0
  84. package/lib/src/business/ag-grid-modal/selected-items/default.vue2.js +1 -0
  85. package/lib/src/business/ag-grid-modal/selected-items/index.d.ts +36 -0
  86. package/lib/src/business/ag-grid-modal/selected-items/index.js +1 -0
  87. package/lib/src/business/ag-grid-modal/selected-items/style/css.cjs +1 -0
  88. package/lib/src/business/ag-grid-modal/selected-items/style/css.d.ts +0 -0
  89. package/lib/src/business/ag-grid-modal/selected-items/style/index.cjs +1 -0
  90. package/lib/src/business/ag-grid-modal/selected-items/style/index.d.ts +0 -0
  91. package/lib/src/business/ag-grid-modal/style/css.cjs +1 -0
  92. package/lib/src/business/ag-grid-modal/style/css.d.ts +0 -0
  93. package/lib/src/business/ag-grid-modal/style/index.cjs +1 -0
  94. package/lib/src/business/ag-grid-modal/style/index.d.ts +0 -0
  95. package/lib/src/business/ag-grid-modal/utils.d.ts +54 -0
  96. package/lib/src/business/ag-grid-modal/utils.js +1 -0
  97. package/lib/src/business/ag-grid-modal/wrapper/index.vue.d.ts +23 -0
  98. package/lib/src/business/ag-grid-modal/wrapper/index.vue.js +1 -0
  99. package/lib/src/business/ag-grid-modal/wrapper/index.vue2.js +1 -0
  100. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -0
  101. package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +1 -0
  102. package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +1 -0
  103. package/lib/src/business/ap-table-modal/index.d.ts +3 -0
  104. package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
  105. package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
  106. package/lib/src/business/hooks/usePageListApTable.d.ts +1 -0
  107. package/lib/src/business/index.d.ts +1 -0
  108. package/lib/src/business/index.js +1 -1
  109. package/lib/src/index.js +1 -1
  110. package/lib/src/path-map.js +1 -1
  111. package/lib/src/version.d.ts +1 -1
  112. package/lib/src/version.js +1 -1
  113. package/package.json +3 -3
  114. package/theme/ag-grid/index.css +3 -0
  115. package/theme/ag-grid-modal/index.css +789 -0
  116. package/theme/ag-grid-modal/index.less +73 -0
  117. package/theme/ag-grid-modal/selected-items.css +72 -0
  118. package/theme/ag-grid-modal/selected-items.less +34 -0
  119. package/theme/ap-form/ap-form-item.css +3 -0
  120. package/theme/ap-form/ap-form-item.less +3 -0
  121. package/theme/ap-form/index.css +3 -0
  122. package/theme/ap-form/search-form.css +3 -0
  123. package/theme/ap-grid/index.css +3 -0
  124. package/theme/ap-table/ap-table.css +3 -0
  125. package/theme/ap-table-modal/index.css +3 -0
  126. package/theme/ap-upload/index.css +5 -0
  127. package/theme/ap-upload/multiple-file.css +5 -0
  128. package/theme/ap-upload/multiple-file.less +6 -0
  129. package/theme/editable-table/index.css +3 -0
  130. package/theme/index.css +96 -0
  131. package/theme/index.less +2 -0
@@ -0,0 +1,165 @@
1
+ import { defineComponent as L, reactive as q, createVNode as i, onUnmounted as v } from "vue";
2
+ import { ApModal as G } from "../../../ap-modal/index.mjs";
3
+ import "../../../ag-grid/index.mjs";
4
+ import { AsyncCallback as H, genRequest as T, delRowKeyField as F, addRowKeyField as D, getModalLayoutConfig as b } from "../utils.mjs";
5
+ import { useAgGridInstance as E } from "./use-ag-grid-instance.mjs";
6
+ import { isFunction as m, isEmpty as p, omitBy as U, isUndefined as W, omit as K } from "lodash-unified";
7
+ import { ROW_KEY as $ } from "../constants.mjs";
8
+ import { useModalTitle as z } from "./use-modal-title.mjs";
9
+ import { message as B } from "@aplus-frontend/antdv";
10
+ import "../../../config-provider/index.mjs";
11
+ import "../modal-layout/index.vue.mjs";
12
+ import "../wrapper/index.vue.mjs";
13
+ import { useLocale as N } from "../../../config-provider/hooks/use-locale.mjs";
14
+ import V from "../wrapper/index.vue2.mjs";
15
+ import Y from "../modal-layout/index.vue2.mjs";
16
+ import J from "../../../ag-grid/index.vue.mjs";
17
+ function fe(o) {
18
+ let d, f = null, g = null;
19
+ const c = new H(), [k, x] = z(), {
20
+ t: S
21
+ } = N(), [a, M] = E({
22
+ onSelectedRows(e) {
23
+ x.setCount(e?.length || 0);
24
+ }
25
+ }), y = T(o.api, o.getRowKey, a.setDataSourceLength), w = (e) => {
26
+ const {
27
+ title: t,
28
+ width: n,
29
+ modalProps: r,
30
+ ...s
31
+ } = m(e) ? e(o) : e;
32
+ p(s) || g?.(s);
33
+ const l = U({
34
+ title: t,
35
+ width: n,
36
+ modalProps: r
37
+ }, W);
38
+ p(l) || f?.update(l);
39
+ }, u = m(o.getRowKey) ? o.getRowKey : (e) => e[o.getRowKey], I = () => {
40
+ const e = o.mergeRule || "old", t = a.getSelectedRows() || [];
41
+ return {
42
+ keys: _(t),
43
+ rows: t.map((s) => {
44
+ const l = u(s);
45
+ return e === "old" && d?.[l] ? d[l] : F(s);
46
+ })
47
+ };
48
+ }, C = async () => {
49
+ const e = I(), t = o.maxCount || 1 / 0;
50
+ return e.keys.length > t ? (B.warning(S("ap.apTableModal.messageMaxCount", {
51
+ maxCount: t
52
+ })), Promise.reject()) : (await o.beforeOk?.(e), o.finishCallback?.(e), c.resolve(e), e);
53
+ }, O = () => {
54
+ c.reject("modal is closed!");
55
+ }, P = /* @__PURE__ */ L({
56
+ name: "AgGridModalSelectContent",
57
+ props: {
58
+ modalConfig: {
59
+ type: Object,
60
+ required: !0
61
+ },
62
+ selectedRows: {
63
+ type: Array,
64
+ default: () => []
65
+ }
66
+ },
67
+ setup(e) {
68
+ const t = q(e.modalConfig);
69
+ return g = (n) => {
70
+ Object.assign(t, n);
71
+ }, () => {
72
+ const n = e.selectedRows?.map((r) => D(r, t.getRowKey));
73
+ return i(M, null, {
74
+ default: () => [i(V, {
75
+ rowHeight: t.rowHeight
76
+ }, {
77
+ default: () => [o.renderHeader?.(K(a, "setInstance"), {
78
+ updateProps: w
79
+ }), i(Y, b(t.modalLayout).props, {
80
+ default: () => [i(J, {
81
+ ref: a.setInstance,
82
+ searchForm: {
83
+ sortable: !1,
84
+ resize: {
85
+ target: "form"
86
+ }
87
+ },
88
+ rowKey: m(t.getRowKey) ? $ : t.getRowKey,
89
+ request: y.request,
90
+ style: {
91
+ padding: "0px"
92
+ },
93
+ rowHeight: t.rowHeight,
94
+ columns: t.columns,
95
+ rowSelection: {
96
+ defaultSelectedRows: n,
97
+ preserveSelectedRowKeys: !0,
98
+ type: t.mode || "checkbox",
99
+ fixed: "left",
100
+ columnWidth: 38,
101
+ disabled(r) {
102
+ return m(t.disabledCheckbox) ? t.disabledCheckbox(r, K(a, "setInstance")) : t.disabledCheckbox ?? !1;
103
+ }
104
+ }
105
+ }, t.gridSlots)],
106
+ ...b(t.modalLayout).slots
107
+ })]
108
+ })]
109
+ });
110
+ };
111
+ }
112
+ });
113
+ function R(e) {
114
+ return i(P, {
115
+ modalConfig: o,
116
+ selectedRows: e
117
+ }, null);
118
+ }
119
+ function A() {
120
+ const e = Object.values(d || {}), t = R(e);
121
+ f = G.createModal({
122
+ title: i(k, {
123
+ title: o.title,
124
+ maxCount: o.maxCount || 1 / 0
125
+ }, o.modalTitleSlots),
126
+ width: o.width,
127
+ destroyOnClose: !0,
128
+ maskClosable: !1,
129
+ onOk: C,
130
+ onCancel: O,
131
+ afterOpenChange(n) {
132
+ n === !1 && (a.setInstance(void 0), a.setDataSourceLength(0));
133
+ },
134
+ content: t,
135
+ ...o.modalProps || {}
136
+ });
137
+ }
138
+ function _(e) {
139
+ return e?.map(u) || [];
140
+ }
141
+ function h(e, t, n = !1) {
142
+ if (d = e?.reduce((r, s) => {
143
+ const l = u(s);
144
+ return r[l] = s, r;
145
+ }, {}), y.setExtraParams(t?.extraParams), A(), n)
146
+ return c.buildPromise();
147
+ }
148
+ function j(e, t) {
149
+ return h(e, t, !0);
150
+ }
151
+ return v(() => {
152
+ c.reject("component is Unmounted!");
153
+ }), {
154
+ open: h,
155
+ asyncOpen: j,
156
+ refresh: a.refresh,
157
+ getAgGridInstance: a.getInstance,
158
+ genContent: R,
159
+ validate: C,
160
+ updateProps: w
161
+ };
162
+ }
163
+ export {
164
+ fe as useAgGridSelectModal
165
+ };
@@ -0,0 +1,24 @@
1
+ import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ export declare function useModalTitle(): readonly [ DefineComponent<ExtractPropTypes<{
3
+ title: {
4
+ type: any;
5
+ default: null;
6
+ };
7
+ maxCount: {
8
+ type: NumberConstructor;
9
+ required: true;
10
+ };
11
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
12
+ title: {
13
+ type: any;
14
+ default: null;
15
+ };
16
+ maxCount: {
17
+ type: NumberConstructor;
18
+ required: true;
19
+ };
20
+ }>> & Readonly<{}>, {
21
+ title: any;
22
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
23
+ readonly setCount: (data: number) => void;
24
+ }];
@@ -0,0 +1,49 @@
1
+ import { ref as n, defineComponent as u, createVNode as a } from "vue";
2
+ import "../../../config-provider/index.mjs";
3
+ import { useLocale as i } from "../../../config-provider/hooks/use-locale.mjs";
4
+ function d() {
5
+ const e = n(0);
6
+ return [/* @__PURE__ */ u({
7
+ props: {
8
+ title: {
9
+ type: null,
10
+ default: null
11
+ },
12
+ maxCount: {
13
+ type: Number,
14
+ required: !0
15
+ }
16
+ },
17
+ setup(t, {
18
+ slots: l
19
+ }) {
20
+ const {
21
+ t: o
22
+ } = i();
23
+ return () => a("div", null, [t.title, l.default ? l.default({
24
+ maxCount: t.maxCount,
25
+ count: e.value
26
+ }) : a("span", {
27
+ style: {
28
+ color: "var(--ap-text-color-3)",
29
+ fontSize: "12px",
30
+ fontWeight: "normal",
31
+ marginLeft: "12px"
32
+ }
33
+ }, [isFinite(t.maxCount) ? o("ap.apTableModal.titleSuffixOne", {
34
+ maxCount: t.maxCount
35
+ }) : "", o("ap.apTableModal.titleSuffixTwo"), a("span", {
36
+ style: {
37
+ color: "var(--ap-color-primary)"
38
+ }
39
+ }, [e.value]), o("ap.apTableModal.titleSuffixThree")])]);
40
+ }
41
+ }), {
42
+ setCount: (t) => {
43
+ e.value = t;
44
+ }
45
+ }];
46
+ }
47
+ export {
48
+ d as useModalTitle
49
+ };
@@ -0,0 +1,3 @@
1
+ export { useAgGridModal } from './hooks/use-ag-grid-modal';
2
+ export { useAgGridSelectModal } from './hooks/use-ag-grid-select-modal';
3
+ export { ApSelectedItems } from './selected-items';
@@ -0,0 +1,8 @@
1
+ import { useAgGridModal as r } from "./hooks/use-ag-grid-modal.mjs";
2
+ import { useAgGridSelectModal as d } from "./hooks/use-ag-grid-select-modal.mjs";
3
+ import { ApSelectedItems as m } from "./selected-items/index.mjs";
4
+ export {
5
+ m as ApSelectedItems,
6
+ r as useAgGridModal,
7
+ d as useAgGridSelectModal
8
+ };
@@ -0,0 +1,141 @@
1
+ import { StyleValue, VNodeChild } from 'vue';
2
+ import { AgGridColumnType, AgGridExpose, AgGridProps, AgGridSlots } from '../../ag-grid';
3
+ import { CreateModalFuncProps } from '../../ap-modal';
4
+ import { Recordable } from '../../type';
5
+ import { GridApi } from './hooks/use-ag-grid-instance';
6
+ export type GetRowKey<TableRowType> = ((record: TableRowType) => string | number) | string;
7
+ export type UpdatePropsFn<T> = (props: Partial<AgGridPreviewModalProps<T>> | ((props: AgGridPreviewModalProps<T>) => Partial<AgGridPreviewModalProps<T>>)) => void;
8
+ export type UpdateSelectPropsFn<T> = (props: Partial<AgGridSelectModalProps<T>> | ((props: AgGridSelectModalProps<T>) => Partial<AgGridSelectModalProps<T>>)) => void;
9
+ /** AgGridModal 基础类型 */
10
+ export interface AgGridModalBasicProps<TableRowType = any> {
11
+ title?: VNodeChild;
12
+ width?: string | number;
13
+ modalProps?: Omit<CreateModalFuncProps, 'content'>;
14
+ columns: AgGridColumnType<TableRowType, any>[];
15
+ getRowKey: GetRowKey<TableRowType>;
16
+ api?: (params: any) => Promise<RequestReturn<TableRowType>>;
17
+ /** 渲染头部信息 */
18
+ renderHeader?: (gridApi: Omit<GridApi, 'setInstance'>, modalApi: {
19
+ updateProps: UpdatePropsFn<TableRowType>;
20
+ }) => VNodeChild;
21
+ rowHeight?: number;
22
+ }
23
+ /** 刷新方式 */
24
+ export type RefreshType = 'reset' | 'submit' | 'submitWith';
25
+ /** 只读模式 */
26
+ export interface AgGridPreviewModalProps<RowType = any> extends AgGridModalBasicProps<RowType> {
27
+ /** ag-grid 插槽 */
28
+ gridSlots?: AgGridSlots<RowType>;
29
+ }
30
+ /** 只读模式返回值 */
31
+ export interface PreviewModalReturnType<RowType = any> {
32
+ /** 打开弹框 */
33
+ open(opt?: OpenOptions): void;
34
+ /** 刷新表格数据 */
35
+ refresh: (type: RefreshType) => void;
36
+ /** 获取ag-grid实例 */
37
+ getAgGridInstance: () => AgGridExpose | undefined;
38
+ /** 修改hook的props */
39
+ updateProps: UpdatePropsFn<RowType>;
40
+ }
41
+ export interface OpenOptions {
42
+ /** 发起网络请求携带的额外参数 */
43
+ extraParams?: Recordable;
44
+ }
45
+ /** 可选模式 */
46
+ export interface AgGridSelectModalProps<RowType = any> extends AgGridModalBasicProps<RowType> {
47
+ /** ag-grid 插槽 */
48
+ gridSlots?: AgGridSlots<RowType>;
49
+ /**
50
+ * 选择模式
51
+ * - radio: 单选模式
52
+ * - checkbox: 多选模式
53
+ * @default 'checkbox'
54
+ */
55
+ mode?: 'radio' | 'checkbox';
56
+ /**
57
+ * 合并规则
58
+ * - old 老数据优先
59
+ * - new 新数据优先
60
+ * @default 'old'
61
+ */
62
+ mergeRule?: 'old' | 'new';
63
+ /** 点击确认后执行的回调 */
64
+ finishCallback?: (data: OpenReturnType<RowType>) => void;
65
+ /** 最多选择多少条 */
66
+ maxCount?: number;
67
+ /** 禁用选项 */
68
+ disabledCheckbox?: boolean | ((record: RowType, actions: Omit<GridApi, 'setInstance'>) => boolean);
69
+ /** 额外的rowSelection配置 */
70
+ rowSelection?: Omit<AgGridProps['rowSelection'], 'disabled'>;
71
+ /** modal标题插槽 */
72
+ modalTitleSlots?: ModalTitleSlots;
73
+ /** 在finishCallback执行前执行,返回reject终止后续执行 */
74
+ beforeOk?: (data: OpenReturnType<RowType>) => Promise<any> | void;
75
+ /** 设置是否是复杂布局 */
76
+ modalLayout?: ModalLayoutConfig<RowType>;
77
+ }
78
+ export interface SelectModalReturnType<T = any> {
79
+ /** 打开弹框 */
80
+ open: (selectRows?: T[], options?: OpenOptions, isAsync?: boolean) => Promise<OpenReturnType<T>> | undefined;
81
+ /** 异步打开弹框 */
82
+ asyncOpen: (selectRows?: T[], options?: OpenOptions) => Promise<OpenReturnType<T>>;
83
+ /** 刷新表格数据 */
84
+ refresh: (type?: RefreshType) => void;
85
+ /** 获取表格实例 */
86
+ getAgGridInstance: () => AgGridExpose | undefined;
87
+ /** 获取原子化内容 */
88
+ genContent: (selectedRows?: T[]) => VNodeChild;
89
+ /** 获取数据并校验 */
90
+ validate: () => Promise<OpenReturnType<T>>;
91
+ /** 修改hook的props */
92
+ updateProps: UpdateSelectPropsFn<T>;
93
+ }
94
+ export interface RequestReturn<T = any> {
95
+ records: T[];
96
+ total: number;
97
+ }
98
+ /** open打开方法返回的值的类型 */
99
+ export interface OpenReturnType<RowType> {
100
+ keys: (string | number)[];
101
+ rows: RowType[];
102
+ }
103
+ /** modal-title slots */
104
+ export interface ModalTitleSlots {
105
+ /** 标题 suffix 插槽 */
106
+ default: (props: {
107
+ maxCount: number;
108
+ count: number;
109
+ }) => VNodeChild;
110
+ }
111
+ /** 弹框布局props */
112
+ export interface ModalLayoutProps {
113
+ /** 左侧标题 */
114
+ leftTitle?: string | VNodeChild;
115
+ /** 右侧内容样式 */
116
+ rightContentStyle?: StyleValue;
117
+ /** 中间分割线向上偏移量 */
118
+ dividerOffset?: number;
119
+ /** 是否有边框 */
120
+ bordered?: boolean;
121
+ }
122
+ /** modal-layout配置 */
123
+ export interface ModalLayoutConfig<T = any> extends ModalLayoutProps {
124
+ /** 右侧标题插槽 */
125
+ rightTitle?: (selectedCount: number) => any;
126
+ /** 右侧底部插槽 */
127
+ rightBottom?: (props: {
128
+ records: T[];
129
+ actions: {
130
+ deleteItem: (record: T) => void;
131
+ };
132
+ }) => any;
133
+ /** 已经选择item渲染, 选择项渲染插槽 */
134
+ renderSelectedItem: (props: {
135
+ record: T;
136
+ actions: {
137
+ deleteItem: (record: T) => void;
138
+ deleteCurrent: () => void;
139
+ };
140
+ }) => any;
141
+ }
@@ -0,0 +1,44 @@
1
+ import { ModalLayoutProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, VNodeArrayChildren, VNode, RendererNode, RendererElement, ComponentProvideOptions } from 'vue';
3
+ type __VLS_Props = ModalLayoutProps & {
4
+ layoutType?: 'two-column';
5
+ };
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: {
9
+ default?(_: {}): any;
10
+ default?(_: {}): any;
11
+ rightTitle?(_: {
12
+ count: number;
13
+ }): any;
14
+ renderSelectedItem?(_: {
15
+ record: any;
16
+ actions: {
17
+ deleteItem: (record: any) => void;
18
+ deleteCurrent: () => void;
19
+ };
20
+ }): any;
21
+ rightBottom?(_: {
22
+ records: any[];
23
+ actions: {
24
+ deleteItem: (record: any) => void;
25
+ };
26
+ }): any;
27
+ };
28
+ refs: {};
29
+ rootEl: any;
30
+ };
31
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
32
+ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
33
+ leftTitle: string | number | boolean | void | VNodeArrayChildren | VNode<RendererNode, RendererElement, {
34
+ [key: string]: any;
35
+ }> | null;
36
+ layoutType: "two-column";
37
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,106 @@
1
+ import { defineComponent as N, computed as I, createElementBlock as p, renderSlot as a, openBlock as n, normalizeStyle as g, normalizeClass as o, unref as e, createElementVNode as i, createBlock as v, createCommentVNode as h, withCtx as s, resolveDynamicComponent as M, h as O, Fragment as b, createVNode as m, createTextVNode as S, toDisplayString as T, renderList as V } from "vue";
2
+ import "../../../config-provider/index.mjs";
3
+ import { ApTitle as k } from "../../ap-title/index.mjs";
4
+ import { Button as w, Empty as C } from "@aplus-frontend/antdv";
5
+ import { useAgGridModalInject as L } from "../hooks/use-ag-grid-instance.mjs";
6
+ import { useLocale as j } from "../../../config-provider/hooks/use-locale.mjs";
7
+ import { useNamespace as x } from "../../../config-provider/hooks/use-namespace.mjs";
8
+ const H = /* @__PURE__ */ N({
9
+ __name: "index",
10
+ props: {
11
+ leftTitle: { type: [String, Object, Number, Boolean, null, Array], default: "" },
12
+ rightContentStyle: { type: [Boolean, null, String, Object, Array] },
13
+ dividerOffset: {},
14
+ bordered: { type: Boolean },
15
+ layoutType: { default: void 0 }
16
+ },
17
+ setup(B) {
18
+ const { t: f } = j(), d = L(), r = I(() => d?.selectedRows?.value || []), y = B, E = () => {
19
+ if (y.dividerOffset != null)
20
+ return {
21
+ "--ag-grid-modal-layout-divider-offset": `${y.dividerOffset}px`
22
+ };
23
+ }, $ = () => {
24
+ d?.clearAllSelected();
25
+ }, u = (t) => {
26
+ d?.removeSelected(t);
27
+ }, { e: A, m: l } = x("ag-grid-modal");
28
+ return (t, D) => t.layoutType === "two-column" ? (n(), p("div", {
29
+ key: 0,
30
+ class: o([e(l)("table-layout"), t.bordered ? e(l)("bordered") : ""]),
31
+ style: g(E())
32
+ }, [
33
+ i("div", {
34
+ class: o(e(l)("table-layout-left"))
35
+ }, [
36
+ t.leftTitle ? (n(), v(e(k), {
37
+ key: 0,
38
+ style: { "margin-bottom": "16px" }
39
+ }, {
40
+ prefix: s(() => [
41
+ (n(), v(M(O(b, [t.leftTitle]))))
42
+ ]),
43
+ _: 1
44
+ })) : h("", !0),
45
+ i("div", {
46
+ class: o(e(l)("table-layout-left-content"))
47
+ }, [
48
+ a(t.$slots, "default")
49
+ ], 2)
50
+ ], 2),
51
+ i("div", {
52
+ class: o(e(l)("table-layout-right")),
53
+ style: g(t.rightContentStyle)
54
+ }, [
55
+ m(e(k), null, {
56
+ prefix: s(() => [
57
+ a(t.$slots, "rightTitle", {
58
+ count: r.value.length
59
+ }, () => [
60
+ S(T(`${e(f)("ap.apTableModal.selected")} (${r.value.length})`), 1)
61
+ ])
62
+ ]),
63
+ suffix: s(() => [
64
+ m(e(w), {
65
+ type: "link",
66
+ style: { padding: "0px", height: "22px", "border-width": "0px" },
67
+ onClick: $
68
+ }, {
69
+ default: s(() => [
70
+ S(T(e(f)("ap.apTableModal.clear")), 1)
71
+ ]),
72
+ _: 1
73
+ })
74
+ ]),
75
+ _: 3
76
+ }),
77
+ i("div", {
78
+ class: o(e(l)("table-layout-right-content"))
79
+ }, [
80
+ (n(!0), p(b, null, V(r.value, (c) => a(t.$slots, "renderSelectedItem", {
81
+ key: c,
82
+ record: c,
83
+ actions: { deleteItem: u, deleteCurrent: () => u(c) }
84
+ })), 128)),
85
+ r.value.length === 0 ? (n(), p("div", {
86
+ key: 0,
87
+ class: o(e(A)("empty"))
88
+ }, [
89
+ m(e(C), {
90
+ image: e(C).PRESENTED_IMAGE_SIMPLE
91
+ }, null, 8, ["image"])
92
+ ], 2)) : h("", !0)
93
+ ], 2),
94
+ i("div", null, [
95
+ a(t.$slots, "rightBottom", {
96
+ records: r.value,
97
+ actions: { deleteItem: u }
98
+ })
99
+ ])
100
+ ], 6)
101
+ ], 6)) : a(t.$slots, "default", { key: 1 });
102
+ }
103
+ });
104
+ export {
105
+ H as default
106
+ };
@@ -0,0 +1,25 @@
1
+ import { StyleValue, DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ type __VLS_Props = {
3
+ style?: StyleValue;
4
+ };
5
+ declare function __VLS_template(): {
6
+ attrs: Partial<{}>;
7
+ slots: {
8
+ default?(_: {}): any;
9
+ };
10
+ refs: {};
11
+ rootEl: HTMLDivElement;
12
+ };
13
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
+ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
15
+ clickDel: (...args: any[]) => void;
16
+ }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ onClickDel?: ((...args: any[]) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
19
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
20
+ export default _default;
21
+ type __VLS_WithTemplateSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./default.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,33 @@
1
+ import { defineComponent as c, createElementBlock as i, openBlock as m, normalizeClass as l, unref as e, normalizeStyle as p, createElementVNode as n, renderSlot as d, createVNode as f } from "vue";
2
+ import { IconApAdLineCloseDrawer as u } from "@aplus-frontend/icon";
3
+ import "../../../config-provider/index.mjs";
4
+ import { useNamespace as k } from "../../../config-provider/hooks/use-namespace.mjs";
5
+ const N = /* @__PURE__ */ c({
6
+ __name: "default",
7
+ props: {
8
+ style: { type: [Boolean, null, String, Object, Array] }
9
+ },
10
+ emits: ["clickDel"],
11
+ setup(y, { emit: s }) {
12
+ const { e: t } = k("ap-selected-items"), r = s, a = () => r("clickDel");
13
+ return (o, _) => (m(), i("div", {
14
+ style: p(o.style),
15
+ class: l(e(t)("default"))
16
+ }, [
17
+ n("div", {
18
+ class: l(e(t)("default-content"))
19
+ }, [
20
+ d(o.$slots, "default")
21
+ ], 2),
22
+ n("span", {
23
+ class: l(e(t)("del-icon")),
24
+ onClick: a
25
+ }, [
26
+ f(e(u))
27
+ ], 2)
28
+ ], 6));
29
+ }
30
+ });
31
+ export {
32
+ N as default
33
+ };
@@ -0,0 +1,36 @@
1
+ import { CreateComponentPublicInstanceWithMixins, StyleValue, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps } from 'vue';
2
+ export declare const ApSelectedItems: {
3
+ Default: {
4
+ new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
5
+ style?: StyleValue;
6
+ }> & Readonly<{
7
+ onClickDel?: ((...args: any[]) => any) | undefined;
8
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
9
+ clickDel: (...args: any[]) => void;
10
+ }, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
11
+ P: {};
12
+ B: {};
13
+ D: {};
14
+ C: {};
15
+ M: {};
16
+ Defaults: {};
17
+ }, Readonly<{
18
+ style?: StyleValue;
19
+ }> & Readonly<{
20
+ onClickDel?: ((...args: any[]) => any) | undefined;
21
+ }>, {}, {}, {}, {}, {}>;
22
+ __isFragment?: never;
23
+ __isTeleport?: never;
24
+ __isSuspense?: never;
25
+ } & ComponentOptionsBase<Readonly<{
26
+ style?: StyleValue;
27
+ }> & Readonly<{
28
+ onClickDel?: ((...args: any[]) => any) | undefined;
29
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
30
+ clickDel: (...args: any[]) => void;
31
+ }, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
32
+ $slots: {
33
+ default?(_: {}): any;
34
+ };
35
+ });
36
+ };
@@ -0,0 +1,8 @@
1
+ import "./default.vue.mjs";
2
+ import t from "./default.vue2.mjs";
3
+ const o = {
4
+ Default: t
5
+ };
6
+ export {
7
+ o as ApSelectedItems
8
+ };
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ag-grid-modal/selected-items.css';
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ag-grid-modal/selected-items.less';
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ag-grid-modal/index.css';