@alibarbar/components 1.0.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/README.md +181 -0
- package/dist/components/FatForm/FatForm.vue.d.ts +99 -0
- package/dist/components/FatForm/FatForm.vue.d.ts.map +1 -0
- package/dist/components/FatForm/FatFormItem.vue.d.ts +35 -0
- package/dist/components/FatForm/FatFormItem.vue.d.ts.map +1 -0
- package/dist/components/FatForm/index.d.ts +7 -0
- package/dist/components/FatForm/index.d.ts.map +1 -0
- package/dist/components/FatForm/types.d.ts +101 -0
- package/dist/components/FatForm/types.d.ts.map +1 -0
- package/dist/components/FatFormLayout/FatFormLayout.vue.d.ts +47 -0
- package/dist/components/FatFormLayout/FatFormLayout.vue.d.ts.map +1 -0
- package/dist/components/FatFormLayout/index.d.ts +5 -0
- package/dist/components/FatFormLayout/index.d.ts.map +1 -0
- package/dist/components/FatFormLayout/types.d.ts +15 -0
- package/dist/components/FatFormLayout/types.d.ts.map +1 -0
- package/dist/components/FatTable/FatTable.vue.d.ts +42 -0
- package/dist/components/FatTable/FatTable.vue.d.ts.map +1 -0
- package/dist/components/FatTable/index.d.ts +9 -0
- package/dist/components/FatTable/index.d.ts.map +1 -0
- package/dist/components/FatTable/types.d.ts +274 -0
- package/dist/components/FatTable/types.d.ts.map +1 -0
- package/dist/components/FatTableLayout/FatTableLayout.vue.d.ts +47 -0
- package/dist/components/FatTableLayout/FatTableLayout.vue.d.ts.map +1 -0
- package/dist/components/FatTableLayout/index.d.ts +5 -0
- package/dist/components/FatTableLayout/index.d.ts.map +1 -0
- package/dist/components/FatTableLayout/types.d.ts +19 -0
- package/dist/components/FatTableLayout/types.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +61 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/locales/en-US.d.ts +30 -0
- package/dist/i18n/locales/en-US.d.ts.map +1 -0
- package/dist/i18n/locales/zh-CN.d.ts +30 -0
- package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
- package/dist/index.d.ts +485 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +972 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/types.d.ts +5 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/package.json +61 -0
- package/src/style/fat-form-layout.scss +53 -0
- package/src/style/fat-form.scss +132 -0
- package/src/style/fat-table-layout.scss +43 -0
- package/src/style/fat-table.scss +132 -0
- package/src/style/index.scss +14 -0
- package/src/style/variables.scss +23 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,972 @@
|
|
|
1
|
+
import { createI18n, useI18n } from "vue-i18n";
|
|
2
|
+
import { defineComponent, ref, reactive, computed, watch, onMounted, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeStyle, Fragment, renderList, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, toDisplayString, unref, provide, withModifiers, inject, createTextVNode } from "vue";
|
|
3
|
+
const zhCN = {
|
|
4
|
+
common: {
|
|
5
|
+
confirm: "确认",
|
|
6
|
+
cancel: "取消",
|
|
7
|
+
submit: "提交",
|
|
8
|
+
reset: "重置",
|
|
9
|
+
search: "搜索",
|
|
10
|
+
add: "新增",
|
|
11
|
+
edit: "编辑",
|
|
12
|
+
delete: "删除",
|
|
13
|
+
save: "保存",
|
|
14
|
+
loading: "加载中...",
|
|
15
|
+
noData: "暂无数据"
|
|
16
|
+
},
|
|
17
|
+
table: {
|
|
18
|
+
total: "共 {total} 条",
|
|
19
|
+
pageSize: "每页显示",
|
|
20
|
+
page: "页",
|
|
21
|
+
goto: "前往",
|
|
22
|
+
pageSizeOptions: ["10", "20", "50", "100"]
|
|
23
|
+
},
|
|
24
|
+
form: {
|
|
25
|
+
required: "此项为必填项",
|
|
26
|
+
invalidFormat: "格式不正确",
|
|
27
|
+
submitSuccess: "提交成功",
|
|
28
|
+
submitFailed: "提交失败"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const enUS = {
|
|
32
|
+
common: {
|
|
33
|
+
confirm: "Confirm",
|
|
34
|
+
cancel: "Cancel",
|
|
35
|
+
submit: "Submit",
|
|
36
|
+
reset: "Reset",
|
|
37
|
+
search: "Search",
|
|
38
|
+
add: "Add",
|
|
39
|
+
edit: "Edit",
|
|
40
|
+
delete: "Delete",
|
|
41
|
+
save: "Save",
|
|
42
|
+
loading: "Loading...",
|
|
43
|
+
noData: "No Data"
|
|
44
|
+
},
|
|
45
|
+
table: {
|
|
46
|
+
total: "Total {total} items",
|
|
47
|
+
pageSize: "Items per page",
|
|
48
|
+
page: "Page",
|
|
49
|
+
goto: "Go to",
|
|
50
|
+
pageSizeOptions: ["10", "20", "50", "100"]
|
|
51
|
+
},
|
|
52
|
+
form: {
|
|
53
|
+
required: "This field is required",
|
|
54
|
+
invalidFormat: "Invalid format",
|
|
55
|
+
submitSuccess: "Submit successful",
|
|
56
|
+
submitFailed: "Submit failed"
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const messages = {
|
|
60
|
+
"zh-CN": zhCN,
|
|
61
|
+
"en-US": enUS
|
|
62
|
+
};
|
|
63
|
+
const i18n = createI18n({
|
|
64
|
+
legacy: false,
|
|
65
|
+
locale: "zh-CN",
|
|
66
|
+
fallbackLocale: "en-US",
|
|
67
|
+
messages
|
|
68
|
+
});
|
|
69
|
+
const _hoisted_1$4 = { class: "fat-table-wrapper" };
|
|
70
|
+
const _hoisted_2$4 = { class: "fat-table__inner" };
|
|
71
|
+
const _hoisted_3$3 = { class: "fat-table__header" };
|
|
72
|
+
const _hoisted_4$2 = { class: "fat-table__cell" };
|
|
73
|
+
const _hoisted_5$2 = { key: 0 };
|
|
74
|
+
const _hoisted_6$2 = { key: 1 };
|
|
75
|
+
const _hoisted_7$2 = ["onClick"];
|
|
76
|
+
const _hoisted_8 = { class: "fat-table__body" };
|
|
77
|
+
const _hoisted_9 = {
|
|
78
|
+
key: 0,
|
|
79
|
+
class: "fat-table__loading-row"
|
|
80
|
+
};
|
|
81
|
+
const _hoisted_10 = ["colspan"];
|
|
82
|
+
const _hoisted_11 = {
|
|
83
|
+
key: 1,
|
|
84
|
+
class: "fat-table__empty-row"
|
|
85
|
+
};
|
|
86
|
+
const _hoisted_12 = ["colspan"];
|
|
87
|
+
const _hoisted_13 = ["onClick"];
|
|
88
|
+
const _hoisted_14 = { class: "fat-table__cell" };
|
|
89
|
+
const _hoisted_15 = { key: 0 };
|
|
90
|
+
const _hoisted_16 = { key: 1 };
|
|
91
|
+
const _hoisted_17 = {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: "fat-table__pagination"
|
|
94
|
+
};
|
|
95
|
+
const _hoisted_18 = { class: "fat-table__pagination-info" };
|
|
96
|
+
const _hoisted_19 = { class: "fat-table__pagination-controls" };
|
|
97
|
+
const _hoisted_20 = ["value"];
|
|
98
|
+
const _hoisted_21 = ["value"];
|
|
99
|
+
const _hoisted_22 = { class: "fat-table__pagination-text" };
|
|
100
|
+
const _hoisted_23 = ["disabled"];
|
|
101
|
+
const _hoisted_24 = { class: "fat-table__pagination-text" };
|
|
102
|
+
const _hoisted_25 = ["disabled"];
|
|
103
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
104
|
+
__name: "FatTable",
|
|
105
|
+
props: {
|
|
106
|
+
columns: {},
|
|
107
|
+
data: { default: () => [] },
|
|
108
|
+
loading: { type: Boolean, default: false },
|
|
109
|
+
pagination: { type: [Boolean, Object], default: false },
|
|
110
|
+
height: {},
|
|
111
|
+
maxHeight: {},
|
|
112
|
+
stripe: { type: Boolean, default: false },
|
|
113
|
+
border: { type: Boolean, default: true },
|
|
114
|
+
size: { default: "default" },
|
|
115
|
+
emptyText: { default: "" },
|
|
116
|
+
rowKey: {},
|
|
117
|
+
fetchHandler: {},
|
|
118
|
+
query: {},
|
|
119
|
+
requestOnMounted: { type: Boolean, default: true },
|
|
120
|
+
requestOnQueryChange: { type: Boolean, default: true },
|
|
121
|
+
requestOnSortChange: { type: Boolean, default: true }
|
|
122
|
+
},
|
|
123
|
+
emits: ["page-change", "page-size-change", "sort-change", "row-click"],
|
|
124
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
125
|
+
const props = __props;
|
|
126
|
+
const emit = __emit;
|
|
127
|
+
const { t } = useI18n();
|
|
128
|
+
const internalList = ref([]);
|
|
129
|
+
const internalLoading = ref(false);
|
|
130
|
+
const internalPagination = reactive({
|
|
131
|
+
currentPage: 1,
|
|
132
|
+
pageSize: 10,
|
|
133
|
+
total: 0
|
|
134
|
+
});
|
|
135
|
+
const query = computed(() => props.query || {});
|
|
136
|
+
const sortState = reactive({
|
|
137
|
+
prop: "",
|
|
138
|
+
order: null
|
|
139
|
+
});
|
|
140
|
+
const useFetchHandler = computed(() => !!props.fetchHandler);
|
|
141
|
+
const list = computed(() => {
|
|
142
|
+
if (useFetchHandler.value) {
|
|
143
|
+
return internalList.value;
|
|
144
|
+
}
|
|
145
|
+
return props.data || [];
|
|
146
|
+
});
|
|
147
|
+
const loading = computed(() => {
|
|
148
|
+
if (useFetchHandler.value) {
|
|
149
|
+
return internalLoading.value;
|
|
150
|
+
}
|
|
151
|
+
return props.loading;
|
|
152
|
+
});
|
|
153
|
+
const paginationData = computed(() => {
|
|
154
|
+
if (useFetchHandler.value) {
|
|
155
|
+
return internalPagination;
|
|
156
|
+
}
|
|
157
|
+
if (typeof props.pagination === "boolean") {
|
|
158
|
+
return {
|
|
159
|
+
currentPage: 1,
|
|
160
|
+
pageSize: 10,
|
|
161
|
+
total: list.value.length
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return props.pagination;
|
|
165
|
+
});
|
|
166
|
+
const pageSizes = computed(() => {
|
|
167
|
+
if (typeof props.pagination === "object" && props.pagination.pageSizes) {
|
|
168
|
+
return props.pagination.pageSizes;
|
|
169
|
+
}
|
|
170
|
+
return [10, 20, 50, 100];
|
|
171
|
+
});
|
|
172
|
+
const totalPages = computed(() => {
|
|
173
|
+
const total = paginationData.value.total;
|
|
174
|
+
const pageSize = paginationData.value.pageSize;
|
|
175
|
+
return Math.ceil(total / pageSize);
|
|
176
|
+
});
|
|
177
|
+
const tableStyle = computed(() => {
|
|
178
|
+
const style = {};
|
|
179
|
+
if (props.height) {
|
|
180
|
+
style.height = typeof props.height === "number" ? `${props.height}px` : props.height;
|
|
181
|
+
}
|
|
182
|
+
if (props.maxHeight) {
|
|
183
|
+
style.maxHeight = typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight;
|
|
184
|
+
}
|
|
185
|
+
return style;
|
|
186
|
+
});
|
|
187
|
+
const getColumnKey = (column, index2) => {
|
|
188
|
+
return column.key || column.prop || `column-${index2}`;
|
|
189
|
+
};
|
|
190
|
+
const getRowKey = (row, index2) => {
|
|
191
|
+
if (typeof props.rowKey === "function") {
|
|
192
|
+
return props.rowKey(row);
|
|
193
|
+
}
|
|
194
|
+
if (typeof props.rowKey === "string") {
|
|
195
|
+
return row[props.rowKey];
|
|
196
|
+
}
|
|
197
|
+
return index2;
|
|
198
|
+
};
|
|
199
|
+
const getColumnStyle = (column) => {
|
|
200
|
+
const style = {};
|
|
201
|
+
if (column.width) {
|
|
202
|
+
style.width = typeof column.width === "number" ? `${column.width}px` : column.width;
|
|
203
|
+
}
|
|
204
|
+
if (column.minWidth) {
|
|
205
|
+
style.minWidth = typeof column.minWidth === "number" ? `${column.minWidth}px` : column.minWidth;
|
|
206
|
+
}
|
|
207
|
+
if (column.align) {
|
|
208
|
+
style.textAlign = column.align;
|
|
209
|
+
}
|
|
210
|
+
return style;
|
|
211
|
+
};
|
|
212
|
+
const getColumnClass = (column) => {
|
|
213
|
+
return {
|
|
214
|
+
"fat-table__header-cell--fixed-left": column.fixed === "left" || column.fixed === true,
|
|
215
|
+
"fat-table__header-cell--fixed-right": column.fixed === "right"
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
const getCellClass = (column) => {
|
|
219
|
+
return {
|
|
220
|
+
"fat-table__cell--fixed-left": column.fixed === "left" || column.fixed === true,
|
|
221
|
+
"fat-table__cell--fixed-right": column.fixed === "right"
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
const getCellValue = (row, column) => {
|
|
225
|
+
if (!column.prop) return void 0;
|
|
226
|
+
return row[column.prop];
|
|
227
|
+
};
|
|
228
|
+
const formatCellValue = (row, column) => {
|
|
229
|
+
const value = getCellValue(row, column);
|
|
230
|
+
return value ?? "";
|
|
231
|
+
};
|
|
232
|
+
const getRequestParams = () => {
|
|
233
|
+
const page = paginationData.value.currentPage;
|
|
234
|
+
const pageSize = paginationData.value.pageSize;
|
|
235
|
+
return {
|
|
236
|
+
pagination: {
|
|
237
|
+
pageSize,
|
|
238
|
+
page,
|
|
239
|
+
offset: (page - 1) * pageSize
|
|
240
|
+
},
|
|
241
|
+
sort: sortState.prop && sortState.order ? {
|
|
242
|
+
prop: sortState.prop,
|
|
243
|
+
order: sortState.order
|
|
244
|
+
} : void 0,
|
|
245
|
+
query: query.value,
|
|
246
|
+
list: internalList.value
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
const fetchData = async () => {
|
|
250
|
+
if (!props.fetchHandler) return;
|
|
251
|
+
internalLoading.value = true;
|
|
252
|
+
try {
|
|
253
|
+
const params = getRequestParams();
|
|
254
|
+
const response = await props.fetchHandler(params);
|
|
255
|
+
internalList.value = response.list;
|
|
256
|
+
internalPagination.total = response.total;
|
|
257
|
+
} catch (error) {
|
|
258
|
+
console.error("FatTable fetchData error:", error);
|
|
259
|
+
internalList.value = [];
|
|
260
|
+
internalPagination.total = 0;
|
|
261
|
+
} finally {
|
|
262
|
+
internalLoading.value = false;
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const handleSort = (column) => {
|
|
266
|
+
if (!column.sortable || !column.prop) return;
|
|
267
|
+
if (sortState.prop === column.prop) {
|
|
268
|
+
if (sortState.order === "ascending") {
|
|
269
|
+
sortState.order = "descending";
|
|
270
|
+
} else if (sortState.order === "descending") {
|
|
271
|
+
sortState.prop = "";
|
|
272
|
+
sortState.order = null;
|
|
273
|
+
} else {
|
|
274
|
+
sortState.order = "ascending";
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
sortState.prop = column.prop;
|
|
278
|
+
sortState.order = "ascending";
|
|
279
|
+
}
|
|
280
|
+
if (sortState.prop && sortState.order && column.prop) {
|
|
281
|
+
emit("sort-change", {
|
|
282
|
+
column,
|
|
283
|
+
prop: column.prop,
|
|
284
|
+
order: sortState.order
|
|
285
|
+
});
|
|
286
|
+
if (useFetchHandler.value && props.requestOnSortChange) {
|
|
287
|
+
internalPagination.currentPage = 1;
|
|
288
|
+
fetchData();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const handlePageChange = (page) => {
|
|
293
|
+
if (useFetchHandler.value) {
|
|
294
|
+
internalPagination.currentPage = page;
|
|
295
|
+
fetchData();
|
|
296
|
+
} else if (typeof props.pagination === "object") {
|
|
297
|
+
emit("page-change", page);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const handlePageSizeChange = (event) => {
|
|
301
|
+
const target = event.target;
|
|
302
|
+
const pageSize = Number(target.value);
|
|
303
|
+
if (useFetchHandler.value) {
|
|
304
|
+
internalPagination.pageSize = pageSize;
|
|
305
|
+
internalPagination.currentPage = 1;
|
|
306
|
+
fetchData();
|
|
307
|
+
} else if (typeof props.pagination === "object") {
|
|
308
|
+
emit("page-size-change", pageSize);
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const handleRowClick = (row, event) => {
|
|
312
|
+
emit("row-click", row, {}, event);
|
|
313
|
+
};
|
|
314
|
+
watch(
|
|
315
|
+
() => props.query,
|
|
316
|
+
() => {
|
|
317
|
+
if (useFetchHandler.value && props.requestOnQueryChange) {
|
|
318
|
+
internalPagination.currentPage = 1;
|
|
319
|
+
fetchData();
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
{ deep: true }
|
|
323
|
+
);
|
|
324
|
+
watch(
|
|
325
|
+
() => props.pagination,
|
|
326
|
+
(newPagination) => {
|
|
327
|
+
if (useFetchHandler.value && typeof newPagination === "object") {
|
|
328
|
+
internalPagination.currentPage = newPagination.currentPage;
|
|
329
|
+
internalPagination.pageSize = newPagination.pageSize;
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{ deep: true }
|
|
333
|
+
);
|
|
334
|
+
onMounted(() => {
|
|
335
|
+
if (useFetchHandler.value && props.requestOnMounted) {
|
|
336
|
+
fetchData();
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
__expose({
|
|
340
|
+
/**
|
|
341
|
+
* 刷新数据
|
|
342
|
+
*/
|
|
343
|
+
refresh: () => {
|
|
344
|
+
if (useFetchHandler.value) {
|
|
345
|
+
fetchData();
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* 重置并重新获取数据
|
|
350
|
+
*/
|
|
351
|
+
reset: () => {
|
|
352
|
+
if (useFetchHandler.value) {
|
|
353
|
+
internalPagination.currentPage = 1;
|
|
354
|
+
sortState.prop = "";
|
|
355
|
+
sortState.order = null;
|
|
356
|
+
fetchData();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
/**
|
|
360
|
+
* 获取请求参数
|
|
361
|
+
*/
|
|
362
|
+
getRequestParams
|
|
363
|
+
});
|
|
364
|
+
return (_ctx, _cache) => {
|
|
365
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
366
|
+
createElementVNode("div", {
|
|
367
|
+
class: "fat-table",
|
|
368
|
+
style: normalizeStyle(tableStyle.value)
|
|
369
|
+
}, [
|
|
370
|
+
createElementVNode("table", _hoisted_2$4, [
|
|
371
|
+
createElementVNode("thead", _hoisted_3$3, [
|
|
372
|
+
createElementVNode("tr", null, [
|
|
373
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, index2) => {
|
|
374
|
+
return openBlock(), createElementBlock("th", {
|
|
375
|
+
key: getColumnKey(column, index2),
|
|
376
|
+
style: normalizeStyle(getColumnStyle(column)),
|
|
377
|
+
class: normalizeClass(getColumnClass(column))
|
|
378
|
+
}, [
|
|
379
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
380
|
+
renderSlot(_ctx.$slots, `header-${getColumnKey(column, index2)}`, {
|
|
381
|
+
column,
|
|
382
|
+
index: index2
|
|
383
|
+
}, () => [
|
|
384
|
+
column.renderHeader ? (openBlock(), createElementBlock("span", _hoisted_5$2, [
|
|
385
|
+
(openBlock(), createBlock(resolveDynamicComponent(() => {
|
|
386
|
+
var _a;
|
|
387
|
+
return (_a = column.renderHeader) == null ? void 0 : _a.call(column, column, index2);
|
|
388
|
+
})))
|
|
389
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_6$2, toDisplayString(column.label), 1)),
|
|
390
|
+
column.sortable ? (openBlock(), createElementBlock("span", {
|
|
391
|
+
key: 2,
|
|
392
|
+
class: "fat-table__sort",
|
|
393
|
+
onClick: ($event) => handleSort(column)
|
|
394
|
+
}, [
|
|
395
|
+
createElementVNode("span", {
|
|
396
|
+
class: normalizeClass(["fat-table__sort-icon", { active: sortState.prop === column.prop && sortState.order === "ascending" }])
|
|
397
|
+
}, " ↑ ", 2),
|
|
398
|
+
createElementVNode("span", {
|
|
399
|
+
class: normalizeClass(["fat-table__sort-icon", { active: sortState.prop === column.prop && sortState.order === "descending" }])
|
|
400
|
+
}, " ↓ ", 2)
|
|
401
|
+
], 8, _hoisted_7$2)) : createCommentVNode("", true)
|
|
402
|
+
], true)
|
|
403
|
+
])
|
|
404
|
+
], 6);
|
|
405
|
+
}), 128))
|
|
406
|
+
])
|
|
407
|
+
]),
|
|
408
|
+
createElementVNode("tbody", _hoisted_8, [
|
|
409
|
+
loading.value ? (openBlock(), createElementBlock("tr", _hoisted_9, [
|
|
410
|
+
createElementVNode("td", {
|
|
411
|
+
colspan: __props.columns.length,
|
|
412
|
+
class: "fat-table__loading-cell"
|
|
413
|
+
}, toDisplayString(unref(t)("common.loading")), 9, _hoisted_10)
|
|
414
|
+
])) : !list.value || list.value.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_11, [
|
|
415
|
+
createElementVNode("td", {
|
|
416
|
+
colspan: __props.columns.length,
|
|
417
|
+
class: "fat-table__empty-cell"
|
|
418
|
+
}, toDisplayString(__props.emptyText || unref(t)("common.noData")), 9, _hoisted_12)
|
|
419
|
+
])) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(list.value, (row, rowIndex) => {
|
|
420
|
+
return openBlock(), createElementBlock("tr", {
|
|
421
|
+
key: getRowKey(row, rowIndex),
|
|
422
|
+
class: normalizeClass([
|
|
423
|
+
"fat-table__row",
|
|
424
|
+
{ "fat-table__row--stripe": __props.stripe && rowIndex % 2 === 1 }
|
|
425
|
+
]),
|
|
426
|
+
onClick: ($event) => handleRowClick(row, $event)
|
|
427
|
+
}, [
|
|
428
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, colIndex) => {
|
|
429
|
+
return openBlock(), createElementBlock("td", {
|
|
430
|
+
key: getColumnKey(column, colIndex),
|
|
431
|
+
class: normalizeClass(getCellClass(column)),
|
|
432
|
+
style: normalizeStyle(getColumnStyle(column))
|
|
433
|
+
}, [
|
|
434
|
+
createElementVNode("div", _hoisted_14, [
|
|
435
|
+
renderSlot(_ctx.$slots, `cell-${getColumnKey(column, colIndex)}`, {
|
|
436
|
+
row,
|
|
437
|
+
column,
|
|
438
|
+
value: getCellValue(row, column),
|
|
439
|
+
index: rowIndex
|
|
440
|
+
}, () => [
|
|
441
|
+
column.render ? (openBlock(), createElementBlock("span", _hoisted_15, [
|
|
442
|
+
(openBlock(), createBlock(resolveDynamicComponent(() => {
|
|
443
|
+
var _a;
|
|
444
|
+
return (_a = column.render) == null ? void 0 : _a.call(column, getCellValue(row, column), row, rowIndex);
|
|
445
|
+
})))
|
|
446
|
+
])) : (openBlock(), createElementBlock("span", _hoisted_16, toDisplayString(formatCellValue(row, column)), 1))
|
|
447
|
+
], true)
|
|
448
|
+
])
|
|
449
|
+
], 6);
|
|
450
|
+
}), 128))
|
|
451
|
+
], 10, _hoisted_13);
|
|
452
|
+
}), 128))
|
|
453
|
+
])
|
|
454
|
+
])
|
|
455
|
+
], 4),
|
|
456
|
+
__props.pagination ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
457
|
+
createElementVNode("div", _hoisted_18, toDisplayString(unref(t)("table.total", { total: paginationData.value.total })), 1),
|
|
458
|
+
createElementVNode("div", _hoisted_19, [
|
|
459
|
+
createElementVNode("select", {
|
|
460
|
+
value: paginationData.value.pageSize,
|
|
461
|
+
class: "fat-table__page-size-select",
|
|
462
|
+
onChange: _cache[0] || (_cache[0] = ($event) => handlePageSizeChange($event))
|
|
463
|
+
}, [
|
|
464
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(pageSizes.value, (size) => {
|
|
465
|
+
return openBlock(), createElementBlock("option", {
|
|
466
|
+
key: size,
|
|
467
|
+
value: size
|
|
468
|
+
}, toDisplayString(size), 9, _hoisted_21);
|
|
469
|
+
}), 128))
|
|
470
|
+
], 40, _hoisted_20),
|
|
471
|
+
createElementVNode("span", _hoisted_22, toDisplayString(unref(t)("table.pageSize")), 1),
|
|
472
|
+
createElementVNode("button", {
|
|
473
|
+
class: "fat-table__pagination-btn",
|
|
474
|
+
disabled: paginationData.value.currentPage === 1,
|
|
475
|
+
onClick: _cache[1] || (_cache[1] = ($event) => handlePageChange(paginationData.value.currentPage - 1))
|
|
476
|
+
}, " 上一页 ", 8, _hoisted_23),
|
|
477
|
+
createElementVNode("span", _hoisted_24, toDisplayString(unref(t)("table.page")) + " " + toDisplayString(paginationData.value.currentPage) + " / " + toDisplayString(totalPages.value), 1),
|
|
478
|
+
createElementVNode("button", {
|
|
479
|
+
class: "fat-table__pagination-btn",
|
|
480
|
+
disabled: paginationData.value.currentPage >= totalPages.value,
|
|
481
|
+
onClick: _cache[2] || (_cache[2] = ($event) => handlePageChange(paginationData.value.currentPage + 1))
|
|
482
|
+
}, " 下一页 ", 8, _hoisted_25)
|
|
483
|
+
])
|
|
484
|
+
])) : createCommentVNode("", true)
|
|
485
|
+
]);
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
const _export_sfc = (sfc, props) => {
|
|
490
|
+
const target = sfc.__vccOpts || sfc;
|
|
491
|
+
for (const [key, val] of props) {
|
|
492
|
+
target[key] = val;
|
|
493
|
+
}
|
|
494
|
+
return target;
|
|
495
|
+
};
|
|
496
|
+
const FatTable = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1245c8df"]]);
|
|
497
|
+
const FatTableWithInstall = FatTable;
|
|
498
|
+
FatTableWithInstall.install = (app) => {
|
|
499
|
+
app.component("FatTable", FatTable);
|
|
500
|
+
};
|
|
501
|
+
const _hoisted_1$3 = {
|
|
502
|
+
key: 0,
|
|
503
|
+
class: "fat-form__submitter"
|
|
504
|
+
};
|
|
505
|
+
const _hoisted_2$3 = ["disabled", "loading"];
|
|
506
|
+
const _hoisted_3$2 = ["disabled"];
|
|
507
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
508
|
+
__name: "FatForm",
|
|
509
|
+
props: {
|
|
510
|
+
modelValue: { default: () => ({}) },
|
|
511
|
+
mode: { default: "editable" },
|
|
512
|
+
layout: { default: "horizontal" },
|
|
513
|
+
labelWidth: {},
|
|
514
|
+
labelSuffix: { default: ":" },
|
|
515
|
+
size: { default: "default" },
|
|
516
|
+
disabled: { type: Boolean, default: false },
|
|
517
|
+
loading: { type: Boolean, default: false },
|
|
518
|
+
initialValue: { default: () => ({}) },
|
|
519
|
+
rules: { default: () => ({}) },
|
|
520
|
+
enableSubmitter: { type: Boolean, default: true },
|
|
521
|
+
enableReset: { type: Boolean, default: true },
|
|
522
|
+
submitText: {},
|
|
523
|
+
resetText: {},
|
|
524
|
+
onSubmit: {}
|
|
525
|
+
},
|
|
526
|
+
emits: ["update:modelValue", "submit", "reset", "validate"],
|
|
527
|
+
setup(__props, { emit: __emit }) {
|
|
528
|
+
const props = __props;
|
|
529
|
+
const emit = __emit;
|
|
530
|
+
const { t } = useI18n();
|
|
531
|
+
const submitting = ref(false);
|
|
532
|
+
const formValues = reactive({ ...props.initialValue, ...props.modelValue });
|
|
533
|
+
const errors = reactive({});
|
|
534
|
+
const formClass = computed(() => {
|
|
535
|
+
return [
|
|
536
|
+
`fat-form--${props.layout}`,
|
|
537
|
+
`fat-form--${props.size}`,
|
|
538
|
+
{
|
|
539
|
+
"fat-form--disabled": props.disabled,
|
|
540
|
+
"fat-form--preview": props.mode === "preview"
|
|
541
|
+
}
|
|
542
|
+
];
|
|
543
|
+
});
|
|
544
|
+
const formInstance = {
|
|
545
|
+
get mode() {
|
|
546
|
+
return props.mode;
|
|
547
|
+
},
|
|
548
|
+
get layout() {
|
|
549
|
+
return props.layout;
|
|
550
|
+
},
|
|
551
|
+
get disabled() {
|
|
552
|
+
return props.disabled;
|
|
553
|
+
},
|
|
554
|
+
get loading() {
|
|
555
|
+
return computed(() => props.loading || submitting.value);
|
|
556
|
+
},
|
|
557
|
+
get submitting() {
|
|
558
|
+
return computed(() => submitting.value);
|
|
559
|
+
},
|
|
560
|
+
get values() {
|
|
561
|
+
return computed(() => formValues);
|
|
562
|
+
},
|
|
563
|
+
async submit() {
|
|
564
|
+
const isValid = await this.validate();
|
|
565
|
+
if (!isValid) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
submitting.value = true;
|
|
569
|
+
try {
|
|
570
|
+
if (props.onSubmit) {
|
|
571
|
+
await props.onSubmit({ ...formValues });
|
|
572
|
+
}
|
|
573
|
+
emit("submit", { ...formValues });
|
|
574
|
+
} finally {
|
|
575
|
+
submitting.value = false;
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
reset() {
|
|
579
|
+
Object.keys(formValues).forEach((key) => {
|
|
580
|
+
delete formValues[key];
|
|
581
|
+
});
|
|
582
|
+
Object.assign(formValues, { ...props.initialValue });
|
|
583
|
+
Object.keys(errors).forEach((key) => {
|
|
584
|
+
delete errors[key];
|
|
585
|
+
});
|
|
586
|
+
emit("update:modelValue", { ...formValues });
|
|
587
|
+
emit("reset", { ...formValues });
|
|
588
|
+
},
|
|
589
|
+
async validate() {
|
|
590
|
+
let isValid = true;
|
|
591
|
+
const rules = props.rules || {};
|
|
592
|
+
for (const [prop, ruleList] of Object.entries(rules)) {
|
|
593
|
+
const value = formValues[prop];
|
|
594
|
+
for (const rule of ruleList) {
|
|
595
|
+
if (rule.required && (value === void 0 || value === null || value === "")) {
|
|
596
|
+
errors[prop] = rule.message || `${prop} 不能为空`;
|
|
597
|
+
emit("validate", prop, false, errors[prop]);
|
|
598
|
+
isValid = false;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
if (rule.validator && typeof rule.validator === "function") {
|
|
602
|
+
try {
|
|
603
|
+
await rule.validator(rule, value, formValues);
|
|
604
|
+
} catch (error) {
|
|
605
|
+
errors[prop] = error.message || "验证失败";
|
|
606
|
+
emit("validate", prop, false, errors[prop]);
|
|
607
|
+
isValid = false;
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (isValid && errors[prop]) {
|
|
613
|
+
delete errors[prop];
|
|
614
|
+
emit("validate", prop, true);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return isValid;
|
|
618
|
+
},
|
|
619
|
+
async validateField(prop) {
|
|
620
|
+
var _a;
|
|
621
|
+
const propsToValidate = Array.isArray(prop) ? prop : [prop];
|
|
622
|
+
let isValid = true;
|
|
623
|
+
for (const p of propsToValidate) {
|
|
624
|
+
const rules = ((_a = props.rules) == null ? void 0 : _a[p]) || [];
|
|
625
|
+
const value = formValues[p];
|
|
626
|
+
for (const rule of rules) {
|
|
627
|
+
if (rule.required && (value === void 0 || value === null || value === "")) {
|
|
628
|
+
errors[p] = rule.message || `${p} 不能为空`;
|
|
629
|
+
emit("validate", p, false, errors[p]);
|
|
630
|
+
isValid = false;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
if (rule.validator && typeof rule.validator === "function") {
|
|
634
|
+
try {
|
|
635
|
+
await rule.validator(rule, value, formValues);
|
|
636
|
+
} catch (error) {
|
|
637
|
+
errors[p] = error.message || "验证失败";
|
|
638
|
+
emit("validate", p, false, errors[p]);
|
|
639
|
+
isValid = false;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (isValid && errors[p]) {
|
|
645
|
+
delete errors[p];
|
|
646
|
+
emit("validate", p, true);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return isValid;
|
|
650
|
+
},
|
|
651
|
+
clearValidate(prop) {
|
|
652
|
+
if (!prop) {
|
|
653
|
+
Object.keys(errors).forEach((key) => {
|
|
654
|
+
delete errors[key];
|
|
655
|
+
});
|
|
656
|
+
} else {
|
|
657
|
+
const propsToClear = Array.isArray(prop) ? prop : [prop];
|
|
658
|
+
propsToClear.forEach((p) => {
|
|
659
|
+
delete errors[p];
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
getFieldValue(prop) {
|
|
664
|
+
return formValues[prop];
|
|
665
|
+
},
|
|
666
|
+
setFieldValue(prop, value) {
|
|
667
|
+
formValues[prop] = value;
|
|
668
|
+
emit("update:modelValue", { ...formValues });
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
provide("fatForm", formInstance);
|
|
672
|
+
provide("fatFormErrors", errors);
|
|
673
|
+
const handleSubmit = async () => {
|
|
674
|
+
await formInstance.submit();
|
|
675
|
+
};
|
|
676
|
+
const handleReset = () => {
|
|
677
|
+
formInstance.reset();
|
|
678
|
+
};
|
|
679
|
+
return (_ctx, _cache) => {
|
|
680
|
+
return openBlock(), createElementBlock("form", {
|
|
681
|
+
class: normalizeClass(["fat-form", formClass.value]),
|
|
682
|
+
onSubmit: withModifiers(handleSubmit, ["prevent"])
|
|
683
|
+
}, [
|
|
684
|
+
renderSlot(_ctx.$slots, "default", { form: formInstance }, void 0, true),
|
|
685
|
+
__props.enableSubmitter ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
686
|
+
renderSlot(_ctx.$slots, "submitter", { form: formInstance }, () => [
|
|
687
|
+
createElementVNode("button", {
|
|
688
|
+
type: "submit",
|
|
689
|
+
class: "fat-form__submit-btn",
|
|
690
|
+
disabled: submitting.value || __props.disabled,
|
|
691
|
+
loading: submitting.value
|
|
692
|
+
}, toDisplayString(__props.submitText || unref(t)("common.submit")), 9, _hoisted_2$3),
|
|
693
|
+
__props.enableReset ? (openBlock(), createElementBlock("button", {
|
|
694
|
+
key: 0,
|
|
695
|
+
type: "button",
|
|
696
|
+
class: "fat-form__reset-btn",
|
|
697
|
+
disabled: submitting.value || __props.disabled,
|
|
698
|
+
onClick: handleReset
|
|
699
|
+
}, toDisplayString(__props.resetText || unref(t)("common.reset")), 9, _hoisted_3$2)) : createCommentVNode("", true)
|
|
700
|
+
], true)
|
|
701
|
+
])) : createCommentVNode("", true)
|
|
702
|
+
], 34);
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
const FatForm = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-13c5bb85"]]);
|
|
707
|
+
const _hoisted_1$2 = {
|
|
708
|
+
key: 0,
|
|
709
|
+
class: "fat-form-item__required"
|
|
710
|
+
};
|
|
711
|
+
const _hoisted_2$2 = {
|
|
712
|
+
key: 0,
|
|
713
|
+
class: "fat-form-item__error"
|
|
714
|
+
};
|
|
715
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
716
|
+
__name: "FatFormItem",
|
|
717
|
+
props: {
|
|
718
|
+
prop: {},
|
|
719
|
+
label: {},
|
|
720
|
+
required: { type: Boolean },
|
|
721
|
+
hidden: { type: Boolean },
|
|
722
|
+
disabled: { type: Boolean },
|
|
723
|
+
labelWidth: {},
|
|
724
|
+
width: {}
|
|
725
|
+
},
|
|
726
|
+
setup(__props) {
|
|
727
|
+
const props = __props;
|
|
728
|
+
const form = inject("fatForm");
|
|
729
|
+
const errors = inject("fatFormErrors", {});
|
|
730
|
+
const labelSuffix = computed(() => {
|
|
731
|
+
return (form == null ? void 0 : form.layout) === "horizontal" ? form.labelSuffix || ":" : "";
|
|
732
|
+
});
|
|
733
|
+
const value = computed(() => {
|
|
734
|
+
return form == null ? void 0 : form.getFieldValue(props.prop);
|
|
735
|
+
});
|
|
736
|
+
const errorMessage = computed(() => {
|
|
737
|
+
return errors[props.prop];
|
|
738
|
+
});
|
|
739
|
+
const hidden = computed(() => {
|
|
740
|
+
return props.hidden || (form == null ? void 0 : form.mode) === "preview";
|
|
741
|
+
});
|
|
742
|
+
const formItemClass = computed(() => {
|
|
743
|
+
return [
|
|
744
|
+
`fat-form-item--${(form == null ? void 0 : form.layout) || "horizontal"}`,
|
|
745
|
+
{
|
|
746
|
+
"fat-form-item--error": !!errorMessage.value,
|
|
747
|
+
"fat-form-item--required": props.required,
|
|
748
|
+
"fat-form-item--disabled": props.disabled || (form == null ? void 0 : form.disabled)
|
|
749
|
+
}
|
|
750
|
+
];
|
|
751
|
+
});
|
|
752
|
+
const labelStyle = computed(() => {
|
|
753
|
+
const style = {};
|
|
754
|
+
if ((form == null ? void 0 : form.layout) === "horizontal" && (props.labelWidth || form.labelWidth)) {
|
|
755
|
+
const width = props.labelWidth || form.labelWidth;
|
|
756
|
+
style.width = typeof width === "number" ? `${width}px` : width;
|
|
757
|
+
}
|
|
758
|
+
return style;
|
|
759
|
+
});
|
|
760
|
+
const contentStyle = computed(() => {
|
|
761
|
+
const style = {};
|
|
762
|
+
if (props.width) {
|
|
763
|
+
style.width = typeof props.width === "number" ? `${props.width}px` : props.width;
|
|
764
|
+
}
|
|
765
|
+
return style;
|
|
766
|
+
});
|
|
767
|
+
watch(
|
|
768
|
+
() => value.value,
|
|
769
|
+
(newVal) => {
|
|
770
|
+
if (form) {
|
|
771
|
+
form.setFieldValue(props.prop, newVal);
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
{ deep: true }
|
|
775
|
+
);
|
|
776
|
+
return (_ctx, _cache) => {
|
|
777
|
+
return !hidden.value ? (openBlock(), createElementBlock("div", {
|
|
778
|
+
key: 0,
|
|
779
|
+
class: normalizeClass(["fat-form-item", formItemClass.value])
|
|
780
|
+
}, [
|
|
781
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
782
|
+
key: 0,
|
|
783
|
+
class: "fat-form-item__label",
|
|
784
|
+
style: normalizeStyle(labelStyle.value)
|
|
785
|
+
}, [
|
|
786
|
+
__props.required ? (openBlock(), createElementBlock("span", _hoisted_1$2, "*")) : createCommentVNode("", true),
|
|
787
|
+
createTextVNode(" " + toDisplayString(__props.label) + toDisplayString(labelSuffix.value), 1)
|
|
788
|
+
], 4)) : createCommentVNode("", true),
|
|
789
|
+
createElementVNode("div", {
|
|
790
|
+
class: "fat-form-item__content",
|
|
791
|
+
style: normalizeStyle(contentStyle.value)
|
|
792
|
+
}, [
|
|
793
|
+
renderSlot(_ctx.$slots, "default", {
|
|
794
|
+
value: value.value,
|
|
795
|
+
form: unref(form)
|
|
796
|
+
}, void 0, true),
|
|
797
|
+
errorMessage.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, toDisplayString(errorMessage.value), 1)) : createCommentVNode("", true)
|
|
798
|
+
], 4)
|
|
799
|
+
], 2)) : createCommentVNode("", true);
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
const FatFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2793b4e0"]]);
|
|
804
|
+
FatForm.install = (app) => {
|
|
805
|
+
app.component("FatForm", FatForm);
|
|
806
|
+
app.component("FatFormItem", FatFormItem);
|
|
807
|
+
};
|
|
808
|
+
const _hoisted_1$1 = { class: "fat-table-layout" };
|
|
809
|
+
const _hoisted_2$1 = {
|
|
810
|
+
key: 0,
|
|
811
|
+
class: "fat-table-layout__header"
|
|
812
|
+
};
|
|
813
|
+
const _hoisted_3$1 = {
|
|
814
|
+
key: 0,
|
|
815
|
+
class: "fat-table-layout__title"
|
|
816
|
+
};
|
|
817
|
+
const _hoisted_4$1 = {
|
|
818
|
+
key: 1,
|
|
819
|
+
class: "fat-table-layout__query"
|
|
820
|
+
};
|
|
821
|
+
const _hoisted_5$1 = {
|
|
822
|
+
key: 2,
|
|
823
|
+
class: "fat-table-layout__toolbar"
|
|
824
|
+
};
|
|
825
|
+
const _hoisted_6$1 = { class: "fat-table-layout__table" };
|
|
826
|
+
const _hoisted_7$1 = {
|
|
827
|
+
key: 3,
|
|
828
|
+
class: "fat-table-layout__pagination"
|
|
829
|
+
};
|
|
830
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
831
|
+
__name: "FatTableLayout",
|
|
832
|
+
props: {
|
|
833
|
+
title: {},
|
|
834
|
+
showQuery: { type: Boolean, default: true },
|
|
835
|
+
showToolbar: { type: Boolean, default: true },
|
|
836
|
+
showPagination: { type: Boolean, default: true }
|
|
837
|
+
},
|
|
838
|
+
setup(__props) {
|
|
839
|
+
return (_ctx, _cache) => {
|
|
840
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
841
|
+
__props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
842
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
843
|
+
__props.title ? (openBlock(), createElementBlock("h2", _hoisted_3$1, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
|
|
844
|
+
], true)
|
|
845
|
+
])) : createCommentVNode("", true),
|
|
846
|
+
__props.showQuery && _ctx.$slots.query ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
847
|
+
renderSlot(_ctx.$slots, "query", {}, void 0, true)
|
|
848
|
+
])) : createCommentVNode("", true),
|
|
849
|
+
__props.showToolbar && _ctx.$slots.toolbar ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
850
|
+
renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
|
|
851
|
+
])) : createCommentVNode("", true),
|
|
852
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
853
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
854
|
+
]),
|
|
855
|
+
__props.showPagination && _ctx.$slots.pagination ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
856
|
+
renderSlot(_ctx.$slots, "pagination", {}, void 0, true)
|
|
857
|
+
])) : createCommentVNode("", true)
|
|
858
|
+
]);
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
const FatTableLayout = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-69de3a24"]]);
|
|
863
|
+
FatTableLayout.install = (app) => {
|
|
864
|
+
app.component("FatTableLayout", FatTableLayout);
|
|
865
|
+
};
|
|
866
|
+
const _hoisted_1 = { class: "fat-form-layout" };
|
|
867
|
+
const _hoisted_2 = {
|
|
868
|
+
key: 0,
|
|
869
|
+
class: "fat-form-layout__header"
|
|
870
|
+
};
|
|
871
|
+
const _hoisted_3 = { class: "fat-form-layout__header-left" };
|
|
872
|
+
const _hoisted_4 = {
|
|
873
|
+
key: 0,
|
|
874
|
+
class: "fat-form-layout__title"
|
|
875
|
+
};
|
|
876
|
+
const _hoisted_5 = {
|
|
877
|
+
key: 0,
|
|
878
|
+
class: "fat-form-layout__header-extra"
|
|
879
|
+
};
|
|
880
|
+
const _hoisted_6 = { class: "fat-form-layout__content" };
|
|
881
|
+
const _hoisted_7 = {
|
|
882
|
+
key: 1,
|
|
883
|
+
class: "fat-form-layout__footer"
|
|
884
|
+
};
|
|
885
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
886
|
+
__name: "FatFormLayout",
|
|
887
|
+
props: {
|
|
888
|
+
title: {},
|
|
889
|
+
showSubmitter: { type: Boolean, default: true },
|
|
890
|
+
showBack: { type: Boolean, default: false }
|
|
891
|
+
},
|
|
892
|
+
emits: ["back"],
|
|
893
|
+
setup(__props, { emit: __emit }) {
|
|
894
|
+
const emit = __emit;
|
|
895
|
+
const { t } = useI18n();
|
|
896
|
+
const handleBack = () => {
|
|
897
|
+
emit("back");
|
|
898
|
+
};
|
|
899
|
+
return (_ctx, _cache) => {
|
|
900
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
901
|
+
__props.title || _ctx.$slots.title || __props.showBack ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
902
|
+
createElementVNode("div", _hoisted_3, [
|
|
903
|
+
__props.showBack ? (openBlock(), createElementBlock("button", {
|
|
904
|
+
key: 0,
|
|
905
|
+
class: "fat-form-layout__back-btn",
|
|
906
|
+
onClick: handleBack
|
|
907
|
+
}, " ← " + toDisplayString(unref(t)("common.cancel")), 1)) : createCommentVNode("", true),
|
|
908
|
+
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
909
|
+
__props.title ? (openBlock(), createElementBlock("h2", _hoisted_4, toDisplayString(__props.title), 1)) : createCommentVNode("", true)
|
|
910
|
+
], true)
|
|
911
|
+
]),
|
|
912
|
+
_ctx.$slots.extra ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
913
|
+
renderSlot(_ctx.$slots, "extra", {}, void 0, true)
|
|
914
|
+
])) : createCommentVNode("", true)
|
|
915
|
+
])) : createCommentVNode("", true),
|
|
916
|
+
createElementVNode("div", _hoisted_6, [
|
|
917
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
918
|
+
]),
|
|
919
|
+
__props.showSubmitter && _ctx.$slots.submitter ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
920
|
+
renderSlot(_ctx.$slots, "submitter", {}, void 0, true)
|
|
921
|
+
])) : createCommentVNode("", true)
|
|
922
|
+
]);
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
const FatFormLayout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4698d66e"]]);
|
|
927
|
+
FatFormLayout.install = (app) => {
|
|
928
|
+
app.component("FatFormLayout", FatFormLayout);
|
|
929
|
+
};
|
|
930
|
+
const useI18nT = () => {
|
|
931
|
+
const { t } = useI18n();
|
|
932
|
+
return t;
|
|
933
|
+
};
|
|
934
|
+
const useT = () => {
|
|
935
|
+
const { t } = useI18n();
|
|
936
|
+
return t;
|
|
937
|
+
};
|
|
938
|
+
const components = [
|
|
939
|
+
FatTableWithInstall,
|
|
940
|
+
FatForm,
|
|
941
|
+
FatTableLayout,
|
|
942
|
+
FatFormLayout
|
|
943
|
+
];
|
|
944
|
+
const install = (app) => {
|
|
945
|
+
components.forEach((component) => {
|
|
946
|
+
const comp = component;
|
|
947
|
+
if (comp.install) {
|
|
948
|
+
app.use(comp);
|
|
949
|
+
} else if (comp.name) {
|
|
950
|
+
app.component(comp.name, comp);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
app.use(i18n);
|
|
954
|
+
};
|
|
955
|
+
const index = {
|
|
956
|
+
install,
|
|
957
|
+
FatTable: FatTableWithInstall,
|
|
958
|
+
FatForm,
|
|
959
|
+
FatTableLayout,
|
|
960
|
+
FatFormLayout
|
|
961
|
+
};
|
|
962
|
+
export {
|
|
963
|
+
FatForm,
|
|
964
|
+
FatFormLayout,
|
|
965
|
+
FatTableWithInstall as FatTable,
|
|
966
|
+
FatTableLayout,
|
|
967
|
+
index as default,
|
|
968
|
+
i18n,
|
|
969
|
+
useI18nT,
|
|
970
|
+
useT
|
|
971
|
+
};
|
|
972
|
+
//# sourceMappingURL=index.js.map
|