@gx-design-vue/pro-table 0.2.0-alpha.14 → 0.2.0-alpha.16
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/ProTable.js +27 -4
- package/dist/components/SearchForm/CollapseToggle.d.ts +1 -1
- package/dist/components/SearchForm/FormItemContainer.d.ts +2 -2
- package/dist/components/SearchForm/FormItemWrapper.d.ts +2 -2
- package/dist/components/SearchForm/SearchForm.d.ts +4 -4
- package/dist/components/Toolbar/ListToolBar.d.ts +8 -8
- package/dist/components/Toolbar/index.d.ts +5 -5
- package/dist/hooks/useFetchData.js +1 -1
- package/dist/hooks/useTable.js +6 -4
- package/dist/pro-table.esm.js +194 -167
- package/dist/pro-table.js +1 -1
- package/dist/style/index.js +10 -0
- package/package.json +4 -4
package/dist/ProTable.js
CHANGED
|
@@ -87,6 +87,20 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
87
87
|
loading: computed(() => props.loading),
|
|
88
88
|
onChange: (val) => props.onLoadingChange?.(val)
|
|
89
89
|
});
|
|
90
|
+
/**
|
|
91
|
+
* loading 指示器解析:
|
|
92
|
+
* 优先级 loading(SpinProps).indicator > 全局 configContext.indicator > Spin 默认。
|
|
93
|
+
* configContext.indicator 可能是函数,需调用取值(与 AppPage 一致)。
|
|
94
|
+
*/
|
|
95
|
+
const resolvedIndicator = computed(() => {
|
|
96
|
+
const loadingProp = props.loading;
|
|
97
|
+
if (loadingProp && typeof loadingProp === "object") {
|
|
98
|
+
const indicator = loadingProp.indicator;
|
|
99
|
+
if (indicator !== void 0) return indicator;
|
|
100
|
+
}
|
|
101
|
+
const ctxIndicator = configContext?.indicator?.value;
|
|
102
|
+
return typeof ctxIndicator === "function" ? ctxIndicator() : ctxIndicator;
|
|
103
|
+
});
|
|
90
104
|
const { selectedRowKeys, selectedItems, mergedRowSelection, select: selectRow, selectAll: selectAllRows, remove: removeSelectedKeys, clear: clearSelectedKeys, sync: syncSelectedRows } = useRowSelection({
|
|
91
105
|
rowKey: computed(() => props.rowKey),
|
|
92
106
|
rowSelection: computed(() => props.rowSelection),
|
|
@@ -249,6 +263,15 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
249
263
|
};
|
|
250
264
|
continue;
|
|
251
265
|
}
|
|
266
|
+
if (key === "expandable") {
|
|
267
|
+
const userExpandable = props.expandable;
|
|
268
|
+
const controlledExpandedRowKeys = props.expandedRowKeys;
|
|
269
|
+
if (userExpandable !== void 0 || controlledExpandedRowKeys !== void 0) result.expandable = {
|
|
270
|
+
...userExpandable ?? {},
|
|
271
|
+
...controlledExpandedRowKeys !== void 0 ? { expandedRowKeys: controlledExpandedRowKeys } : {}
|
|
272
|
+
};
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
252
275
|
const val = props[key];
|
|
253
276
|
if (val !== void 0) result[key] = val;
|
|
254
277
|
}
|
|
@@ -363,7 +386,7 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
363
386
|
"listToolAfter": slots.listToolAfter?.() ?? props.listToolAfter,
|
|
364
387
|
"proClasses": props.proClasses ?? {},
|
|
365
388
|
"proStyles": props.proStyles ?? {}
|
|
366
|
-
}, null),
|
|
389
|
+
}, null), createVNode("div", { "class": `${prefixCls.value}-loading-container` }, [isCustomRenderMode.value ? createVNode("div", { "class": classNames(`${prefixCls.value}-list`, props.proClasses?.list) }, [createVNode("div", {
|
|
367
390
|
"class": classNames(`${prefixCls.value}-list-content`, props.proClasses?.listContent),
|
|
368
391
|
"style": props.proStyles?.listContent
|
|
369
392
|
}, [renderCustomContent()]), paginationInfo.value !== false && dataSource.value?.length > 0 && createVNode(Pagination, mergeProps(paginationInfo.value, {
|
|
@@ -371,7 +394,7 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
371
394
|
"class": classNames(`${prefixCls.value}-pagination`, props.proClasses?.pagination),
|
|
372
395
|
"style": props.proStyles?.pagination,
|
|
373
396
|
"onChange": onCustomPaginationChange
|
|
374
|
-
}), null)])
|
|
397
|
+
}), null)]) : createVNode(Fragment, null, [createVNode(Table, mergeProps(passThroughProps.value, {
|
|
375
398
|
"scroll": tableScroll.value,
|
|
376
399
|
"dataSource": dataSource.value,
|
|
377
400
|
"columns": props.draggable ? resizableColumns.value : tableColumns.value,
|
|
@@ -379,7 +402,7 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
379
402
|
"rowKey": props.rowKey,
|
|
380
403
|
"size": tableSize.value,
|
|
381
404
|
"pagination": paginationInfo.value,
|
|
382
|
-
"loading":
|
|
405
|
+
"loading": false,
|
|
383
406
|
"rowSelection": mergedRowSelection.value,
|
|
384
407
|
"onChange": onTableChange,
|
|
385
408
|
"onUpdate:expandedRowKeys": onTableExpandedRowKeysChange,
|
|
@@ -391,7 +414,7 @@ const ForwardProTable = /* @__PURE__ */ defineComponent((props, { attrs, slots,
|
|
|
391
414
|
}), tableSlots.value), scrollEl.value && createVNode(Teleport, { "to": scrollEl.value }, { default: () => [createVNode(Bar_default, {
|
|
392
415
|
"ref": barRef,
|
|
393
416
|
"hasScrollY": !!tableScroll.value.y
|
|
394
|
-
}, null)] })])])])]);
|
|
417
|
+
}, null)] })]), loadingState.value && createVNode("div", { "class": classNames(`${prefixCls.value}-loading-mask`, hashId.value) }, [createVNode(Spin, { "indicator": resolvedIndicator.value }, null)])])])])]);
|
|
395
418
|
};
|
|
396
419
|
}, {
|
|
397
420
|
props: /* @__PURE__ */ mergeDefaults({
|
|
@@ -47,9 +47,9 @@ declare const CollapseToggle: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
47
47
|
required: true;
|
|
48
48
|
};
|
|
49
49
|
}>> & Readonly<{}>, {
|
|
50
|
-
hashId: string;
|
|
51
50
|
collapsed: boolean;
|
|
52
51
|
collapseRender: WithFalse<(collapsed?: boolean) => CustomRender>;
|
|
52
|
+
hashId: string;
|
|
53
53
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
54
54
|
//#endregion
|
|
55
55
|
export { CollapseToggle };
|
|
@@ -67,9 +67,9 @@ declare const FormItemContainer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
67
67
|
default: any;
|
|
68
68
|
};
|
|
69
69
|
}>> & Readonly<{}>, {
|
|
70
|
-
loading: boolean;
|
|
71
|
-
autoRequest: boolean;
|
|
72
70
|
onSubmit: () => void;
|
|
71
|
+
autoRequest: boolean;
|
|
72
|
+
loading: boolean;
|
|
73
73
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
//#endregion
|
|
75
75
|
export { FormItemContainer };
|
|
@@ -71,10 +71,10 @@ declare const FormItemWrapper: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
71
71
|
};
|
|
72
72
|
}>> & Readonly<{}>, {
|
|
73
73
|
label: any;
|
|
74
|
+
hashId: string;
|
|
74
75
|
labelWidth: string | number;
|
|
75
|
-
labelAlign: "left" | "
|
|
76
|
+
labelAlign: "left" | "right" | "center";
|
|
76
77
|
colon: boolean;
|
|
77
|
-
hashId: string;
|
|
78
78
|
formItemStyle: CSSProperties;
|
|
79
79
|
globalLabelGap: number;
|
|
80
80
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
@@ -111,6 +111,10 @@ declare const ProTableSearchForm: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
111
111
|
default: any;
|
|
112
112
|
};
|
|
113
113
|
}>> & Readonly<{}>, {
|
|
114
|
+
onReset: (params: Record<string, any>) => void;
|
|
115
|
+
proClasses: Record<string, string>;
|
|
116
|
+
proStyles: Record<string, any>;
|
|
117
|
+
loading: any;
|
|
114
118
|
formColumns: ProSearchMap<"text", string>[];
|
|
115
119
|
formConfig: FormConfig;
|
|
116
120
|
formAutoRequest: boolean;
|
|
@@ -120,11 +124,7 @@ declare const ProTableSearchForm: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
120
124
|
searchText?: string;
|
|
121
125
|
resetText?: string;
|
|
122
126
|
};
|
|
123
|
-
loading: any;
|
|
124
127
|
cardBordered: boolean;
|
|
125
|
-
proClasses: Record<string, string>;
|
|
126
|
-
proStyles: Record<string, any>;
|
|
127
|
-
onReset: (params: Record<string, any>) => void;
|
|
128
128
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
129
129
|
//#endregion
|
|
130
130
|
export { ProTableSearchForm as default };
|
|
@@ -93,19 +93,19 @@ declare const ListToolBar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
93
93
|
default: () => {};
|
|
94
94
|
};
|
|
95
95
|
}>> & Readonly<{}>, {
|
|
96
|
-
actions: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
97
|
-
[key: string]: any;
|
|
98
|
-
}>[];
|
|
99
|
-
proClasses: Record<string, any>;
|
|
100
|
-
proStyles: Record<string, any>;
|
|
101
|
-
titleTipText: string;
|
|
102
|
-
actionsPlacement: ToolbarPlacement;
|
|
103
96
|
headerTitle: any;
|
|
104
|
-
listToolAfter: any;
|
|
105
97
|
headerTitleTip: any;
|
|
98
|
+
titleTipText: string;
|
|
106
99
|
settings: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
107
100
|
[key: string]: any;
|
|
108
101
|
}>[];
|
|
102
|
+
actions: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
103
|
+
[key: string]: any;
|
|
104
|
+
}>[];
|
|
105
|
+
actionsPlacement: ToolbarPlacement;
|
|
106
|
+
listToolAfter: any;
|
|
107
|
+
proClasses: Record<string, any>;
|
|
108
|
+
proStyles: Record<string, any>;
|
|
109
109
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { ListToolBar, ListToolBarSetting };
|
|
@@ -87,17 +87,17 @@ declare const Toolbar: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
87
87
|
default: () => {};
|
|
88
88
|
};
|
|
89
89
|
}>> & Readonly<{}>, {
|
|
90
|
+
headerTitle: any;
|
|
91
|
+
headerTitleTip: any;
|
|
92
|
+
titleTipText: string;
|
|
90
93
|
actions: VNode<_$vue.RendererNode, _$vue.RendererElement, {
|
|
91
94
|
[key: string]: any;
|
|
92
95
|
}>[];
|
|
96
|
+
actionsPlacement: ToolbarPlacement;
|
|
97
|
+
listToolAfter: any;
|
|
93
98
|
proClasses: Record<string, any>;
|
|
94
99
|
proStyles: Record<string, any>;
|
|
95
100
|
options: any;
|
|
96
|
-
titleTipText: string;
|
|
97
|
-
actionsPlacement: ToolbarPlacement;
|
|
98
|
-
headerTitle: any;
|
|
99
|
-
listToolAfter: any;
|
|
100
|
-
headerTitleTip: any;
|
|
101
101
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
102
102
|
//#endregion
|
|
103
103
|
export { Toolbar, Toolbar as default };
|
|
@@ -50,7 +50,7 @@ function useFetchData(config, action) {
|
|
|
50
50
|
}
|
|
51
51
|
/** 写入表格数据并同步 sortIndex,无 request 时同步 dataSource total */
|
|
52
52
|
function setTableDataList(list) {
|
|
53
|
-
tableDataList.value = getSortIndex(list, toRaw(pageInfo));
|
|
53
|
+
tableDataList.value = getSortIndex(toRaw(list), toRaw(pageInfo));
|
|
54
54
|
if (!request || !isFunction(request)) {
|
|
55
55
|
const total = list.length || 0;
|
|
56
56
|
if (total !== pageInfo.total) setPagination({ total });
|
package/dist/hooks/useTable.js
CHANGED
|
@@ -9,13 +9,15 @@ function useTable(tableRef, options) {
|
|
|
9
9
|
});
|
|
10
10
|
const syncedStateKeys = /* @__PURE__ */ new Set();
|
|
11
11
|
function syncTableState(state = {}) {
|
|
12
|
-
const
|
|
13
|
-
for (const key of syncedStateKeys) if (!(key in nextState)) {
|
|
12
|
+
for (const key of syncedStateKeys) if (!(key in state)) {
|
|
14
13
|
delete tableState[key];
|
|
15
14
|
syncedStateKeys.delete(key);
|
|
16
15
|
}
|
|
17
|
-
Object.
|
|
18
|
-
|
|
16
|
+
for (const key of Object.keys(state)) {
|
|
17
|
+
const nextValue = state[key];
|
|
18
|
+
if (nextValue !== tableState[key]) tableState[key] = nextValue;
|
|
19
|
+
syncedStateKeys.add(key);
|
|
20
|
+
}
|
|
19
21
|
if (options?.request) tableState.request = options.request;
|
|
20
22
|
}
|
|
21
23
|
watch(() => toValue(options?.state), (newState) => {
|