@funcho/ui 1.1.3 → 1.1.5
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/dist/cjs/business/DataTable/DataTable.vue.js +22 -12
- package/dist/cjs/packages/ui/package.json.js +1 -1
- package/dist/esm/business/DataTable/DataTable.vue.mjs +22 -12
- package/dist/esm/packages/ui/package.json.mjs +1 -1
- package/dist/types/business/DataTable/DataTable.vue.d.ts +6 -1
- package/dist/types/business/DataTable/index.d.ts +18 -3
- package/package.json +1 -1
|
@@ -97,9 +97,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
97
97
|
fields: { default: () => [] },
|
|
98
98
|
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
99
99
|
actions: { default: () => [] },
|
|
100
|
+
actionsWidth: { default: 0 },
|
|
100
101
|
tools: { default: () => [] }
|
|
101
102
|
},
|
|
102
|
-
setup(__props) {
|
|
103
|
+
setup(__props, { expose: __expose }) {
|
|
103
104
|
const ns = useNamespace.useNamespace("data-table");
|
|
104
105
|
const formRef = vue.ref();
|
|
105
106
|
const { height: formHeight } = core.useElementSize(formRef);
|
|
@@ -158,7 +159,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
158
159
|
const params = formRef.value?.model || {};
|
|
159
160
|
try {
|
|
160
161
|
tableLoading.value = true;
|
|
161
|
-
const { data } = await props.request(
|
|
162
|
+
const { data } = await props.request(
|
|
163
|
+
props.isPagination ? { ...params, page: pagination.value.currentPage, size: pagination.value.pageSize } : params
|
|
164
|
+
);
|
|
162
165
|
tableData.value = Array.isArray(data) ? data : data.list || [];
|
|
163
166
|
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
164
167
|
} catch (error) {
|
|
@@ -185,6 +188,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
185
188
|
pagination.value.pageSize = pageSize;
|
|
186
189
|
loadData();
|
|
187
190
|
};
|
|
191
|
+
__expose({
|
|
192
|
+
loadData,
|
|
193
|
+
tableData
|
|
194
|
+
});
|
|
188
195
|
return (_ctx, _cache) => {
|
|
189
196
|
const _directive_loading = vue.resolveDirective("loading");
|
|
190
197
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -248,17 +255,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
248
255
|
}, 8, ["disabled"]),
|
|
249
256
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.tools, (tool, i) => {
|
|
250
257
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
|
|
251
|
-
(typeof tool.hidden === "function" ? !tool.hidden() : !tool.hidden) ? (vue.openBlock(), vue.createBlock(vue.unref(index.FcButton), {
|
|
258
|
+
(typeof tool.hidden === "function" ? !tool.hidden() : !tool.hidden) ? (vue.openBlock(), vue.createBlock(vue.unref(index.FcButton), vue.mergeProps({
|
|
252
259
|
key: 0,
|
|
253
|
-
type: tool.type || "primary"
|
|
260
|
+
type: tool.type || "primary"
|
|
261
|
+
}, { ref_for: true }, tool, {
|
|
254
262
|
disabled: typeof tool.disabled === "function" ? tool.disabled() : tool.disabled,
|
|
255
263
|
onClick: tool.onClick
|
|
256
|
-
}, {
|
|
264
|
+
}), {
|
|
257
265
|
default: vue.withCtx(() => [
|
|
258
266
|
vue.createTextVNode(vue.toDisplayString(tool.label), 1)
|
|
259
267
|
]),
|
|
260
268
|
_: 2
|
|
261
|
-
},
|
|
269
|
+
}, 1040, ["type", "disabled", "onClick"])) : vue.createCommentVNode("", true)
|
|
262
270
|
], 64);
|
|
263
271
|
}), 128))
|
|
264
272
|
], 2)
|
|
@@ -298,7 +306,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
298
306
|
key: "actions",
|
|
299
307
|
label: "操作",
|
|
300
308
|
align: "right",
|
|
301
|
-
fixed: "right"
|
|
309
|
+
fixed: "right",
|
|
310
|
+
width: __props.actionsWidth || void 0
|
|
302
311
|
}, {
|
|
303
312
|
default: vue.withCtx(({ row, $index }) => [
|
|
304
313
|
vue.createElementVNode("div", {
|
|
@@ -306,24 +315,25 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
306
315
|
}, [
|
|
307
316
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.actions, (action, i) => {
|
|
308
317
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
|
|
309
|
-
(typeof action.hidden === "function" ? !action.hidden(row) : !action.hidden) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.label.includes("删除") ? vue.unref(index.FcDangerButton) : vue.unref(index.FcLinkButton)), {
|
|
318
|
+
(typeof action.hidden === "function" ? !action.hidden(row) : !action.hidden) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.label.includes("删除") ? vue.unref(index.FcDangerButton) : vue.unref(index.FcLinkButton)), vue.mergeProps({
|
|
310
319
|
key: 0,
|
|
311
320
|
type: action.type || "primary",
|
|
312
|
-
disabled: typeof action.disabled === "function" ? action.disabled(row) : action.disabled
|
|
321
|
+
disabled: typeof action.disabled === "function" ? action.disabled(row) : action.disabled
|
|
322
|
+
}, { ref_for: true }, action, {
|
|
313
323
|
onClick: ($event) => action.label.includes("删除") ? void 0 : action.onClick(row, $index),
|
|
314
324
|
onConfirm: ($event) => action.label.includes("删除") ? action.onClick(row, $index) : void 0
|
|
315
|
-
}, {
|
|
325
|
+
}), {
|
|
316
326
|
default: vue.withCtx(() => [
|
|
317
327
|
vue.createTextVNode(vue.toDisplayString(action.label), 1)
|
|
318
328
|
]),
|
|
319
329
|
_: 2
|
|
320
|
-
},
|
|
330
|
+
}, 1040, ["type", "disabled", "onClick", "onConfirm"])) : vue.createCommentVNode("", true)
|
|
321
331
|
], 64);
|
|
322
332
|
}), 128))
|
|
323
333
|
], 2)
|
|
324
334
|
]),
|
|
325
335
|
_: 1
|
|
326
|
-
})) : vue.createCommentVNode("", true)
|
|
336
|
+
}, 8, ["width"])) : vue.createCommentVNode("", true)
|
|
327
337
|
]),
|
|
328
338
|
_: 1
|
|
329
339
|
}, 16, ["data", "max-height"])), [
|
|
@@ -93,9 +93,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
93
93
|
fields: { default: () => [] },
|
|
94
94
|
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
95
95
|
actions: { default: () => [] },
|
|
96
|
+
actionsWidth: { default: 0 },
|
|
96
97
|
tools: { default: () => [] }
|
|
97
98
|
},
|
|
98
|
-
setup(__props) {
|
|
99
|
+
setup(__props, { expose: __expose }) {
|
|
99
100
|
const ns = useNamespace("data-table");
|
|
100
101
|
const formRef = ref();
|
|
101
102
|
const { height: formHeight } = useElementSize(formRef);
|
|
@@ -154,7 +155,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
154
155
|
const params = formRef.value?.model || {};
|
|
155
156
|
try {
|
|
156
157
|
tableLoading.value = true;
|
|
157
|
-
const { data } = await props.request(
|
|
158
|
+
const { data } = await props.request(
|
|
159
|
+
props.isPagination ? { ...params, page: pagination.value.currentPage, size: pagination.value.pageSize } : params
|
|
160
|
+
);
|
|
158
161
|
tableData.value = Array.isArray(data) ? data : data.list || [];
|
|
159
162
|
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
160
163
|
} catch (error) {
|
|
@@ -181,6 +184,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
181
184
|
pagination.value.pageSize = pageSize;
|
|
182
185
|
loadData();
|
|
183
186
|
};
|
|
187
|
+
__expose({
|
|
188
|
+
loadData,
|
|
189
|
+
tableData
|
|
190
|
+
});
|
|
184
191
|
return (_ctx, _cache) => {
|
|
185
192
|
const _directive_loading = resolveDirective("loading");
|
|
186
193
|
return openBlock(), createElementBlock("div", {
|
|
@@ -244,17 +251,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
244
251
|
}, 8, ["disabled"]),
|
|
245
252
|
(openBlock(true), createElementBlock(Fragment, null, renderList(props.tools, (tool, i) => {
|
|
246
253
|
return openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
247
|
-
(typeof tool.hidden === "function" ? !tool.hidden() : !tool.hidden) ? (openBlock(), createBlock(unref(FcButton), {
|
|
254
|
+
(typeof tool.hidden === "function" ? !tool.hidden() : !tool.hidden) ? (openBlock(), createBlock(unref(FcButton), mergeProps({
|
|
248
255
|
key: 0,
|
|
249
|
-
type: tool.type || "primary"
|
|
256
|
+
type: tool.type || "primary"
|
|
257
|
+
}, { ref_for: true }, tool, {
|
|
250
258
|
disabled: typeof tool.disabled === "function" ? tool.disabled() : tool.disabled,
|
|
251
259
|
onClick: tool.onClick
|
|
252
|
-
}, {
|
|
260
|
+
}), {
|
|
253
261
|
default: withCtx(() => [
|
|
254
262
|
createTextVNode(toDisplayString(tool.label), 1)
|
|
255
263
|
]),
|
|
256
264
|
_: 2
|
|
257
|
-
},
|
|
265
|
+
}, 1040, ["type", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
258
266
|
], 64);
|
|
259
267
|
}), 128))
|
|
260
268
|
], 2)
|
|
@@ -294,7 +302,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
294
302
|
key: "actions",
|
|
295
303
|
label: "操作",
|
|
296
304
|
align: "right",
|
|
297
|
-
fixed: "right"
|
|
305
|
+
fixed: "right",
|
|
306
|
+
width: __props.actionsWidth || void 0
|
|
298
307
|
}, {
|
|
299
308
|
default: withCtx(({ row, $index }) => [
|
|
300
309
|
createElementVNode("div", {
|
|
@@ -302,24 +311,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
302
311
|
}, [
|
|
303
312
|
(openBlock(true), createElementBlock(Fragment, null, renderList(props.actions, (action, i) => {
|
|
304
313
|
return openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
305
|
-
(typeof action.hidden === "function" ? !action.hidden(row) : !action.hidden) ? (openBlock(), createBlock(resolveDynamicComponent(action.label.includes("删除") ? unref(FcDangerButton) : unref(FcLinkButton)), {
|
|
314
|
+
(typeof action.hidden === "function" ? !action.hidden(row) : !action.hidden) ? (openBlock(), createBlock(resolveDynamicComponent(action.label.includes("删除") ? unref(FcDangerButton) : unref(FcLinkButton)), mergeProps({
|
|
306
315
|
key: 0,
|
|
307
316
|
type: action.type || "primary",
|
|
308
|
-
disabled: typeof action.disabled === "function" ? action.disabled(row) : action.disabled
|
|
317
|
+
disabled: typeof action.disabled === "function" ? action.disabled(row) : action.disabled
|
|
318
|
+
}, { ref_for: true }, action, {
|
|
309
319
|
onClick: ($event) => action.label.includes("删除") ? void 0 : action.onClick(row, $index),
|
|
310
320
|
onConfirm: ($event) => action.label.includes("删除") ? action.onClick(row, $index) : void 0
|
|
311
|
-
}, {
|
|
321
|
+
}), {
|
|
312
322
|
default: withCtx(() => [
|
|
313
323
|
createTextVNode(toDisplayString(action.label), 1)
|
|
314
324
|
]),
|
|
315
325
|
_: 2
|
|
316
|
-
},
|
|
326
|
+
}, 1040, ["type", "disabled", "onClick", "onConfirm"])) : createCommentVNode("", true)
|
|
317
327
|
], 64);
|
|
318
328
|
}), 128))
|
|
319
329
|
], 2)
|
|
320
330
|
]),
|
|
321
331
|
_: 1
|
|
322
|
-
})) : createCommentVNode("", true)
|
|
332
|
+
}, 8, ["width"])) : createCommentVNode("", true)
|
|
323
333
|
]),
|
|
324
334
|
_: 1
|
|
325
335
|
}, 16, ["data", "max-height"])), [
|
|
@@ -21,6 +21,7 @@ type __VLS_Props = {
|
|
|
21
21
|
hidden?: boolean | ((row: any) => boolean);
|
|
22
22
|
onClick: (row: any, index: number) => void;
|
|
23
23
|
}>;
|
|
24
|
+
actionsWidth?: number;
|
|
24
25
|
tools?: Array<{
|
|
25
26
|
label: string;
|
|
26
27
|
type?: ButtonType;
|
|
@@ -29,7 +30,10 @@ type __VLS_Props = {
|
|
|
29
30
|
hidden?: boolean | (() => boolean);
|
|
30
31
|
}>;
|
|
31
32
|
};
|
|
32
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
33
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
34
|
+
loadData: () => Promise<void>;
|
|
35
|
+
tableData: import('vue').Ref<any[], any[]>;
|
|
36
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
33
37
|
height: number;
|
|
34
38
|
fields: Array<TProFormField>;
|
|
35
39
|
tools: Array<{
|
|
@@ -55,6 +59,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
55
59
|
hidden?: boolean | ((row: any) => boolean);
|
|
56
60
|
onClick: (row: any, index: number) => void;
|
|
57
61
|
}>;
|
|
62
|
+
actionsWidth: number;
|
|
58
63
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
59
64
|
containerRef: HTMLDivElement;
|
|
60
65
|
queryBoxRef: HTMLDivElement;
|
|
@@ -18,6 +18,7 @@ export declare const FcProDataTable: {
|
|
|
18
18
|
hidden?: boolean | ((row: any) => boolean);
|
|
19
19
|
onClick: (row: any, index: number) => void;
|
|
20
20
|
}>;
|
|
21
|
+
actionsWidth?: number;
|
|
21
22
|
tools?: Array<{
|
|
22
23
|
label: string;
|
|
23
24
|
type?: "" | "default" | "primary" | "success" | "warning" | "info" | "danger";
|
|
@@ -25,7 +26,10 @@ export declare const FcProDataTable: {
|
|
|
25
26
|
disabled?: boolean | (() => boolean);
|
|
26
27
|
hidden?: boolean | (() => boolean);
|
|
27
28
|
}>;
|
|
28
|
-
}> & Readonly<{}>, {
|
|
29
|
+
}> & Readonly<{}>, {
|
|
30
|
+
loadData: () => Promise<void>;
|
|
31
|
+
tableData: import('vue').Ref<any[], any[]>;
|
|
32
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
29
33
|
height: number;
|
|
30
34
|
fields: Array<import('..').TProFormField>;
|
|
31
35
|
tools: Array<{
|
|
@@ -51,6 +55,7 @@ export declare const FcProDataTable: {
|
|
|
51
55
|
hidden?: boolean | ((row: any) => boolean);
|
|
52
56
|
onClick: (row: any, index: number) => void;
|
|
53
57
|
}>;
|
|
58
|
+
actionsWidth: number;
|
|
54
59
|
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
55
60
|
containerRef: HTMLDivElement;
|
|
56
61
|
queryBoxRef: HTMLDivElement;
|
|
@@ -1819,6 +1824,7 @@ export declare const FcProDataTable: {
|
|
|
1819
1824
|
hidden?: boolean | ((row: any) => boolean);
|
|
1820
1825
|
onClick: (row: any, index: number) => void;
|
|
1821
1826
|
}>;
|
|
1827
|
+
actionsWidth?: number;
|
|
1822
1828
|
tools?: Array<{
|
|
1823
1829
|
label: string;
|
|
1824
1830
|
type?: "" | "default" | "primary" | "success" | "warning" | "info" | "danger";
|
|
@@ -1826,7 +1832,10 @@ export declare const FcProDataTable: {
|
|
|
1826
1832
|
disabled?: boolean | (() => boolean);
|
|
1827
1833
|
hidden?: boolean | (() => boolean);
|
|
1828
1834
|
}>;
|
|
1829
|
-
}> & Readonly<{}>, {
|
|
1835
|
+
}> & Readonly<{}>, {
|
|
1836
|
+
loadData: () => Promise<void>;
|
|
1837
|
+
tableData: import('vue').Ref<any[], any[]>;
|
|
1838
|
+
}, {}, {}, {}, {
|
|
1830
1839
|
height: number;
|
|
1831
1840
|
fields: Array<import('..').TProFormField>;
|
|
1832
1841
|
tools: Array<{
|
|
@@ -1852,6 +1861,7 @@ export declare const FcProDataTable: {
|
|
|
1852
1861
|
hidden?: boolean | ((row: any) => boolean);
|
|
1853
1862
|
onClick: (row: any, index: number) => void;
|
|
1854
1863
|
}>;
|
|
1864
|
+
actionsWidth: number;
|
|
1855
1865
|
}>;
|
|
1856
1866
|
__isFragment?: never;
|
|
1857
1867
|
__isTeleport?: never;
|
|
@@ -1875,6 +1885,7 @@ export declare const FcProDataTable: {
|
|
|
1875
1885
|
hidden?: boolean | ((row: any) => boolean);
|
|
1876
1886
|
onClick: (row: any, index: number) => void;
|
|
1877
1887
|
}>;
|
|
1888
|
+
actionsWidth?: number;
|
|
1878
1889
|
tools?: Array<{
|
|
1879
1890
|
label: string;
|
|
1880
1891
|
type?: "" | "default" | "primary" | "success" | "warning" | "info" | "danger";
|
|
@@ -1882,7 +1893,10 @@ export declare const FcProDataTable: {
|
|
|
1882
1893
|
disabled?: boolean | (() => boolean);
|
|
1883
1894
|
hidden?: boolean | (() => boolean);
|
|
1884
1895
|
}>;
|
|
1885
|
-
}> & Readonly<{}>, {
|
|
1896
|
+
}> & Readonly<{}>, {
|
|
1897
|
+
loadData: () => Promise<void>;
|
|
1898
|
+
tableData: import('vue').Ref<any[], any[]>;
|
|
1899
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
1886
1900
|
height: number;
|
|
1887
1901
|
fields: Array<import('..').TProFormField>;
|
|
1888
1902
|
tools: Array<{
|
|
@@ -1908,6 +1922,7 @@ export declare const FcProDataTable: {
|
|
|
1908
1922
|
hidden?: boolean | ((row: any) => boolean);
|
|
1909
1923
|
onClick: (row: any, index: number) => void;
|
|
1910
1924
|
}>;
|
|
1925
|
+
actionsWidth: number;
|
|
1911
1926
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin;
|
|
1912
1927
|
export default FcProDataTable;
|
|
1913
1928
|
export * from './DataTable.types';
|