@funcho/ui 1.1.1 → 1.1.3
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 +24 -8
- package/dist/cjs/packages/ui/package.json.js +1 -1
- package/dist/esm/business/DataTable/DataTable.vue.mjs +25 -9
- package/dist/esm/packages/ui/package.json.mjs +1 -1
- package/dist/types/business/DataTable/DataTable.types.d.ts +4 -2
- package/dist/types/business/DataTable/DataTable.vue.d.ts +1796 -30
- package/dist/types/business/DataTable/index.d.ts +1905 -26
- package/package.json +3 -3
|
@@ -95,8 +95,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
95
95
|
columns: { default: () => [] },
|
|
96
96
|
isPagination: { type: Boolean, default: true },
|
|
97
97
|
fields: { default: () => [] },
|
|
98
|
-
request: { type: Function, default: () => Promise.resolve({ list: [], total: 0 }) },
|
|
99
|
-
actions: { default: () => [] }
|
|
98
|
+
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
99
|
+
actions: { default: () => [] },
|
|
100
|
+
tools: { default: () => [] }
|
|
100
101
|
},
|
|
101
102
|
setup(__props) {
|
|
102
103
|
const ns = useNamespace.useNamespace("data-table");
|
|
@@ -157,9 +158,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
157
158
|
const params = formRef.value?.model || {};
|
|
158
159
|
try {
|
|
159
160
|
tableLoading.value = true;
|
|
160
|
-
const {
|
|
161
|
-
tableData.value = list || [];
|
|
162
|
-
pagination.value.total = total || 0;
|
|
161
|
+
const { data } = await props.request(params);
|
|
162
|
+
tableData.value = Array.isArray(data) ? data : data.list || [];
|
|
163
|
+
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
163
164
|
} catch (error) {
|
|
164
165
|
console.log("获取数据失败", error);
|
|
165
166
|
} finally {
|
|
@@ -205,8 +206,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
205
206
|
fields: searchFormFields.value,
|
|
206
207
|
class: vue.normalizeClass(vue.unref(ns).e("query-form")),
|
|
207
208
|
"label-position": "right",
|
|
208
|
-
"label-width": "auto"
|
|
209
|
-
}, null, 8, ["fields", "class"]),
|
|
209
|
+
"label-width": hasMoreContent.value && isExpanded.value ? "auto" : "fit-content"
|
|
210
|
+
}, null, 8, ["fields", "class", "label-width"]),
|
|
210
211
|
vue.createElementVNode("div", {
|
|
211
212
|
class: vue.normalizeClass(vue.unref(ns).e("tools"))
|
|
212
213
|
}, [
|
|
@@ -244,7 +245,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
244
245
|
vue.createTextVNode("查询", -1)
|
|
245
246
|
])]),
|
|
246
247
|
_: 1
|
|
247
|
-
}, 8, ["disabled"])
|
|
248
|
+
}, 8, ["disabled"]),
|
|
249
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.tools, (tool, i) => {
|
|
250
|
+
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), {
|
|
252
|
+
key: 0,
|
|
253
|
+
type: tool.type || "primary",
|
|
254
|
+
disabled: typeof tool.disabled === "function" ? tool.disabled() : tool.disabled,
|
|
255
|
+
onClick: tool.onClick
|
|
256
|
+
}, {
|
|
257
|
+
default: vue.withCtx(() => [
|
|
258
|
+
vue.createTextVNode(vue.toDisplayString(tool.label), 1)
|
|
259
|
+
]),
|
|
260
|
+
_: 2
|
|
261
|
+
}, 1032, ["type", "disabled", "onClick"])) : vue.createCommentVNode("", true)
|
|
262
|
+
], 64);
|
|
263
|
+
}), 128))
|
|
248
264
|
], 2)
|
|
249
265
|
], 6)) : vue.createCommentVNode("", true),
|
|
250
266
|
vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(index$2.FcTable), vue.mergeProps(_ctx.$attrs, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, onMounted, resolveDirective, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, withDirectives, normalizeStyle, createVNode, createElementVNode, createBlock, withCtx, createTextVNode, toDisplayString,
|
|
1
|
+
import { defineComponent, ref, computed, onMounted, resolveDirective, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, withDirectives, normalizeStyle, createVNode, createElementVNode, createBlock, withCtx, createTextVNode, toDisplayString, Fragment, renderList, mergeProps, createSlots, resolveDynamicComponent } from 'vue';
|
|
2
2
|
import { useNamespace } from '../../hooks/use-namespace.mjs';
|
|
3
3
|
import { FcButton, FcDangerButton, FcLinkButton } from '../../components/Button/index.mjs';
|
|
4
4
|
import '../../components/Dialog/index.mjs';
|
|
@@ -91,8 +91,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
91
91
|
columns: { default: () => [] },
|
|
92
92
|
isPagination: { type: Boolean, default: true },
|
|
93
93
|
fields: { default: () => [] },
|
|
94
|
-
request: { type: Function, default: () => Promise.resolve({ list: [], total: 0 }) },
|
|
95
|
-
actions: { default: () => [] }
|
|
94
|
+
request: { type: Function, default: () => Promise.resolve({ data: { list: [], total: 0 } }) },
|
|
95
|
+
actions: { default: () => [] },
|
|
96
|
+
tools: { default: () => [] }
|
|
96
97
|
},
|
|
97
98
|
setup(__props) {
|
|
98
99
|
const ns = useNamespace("data-table");
|
|
@@ -153,9 +154,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
153
154
|
const params = formRef.value?.model || {};
|
|
154
155
|
try {
|
|
155
156
|
tableLoading.value = true;
|
|
156
|
-
const {
|
|
157
|
-
tableData.value = list || [];
|
|
158
|
-
pagination.value.total = total || 0;
|
|
157
|
+
const { data } = await props.request(params);
|
|
158
|
+
tableData.value = Array.isArray(data) ? data : data.list || [];
|
|
159
|
+
pagination.value.total = Array.isArray(data) ? data.length : data.total || 0;
|
|
159
160
|
} catch (error) {
|
|
160
161
|
console.log("获取数据失败", error);
|
|
161
162
|
} finally {
|
|
@@ -201,8 +202,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
201
202
|
fields: searchFormFields.value,
|
|
202
203
|
class: normalizeClass(unref(ns).e("query-form")),
|
|
203
204
|
"label-position": "right",
|
|
204
|
-
"label-width": "auto"
|
|
205
|
-
}, null, 8, ["fields", "class"]),
|
|
205
|
+
"label-width": hasMoreContent.value && isExpanded.value ? "auto" : "fit-content"
|
|
206
|
+
}, null, 8, ["fields", "class", "label-width"]),
|
|
206
207
|
createElementVNode("div", {
|
|
207
208
|
class: normalizeClass(unref(ns).e("tools"))
|
|
208
209
|
}, [
|
|
@@ -240,7 +241,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
240
241
|
createTextVNode("查询", -1)
|
|
241
242
|
])]),
|
|
242
243
|
_: 1
|
|
243
|
-
}, 8, ["disabled"])
|
|
244
|
+
}, 8, ["disabled"]),
|
|
245
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.tools, (tool, i) => {
|
|
246
|
+
return openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
247
|
+
(typeof tool.hidden === "function" ? !tool.hidden() : !tool.hidden) ? (openBlock(), createBlock(unref(FcButton), {
|
|
248
|
+
key: 0,
|
|
249
|
+
type: tool.type || "primary",
|
|
250
|
+
disabled: typeof tool.disabled === "function" ? tool.disabled() : tool.disabled,
|
|
251
|
+
onClick: tool.onClick
|
|
252
|
+
}, {
|
|
253
|
+
default: withCtx(() => [
|
|
254
|
+
createTextVNode(toDisplayString(tool.label), 1)
|
|
255
|
+
]),
|
|
256
|
+
_: 2
|
|
257
|
+
}, 1032, ["type", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
258
|
+
], 64);
|
|
259
|
+
}), 128))
|
|
244
260
|
], 2)
|
|
245
261
|
], 6)) : createCommentVNode("", true),
|
|
246
262
|
withDirectives((openBlock(), createBlock(unref(FcTable), mergeProps(_ctx.$attrs, {
|