@funcho/ui 1.1.33 → 1.1.35
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 +15 -3
- package/dist/cjs/packages/ui/package.json.js +1 -1
- package/dist/esm/business/DataTable/DataTable.vue.mjs +16 -4
- package/dist/esm/packages/ui/package.json.mjs +1 -1
- package/dist/types/business/DataTable/DataTable.types.d.ts +1 -0
- package/dist/types/business/DataTable/DataTable.vue.d.ts +2 -1
- package/dist/types/business/DataTable/index.d.ts +6 -3
- package/dist/types/business/DataTableDialog/DataTableDialog.vue.d.ts +6 -3
- package/dist/types/business/DataTableDialog/index.d.ts +6 -3
- package/package.json +1 -1
|
@@ -98,6 +98,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
98
98
|
columns: { default: () => [] },
|
|
99
99
|
isPagination: { type: Boolean, default: true },
|
|
100
100
|
fields: { default: () => [] },
|
|
101
|
+
data: { default: void 0 },
|
|
101
102
|
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
102
103
|
actions: { default: () => [] },
|
|
103
104
|
actionsWidth: { default: 0 },
|
|
@@ -106,6 +107,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
106
107
|
setup(__props, { expose: __expose }) {
|
|
107
108
|
const ns = useNamespace.useNamespace("data-table");
|
|
108
109
|
const props = __props;
|
|
110
|
+
const showPagination = vue.computed(() => {
|
|
111
|
+
if (!props.isPagination) return false;
|
|
112
|
+
if (props.data !== void 0) return false;
|
|
113
|
+
return true;
|
|
114
|
+
});
|
|
109
115
|
const renderActions = (actions, row, index) => {
|
|
110
116
|
return vue.h(
|
|
111
117
|
"div",
|
|
@@ -146,7 +152,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
146
152
|
const getIndex = (i) => {
|
|
147
153
|
return (pagination.value.currentPage - 1) * pagination.value.pageSize + i + 1;
|
|
148
154
|
};
|
|
149
|
-
const
|
|
155
|
+
const requestTableData = vue.ref([]);
|
|
156
|
+
const tableData = vue.computed(() => {
|
|
157
|
+
if (props.data !== void 0) {
|
|
158
|
+
return props.data || [];
|
|
159
|
+
}
|
|
160
|
+
return requestTableData.value;
|
|
161
|
+
});
|
|
150
162
|
const tableLoading = vue.ref(false);
|
|
151
163
|
const loadData = async () => {
|
|
152
164
|
if (props.request) {
|
|
@@ -159,7 +171,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
159
171
|
const { data } = await props.request(
|
|
160
172
|
props.isPagination ? { ...params, page: pagination.value.currentPage, size: pagination.value.pageSize } : params
|
|
161
173
|
);
|
|
162
|
-
|
|
174
|
+
requestTableData.value = Array.isArray(data) ? data : data.list || [];
|
|
163
175
|
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
164
176
|
} catch (error) {
|
|
165
177
|
console.log("获取数据失败", error);
|
|
@@ -292,7 +304,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
292
304
|
]),
|
|
293
305
|
key: "0"
|
|
294
306
|
} : void 0,
|
|
295
|
-
|
|
307
|
+
showPagination.value ? {
|
|
296
308
|
name: "footer",
|
|
297
309
|
fn: vue.withCtx(() => [
|
|
298
310
|
vue.createVNode(vue.unref(index$2.FcPagination), {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, resolveComponent, resolveDirective, createBlock, openBlock, normalizeClass, unref, createSlots, withCtx, withDirectives, mergeProps, createCommentVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createVNode, renderSlot, h } from 'vue';
|
|
1
|
+
import { defineComponent, computed, ref, onMounted, resolveComponent, resolveDirective, createBlock, openBlock, normalizeClass, unref, createSlots, withCtx, withDirectives, mergeProps, createCommentVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createVNode, renderSlot, h } from 'vue';
|
|
2
2
|
import { useNamespace } from '../../hooks/use-namespace.mjs';
|
|
3
3
|
import { FcDangerButton, FcLinkButton } from '../../components/Button/index.mjs';
|
|
4
4
|
import '../../components/Dialog/index.mjs';
|
|
@@ -94,6 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
94
|
columns: { default: () => [] },
|
|
95
95
|
isPagination: { type: Boolean, default: true },
|
|
96
96
|
fields: { default: () => [] },
|
|
97
|
+
data: { default: void 0 },
|
|
97
98
|
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
98
99
|
actions: { default: () => [] },
|
|
99
100
|
actionsWidth: { default: 0 },
|
|
@@ -102,6 +103,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
102
103
|
setup(__props, { expose: __expose }) {
|
|
103
104
|
const ns = useNamespace("data-table");
|
|
104
105
|
const props = __props;
|
|
106
|
+
const showPagination = computed(() => {
|
|
107
|
+
if (!props.isPagination) return false;
|
|
108
|
+
if (props.data !== void 0) return false;
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
105
111
|
const renderActions = (actions, row, index) => {
|
|
106
112
|
return h(
|
|
107
113
|
"div",
|
|
@@ -142,7 +148,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
142
148
|
const getIndex = (i) => {
|
|
143
149
|
return (pagination.value.currentPage - 1) * pagination.value.pageSize + i + 1;
|
|
144
150
|
};
|
|
145
|
-
const
|
|
151
|
+
const requestTableData = ref([]);
|
|
152
|
+
const tableData = computed(() => {
|
|
153
|
+
if (props.data !== void 0) {
|
|
154
|
+
return props.data || [];
|
|
155
|
+
}
|
|
156
|
+
return requestTableData.value;
|
|
157
|
+
});
|
|
146
158
|
const tableLoading = ref(false);
|
|
147
159
|
const loadData = async () => {
|
|
148
160
|
if (props.request) {
|
|
@@ -155,7 +167,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
155
167
|
const { data } = await props.request(
|
|
156
168
|
props.isPagination ? { ...params, page: pagination.value.currentPage, size: pagination.value.pageSize } : params
|
|
157
169
|
);
|
|
158
|
-
|
|
170
|
+
requestTableData.value = Array.isArray(data) ? data : data.list || [];
|
|
159
171
|
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
160
172
|
} catch (error) {
|
|
161
173
|
console.log("获取数据失败", error);
|
|
@@ -288,7 +300,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
288
300
|
]),
|
|
289
301
|
key: "0"
|
|
290
302
|
} : void 0,
|
|
291
|
-
|
|
303
|
+
showPagination.value ? {
|
|
292
304
|
name: "footer",
|
|
293
305
|
fn: withCtx(() => [
|
|
294
306
|
createVNode(unref(FcPagination), {
|
|
@@ -1471,11 +1471,12 @@ declare function __VLS_template(): {
|
|
|
1471
1471
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
1472
1472
|
declare const __VLS_component: import('vue').DefineComponent<TFcProDataTableProps, {
|
|
1473
1473
|
loadData: () => Promise<void>;
|
|
1474
|
-
tableData: import('vue').
|
|
1474
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1475
1475
|
reload: () => void;
|
|
1476
1476
|
resetSearch: () => void;
|
|
1477
1477
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
1478
1478
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TFcProDataTableProps> & Readonly<{}>, {
|
|
1479
|
+
data: any[];
|
|
1479
1480
|
height: number;
|
|
1480
1481
|
fields: Array<import('..').TProFormField>;
|
|
1481
1482
|
tools: Array<ButtonProps>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export declare const FcProDataTable: {
|
|
2
2
|
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('./DataTable.types').TFcProDataTableProps> & Readonly<{}>, {
|
|
3
3
|
loadData: () => Promise<void>;
|
|
4
|
-
tableData: import('vue').
|
|
4
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
5
5
|
reload: () => void;
|
|
6
6
|
resetSearch: () => void;
|
|
7
7
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
8
8
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
9
|
+
data: any[];
|
|
9
10
|
height: number;
|
|
10
11
|
fields: Array<import('..').TProFormField>;
|
|
11
12
|
tools: Array<import('./DataTable.types').ButtonProps>;
|
|
@@ -1491,11 +1492,12 @@ export declare const FcProDataTable: {
|
|
|
1491
1492
|
Defaults: {};
|
|
1492
1493
|
}, Readonly<import('./DataTable.types').TFcProDataTableProps> & Readonly<{}>, {
|
|
1493
1494
|
loadData: () => Promise<void>;
|
|
1494
|
-
tableData: import('vue').
|
|
1495
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1495
1496
|
reload: () => void;
|
|
1496
1497
|
resetSearch: () => void;
|
|
1497
1498
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
1498
1499
|
}, {}, {}, {}, {
|
|
1500
|
+
data: any[];
|
|
1499
1501
|
height: number;
|
|
1500
1502
|
fields: Array<import('..').TProFormField>;
|
|
1501
1503
|
tools: Array<import('./DataTable.types').ButtonProps>;
|
|
@@ -1517,11 +1519,12 @@ export declare const FcProDataTable: {
|
|
|
1517
1519
|
__isSuspense?: never;
|
|
1518
1520
|
} & import('vue').ComponentOptionsBase<Readonly<import('./DataTable.types').TFcProDataTableProps> & Readonly<{}>, {
|
|
1519
1521
|
loadData: () => Promise<void>;
|
|
1520
|
-
tableData: import('vue').
|
|
1522
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1521
1523
|
reload: () => void;
|
|
1522
1524
|
resetSearch: () => void;
|
|
1523
1525
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
1524
1526
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
1527
|
+
data: any[];
|
|
1525
1528
|
height: number;
|
|
1526
1529
|
fields: Array<import('..').TProFormField>;
|
|
1527
1530
|
tools: Array<import('./DataTable.types').ButtonProps>;
|
|
@@ -52,6 +52,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
52
52
|
}> | undefined;
|
|
53
53
|
readonly isPagination?: boolean | undefined;
|
|
54
54
|
readonly fields?: Array<import('..').TProFormField> | undefined;
|
|
55
|
+
readonly data?: any[] | undefined | undefined;
|
|
55
56
|
readonly request?: ((params: any) => Promise<import('..').RequestResult<any>>) | undefined;
|
|
56
57
|
readonly actions?: Array<import('..').ButtonProps> | undefined;
|
|
57
58
|
readonly actionsWidth?: number | undefined;
|
|
@@ -1534,11 +1535,12 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
1534
1535
|
$el: any;
|
|
1535
1536
|
$options: import('vue').ComponentOptionsBase<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, {
|
|
1536
1537
|
loadData: () => Promise<void>;
|
|
1537
|
-
tableData: import('vue').
|
|
1538
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1538
1539
|
reload: () => void;
|
|
1539
1540
|
resetSearch: () => void;
|
|
1540
1541
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
1541
1542
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
1543
|
+
data: any[];
|
|
1542
1544
|
height: number;
|
|
1543
1545
|
fields: Array<import('..').TProFormField>;
|
|
1544
1546
|
tools: Array<import('..').ButtonProps>;
|
|
@@ -1575,6 +1577,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
1575
1577
|
$nextTick: typeof import('vue').nextTick;
|
|
1576
1578
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
1577
1579
|
} & Readonly<{
|
|
1580
|
+
data: any[];
|
|
1578
1581
|
height: number;
|
|
1579
1582
|
fields: Array<import('..').TProFormField>;
|
|
1580
1583
|
tools: Array<import('..').ButtonProps>;
|
|
@@ -1590,9 +1593,9 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
1590
1593
|
request: (params: any) => Promise<import('..').RequestResult<any>>;
|
|
1591
1594
|
actions: Array<import('..').ButtonProps>;
|
|
1592
1595
|
actionsWidth: number;
|
|
1593
|
-
}> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
|
|
1596
|
+
}> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("data" | "height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
|
|
1594
1597
|
loadData: () => Promise<void>;
|
|
1595
|
-
tableData: import('vue').
|
|
1598
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1596
1599
|
reload: () => void;
|
|
1597
1600
|
resetSearch: () => void;
|
|
1598
1601
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
@@ -52,6 +52,7 @@ export declare const FcProDataTableDialog: {
|
|
|
52
52
|
}> | undefined;
|
|
53
53
|
readonly isPagination?: boolean | undefined;
|
|
54
54
|
readonly fields?: Array<import('..').TProFormField> | undefined;
|
|
55
|
+
readonly data?: any[] | undefined | undefined;
|
|
55
56
|
readonly request?: ((params: any) => Promise<import('..').RequestResult<any>>) | undefined;
|
|
56
57
|
readonly actions?: Array<import('..').ButtonProps> | undefined;
|
|
57
58
|
readonly actionsWidth?: number | undefined;
|
|
@@ -1534,11 +1535,12 @@ export declare const FcProDataTableDialog: {
|
|
|
1534
1535
|
$el: any;
|
|
1535
1536
|
$options: import('vue').ComponentOptionsBase<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, {
|
|
1536
1537
|
loadData: () => Promise<void>;
|
|
1537
|
-
tableData: import('vue').
|
|
1538
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1538
1539
|
reload: () => void;
|
|
1539
1540
|
resetSearch: () => void;
|
|
1540
1541
|
selectedRows: import('vue').Ref<any[], any[]>;
|
|
1541
1542
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
1543
|
+
data: any[];
|
|
1542
1544
|
height: number;
|
|
1543
1545
|
fields: Array<import('..').TProFormField>;
|
|
1544
1546
|
tools: Array<import('..').ButtonProps>;
|
|
@@ -1575,6 +1577,7 @@ export declare const FcProDataTableDialog: {
|
|
|
1575
1577
|
$nextTick: typeof import('vue').nextTick;
|
|
1576
1578
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
1577
1579
|
} & Readonly<{
|
|
1580
|
+
data: any[];
|
|
1578
1581
|
height: number;
|
|
1579
1582
|
fields: Array<import('..').TProFormField>;
|
|
1580
1583
|
tools: Array<import('..').ButtonProps>;
|
|
@@ -1590,9 +1593,9 @@ export declare const FcProDataTableDialog: {
|
|
|
1590
1593
|
request: (params: any) => Promise<import('..').RequestResult<any>>;
|
|
1591
1594
|
actions: Array<import('..').ButtonProps>;
|
|
1592
1595
|
actionsWidth: number;
|
|
1593
|
-
}> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
|
|
1596
|
+
}> & Omit<Readonly<import('..').TFcProDataTableProps> & Readonly<{}>, "loadData" | "tableData" | "reload" | "resetSearch" | "selectedRows" | ("data" | "height" | "fields" | "tools" | "columns" | "selectable" | "hasIndex" | "isPagination" | "request" | "actions" | "actionsWidth")> & import('vue').ShallowUnwrapRef<{
|
|
1594
1597
|
loadData: () => Promise<void>;
|
|
1595
|
-
tableData: import('vue').
|
|
1598
|
+
tableData: import('vue').ComputedRef<any[]>;
|
|
1596
1599
|
reload: () => void;
|
|
1597
1600
|
resetSearch: () => void;
|
|
1598
1601
|
selectedRows: import('vue').Ref<any[], any[]>;
|