@dt-frames/ui 2.0.2 → 2.0.4
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/es/assets/locales/en.ts +1 -1
- package/es/components/container/index.d.ts +4 -3
- package/es/components/container/index.js +24 -22
- package/es/components/container/src/slot-container.d.ts +5 -3
- package/es/components/curd/index.js +261 -229
- package/es/components/curd/src/components/Curd.d.ts +126 -331
- package/es/components/curd/src/props.d.ts +14 -15
- package/es/components/drawer/index.d.ts +3 -5
- package/es/components/drawer/index.js +55 -54
- package/es/components/drawer/src/components/DrawerHeader.d.ts +1 -3
- package/es/components/drawer/src/index.d.ts +4 -7
- package/es/components/form/index.d.ts +213 -361
- package/es/components/form/index.js +210 -163
- package/es/components/form/index.less +206 -8
- package/es/components/form/src/components/FormButtons.d.ts +3 -3
- package/es/components/form/src/components/FormItem.d.ts +152 -304
- package/es/components/form/src/components/formIcon.d.ts +4 -4
- package/es/components/form/src/components/formInputUseDialog.d.ts +3 -3
- package/es/components/form/src/enums/index.d.ts +1 -1
- package/es/components/form/src/index.d.ts +199 -347
- package/es/components/form/src/props.d.ts +8 -12
- package/es/components/form/src/types/form.type.d.ts +2 -2
- package/es/components/icons/index.d.ts +496 -2
- package/es/components/icons/index.less +5 -0
- package/es/components/icons/src/pick-icon.d.ts +5 -5
- package/es/components/modal/index.js +76 -74
- package/es/components/modal/index.less +10 -0
- package/es/components/modal/src/components/Modal.d.ts +108 -215
- package/es/components/modal/src/components/ModalFooter.d.ts +3 -3
- package/es/components/modal/src/index.d.ts +116 -223
- package/es/components/source/hooks/useSource.d.ts +14 -0
- package/es/components/source/index.js +66 -27
- package/es/components/source/types/source.type.d.ts +4 -8
- package/es/components/table/index.js +452 -820
- package/es/components/table/index.less +50 -14
- package/es/components/table/src/components/TableAction.d.ts +1 -1
- package/es/components/table/src/components/TableHeader.d.ts +109 -216
- package/es/components/table/src/components/TableRender.d.ts +13 -9
- package/es/components/table/src/components/tableSetting/Download.d.ts +107 -214
- package/es/components/table/src/components/tableSetting/DownloadCtrl.d.ts +107 -214
- package/es/components/table/src/components/tableSetting/index.d.ts +107 -214
- package/es/components/table/src/hooks/useDataSource.d.ts +1 -2
- package/es/components/table/src/hooks/usePagination.d.ts +3 -118
- package/es/components/table/src/index.d.ts +99 -435
- package/es/components/table/src/props.d.ts +19 -74
- package/es/components/table/src/types/actions.type.d.ts +1 -2
- package/es/components/table/src/types/table.type.d.ts +13 -8
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -3240
- package/es/theme/index.js +688 -453
- package/es/theme/index.less +150 -0
- package/es/theme/src/components/header/components/logo.d.ts +0 -1
- package/es/theme/src/components/header/components/notify.d.ts +4 -3
- package/es/theme/src/components/header/components/setting-theme.d.ts +2 -1
- package/es/theme/src/components/header/components/user-info.d.ts +4 -3
- package/es/theme/src/components/header/helper/menu-tree.d.ts +1 -0
- package/es/theme/src/components/header/index.d.ts +8 -7
- package/es/theme/src/components/header/multiple-header.d.ts +22 -25
- package/es/theme/src/components/sider/components/drag-bar.d.ts +1 -1
- package/es/theme/src/components/sider/components/sider-trigger.d.ts +0 -1
- package/es/theme/src/components/sider/index.d.ts +147 -3
- package/es/theme/src/components/sider/mix-sider.d.ts +146 -0
- package/es/theme/src/enums/theme.enum.d.ts +2 -1
- package/es/theme/src/hooks/useMenu.d.ts +4 -2
- package/es/theme/src/index.d.ts +166 -23
- package/es/theme/src/stores/theme.store.d.ts +3 -0
- package/es/theme/src/types/theme.type.d.ts +2 -1
- package/package.json +3 -4
- package/vite.config.ts +0 -27
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { RadioButton, RadioGroup, Button, FormItem as FormItem$1, Col as Col$1, Row, Form as Form$1 } from "ant-design-vue/es";
|
|
2
2
|
import "ant-design-vue/es/form/style";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import "ant-design-vue/es/row/style";
|
|
4
|
+
import { toRaw, unref, computed, getCurrentInstance, reactive, readonly, watchEffect, nextTick, defineComponent, useAttrs, openBlock, createBlock, mergeProps, isRef, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createElementVNode, createVNode, normalizeProps, guardReactiveProps, createCommentVNode, toRefs, isVNode, ref, watch, resolveDirective, normalizeStyle, withDirectives, normalizeClass, onMounted, withKeys, createSlots, renderSlot } from "vue";
|
|
5
|
+
import { DtCache, CacheKey, deepMerge, Pages, useGo, useRedo, Language, useAppStore, isNumber, useI18n, isString, isFunction, error, useSlots, isArray, isBoolean, isNull, dispatchResize, isObject, isNullAndUnDef, isEmpty, useTimeoutFn } from "@dt-frames/core";
|
|
5
6
|
import { isEqual, omit, cloneDeep, upperFirst, uniqBy, set } from "lodash-es";
|
|
6
7
|
import { Input, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Tooltip, Form, FormItem } from "ant-design-vue";
|
|
7
8
|
import { defineStore } from "pinia";
|
|
9
|
+
import "ant-design-vue/es/radio/style";
|
|
10
|
+
import "ant-design-vue/es/cascader/style";
|
|
11
|
+
import "ant-design-vue/es/input-number/style";
|
|
12
|
+
import "ant-design-vue/es/switch/style";
|
|
13
|
+
import "ant-design-vue/es/tree-select/style";
|
|
14
|
+
import "ant-design-vue/es/slider/style";
|
|
15
|
+
import "ant-design-vue/es/rate/style";
|
|
16
|
+
import "ant-design-vue/es/date-picker/style";
|
|
17
|
+
import "ant-design-vue/es/col/style";
|
|
8
18
|
import "ant-design-vue/es/button/style";
|
|
9
19
|
import dayjs from "dayjs";
|
|
10
|
-
const _default = "";
|
|
11
|
-
const index$1 = "";
|
|
12
20
|
var Theme = /* @__PURE__ */ ((Theme2) => {
|
|
13
21
|
Theme2["DARK"] = "dark";
|
|
14
22
|
Theme2["LIGHT"] = "light";
|
|
@@ -18,6 +26,7 @@ var MenuType = /* @__PURE__ */ ((MenuType2) => {
|
|
|
18
26
|
MenuType2["SIDE"] = "sidebar";
|
|
19
27
|
MenuType2["TOP_MENU"] = "top-menu";
|
|
20
28
|
MenuType2["MIX"] = "mix";
|
|
29
|
+
MenuType2["MIX_SIDEBAR"] = "mix-sidebar";
|
|
21
30
|
return MenuType2;
|
|
22
31
|
})(MenuType || {});
|
|
23
32
|
var MenuMode = /* @__PURE__ */ ((MenuMode2) => {
|
|
@@ -69,7 +78,8 @@ const defaultThemeConf = {
|
|
|
69
78
|
menuWidth: 240,
|
|
70
79
|
trigger: true,
|
|
71
80
|
type: MenuType.SIDE,
|
|
72
|
-
mode: MenuMode.INLINE
|
|
81
|
+
mode: MenuMode.INLINE,
|
|
82
|
+
mixSideTrigger: "hover"
|
|
73
83
|
},
|
|
74
84
|
footerOptions: {
|
|
75
85
|
show: false,
|
|
@@ -90,7 +100,8 @@ const useThemeStore = defineStore({
|
|
|
90
100
|
id: "dt-theme",
|
|
91
101
|
state: () => ({
|
|
92
102
|
themeConf: DtCache.getLocal(CacheKey.THEME) ?? defaultThemeConf,
|
|
93
|
-
pageLoading: false
|
|
103
|
+
pageLoading: false,
|
|
104
|
+
mixSiderHasSubMenu: false
|
|
94
105
|
}),
|
|
95
106
|
getters: {
|
|
96
107
|
getThemeConf() {
|
|
@@ -110,6 +121,9 @@ const useThemeStore = defineStore({
|
|
|
110
121
|
},
|
|
111
122
|
getPageLoading() {
|
|
112
123
|
return this.pageLoading;
|
|
124
|
+
},
|
|
125
|
+
getMixSiderIsHasMenu() {
|
|
126
|
+
return this.mixSiderHasSubMenu;
|
|
113
127
|
}
|
|
114
128
|
},
|
|
115
129
|
actions: {
|
|
@@ -117,6 +131,9 @@ const useThemeStore = defineStore({
|
|
|
117
131
|
let newThemeConf = deepMerge(this.themeConf, options);
|
|
118
132
|
this.themeConf = deepMerge(defaultThemeConf, newThemeConf);
|
|
119
133
|
DtCache.setLocal(CacheKey.THEME, this.themeConf);
|
|
134
|
+
},
|
|
135
|
+
setMixSiderIsHasMenu(val) {
|
|
136
|
+
this.mixSiderHasSubMenu = val;
|
|
120
137
|
}
|
|
121
138
|
}
|
|
122
139
|
});
|
|
@@ -145,12 +162,12 @@ defineStore({
|
|
|
145
162
|
return;
|
|
146
163
|
}
|
|
147
164
|
let updateIndex = -1;
|
|
148
|
-
const tabHasExits = this.tabList.some((tab,
|
|
149
|
-
updateIndex =
|
|
165
|
+
const tabHasExits = this.tabList.some((tab, index) => {
|
|
166
|
+
updateIndex = index;
|
|
150
167
|
return (tab.fullPath || tab.path) === (fullPath || path);
|
|
151
168
|
});
|
|
152
169
|
if (tabHasExits) {
|
|
153
|
-
const curTab = toRaw
|
|
170
|
+
const curTab = toRaw(this.tabList)[updateIndex];
|
|
154
171
|
curTab.params = params || curTab.params;
|
|
155
172
|
curTab.query = query || curTab.query;
|
|
156
173
|
curTab.fullPath = fullPath || curTab.fullPath;
|
|
@@ -162,14 +179,14 @@ defineStore({
|
|
|
162
179
|
},
|
|
163
180
|
closeTab(path, router) {
|
|
164
181
|
const go = useGo(router);
|
|
165
|
-
const
|
|
182
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
166
183
|
let page;
|
|
167
|
-
if (
|
|
184
|
+
if (index === 0) {
|
|
168
185
|
if (this.tabList.length !== 1) {
|
|
169
|
-
page = this.tabList[
|
|
186
|
+
page = this.tabList[index + 1];
|
|
170
187
|
}
|
|
171
188
|
} else {
|
|
172
|
-
page = this.tabList[
|
|
189
|
+
page = this.tabList[index - 1];
|
|
173
190
|
}
|
|
174
191
|
this.bulkCloseTabs([path]);
|
|
175
192
|
this.updateCacheTab();
|
|
@@ -178,15 +195,15 @@ defineStore({
|
|
|
178
195
|
closeAllTab(currentRoute, router) {
|
|
179
196
|
const go = useGo(router);
|
|
180
197
|
let filterTabList = this.tabList.filter((item) => item?.meta?.affix ?? false);
|
|
181
|
-
const route = filterTabList.length > 0 ? filterTabList[filterTabList.length - 1] : unref
|
|
198
|
+
const route = filterTabList.length > 0 ? filterTabList[filterTabList.length - 1] : unref(currentRoute);
|
|
182
199
|
this.tabList = [route];
|
|
183
200
|
this.updateCacheTab();
|
|
184
201
|
go(route.path);
|
|
185
202
|
},
|
|
186
203
|
closeLeftTabs(path) {
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
const leftTabs = this.tabList.slice(0,
|
|
204
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
205
|
+
if (index > 0) {
|
|
206
|
+
const leftTabs = this.tabList.slice(0, index);
|
|
190
207
|
const pathList = [];
|
|
191
208
|
for (const item of leftTabs) {
|
|
192
209
|
const affix = item?.meta?.affix ?? false;
|
|
@@ -199,9 +216,9 @@ defineStore({
|
|
|
199
216
|
this.updateCacheTab();
|
|
200
217
|
},
|
|
201
218
|
closeRightTabs(path) {
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
const rightTabs = this.tabList.slice(
|
|
219
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
220
|
+
if (index >= 0 && index < this.tabList.length - 1) {
|
|
221
|
+
const rightTabs = this.tabList.slice(index + 1, this.tabList.length);
|
|
205
222
|
const pathList = [];
|
|
206
223
|
for (const item of rightTabs) {
|
|
207
224
|
const affix = item?.meta?.affix ?? false;
|
|
@@ -241,7 +258,7 @@ defineStore({
|
|
|
241
258
|
this.cacheTabList = cacheMap;
|
|
242
259
|
},
|
|
243
260
|
async refreshPage(router) {
|
|
244
|
-
const findTab = this.getCachedTabList.find((item) => item === unref
|
|
261
|
+
const findTab = this.getCachedTabList.find((item) => item === unref(router.currentRoute).name);
|
|
245
262
|
if (findTab) {
|
|
246
263
|
this.cacheTabList.delete(findTab.toString());
|
|
247
264
|
}
|
|
@@ -258,41 +275,51 @@ defineStore({
|
|
|
258
275
|
});
|
|
259
276
|
function useMenu() {
|
|
260
277
|
const { getMenuConf, setThemeConf } = useThemeStore();
|
|
261
|
-
const getCollapsedShowTitle = computed
|
|
262
|
-
const getIsSidebarType = computed
|
|
263
|
-
const getMenuFixed = computed
|
|
264
|
-
const getShowMenu = computed
|
|
265
|
-
const getShowSidebar = computed
|
|
266
|
-
return unref
|
|
278
|
+
const getCollapsedShowTitle = computed(() => getMenuConf.collapsedShowTitle);
|
|
279
|
+
const getIsSidebarType = computed(() => getMenuConf.type === MenuType.SIDE);
|
|
280
|
+
const getMenuFixed = computed(() => getMenuConf.fixed);
|
|
281
|
+
const getShowMenu = computed(() => getMenuConf.show);
|
|
282
|
+
const getShowSidebar = computed(() => {
|
|
283
|
+
return unref(getSplit) || unref(getShowMenu) && unref(getMenuMode) !== MenuMode.HORIZONTAL;
|
|
267
284
|
});
|
|
268
|
-
const getMenuHidden = computed
|
|
269
|
-
const getMenuTheme = computed
|
|
270
|
-
const getTrigger = computed
|
|
271
|
-
const getCanDrag = computed
|
|
272
|
-
const getIsMixMode = computed
|
|
273
|
-
return unref
|
|
285
|
+
const getMenuHidden = computed(() => getMenuConf.hidden);
|
|
286
|
+
const getMenuTheme = computed(() => getMenuConf.theme);
|
|
287
|
+
const getTrigger = computed(() => getMenuConf.trigger);
|
|
288
|
+
const getCanDrag = computed(() => getMenuConf.canDrag);
|
|
289
|
+
const getIsMixMode = computed(() => {
|
|
290
|
+
return unref(getMenuMode) === MenuMode.INLINE && unref(getMenuType) === MenuType.MIX;
|
|
274
291
|
});
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
292
|
+
const getIsMixSidebar = computed(() => unref(getMenuType) === MenuType.MIX_SIDEBAR);
|
|
293
|
+
const getMenuWidth = computed(() => {
|
|
294
|
+
if (unref(getIsMixMode)) {
|
|
295
|
+
return Number(getMenuConf.menuWidth) - 40;
|
|
296
|
+
} else if (unref(getIsMixSidebar)) {
|
|
297
|
+
return Number(getMenuConf.menuWidth) - 10;
|
|
298
|
+
} else {
|
|
299
|
+
return Number(getMenuConf.menuWidth);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
const getMixSideTrigger = computed(() => getMenuConf.mixSideTrigger);
|
|
303
|
+
const getLogoWidth = computed(() => unref(getIsMixSidebar) ? "80px" : getMenuConf.menuWidth);
|
|
304
|
+
const getMenuType = computed(() => getMenuConf.type);
|
|
305
|
+
const getIsTopMenu = computed(() => unref(getMenuType) === MenuType.TOP_MENU);
|
|
306
|
+
const getMenuMode = computed(() => getMenuConf.mode);
|
|
307
|
+
const getSplit = computed(() => getMenuConf.split);
|
|
308
|
+
const getCollapsed = computed(() => getMenuConf.collapsed);
|
|
309
|
+
const getIsHorizontal = computed(() => unref(getMenuMode) === MenuMode.HORIZONTAL);
|
|
283
310
|
const setThemeStore = (conf = {}) => setThemeConf(conf);
|
|
284
311
|
const toggleCollapsed = () => setThemeStore({
|
|
285
312
|
menuOptions: {
|
|
286
|
-
collapsed: !unref
|
|
313
|
+
collapsed: !unref(getCollapsed)
|
|
287
314
|
}
|
|
288
315
|
});
|
|
289
|
-
const getMiniWidthNumber = computed
|
|
290
|
-
const getRealWidth = computed
|
|
291
|
-
return unref
|
|
316
|
+
const getMiniWidthNumber = computed(() => getMenuConf.collapsedShowTitle ? 80 : 48);
|
|
317
|
+
const getRealWidth = computed(() => {
|
|
318
|
+
return unref(getCollapsed) ? unref(getMiniWidthNumber) : unref(getMenuWidth);
|
|
292
319
|
});
|
|
293
|
-
const getCalcContentWidth = computed
|
|
294
|
-
const width = unref
|
|
295
|
-
return `calc(100% - ${unref
|
|
320
|
+
const getCalcContentWidth = computed(() => {
|
|
321
|
+
const width = unref(getIsTopMenu) || !unref(getShowMenu) || unref(getSplit) && unref(getMenuHidden) ? 0 : unref(getRealWidth);
|
|
322
|
+
return `calc(100% - ${unref(width)}px)`;
|
|
296
323
|
});
|
|
297
324
|
return {
|
|
298
325
|
getCollapsedShowTitle,
|
|
@@ -315,7 +342,9 @@ function useMenu() {
|
|
|
315
342
|
getRealWidth,
|
|
316
343
|
getCalcContentWidth,
|
|
317
344
|
getIsMixMode,
|
|
345
|
+
getIsMixSidebar,
|
|
318
346
|
getCanDrag,
|
|
347
|
+
getMixSideTrigger,
|
|
319
348
|
toggleCollapsed,
|
|
320
349
|
setThemeStore
|
|
321
350
|
};
|
|
@@ -348,54 +377,54 @@ function useHeader() {
|
|
|
348
377
|
getMenuMode,
|
|
349
378
|
getSplit,
|
|
350
379
|
getIsTopMenu,
|
|
351
|
-
|
|
380
|
+
getIsMixSidebar
|
|
352
381
|
} = useMenu();
|
|
353
382
|
const { getShowMultipleTab } = useMultipleTab();
|
|
354
|
-
const getHeaderTheme = computed
|
|
355
|
-
const getFixed = computed
|
|
356
|
-
const getShowHeaderLogo = computed
|
|
357
|
-
const getShowSearch = computed
|
|
358
|
-
const getShowHeaderTrigger = computed
|
|
359
|
-
if (unref
|
|
383
|
+
const getHeaderTheme = computed(() => getHeaderConf.theme);
|
|
384
|
+
const getFixed = computed(() => getHeaderConf.fixed);
|
|
385
|
+
const getShowHeaderLogo = computed(() => unref(getShowLogo) && !unref(getIsSidebarType) && !unref(getIsMixSidebar));
|
|
386
|
+
const getShowSearch = computed(() => getHeaderConf.showSearch);
|
|
387
|
+
const getShowHeaderTrigger = computed(() => {
|
|
388
|
+
if (unref(getMenuType) === MenuType.TOP_MENU || !unref(getShowMenu) || unref(getMenuHidden)) {
|
|
360
389
|
return false;
|
|
361
390
|
}
|
|
362
|
-
return unref
|
|
391
|
+
return unref(getTrigger);
|
|
363
392
|
});
|
|
364
|
-
const getShowBreadCrumb = computed
|
|
365
|
-
const getShowBread = computed
|
|
366
|
-
() => unref
|
|
393
|
+
const getShowBreadCrumb = computed(() => getHeaderConf.showBreadCrumb);
|
|
394
|
+
const getShowBread = computed(
|
|
395
|
+
() => unref(getMenuMode) !== MenuMode.HORIZONTAL && !unref(getSplit) && unref(getShowBreadCrumb)
|
|
367
396
|
);
|
|
368
|
-
const getShowTopMenu = computed
|
|
369
|
-
const getShowNotice = computed
|
|
370
|
-
const getShowFullScreen = computed
|
|
371
|
-
const getShowLocale = computed
|
|
372
|
-
const getShowSettingTheme = computed
|
|
373
|
-
const getShowFullHeaderRef = computed
|
|
374
|
-
return !unref
|
|
397
|
+
const getShowTopMenu = computed(() => unref(getMenuMode) === MenuMode.HORIZONTAL || unref(getSplit));
|
|
398
|
+
const getShowNotice = computed(() => getHeaderConf.showNotice);
|
|
399
|
+
const getShowFullScreen = computed(() => getHeaderConf.showFullScreen);
|
|
400
|
+
const getShowLocale = computed(() => getHeaderConf.showLocaleSwitch);
|
|
401
|
+
const getShowSettingTheme = computed(() => getHeaderConf.showSettingTheme);
|
|
402
|
+
const getShowFullHeaderRef = computed(() => {
|
|
403
|
+
return !unref(getIsSidebarType) && !unref(getIsMixSidebar) && !unref(getIsTopMenu);
|
|
375
404
|
});
|
|
376
|
-
const getHeaderHeight = computed
|
|
405
|
+
const getHeaderHeight = computed(() => {
|
|
377
406
|
let height = 0;
|
|
378
407
|
height += HEADER_HEIGHT;
|
|
379
|
-
if (unref
|
|
408
|
+
if (unref(getShowMultipleTab) && !unref(getSplit)) {
|
|
380
409
|
height += TABS_HEIGHT;
|
|
381
410
|
}
|
|
382
411
|
return height;
|
|
383
412
|
});
|
|
384
|
-
const getTabsHeight = computed
|
|
385
|
-
const getShowInsetHeaderRef = computed
|
|
386
|
-
return unref
|
|
413
|
+
const getTabsHeight = computed(() => TABS_HEIGHT);
|
|
414
|
+
const getShowInsetHeaderRef = computed(() => {
|
|
415
|
+
return unref(getIsSidebarType) || unref(getIsTopMenu) || unref(getIsMixSidebar);
|
|
387
416
|
});
|
|
388
|
-
const getShowBackToTop = computed
|
|
389
|
-
const getIsZH = computed
|
|
417
|
+
const getShowBackToTop = computed(() => getHeaderConf.showBackToTop);
|
|
418
|
+
const getIsZH = computed(() => {
|
|
390
419
|
let local = DtCache.getLocal(CacheKey.LOCALE);
|
|
391
420
|
if (!local)
|
|
392
421
|
return true;
|
|
393
422
|
return local === Language.ZH;
|
|
394
423
|
});
|
|
395
|
-
const getUiSize = computed
|
|
396
|
-
const getShowUiSize = computed
|
|
397
|
-
const getShowLogo = computed
|
|
398
|
-
const getShowLoginOut = computed
|
|
424
|
+
const getUiSize = computed(() => getHeaderConf?.size ?? UiSize.SMALL);
|
|
425
|
+
const getShowUiSize = computed(() => getHeaderConf?.showSize);
|
|
426
|
+
const getShowLogo = computed(() => getHeaderConf.showLogo);
|
|
427
|
+
const getShowLoginOut = computed(() => getHeaderConf.showLoginOut);
|
|
399
428
|
const loginOutClick = getHeaderConf.logoutClick;
|
|
400
429
|
return {
|
|
401
430
|
getHeaderTheme,
|
|
@@ -488,24 +517,23 @@ function handleInputNumberValue(component, val) {
|
|
|
488
517
|
}
|
|
489
518
|
return val;
|
|
490
519
|
}
|
|
491
|
-
const index = "";
|
|
492
520
|
function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
493
521
|
const instance = getCurrentInstance();
|
|
494
522
|
const emit = instance?.emit;
|
|
495
|
-
const innerState = reactive
|
|
523
|
+
const innerState = reactive({
|
|
496
524
|
value: props[key]
|
|
497
525
|
});
|
|
498
526
|
const defaultState = readonly(innerState);
|
|
499
527
|
const setState = (val) => {
|
|
500
528
|
innerState.value = val;
|
|
501
|
-
nextTick
|
|
502
|
-
emit?.(changeEvent, val, ...toRaw
|
|
529
|
+
nextTick(() => {
|
|
530
|
+
emit?.(changeEvent, val, ...toRaw(unref(emitData)) || []);
|
|
503
531
|
});
|
|
504
532
|
};
|
|
505
533
|
watchEffect(() => {
|
|
506
534
|
innerState.value = props[key];
|
|
507
535
|
});
|
|
508
|
-
const state = computed
|
|
536
|
+
const state = computed({
|
|
509
537
|
get() {
|
|
510
538
|
return innerState.value;
|
|
511
539
|
},
|
|
@@ -513,14 +541,14 @@ function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
|
513
541
|
if (isEqual(value, defaultState.value))
|
|
514
542
|
return;
|
|
515
543
|
innerState.value = value;
|
|
516
|
-
nextTick
|
|
517
|
-
emit?.(changeEvent, value, ...toRaw
|
|
544
|
+
nextTick(() => {
|
|
545
|
+
emit?.(changeEvent, value, ...toRaw(unref(emitData)) || []);
|
|
518
546
|
});
|
|
519
547
|
}
|
|
520
548
|
});
|
|
521
549
|
return [state, setState, defaultState];
|
|
522
550
|
}
|
|
523
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent
|
|
551
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
524
552
|
__name: "radioButton",
|
|
525
553
|
props: {
|
|
526
554
|
value: {
|
|
@@ -535,7 +563,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
535
563
|
const props = __props;
|
|
536
564
|
const attrs = useAttrs();
|
|
537
565
|
const [state] = useFormValue(props);
|
|
538
|
-
const getOptions = computed
|
|
566
|
+
const getOptions = computed(() => {
|
|
539
567
|
const { options } = props;
|
|
540
568
|
if (!options || options?.length === 0)
|
|
541
569
|
return [];
|
|
@@ -547,13 +575,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
547
575
|
return (_ctx, _cache) => {
|
|
548
576
|
const _component_ARadioButton = RadioButton;
|
|
549
577
|
const _component_ARadioGroup = RadioGroup;
|
|
550
|
-
return openBlock(), createBlock(_component_ARadioGroup, mergeProps(unref
|
|
551
|
-
value: unref
|
|
578
|
+
return openBlock(), createBlock(_component_ARadioGroup, mergeProps(unref(attrs), {
|
|
579
|
+
value: unref(state),
|
|
552
580
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(state) ? state.value = $event : null),
|
|
553
581
|
"button-style": "solid"
|
|
554
582
|
}), {
|
|
555
583
|
default: withCtx(() => [
|
|
556
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref
|
|
584
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptions), (item) => {
|
|
557
585
|
return openBlock(), createBlock(_component_ARadioButton, {
|
|
558
586
|
key: `${item.value}`,
|
|
559
587
|
value: item.value,
|
|
@@ -571,13 +599,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
571
599
|
};
|
|
572
600
|
}
|
|
573
601
|
});
|
|
602
|
+
const _export_sfc = (sfc, props) => {
|
|
603
|
+
const target = sfc.__vccOpts || sfc;
|
|
604
|
+
for (const [key, val] of props) {
|
|
605
|
+
target[key] = val;
|
|
606
|
+
}
|
|
607
|
+
return target;
|
|
608
|
+
};
|
|
609
|
+
const RadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/radioButton.vue"]]);
|
|
574
610
|
const _hoisted_1$1 = { class: "input-with-dialog" };
|
|
575
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent
|
|
611
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
576
612
|
__name: "formInputUseDialog",
|
|
577
613
|
setup(__props) {
|
|
578
614
|
const { t } = useI18n("UI");
|
|
579
|
-
const attrs = useAttrs
|
|
580
|
-
const bindProps = computed
|
|
615
|
+
const attrs = useAttrs();
|
|
616
|
+
const bindProps = computed(() => {
|
|
581
617
|
return {
|
|
582
618
|
...omit(attrs, [
|
|
583
619
|
"formValues"
|
|
@@ -600,20 +636,21 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent$1({
|
|
|
600
636
|
return (_ctx, _cache) => {
|
|
601
637
|
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
602
638
|
createElementVNode("div", { onClick: onClickInput }, [
|
|
603
|
-
createVNode(unref
|
|
639
|
+
createVNode(unref(Input), normalizeProps(guardReactiveProps(unref(bindProps))), null, 16)
|
|
604
640
|
]),
|
|
605
|
-
unref
|
|
641
|
+
unref(attrs).formValues?.schema?.linkProps?.length ? (openBlock(), createElementBlock("i", {
|
|
606
642
|
key: 0,
|
|
607
643
|
class: "i mdi:close-circle",
|
|
608
644
|
onClick: clearProps
|
|
609
|
-
})) : createCommentVNode("", true)
|
|
645
|
+
})) : createCommentVNode("v-if", true)
|
|
610
646
|
]);
|
|
611
647
|
};
|
|
612
648
|
}
|
|
613
649
|
});
|
|
650
|
+
const DtFormInputDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/formInputUseDialog.vue"]]);
|
|
614
651
|
const components = {
|
|
615
652
|
Input,
|
|
616
|
-
InputWithDialog:
|
|
653
|
+
InputWithDialog: DtFormInputDialog,
|
|
617
654
|
InputTextArea: Input.TextArea,
|
|
618
655
|
InputSearch: Input.Search,
|
|
619
656
|
InputGroup: Input.Group,
|
|
@@ -622,7 +659,7 @@ const components = {
|
|
|
622
659
|
TreeSelect,
|
|
623
660
|
Radio,
|
|
624
661
|
RadioGroup: Radio.Group,
|
|
625
|
-
RadioButtonGroup
|
|
662
|
+
RadioButtonGroup,
|
|
626
663
|
Checkbox,
|
|
627
664
|
CheckboxGroup: Checkbox.Group,
|
|
628
665
|
AutoComplete,
|
|
@@ -645,7 +682,7 @@ for (let item in components) {
|
|
|
645
682
|
function _isSlot(s) {
|
|
646
683
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
647
684
|
}
|
|
648
|
-
const _sfc_main$2 =
|
|
685
|
+
const _sfc_main$2 = {
|
|
649
686
|
name: "FormItem",
|
|
650
687
|
inheritAttrs: false,
|
|
651
688
|
props: {
|
|
@@ -1006,7 +1043,8 @@ const _sfc_main$2 = defineComponent({
|
|
|
1006
1043
|
});
|
|
1007
1044
|
};
|
|
1008
1045
|
}
|
|
1009
|
-
}
|
|
1046
|
+
};
|
|
1047
|
+
const DtFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormItem.vue"]]);
|
|
1010
1048
|
const _hoisted_1 = {
|
|
1011
1049
|
key: 0,
|
|
1012
1050
|
className: "preIcon pr-1"
|
|
@@ -1020,7 +1058,7 @@ const _hoisted_4 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i
|
|
|
1020
1058
|
const _hoisted_5 = [
|
|
1021
1059
|
_hoisted_4
|
|
1022
1060
|
];
|
|
1023
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent
|
|
1061
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1024
1062
|
__name: "FormButtons",
|
|
1025
1063
|
props: {
|
|
1026
1064
|
mode: {
|
|
@@ -1107,7 +1145,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1107
1145
|
const _component_ACol = Col$1;
|
|
1108
1146
|
const _directive_icon = resolveDirective("icon");
|
|
1109
1147
|
const _directive_auth = resolveDirective("auth");
|
|
1110
|
-
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref
|
|
1148
|
+
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref(colOpt))), {
|
|
1111
1149
|
default: withCtx(() => [
|
|
1112
1150
|
createVNode(_component_AFormItem, {
|
|
1113
1151
|
class: "dt-form-btns",
|
|
@@ -1119,58 +1157,60 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1119
1157
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (button) => {
|
|
1120
1158
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1121
1159
|
(button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
|
|
1160
|
+
class: normalizeClass(["items-center", button.class]),
|
|
1122
1161
|
type: button.type,
|
|
1123
|
-
class: normalizeClass(button.class),
|
|
1124
1162
|
loading: button.loading,
|
|
1125
1163
|
disabled: button.disabled,
|
|
1126
|
-
key: unref
|
|
1164
|
+
key: unref(key),
|
|
1127
1165
|
onClick: ($event) => handleBtnClick(button)
|
|
1128
1166
|
}, {
|
|
1129
1167
|
icon: withCtx(() => [
|
|
1130
1168
|
button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
|
|
1131
1169
|
[_directive_icon, button.preIcon]
|
|
1132
|
-
]) : createCommentVNode("", true)
|
|
1170
|
+
]) : createCommentVNode("v-if", true)
|
|
1133
1171
|
]),
|
|
1134
1172
|
default: withCtx(() => [
|
|
1135
|
-
createTextVNode(" " + toDisplayString(unref
|
|
1173
|
+
createTextVNode(" " + toDisplayString(unref(t)(button.label)) + " ", 1),
|
|
1136
1174
|
button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
|
|
1137
1175
|
[_directive_icon, button.postIcon]
|
|
1138
|
-
]) : createCommentVNode("", true)
|
|
1176
|
+
]) : createCommentVNode("v-if", true)
|
|
1139
1177
|
]),
|
|
1140
1178
|
_: 2
|
|
1141
1179
|
}, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
|
|
1142
1180
|
[_directive_auth, button.auth]
|
|
1143
|
-
]) : createCommentVNode("", true)
|
|
1181
|
+
]) : createCommentVNode("v-if", true)
|
|
1144
1182
|
], 64);
|
|
1145
1183
|
}), 256)),
|
|
1146
|
-
unref
|
|
1184
|
+
unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
|
|
1147
1185
|
key: 0,
|
|
1148
1186
|
type: "link",
|
|
1149
1187
|
class: "advanced",
|
|
1150
1188
|
onClick: toggleAdvanced
|
|
1151
1189
|
}, {
|
|
1152
1190
|
default: withCtx(() => [
|
|
1153
|
-
|
|
1191
|
+
createCommentVNode(" \u6536\u8D77 | \u5C55\u5F00 "),
|
|
1192
|
+
createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
|
|
1154
1193
|
createElementVNode("span", {
|
|
1155
|
-
class: normalizeClass(unref
|
|
1194
|
+
class: normalizeClass(unref(getAdvanceClass))
|
|
1156
1195
|
}, _hoisted_5, 2)
|
|
1157
1196
|
]),
|
|
1158
1197
|
_: 1
|
|
1159
|
-
})) : createCommentVNode("", true)
|
|
1198
|
+
})) : createCommentVNode("v-if", true)
|
|
1160
1199
|
]),
|
|
1161
1200
|
_: 1
|
|
1162
1201
|
}, 8, ["style"])
|
|
1163
1202
|
]),
|
|
1164
1203
|
_: 1
|
|
1165
|
-
}, 16)) : createCommentVNode("", true);
|
|
1204
|
+
}, 16)) : createCommentVNode("v-if", true);
|
|
1166
1205
|
};
|
|
1167
1206
|
}
|
|
1168
1207
|
});
|
|
1208
|
+
const DtFormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormButtons.vue"]]);
|
|
1169
1209
|
const SEARCH_BTN_NAME = "UI.SEARCH";
|
|
1170
1210
|
const RESET_BTN_NAME = "UI.RESET";
|
|
1171
1211
|
const SEARCH_BTNS = [
|
|
1172
|
-
{
|
|
1173
|
-
{
|
|
1212
|
+
{ label: SEARCH_BTN_NAME, preIcon: "mdi:magnify", type: "primary" },
|
|
1213
|
+
{ label: RESET_BTN_NAME, preIcon: "mdi:refresh", type: "default" }
|
|
1174
1214
|
];
|
|
1175
1215
|
function useFormEvents({
|
|
1176
1216
|
emits,
|
|
@@ -1266,22 +1306,22 @@ function useFormEvents({
|
|
|
1266
1306
|
schemaRef.value = schemaList;
|
|
1267
1307
|
}
|
|
1268
1308
|
function _removeSchemaByName(name, schemaList) {
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1309
|
+
const index = schemaList.findIndex((schema) => schema.name === name);
|
|
1310
|
+
if (index !== -1) {
|
|
1271
1311
|
delete formModel[name];
|
|
1272
|
-
schemaList.splice(
|
|
1312
|
+
schemaList.splice(index, 1);
|
|
1273
1313
|
}
|
|
1274
1314
|
}
|
|
1275
1315
|
function appendFormItems(schema, prefixName, first = false) {
|
|
1276
1316
|
const schemaList = cloneDeep(unref(getSchema));
|
|
1277
|
-
const
|
|
1278
|
-
if (!prefixName ||
|
|
1317
|
+
const index = schemaList.findIndex((schema2) => schema2.name === prefixName);
|
|
1318
|
+
if (!prefixName || index === -1 || first) {
|
|
1279
1319
|
first ? schemaList.unshift(...schema) : schemaList.push(...schema);
|
|
1280
1320
|
schemaRef.value = schemaList;
|
|
1281
1321
|
return;
|
|
1282
1322
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
schemaList.splice(
|
|
1323
|
+
if (index !== -1) {
|
|
1324
|
+
schemaList.splice(index + 1, 0, ...schema);
|
|
1285
1325
|
}
|
|
1286
1326
|
schemaRef.value = schemaList;
|
|
1287
1327
|
}
|
|
@@ -1355,7 +1395,7 @@ function useFormValues({
|
|
|
1355
1395
|
}) {
|
|
1356
1396
|
const getComMap = () => {
|
|
1357
1397
|
let comMap = /* @__PURE__ */ new Map();
|
|
1358
|
-
unref
|
|
1398
|
+
unref(getSchema).map((it) => {
|
|
1359
1399
|
if (it.component && it.name) {
|
|
1360
1400
|
comMap.set(it.name, it);
|
|
1361
1401
|
}
|
|
@@ -1392,7 +1432,7 @@ function useFormValues({
|
|
|
1392
1432
|
return vals;
|
|
1393
1433
|
}
|
|
1394
1434
|
function initDefault() {
|
|
1395
|
-
const schema = unref
|
|
1435
|
+
const schema = unref(getSchema), obj = {};
|
|
1396
1436
|
schema.forEach((item) => {
|
|
1397
1437
|
const { props = {}, name, component, defaultValue: gDefaultValue, extraName } = item;
|
|
1398
1438
|
const { defaultValue: itemDefaultValue, mode, format, treeCheckable } = isFunction(props) ? props(formModel) : props;
|
|
@@ -1412,7 +1452,7 @@ function useFormValues({
|
|
|
1412
1452
|
if (isArray(defaultValue2)) {
|
|
1413
1453
|
let vals = defaultValue2.map((it) => format ? dayjs(it, format) : dayjs(it));
|
|
1414
1454
|
if (names.length > 1) {
|
|
1415
|
-
names.map((key,
|
|
1455
|
+
names.map((key, index) => obj[key] = vals[index] ?? null);
|
|
1416
1456
|
} else {
|
|
1417
1457
|
obj[names[0]] = vals;
|
|
1418
1458
|
}
|
|
@@ -1421,11 +1461,11 @@ function useFormValues({
|
|
|
1421
1461
|
}
|
|
1422
1462
|
} else {
|
|
1423
1463
|
if (names.length > 1) {
|
|
1424
|
-
names.forEach((key,
|
|
1425
|
-
if (!defaultValue2 || defaultValue2.length - 1 <
|
|
1464
|
+
names.forEach((key, index) => {
|
|
1465
|
+
if (!defaultValue2 || defaultValue2.length - 1 < index) {
|
|
1426
1466
|
obj[key] = null;
|
|
1427
1467
|
} else {
|
|
1428
|
-
obj[key] = defaultValue2[
|
|
1468
|
+
obj[key] = defaultValue2[index];
|
|
1429
1469
|
}
|
|
1430
1470
|
});
|
|
1431
1471
|
} else {
|
|
@@ -1456,23 +1496,29 @@ function useFormActions(opt) {
|
|
|
1456
1496
|
const { getProps, defaultValue, updateSchema, getFormValues, setFormValues } = opt;
|
|
1457
1497
|
const { appConf } = useAppStore();
|
|
1458
1498
|
function handleAdvanced(isAdvanced) {
|
|
1459
|
-
const {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1499
|
+
const {
|
|
1500
|
+
schemas,
|
|
1501
|
+
minShowColumn = appConf.ui.form?.minShowColumn || 2,
|
|
1502
|
+
showAdvancedButton = appConf.ui.form?.showAdvancedButton || true
|
|
1503
|
+
} = unref(getProps);
|
|
1504
|
+
let schema = [...schemas];
|
|
1505
|
+
if (showAdvancedButton) {
|
|
1506
|
+
schema = schemas.reduce((t, it, index) => {
|
|
1507
|
+
if (index > minShowColumn - 1)
|
|
1508
|
+
it.isAdvanced = isAdvanced;
|
|
1509
|
+
t.push(it);
|
|
1510
|
+
return t;
|
|
1511
|
+
}, []);
|
|
1512
|
+
}
|
|
1466
1513
|
updateSchema(schema);
|
|
1467
1514
|
}
|
|
1468
1515
|
function handleMethod(params) {
|
|
1469
1516
|
const { onSearch, onReset } = unref(getProps);
|
|
1470
1517
|
if (isBoolean(params)) {
|
|
1471
1518
|
handleAdvanced(params);
|
|
1472
|
-
} else if (params.
|
|
1473
|
-
console.log(getProps);
|
|
1519
|
+
} else if (params.label === SEARCH_BTN_NAME) {
|
|
1474
1520
|
onSearch(getFormValues());
|
|
1475
|
-
} else if (params.
|
|
1521
|
+
} else if (params.label === RESET_BTN_NAME) {
|
|
1476
1522
|
setFormValues(toRaw(defaultValue.value));
|
|
1477
1523
|
onReset(getFormValues());
|
|
1478
1524
|
} else {
|
|
@@ -1492,7 +1538,7 @@ const BasicProps = {
|
|
|
1492
1538
|
},
|
|
1493
1539
|
model: {
|
|
1494
1540
|
type: Object,
|
|
1495
|
-
default: {}
|
|
1541
|
+
default: () => ({})
|
|
1496
1542
|
},
|
|
1497
1543
|
layout: {
|
|
1498
1544
|
type: String,
|
|
@@ -1512,23 +1558,19 @@ const BasicProps = {
|
|
|
1512
1558
|
},
|
|
1513
1559
|
labelCol: {
|
|
1514
1560
|
type: Object,
|
|
1515
|
-
default: () => {
|
|
1516
|
-
}
|
|
1561
|
+
default: () => ({})
|
|
1517
1562
|
},
|
|
1518
1563
|
wrapperCol: {
|
|
1519
1564
|
type: Object,
|
|
1520
|
-
default: () => {
|
|
1521
|
-
}
|
|
1565
|
+
default: () => ({})
|
|
1522
1566
|
},
|
|
1523
1567
|
rowProps: {
|
|
1524
1568
|
type: Object,
|
|
1525
|
-
default: () => {
|
|
1526
|
-
}
|
|
1569
|
+
default: () => ({})
|
|
1527
1570
|
},
|
|
1528
1571
|
colProps: {
|
|
1529
1572
|
type: Object,
|
|
1530
|
-
default: () => {
|
|
1531
|
-
}
|
|
1573
|
+
default: () => ({})
|
|
1532
1574
|
},
|
|
1533
1575
|
size: {
|
|
1534
1576
|
type: String,
|
|
@@ -1550,10 +1592,6 @@ const BasicProps = {
|
|
|
1550
1592
|
type: Boolean,
|
|
1551
1593
|
default: true
|
|
1552
1594
|
},
|
|
1553
|
-
alwaysShowLines: {
|
|
1554
|
-
type: Boolean,
|
|
1555
|
-
default: false
|
|
1556
|
-
},
|
|
1557
1595
|
minShowColumn: {
|
|
1558
1596
|
type: Number,
|
|
1559
1597
|
default: 2
|
|
@@ -1604,7 +1642,7 @@ const BasicProps = {
|
|
|
1604
1642
|
type: Function
|
|
1605
1643
|
}
|
|
1606
1644
|
};
|
|
1607
|
-
const _sfc_main = /* @__PURE__ */ defineComponent
|
|
1645
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1608
1646
|
__name: "index",
|
|
1609
1647
|
props: BasicProps,
|
|
1610
1648
|
emits: ["register"],
|
|
@@ -1618,9 +1656,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1618
1656
|
const propsRef = ref();
|
|
1619
1657
|
const schemaRef = ref(null);
|
|
1620
1658
|
const getProps = computed(() => {
|
|
1659
|
+
let colProps = props.colProps;
|
|
1660
|
+
if (isEmpty(props.colProps)) {
|
|
1661
|
+
colProps = props.mode === "search" ? getAppConf.ui.form.searchColspan || { span: 8 } : getAppConf.ui.form.dialogColspan || { span: 12 };
|
|
1662
|
+
}
|
|
1621
1663
|
return {
|
|
1622
1664
|
...props,
|
|
1623
1665
|
...getAppConf.ui.form,
|
|
1666
|
+
colProps,
|
|
1624
1667
|
...unref(propsRef)
|
|
1625
1668
|
};
|
|
1626
1669
|
});
|
|
@@ -1741,6 +1784,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1741
1784
|
setFormValues(null);
|
|
1742
1785
|
emits("register", formActionMethods);
|
|
1743
1786
|
initDefault();
|
|
1787
|
+
if (unref(getProps)?.registerInstance) {
|
|
1788
|
+
unref(getProps)?.registerInstance(formActionMethods);
|
|
1789
|
+
}
|
|
1744
1790
|
});
|
|
1745
1791
|
watch(
|
|
1746
1792
|
() => unref(getProps).onSearch,
|
|
@@ -1769,26 +1815,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1769
1815
|
return (_ctx, _cache) => {
|
|
1770
1816
|
const _component_ARow = Row;
|
|
1771
1817
|
const _component_AForm = Form$1;
|
|
1772
|
-
return openBlock(), createBlock(_component_AForm, mergeProps(unref
|
|
1818
|
+
return openBlock(), createBlock(_component_AForm, mergeProps(unref(getBindValue), {
|
|
1773
1819
|
ref_key: "formElRef",
|
|
1774
1820
|
ref: formElRef,
|
|
1775
|
-
class: unref
|
|
1776
|
-
model:
|
|
1777
|
-
layout: unref
|
|
1821
|
+
class: unref(getFormClass),
|
|
1822
|
+
model: formModel,
|
|
1823
|
+
layout: unref(getProps).layout,
|
|
1778
1824
|
onKeypress: withKeys(handleEnterPress, ["enter"])
|
|
1779
1825
|
}), {
|
|
1780
1826
|
default: withCtx(() => [
|
|
1781
|
-
createVNode(_component_ARow, mergeProps(unref
|
|
1827
|
+
createVNode(_component_ARow, mergeProps(unref(getProps).rowProps, { style: {
|
|
1782
1828
|
margin: 0
|
|
1783
1829
|
} }), {
|
|
1784
1830
|
default: withCtx(() => [
|
|
1785
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref
|
|
1786
|
-
return openBlock(), createBlock(unref
|
|
1831
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSchema), (schema) => {
|
|
1832
|
+
return openBlock(), createBlock(unref(DtFormItem), {
|
|
1787
1833
|
key: schema.name,
|
|
1788
1834
|
schema,
|
|
1789
|
-
formProps: unref
|
|
1790
|
-
formModel
|
|
1791
|
-
defaultValues:
|
|
1835
|
+
formProps: unref(getProps),
|
|
1836
|
+
formModel,
|
|
1837
|
+
defaultValues: defaultValue.value,
|
|
1792
1838
|
setFormModel,
|
|
1793
1839
|
formActionType: formActionMethods
|
|
1794
1840
|
}, createSlots({ _: 2 }, [
|
|
@@ -1802,7 +1848,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1802
1848
|
})
|
|
1803
1849
|
]), 1032, ["schema", "formProps", "formModel", "defaultValues"]);
|
|
1804
1850
|
}), 128)),
|
|
1805
|
-
unref
|
|
1851
|
+
unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(DtFormButtons), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("v-if", true)
|
|
1806
1852
|
]),
|
|
1807
1853
|
_: 3
|
|
1808
1854
|
}, 16)
|
|
@@ -1812,6 +1858,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1812
1858
|
};
|
|
1813
1859
|
}
|
|
1814
1860
|
});
|
|
1861
|
+
const Forms = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/index.vue"]]);
|
|
1815
1862
|
function useForm(props) {
|
|
1816
1863
|
const formRef = ref(null);
|
|
1817
1864
|
const loadedRef = ref(false);
|
|
@@ -1888,7 +1935,7 @@ const withInstall = (comp) => {
|
|
|
1888
1935
|
};
|
|
1889
1936
|
return comp;
|
|
1890
1937
|
};
|
|
1891
|
-
const DtForm = withInstall(
|
|
1938
|
+
const DtForm = withInstall(Forms);
|
|
1892
1939
|
export {
|
|
1893
1940
|
DtForm,
|
|
1894
1941
|
useForm
|