@aplus-frontend/ui 6.21.1 → 6.22.0-beta.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.
- package/es/index.mjs +27 -25
- package/es/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.d.ts +2 -9
- package/es/src/ag-grid/components/body-cell/index.vue2.mjs +27 -0
- package/{lib/src/ap-pro-card/components/divider → es/src/ag-grid/components/header-cell}/index.vue.d.ts +2 -9
- package/es/src/ag-grid/components/header-cell/index.vue2.mjs +59 -0
- package/es/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
- package/es/src/ag-grid/hooks/use-row-selection.mjs +98 -0
- package/es/src/ag-grid/index.d.ts +3 -0
- package/es/src/ag-grid/index.mjs +2 -0
- package/es/src/ag-grid/index.vue.d.ts +41 -0
- package/es/src/ag-grid/index.vue.mjs +377 -0
- package/es/src/ag-grid/index.vue2.mjs +4 -0
- package/es/src/ag-grid/interface.d.ts +194 -0
- package/es/src/ag-grid/interface.mjs +1 -0
- package/es/src/ag-grid/style/css.d.ts +0 -0
- package/es/src/ag-grid/style/css.js +1 -0
- package/es/src/ag-grid/style/index.d.ts +0 -0
- package/es/src/ag-grid/style/index.js +1 -0
- package/es/src/ap-grid/index.vue.mjs +1 -1
- package/es/src/ap-grid/utils/col.d.ts +11 -0
- package/es/src/ap-grid/utils/col.mjs +99 -95
- package/es/src/ap-pro-card/components/card/index.vue2.mjs +37 -37
- package/es/src/ap-pro-card/index.d.ts +41 -9
- package/es/src/ap-pro-card/index.mjs +4 -10
- package/es/src/ap-pro-card/interface.d.ts +2 -2
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +293 -290
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ag-grid/components/body-cell/index.vue.d.ts +6 -0
- package/lib/src/ag-grid/components/body-cell/index.vue2.js +1 -0
- package/lib/src/ag-grid/components/header-cell/index.vue.d.ts +6 -0
- package/lib/src/ag-grid/components/header-cell/index.vue2.js +1 -0
- package/lib/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
- package/lib/src/ag-grid/hooks/use-row-selection.js +1 -0
- package/lib/src/ag-grid/index.d.ts +3 -0
- package/lib/src/ag-grid/index.js +1 -0
- package/lib/src/ag-grid/index.vue.d.ts +41 -0
- package/lib/src/ag-grid/index.vue.js +1 -0
- package/lib/src/ag-grid/index.vue2.js +1 -0
- package/lib/src/ag-grid/interface.d.ts +194 -0
- package/lib/src/ag-grid/interface.js +1 -0
- package/lib/src/ag-grid/style/css.cjs +1 -0
- package/lib/src/ag-grid/style/css.d.ts +0 -0
- package/lib/src/ag-grid/style/index.cjs +1 -0
- package/lib/src/ag-grid/style/index.d.ts +0 -0
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-grid/utils/col.d.ts +11 -0
- package/lib/src/ap-grid/utils/col.js +1 -1
- package/lib/src/ap-pro-card/components/card/index.vue2.js +1 -1
- package/lib/src/ap-pro-card/index.d.ts +41 -9
- package/lib/src/ap-pro-card/index.js +1 -1
- package/lib/src/ap-pro-card/interface.d.ts +2 -2
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -1
- package/theme/ap-grid/index.css +3 -0
- package/theme/ap-grid/index.less +3 -0
- package/theme/ap-pro-card/index.css +0 -52
- package/theme/ap-pro-card/index.less +0 -56
- package/theme/index.css +164 -55
- package/theme/index.less +1 -0
- package/es/src/ap-pro-card/components/divider/index.vue2.mjs +0 -29
- package/es/src/ap-pro-card/components/title/index.vue.d.ts +0 -23
- package/es/src/ap-pro-card/components/title/index.vue2.mjs +0 -28
- package/lib/src/ap-pro-card/components/divider/index.vue2.js +0 -1
- package/lib/src/ap-pro-card/components/title/index.vue.d.ts +0 -23
- package/lib/src/ap-pro-card/components/title/index.vue2.js +0 -1
- /package/es/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.mjs +0 -0
- /package/es/src/{ap-pro-card/components/title → ag-grid/components/header-cell}/index.vue.mjs +0 -0
- /package/lib/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.js +0 -0
- /package/lib/src/{ap-pro-card/components/title → ag-grid/components/header-cell}/index.vue.js +0 -0
package/es/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import p from "./src/version.mjs";
|
|
|
4
4
|
import "./src/hooks/index.mjs";
|
|
5
5
|
import { configProviderProps as A } from "./src/config-provider/config-provider-props.mjs";
|
|
6
6
|
import { DEFAULT_NAMESPACE as n, DEFAULT_UIMODE as c, configProviderContextKey as F } from "./src/config-provider/constants.mjs";
|
|
7
|
-
import { keysOf as T, provideGlobalConfig as b, useGlobalConfig as
|
|
7
|
+
import { keysOf as T, provideGlobalConfig as b, useGlobalConfig as g } from "./src/config-provider/hooks/use-global-config.mjs";
|
|
8
8
|
import { buildLocaleContext as S, buildTranslator as D, localeContextKey as G, translate as h, useLocale as P } from "./src/config-provider/hooks/use-locale.mjs";
|
|
9
9
|
import { defaultNamespace as E, namespaceContextKey as L, useGetDerivedNamespace as M, useNamespace as N } from "./src/config-provider/hooks/use-namespace.mjs";
|
|
10
10
|
import { ConfigProvider as y, globalConfigCached as w } from "./src/config-provider/config-provider.mjs";
|
|
@@ -27,7 +27,7 @@ import { default as Ae } from "./src/ap-form/list/index.vue.mjs";
|
|
|
27
27
|
import { default as ne } from "./src/ap-form/search-form/index.vue.mjs";
|
|
28
28
|
import { default as Fe } from "./src/ap-form/modal-form/index.vue.mjs";
|
|
29
29
|
import { default as Te } from "./src/ap-form/dependency/index.vue.mjs";
|
|
30
|
-
import { default as
|
|
30
|
+
import { default as ge } from "./src/ap-form/set/index.vue.mjs";
|
|
31
31
|
import { default as Se } from "./src/ap-form/drawer-form/index.vue.mjs";
|
|
32
32
|
import { default as Ge } from "./src/ap-form/render/control.vue.mjs";
|
|
33
33
|
import { default as Pe } from "./src/ap-form/render/item.vue.mjs";
|
|
@@ -53,7 +53,7 @@ import { default as Ao } from "./src/ap-action/item-modal/index.vue.mjs";
|
|
|
53
53
|
import { default as no } from "./src/ap-action/item-popconfirm/index.vue.mjs";
|
|
54
54
|
import { default as Fo } from "./src/ap-action/item-dropdown/index.vue.mjs";
|
|
55
55
|
import { default as To } from "./src/ap-action/group/index.vue.mjs";
|
|
56
|
-
import { DictCode as
|
|
56
|
+
import { DictCode as go, langMap as Co } from "./src/work-order-modal/interfaces.mjs";
|
|
57
57
|
import { createWorkOrderModal as Do } from "./src/work-order-modal/createWorkOrder.mjs";
|
|
58
58
|
import { default as ho } from "./src/work-order-modal/work-order-modal.vue.mjs";
|
|
59
59
|
import { default as Ro } from "./src/ap-tag/ap-tag.vue.mjs";
|
|
@@ -80,7 +80,7 @@ import { ApBatchAction as ir } from "./src/business/ap-batch-action/index.mjs";
|
|
|
80
80
|
import { ApBatchActionGroup as cr } from "./src/business/ap-batch-action-group/index.mjs";
|
|
81
81
|
import { ApButtonGroup as Ir } from "./src/business/ap-button-group/index.mjs";
|
|
82
82
|
import { ApCard as br } from "./src/business/ap-card/index.mjs";
|
|
83
|
-
import { ApExpandAlert as
|
|
83
|
+
import { ApExpandAlert as Cr } from "./src/business/ap-expand-alert/index.mjs";
|
|
84
84
|
import { ApExportGroupActionType as Dr } from "./src/business/ap-export-group/interface.mjs";
|
|
85
85
|
import { ApExportGroup as hr } from "./src/business/ap-export-group/index.mjs";
|
|
86
86
|
import { handleExportDownload as Rr } from "./src/business/ap-export-group/handleExportDownload.mjs";
|
|
@@ -104,7 +104,7 @@ import { ApAppendix as At } from "./src/business/ap-appendix/index.mjs";
|
|
|
104
104
|
import { default as nt } from "./src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.mjs";
|
|
105
105
|
import { default as Ft } from "./src/business/batch-input-group/index.vue.mjs";
|
|
106
106
|
import { default as Tt } from "./src/business/batch-input-group/form-item.vue.mjs";
|
|
107
|
-
import { ApSizeInput as
|
|
107
|
+
import { ApSizeInput as gt } from "./src/business/ap-size-input/index.mjs";
|
|
108
108
|
import { ApProductInfo as St } from "./src/business/ap-product-info/index.mjs";
|
|
109
109
|
import { ApCopy as Gt } from "./src/business/ap-copy/index.mjs";
|
|
110
110
|
import { ApView as Pt } from "./src/business/ap-view/index.mjs";
|
|
@@ -131,18 +131,19 @@ import { default as ip } from "./src/resize-observer/index.vue.mjs";
|
|
|
131
131
|
import { ROW_SELECTION_FIELD as cp } from "./src/ap-grid/constants.mjs";
|
|
132
132
|
import { toTreeArray as Ip } from "./src/ap-grid/utils/to-tree-array.mjs";
|
|
133
133
|
import { default as bp } from "./src/ap-grid/index.vue.mjs";
|
|
134
|
-
import { default as
|
|
134
|
+
import { default as Cp } from "./src/ap-grid/editable/index.vue.mjs";
|
|
135
135
|
import { default as Dp } from "./src/ap-grid/editable/form-item.vue.mjs";
|
|
136
136
|
import { default as hp } from "./src/text/index.vue.mjs";
|
|
137
137
|
import { default as Rp } from "./src/text/group.vue.mjs";
|
|
138
138
|
import { default as Lp } from "./src/mask/index.vue.mjs";
|
|
139
139
|
import { Splitter as Np } from "./src/splitter/index.mjs";
|
|
140
|
-
import {
|
|
141
|
-
import {
|
|
142
|
-
import {
|
|
143
|
-
import {
|
|
144
|
-
import {
|
|
145
|
-
import {
|
|
140
|
+
import { default as yp } from "./src/ag-grid/index.vue.mjs";
|
|
141
|
+
import { useMessage as kp } from "./src/hooks/useMessage.mjs";
|
|
142
|
+
import { useControllableValue as Kp } from "./src/hooks/useControllableValue.mjs";
|
|
143
|
+
import { useManualRef as Up } from "./src/hooks/useManualRef.mjs";
|
|
144
|
+
import { useThrottleRef as _p } from "./src/hooks/useThrottleRef.mjs";
|
|
145
|
+
import { useFullScreen as Wp } from "./src/hooks/useFullScreen.mjs";
|
|
146
|
+
import { useResize as jp } from "./src/hooks/useResize.mjs";
|
|
146
147
|
const a = console.log;
|
|
147
148
|
a(`APlus-UI version ${p}`);
|
|
148
149
|
const l = {
|
|
@@ -155,6 +156,7 @@ const l = {
|
|
|
155
156
|
};
|
|
156
157
|
export {
|
|
157
158
|
B as APConfigProvider,
|
|
159
|
+
yp as AgGrid,
|
|
158
160
|
Qo as ApActionButton,
|
|
159
161
|
To as ApActionGroup,
|
|
160
162
|
so as ApActionItem,
|
|
@@ -175,7 +177,7 @@ export {
|
|
|
175
177
|
Ko as ApDownload,
|
|
176
178
|
_t as ApDraggableGrid,
|
|
177
179
|
er as ApDrawer,
|
|
178
|
-
|
|
180
|
+
Cr as ApExpandAlert,
|
|
179
181
|
hr as ApExportGroup,
|
|
180
182
|
Dr as ApExportGroupActionType,
|
|
181
183
|
Me as ApField,
|
|
@@ -216,7 +218,7 @@ export {
|
|
|
216
218
|
Fe as ApFormModalForm,
|
|
217
219
|
Ee as ApFormProvider,
|
|
218
220
|
ne as ApFormSearchForm,
|
|
219
|
-
|
|
221
|
+
ge as ApFormSet,
|
|
220
222
|
bp as ApGrid,
|
|
221
223
|
Nr as ApImage,
|
|
222
224
|
yr as ApInputRadio,
|
|
@@ -232,7 +234,7 @@ export {
|
|
|
232
234
|
St as ApProductInfo,
|
|
233
235
|
Et as ApRadioGroup,
|
|
234
236
|
zr as ApSelectLayout,
|
|
235
|
-
|
|
237
|
+
gt as ApSizeInput,
|
|
236
238
|
$r as ApStatus,
|
|
237
239
|
jr as ApStatusGroup,
|
|
238
240
|
xt as ApSummary,
|
|
@@ -254,8 +256,8 @@ export {
|
|
|
254
256
|
y as ConfigProvider,
|
|
255
257
|
n as DEFAULT_NAMESPACE,
|
|
256
258
|
c as DEFAULT_UIMODE,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
go as DictCode,
|
|
260
|
+
Cp as EditableGrid,
|
|
259
261
|
Dp as EditableGridFormItem,
|
|
260
262
|
Qt as EditableTable,
|
|
261
263
|
Yt as EditableTableFormItem,
|
|
@@ -291,7 +293,7 @@ export {
|
|
|
291
293
|
Rr as handleExportDownload,
|
|
292
294
|
Ut as isNameMatches,
|
|
293
295
|
T as keysOf,
|
|
294
|
-
|
|
296
|
+
Co as langMap,
|
|
295
297
|
G as localeContextKey,
|
|
296
298
|
Or as locales,
|
|
297
299
|
L as namespaceContextKey,
|
|
@@ -300,21 +302,21 @@ export {
|
|
|
300
302
|
Ip as toTreeArray,
|
|
301
303
|
h as translate,
|
|
302
304
|
Kt as useApKeepAliveInject,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
Kp as useControllableValue,
|
|
306
|
+
Wp as useFullScreen,
|
|
305
307
|
M as useGetDerivedNamespace,
|
|
306
|
-
|
|
308
|
+
g as useGlobalConfig,
|
|
307
309
|
rt as useGridRefresh,
|
|
308
310
|
P as useLocale,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
+
Up as useManualRef,
|
|
312
|
+
kp as useMessage,
|
|
311
313
|
N as useNamespace,
|
|
312
314
|
et as usePageListApGrid,
|
|
313
315
|
Qr as usePageListApTable,
|
|
314
|
-
|
|
316
|
+
jp as useResize,
|
|
315
317
|
lr as useTableModal,
|
|
316
318
|
jt as useTablePaging,
|
|
317
319
|
Yr as useTableRefresh,
|
|
318
320
|
dr as useTableSelectModal,
|
|
319
|
-
|
|
321
|
+
_p as useThrottleRef
|
|
320
322
|
};
|
package/es/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.d.ts
RENAMED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
* 布局类型
|
|
5
|
-
*
|
|
6
|
-
* @default vertical
|
|
7
|
-
*/
|
|
8
|
-
type?: 'horizontal' | 'vertical';
|
|
3
|
+
params: any;
|
|
9
4
|
};
|
|
10
|
-
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
-
type: "horizontal" | "vertical";
|
|
12
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
13
6
|
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineComponent as a, createBlock as r, openBlock as n, resolveDynamicComponent as o, unref as m } from "vue";
|
|
2
|
+
import { contentCustom as p } from "../../../ap-grid/utils/col.mjs";
|
|
3
|
+
const t = /* @__PURE__ */ a({
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
params: {}
|
|
7
|
+
},
|
|
8
|
+
setup(s) {
|
|
9
|
+
return (e, u) => (n(), r(o(
|
|
10
|
+
m(p)(
|
|
11
|
+
{
|
|
12
|
+
value: e.params.value,
|
|
13
|
+
text: e.params.value,
|
|
14
|
+
record: e.params.data,
|
|
15
|
+
column: e.params.column,
|
|
16
|
+
rowIndex: e.params.node.rowIndex,
|
|
17
|
+
pinned: e.params.node.rowPinned
|
|
18
|
+
},
|
|
19
|
+
e.params.column,
|
|
20
|
+
e.params.extraValueType
|
|
21
|
+
)
|
|
22
|
+
)));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
t as default
|
|
27
|
+
};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
-
* 布局类型
|
|
5
|
-
*
|
|
6
|
-
* @default vertical
|
|
7
|
-
*/
|
|
8
|
-
type?: 'horizontal' | 'vertical';
|
|
3
|
+
params: any;
|
|
9
4
|
};
|
|
10
|
-
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
-
type: "horizontal" | "vertical";
|
|
12
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
5
|
+
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
13
6
|
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineComponent as k, ref as C, computed as h, watch as T, createElementBlock as c, openBlock as n, normalizeClass as a, unref as e, createBlock as w, createCommentVNode as N, resolveDynamicComponent as y, createVNode as m } from "vue";
|
|
2
|
+
import { useToken as B } from "@aplus-frontend/antdv/es/theme/internal";
|
|
3
|
+
import { CaretUpOutlined as S, CaretDownOutlined as _ } from "@ant-design/icons-vue";
|
|
4
|
+
import { getTableTitle as x } from "../../../ap-table/utils.mjs";
|
|
5
|
+
import "../../../config-provider/index.mjs";
|
|
6
|
+
import { useNamespace as i } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
7
|
+
const j = /* @__PURE__ */ k({
|
|
8
|
+
__name: "index",
|
|
9
|
+
props: {
|
|
10
|
+
params: {}
|
|
11
|
+
},
|
|
12
|
+
setup(u) {
|
|
13
|
+
const o = u, { b: p, e: s } = i("ag-custom-header"), { be: d, bem: f } = i("ap-grid"), [, v] = B(), r = C(), l = h(() => o.params.column.sorter);
|
|
14
|
+
function g(t) {
|
|
15
|
+
if (!t)
|
|
16
|
+
return "asc";
|
|
17
|
+
if (t === "asc")
|
|
18
|
+
return "desc";
|
|
19
|
+
}
|
|
20
|
+
function b() {
|
|
21
|
+
l.value && (r.value = g(o.params.column.getSort()));
|
|
22
|
+
}
|
|
23
|
+
return T(
|
|
24
|
+
() => r.value,
|
|
25
|
+
(t) => {
|
|
26
|
+
o.params.setSort(t);
|
|
27
|
+
}
|
|
28
|
+
), (t, D) => (n(), c("div", {
|
|
29
|
+
class: a([e(p)(), { sortable: l.value }, `align-${t.params.column.align || "left"}`]),
|
|
30
|
+
onClick: b
|
|
31
|
+
}, [
|
|
32
|
+
(n(), w(y(
|
|
33
|
+
e(x)(
|
|
34
|
+
t.params.column,
|
|
35
|
+
[
|
|
36
|
+
e(d)("table-header", "title"),
|
|
37
|
+
t.params.column.tooltip ? "" : e(f)("table-header", "title", "single")
|
|
38
|
+
],
|
|
39
|
+
void 0,
|
|
40
|
+
e(v).colorTextTertiary
|
|
41
|
+
)
|
|
42
|
+
))),
|
|
43
|
+
l.value ? (n(), c("span", {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: a(e(s)("sort-wrapper"))
|
|
46
|
+
}, [
|
|
47
|
+
m(e(S), {
|
|
48
|
+
class: a({ [e(s)("sorter-up")]: !0, active: r.value === "asc" })
|
|
49
|
+
}, null, 8, ["class"]),
|
|
50
|
+
m(e(_), {
|
|
51
|
+
class: a({ [e(s)("sorter-down")]: !0, active: r.value === "desc" })
|
|
52
|
+
}, null, 8, ["class"])
|
|
53
|
+
], 2)) : N("", !0)
|
|
54
|
+
], 2));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export {
|
|
58
|
+
j as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ApTableProps } from '../../ap-table';
|
|
3
|
+
import { Recordable } from '../../type';
|
|
4
|
+
import { AgGridRowSelection } from '../interface';
|
|
5
|
+
import { Key } from '../../ap-table/components/interface';
|
|
6
|
+
export interface RowSelectionReturnType<RecordType = any> {
|
|
7
|
+
selectedRows: Ref<Partial<RecordType>[]>;
|
|
8
|
+
selectedRowKeys: Ref<Key[]>;
|
|
9
|
+
/**
|
|
10
|
+
* 选中某行
|
|
11
|
+
* @param item
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
select: (item: RecordType) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 取消选中某行
|
|
17
|
+
* @param item
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
unSelect: (item: RecordType) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 某行是否被选中
|
|
23
|
+
* @param item
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
isSelected: (item: RecordType) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 选中当前所有数据
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
selectAll: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* 取消选中当前所有数据
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
unSelectAll: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* 清空所有选中
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
clearAll: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* 切换某行的选中状态
|
|
44
|
+
* @param item
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
toggleSelect: (item: RecordType) => void;
|
|
48
|
+
/**
|
|
49
|
+
* 多项选中
|
|
50
|
+
* @param items
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
selectMulti: (items: RecordType[]) => void;
|
|
54
|
+
/**
|
|
55
|
+
* 多项反选
|
|
56
|
+
* @param items
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
unSelectMulti: (items: RecordType[]) => void;
|
|
60
|
+
/**
|
|
61
|
+
* 通过key勾选多条数据
|
|
62
|
+
* @param keys
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
selectMultiByKeys: (keys: (string | number)[]) => void;
|
|
66
|
+
}
|
|
67
|
+
type RowSelectionParams<T> = AgGridRowSelection<T> & {
|
|
68
|
+
/**
|
|
69
|
+
* 数据源(如果是后端分页,则表示当页数据,否则是全量数据)
|
|
70
|
+
*/
|
|
71
|
+
dataSource: Ref<T[]>;
|
|
72
|
+
/**
|
|
73
|
+
* 同Table的rowkey
|
|
74
|
+
*/
|
|
75
|
+
rowKey: ApTableProps['rowKey'];
|
|
76
|
+
};
|
|
77
|
+
declare const useGridRowSelection: <RecordType = Recordable>(props: RowSelectionParams<RecordType>) => RowSelectionReturnType<RecordType>;
|
|
78
|
+
export default useGridRowSelection;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ref as D, computed as d, unref as o } from "vue";
|
|
2
|
+
import { isFunction as r } from "lodash-unified";
|
|
3
|
+
function E(l, n) {
|
|
4
|
+
return !(n != null && n.length) || r(l) ? [] : n.map((u) => ({ [l]: u }));
|
|
5
|
+
}
|
|
6
|
+
const m = (l) => {
|
|
7
|
+
const n = D(
|
|
8
|
+
E(l.rowKey, l.defaultSelectedRowKeys)
|
|
9
|
+
), u = (e) => r(l.rowKey) ? l.rowKey(e) : e[l.rowKey], a = d(() => {
|
|
10
|
+
const e = /* @__PURE__ */ new Map();
|
|
11
|
+
return o(n).forEach((t) => {
|
|
12
|
+
e.set(u(t), t);
|
|
13
|
+
}), e;
|
|
14
|
+
});
|
|
15
|
+
function v(e) {
|
|
16
|
+
return o(a).has(u(e));
|
|
17
|
+
}
|
|
18
|
+
function S(e) {
|
|
19
|
+
if (!s(e))
|
|
20
|
+
return;
|
|
21
|
+
const t = o(a);
|
|
22
|
+
t.set(u(e), e), n.value = [...t.values()];
|
|
23
|
+
}
|
|
24
|
+
function M(e) {
|
|
25
|
+
const t = o(a);
|
|
26
|
+
for (const c of e)
|
|
27
|
+
s(c) && t.set(u(c), c);
|
|
28
|
+
n.value = [...t.values()];
|
|
29
|
+
}
|
|
30
|
+
function w(e) {
|
|
31
|
+
if (r(l.rowKey))
|
|
32
|
+
return;
|
|
33
|
+
const t = o(a);
|
|
34
|
+
for (const c of e) {
|
|
35
|
+
const f = o(l.dataSource).find(
|
|
36
|
+
(A) => u(A) === c
|
|
37
|
+
), i = { [l.rowKey]: c };
|
|
38
|
+
s(f || i) && t.set(c, f || i);
|
|
39
|
+
}
|
|
40
|
+
n.value = [...t.values()];
|
|
41
|
+
}
|
|
42
|
+
function x(e) {
|
|
43
|
+
if (!s(e))
|
|
44
|
+
return;
|
|
45
|
+
const t = o(a);
|
|
46
|
+
t.delete(u(e)), n.value = [...t.values()];
|
|
47
|
+
}
|
|
48
|
+
function g(e) {
|
|
49
|
+
const t = o(a);
|
|
50
|
+
for (const c of e)
|
|
51
|
+
s(c) && t.delete(u(c));
|
|
52
|
+
n.value = [...t.values()];
|
|
53
|
+
}
|
|
54
|
+
function s(e) {
|
|
55
|
+
const t = l.disabled;
|
|
56
|
+
return !(t ? t(e) : !1);
|
|
57
|
+
}
|
|
58
|
+
function y() {
|
|
59
|
+
const e = o(a);
|
|
60
|
+
o(l.dataSource).forEach((t) => {
|
|
61
|
+
s(t) && e.set(u(t), t);
|
|
62
|
+
}), n.value = [...e.values()];
|
|
63
|
+
}
|
|
64
|
+
function h(e) {
|
|
65
|
+
if (!s(e))
|
|
66
|
+
return;
|
|
67
|
+
const t = o(a), c = u(e);
|
|
68
|
+
t.has(c) ? t.delete(c) : t.set(c, e), n.value = [...t.values()];
|
|
69
|
+
}
|
|
70
|
+
function b() {
|
|
71
|
+
const e = o(a);
|
|
72
|
+
o(l.dataSource).forEach((t) => {
|
|
73
|
+
s(t) && e.delete(u(t));
|
|
74
|
+
}), n.value = [...e.values()];
|
|
75
|
+
}
|
|
76
|
+
function K() {
|
|
77
|
+
n.value = [];
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
select: S,
|
|
81
|
+
unSelect: x,
|
|
82
|
+
isSelected: v,
|
|
83
|
+
selectAll: y,
|
|
84
|
+
unSelectAll: b,
|
|
85
|
+
clearAll: K,
|
|
86
|
+
toggleSelect: h,
|
|
87
|
+
selectedRows: n,
|
|
88
|
+
selectedRowKeys: d(
|
|
89
|
+
() => o(n).map((e) => u(e))
|
|
90
|
+
),
|
|
91
|
+
selectMulti: M,
|
|
92
|
+
unSelectMulti: g,
|
|
93
|
+
selectMultiByKeys: w
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
m as default
|
|
98
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AgGridColumnType, AgGridProps } from './interface';
|
|
2
|
+
import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, VNode } from 'vue';
|
|
3
|
+
declare const _default: <RecordType>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & AgGridProps<RecordType> & Partial<{}>> & PublicProps;
|
|
5
|
+
expose(exposed: ShallowUnwrapRef<{}>): void;
|
|
6
|
+
attrs: any;
|
|
7
|
+
slots: Readonly<{
|
|
8
|
+
/**
|
|
9
|
+
* 自定义查询表单额外的区域
|
|
10
|
+
*/
|
|
11
|
+
searchFormExtra?: any;
|
|
12
|
+
/**
|
|
13
|
+
* 自定义表格上部查询表单下部分区域的渲染
|
|
14
|
+
*/
|
|
15
|
+
title?: (params: {
|
|
16
|
+
selectedRows: RecordType[];
|
|
17
|
+
selectedRowKeys: (string | number)[];
|
|
18
|
+
shownColumns: AgGridColumnType<RecordType>[];
|
|
19
|
+
}) => any;
|
|
20
|
+
}> & {
|
|
21
|
+
/**
|
|
22
|
+
* 自定义查询表单额外的区域
|
|
23
|
+
*/
|
|
24
|
+
searchFormExtra?: any;
|
|
25
|
+
/**
|
|
26
|
+
* 自定义表格上部查询表单下部分区域的渲染
|
|
27
|
+
*/
|
|
28
|
+
title?: (params: {
|
|
29
|
+
selectedRows: RecordType[];
|
|
30
|
+
selectedRowKeys: (string | number)[];
|
|
31
|
+
shownColumns: AgGridColumnType<RecordType>[];
|
|
32
|
+
}) => any;
|
|
33
|
+
};
|
|
34
|
+
emit: {};
|
|
35
|
+
}>) => VNode & {
|
|
36
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_PrettifyLocal<T> = {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} & {};
|