@dt-frames/ui 2.0.2 → 2.0.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/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 +304 -282
- 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 +2 -4
- package/es/components/drawer/index.js +64 -63
- package/es/components/drawer/src/components/DrawerHeader.d.ts +1 -3
- package/es/components/drawer/src/index.d.ts +2 -4
- package/es/components/form/index.d.ts +196 -344
- package/es/components/form/index.js +140 -139
- package/es/components/form/src/components/FormButtons.d.ts +3 -3
- package/es/components/form/src/components/FormItem.d.ts +156 -304
- package/es/components/form/src/components/formIcon.d.ts +10 -10
- package/es/components/form/src/components/formInputUseDialog.d.ts +5 -5
- package/es/components/form/src/index.d.ts +186 -334
- package/es/components/form/src/props.d.ts +7 -7
- package/es/components/form/src/types/form.type.d.ts +1 -1
- package/es/components/icons/index.d.ts +496 -2
- package/es/components/icons/src/pick-icon.d.ts +5 -5
- package/es/components/modal/index.js +87 -86
- package/es/components/modal/src/components/Modal.d.ts +108 -215
- package/es/components/modal/src/index.d.ts +107 -214
- package/es/components/source/index.js +1 -0
- package/es/components/table/index.js +357 -788
- package/es/components/table/index.less +9 -0
- 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 +79 -425
- package/es/components/table/src/props.d.ts +11 -70
- package/es/components/table/src/types/actions.type.d.ts +1 -2
- package/es/components/table/src/types/table.type.d.ts +9 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -3240
- package/es/theme/index.js +406 -393
- 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/size.d.ts +5 -5
- package/es/theme/src/components/header/components/user-info.d.ts +4 -3
- package/es/theme/src/components/header/index.d.ts +13 -12
- package/es/theme/src/components/header/multiple-header.d.ts +26 -28
- package/es/theme/src/hooks/useMenu.d.ts +1 -1
- package/es/theme/src/index.d.ts +27 -28
- package/es/theme/src/types/theme.type.d.ts +1 -1
- package/package.json +3 -2
- package/vite.config.ts +0 -27
|
@@ -1,14 +1,15 @@
|
|
|
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 as toRaw$1, 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/col/style";
|
|
8
11
|
import "ant-design-vue/es/button/style";
|
|
9
12
|
import dayjs from "dayjs";
|
|
10
|
-
const _default = "";
|
|
11
|
-
const index$1 = "";
|
|
12
13
|
var Theme = /* @__PURE__ */ ((Theme2) => {
|
|
13
14
|
Theme2["DARK"] = "dark";
|
|
14
15
|
Theme2["LIGHT"] = "light";
|
|
@@ -145,8 +146,8 @@ defineStore({
|
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
148
|
let updateIndex = -1;
|
|
148
|
-
const tabHasExits = this.tabList.some((tab,
|
|
149
|
-
updateIndex =
|
|
149
|
+
const tabHasExits = this.tabList.some((tab, index) => {
|
|
150
|
+
updateIndex = index;
|
|
150
151
|
return (tab.fullPath || tab.path) === (fullPath || path);
|
|
151
152
|
});
|
|
152
153
|
if (tabHasExits) {
|
|
@@ -162,14 +163,14 @@ defineStore({
|
|
|
162
163
|
},
|
|
163
164
|
closeTab(path, router) {
|
|
164
165
|
const go = useGo(router);
|
|
165
|
-
const
|
|
166
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
166
167
|
let page;
|
|
167
|
-
if (
|
|
168
|
+
if (index === 0) {
|
|
168
169
|
if (this.tabList.length !== 1) {
|
|
169
|
-
page = this.tabList[
|
|
170
|
+
page = this.tabList[index + 1];
|
|
170
171
|
}
|
|
171
172
|
} else {
|
|
172
|
-
page = this.tabList[
|
|
173
|
+
page = this.tabList[index - 1];
|
|
173
174
|
}
|
|
174
175
|
this.bulkCloseTabs([path]);
|
|
175
176
|
this.updateCacheTab();
|
|
@@ -178,15 +179,15 @@ defineStore({
|
|
|
178
179
|
closeAllTab(currentRoute, router) {
|
|
179
180
|
const go = useGo(router);
|
|
180
181
|
let filterTabList = this.tabList.filter((item) => item?.meta?.affix ?? false);
|
|
181
|
-
const route = filterTabList.length > 0 ? filterTabList[filterTabList.length - 1] : unref
|
|
182
|
+
const route = filterTabList.length > 0 ? filterTabList[filterTabList.length - 1] : unref(currentRoute);
|
|
182
183
|
this.tabList = [route];
|
|
183
184
|
this.updateCacheTab();
|
|
184
185
|
go(route.path);
|
|
185
186
|
},
|
|
186
187
|
closeLeftTabs(path) {
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
const leftTabs = this.tabList.slice(0,
|
|
188
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
189
|
+
if (index > 0) {
|
|
190
|
+
const leftTabs = this.tabList.slice(0, index);
|
|
190
191
|
const pathList = [];
|
|
191
192
|
for (const item of leftTabs) {
|
|
192
193
|
const affix = item?.meta?.affix ?? false;
|
|
@@ -199,9 +200,9 @@ defineStore({
|
|
|
199
200
|
this.updateCacheTab();
|
|
200
201
|
},
|
|
201
202
|
closeRightTabs(path) {
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
const rightTabs = this.tabList.slice(
|
|
203
|
+
const index = this.tabList.findIndex((item) => item.path === path);
|
|
204
|
+
if (index >= 0 && index < this.tabList.length - 1) {
|
|
205
|
+
const rightTabs = this.tabList.slice(index + 1, this.tabList.length);
|
|
205
206
|
const pathList = [];
|
|
206
207
|
for (const item of rightTabs) {
|
|
207
208
|
const affix = item?.meta?.affix ?? false;
|
|
@@ -241,7 +242,7 @@ defineStore({
|
|
|
241
242
|
this.cacheTabList = cacheMap;
|
|
242
243
|
},
|
|
243
244
|
async refreshPage(router) {
|
|
244
|
-
const findTab = this.getCachedTabList.find((item) => item === unref
|
|
245
|
+
const findTab = this.getCachedTabList.find((item) => item === unref(router.currentRoute).name);
|
|
245
246
|
if (findTab) {
|
|
246
247
|
this.cacheTabList.delete(findTab.toString());
|
|
247
248
|
}
|
|
@@ -258,41 +259,41 @@ defineStore({
|
|
|
258
259
|
});
|
|
259
260
|
function useMenu() {
|
|
260
261
|
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
|
|
262
|
+
const getCollapsedShowTitle = computed(() => getMenuConf.collapsedShowTitle);
|
|
263
|
+
const getIsSidebarType = computed(() => getMenuConf.type === MenuType.SIDE);
|
|
264
|
+
const getMenuFixed = computed(() => getMenuConf.fixed);
|
|
265
|
+
const getShowMenu = computed(() => getMenuConf.show);
|
|
266
|
+
const getShowSidebar = computed(() => {
|
|
267
|
+
return unref(getSplit) || unref(getShowMenu) && unref(getMenuMode) !== MenuMode.HORIZONTAL;
|
|
267
268
|
});
|
|
268
|
-
const getMenuHidden = computed
|
|
269
|
-
const getMenuTheme = computed
|
|
270
|
-
const getTrigger = computed
|
|
271
|
-
const getCanDrag = computed
|
|
272
|
-
const getIsMixMode = computed
|
|
273
|
-
return unref
|
|
269
|
+
const getMenuHidden = computed(() => getMenuConf.hidden);
|
|
270
|
+
const getMenuTheme = computed(() => getMenuConf.theme);
|
|
271
|
+
const getTrigger = computed(() => getMenuConf.trigger);
|
|
272
|
+
const getCanDrag = computed(() => getMenuConf.canDrag);
|
|
273
|
+
const getIsMixMode = computed(() => {
|
|
274
|
+
return unref(getMenuMode) === MenuMode.INLINE && unref(getMenuType) === MenuType.MIX;
|
|
274
275
|
});
|
|
275
|
-
const getMenuWidth = computed
|
|
276
|
-
const getLogoWidth = computed
|
|
277
|
-
const getMenuType = computed
|
|
278
|
-
const getIsTopMenu = computed
|
|
279
|
-
const getMenuMode = computed
|
|
280
|
-
const getSplit = computed
|
|
281
|
-
const getCollapsed = computed
|
|
282
|
-
const getIsHorizontal = computed
|
|
276
|
+
const getMenuWidth = computed(() => unref(getIsMixMode) ? Number(getMenuConf.menuWidth) - 40 : getMenuConf.menuWidth);
|
|
277
|
+
const getLogoWidth = computed(() => getMenuConf.menuWidth);
|
|
278
|
+
const getMenuType = computed(() => getMenuConf.type);
|
|
279
|
+
const getIsTopMenu = computed(() => unref(getMenuType) === MenuType.TOP_MENU);
|
|
280
|
+
const getMenuMode = computed(() => getMenuConf.mode);
|
|
281
|
+
const getSplit = computed(() => getMenuConf.split);
|
|
282
|
+
const getCollapsed = computed(() => getMenuConf.collapsed);
|
|
283
|
+
const getIsHorizontal = computed(() => unref(getMenuMode) === MenuMode.HORIZONTAL);
|
|
283
284
|
const setThemeStore = (conf = {}) => setThemeConf(conf);
|
|
284
285
|
const toggleCollapsed = () => setThemeStore({
|
|
285
286
|
menuOptions: {
|
|
286
|
-
collapsed: !unref
|
|
287
|
+
collapsed: !unref(getCollapsed)
|
|
287
288
|
}
|
|
288
289
|
});
|
|
289
|
-
const getMiniWidthNumber = computed
|
|
290
|
-
const getRealWidth = computed
|
|
291
|
-
return unref
|
|
290
|
+
const getMiniWidthNumber = computed(() => getMenuConf.collapsedShowTitle ? 80 : 48);
|
|
291
|
+
const getRealWidth = computed(() => {
|
|
292
|
+
return unref(getCollapsed) ? unref(getMiniWidthNumber) : unref(getMenuWidth);
|
|
292
293
|
});
|
|
293
|
-
const getCalcContentWidth = computed
|
|
294
|
-
const width = unref
|
|
295
|
-
return `calc(100% - ${unref
|
|
294
|
+
const getCalcContentWidth = computed(() => {
|
|
295
|
+
const width = unref(getIsTopMenu) || !unref(getShowMenu) || unref(getSplit) && unref(getMenuHidden) ? 0 : unref(getRealWidth);
|
|
296
|
+
return `calc(100% - ${unref(width)}px)`;
|
|
296
297
|
});
|
|
297
298
|
return {
|
|
298
299
|
getCollapsedShowTitle,
|
|
@@ -351,51 +352,51 @@ function useHeader() {
|
|
|
351
352
|
getIsMixMode
|
|
352
353
|
} = useMenu();
|
|
353
354
|
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
|
|
355
|
+
const getHeaderTheme = computed(() => getHeaderConf.theme);
|
|
356
|
+
const getFixed = computed(() => getHeaderConf.fixed);
|
|
357
|
+
const getShowHeaderLogo = computed(() => unref(getShowLogo) && !unref(getIsSidebarType));
|
|
358
|
+
const getShowSearch = computed(() => getHeaderConf.showSearch);
|
|
359
|
+
const getShowHeaderTrigger = computed(() => {
|
|
360
|
+
if (unref(getMenuType) === MenuType.TOP_MENU || !unref(getShowMenu) || unref(getMenuHidden)) {
|
|
360
361
|
return false;
|
|
361
362
|
}
|
|
362
|
-
return unref
|
|
363
|
+
return unref(getTrigger);
|
|
363
364
|
});
|
|
364
|
-
const getShowBreadCrumb = computed
|
|
365
|
-
const getShowBread = computed
|
|
366
|
-
() => unref
|
|
365
|
+
const getShowBreadCrumb = computed(() => getHeaderConf.showBreadCrumb);
|
|
366
|
+
const getShowBread = computed(
|
|
367
|
+
() => unref(getMenuMode) !== MenuMode.HORIZONTAL && !unref(getSplit) && unref(getShowBreadCrumb)
|
|
367
368
|
);
|
|
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
|
|
369
|
+
const getShowTopMenu = computed(() => unref(getMenuMode) === MenuMode.HORIZONTAL || unref(getSplit));
|
|
370
|
+
const getShowNotice = computed(() => getHeaderConf.showNotice);
|
|
371
|
+
const getShowFullScreen = computed(() => getHeaderConf.showFullScreen);
|
|
372
|
+
const getShowLocale = computed(() => getHeaderConf.showLocaleSwitch);
|
|
373
|
+
const getShowSettingTheme = computed(() => getHeaderConf.showSettingTheme);
|
|
374
|
+
const getShowFullHeaderRef = computed(() => {
|
|
375
|
+
return !unref(getIsSidebarType) && !unref(getIsTopMenu);
|
|
375
376
|
});
|
|
376
|
-
const getHeaderHeight = computed
|
|
377
|
+
const getHeaderHeight = computed(() => {
|
|
377
378
|
let height = 0;
|
|
378
379
|
height += HEADER_HEIGHT;
|
|
379
|
-
if (unref
|
|
380
|
+
if (unref(getShowMultipleTab) && !unref(getSplit)) {
|
|
380
381
|
height += TABS_HEIGHT;
|
|
381
382
|
}
|
|
382
383
|
return height;
|
|
383
384
|
});
|
|
384
|
-
const getTabsHeight = computed
|
|
385
|
-
const getShowInsetHeaderRef = computed
|
|
386
|
-
return unref
|
|
385
|
+
const getTabsHeight = computed(() => TABS_HEIGHT);
|
|
386
|
+
const getShowInsetHeaderRef = computed(() => {
|
|
387
|
+
return unref(getIsSidebarType) || unref(getIsTopMenu);
|
|
387
388
|
});
|
|
388
|
-
const getShowBackToTop = computed
|
|
389
|
-
const getIsZH = computed
|
|
389
|
+
const getShowBackToTop = computed(() => getHeaderConf.showBackToTop);
|
|
390
|
+
const getIsZH = computed(() => {
|
|
390
391
|
let local = DtCache.getLocal(CacheKey.LOCALE);
|
|
391
392
|
if (!local)
|
|
392
393
|
return true;
|
|
393
394
|
return local === Language.ZH;
|
|
394
395
|
});
|
|
395
|
-
const getUiSize = computed
|
|
396
|
-
const getShowUiSize = computed
|
|
397
|
-
const getShowLogo = computed
|
|
398
|
-
const getShowLoginOut = computed
|
|
396
|
+
const getUiSize = computed(() => getHeaderConf?.size ?? UiSize.SMALL);
|
|
397
|
+
const getShowUiSize = computed(() => getHeaderConf?.showSize);
|
|
398
|
+
const getShowLogo = computed(() => getHeaderConf.showLogo);
|
|
399
|
+
const getShowLoginOut = computed(() => getHeaderConf.showLoginOut);
|
|
399
400
|
const loginOutClick = getHeaderConf.logoutClick;
|
|
400
401
|
return {
|
|
401
402
|
getHeaderTheme,
|
|
@@ -488,24 +489,23 @@ function handleInputNumberValue(component, val) {
|
|
|
488
489
|
}
|
|
489
490
|
return val;
|
|
490
491
|
}
|
|
491
|
-
const index = "";
|
|
492
492
|
function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
493
493
|
const instance = getCurrentInstance();
|
|
494
494
|
const emit = instance?.emit;
|
|
495
|
-
const innerState = reactive
|
|
495
|
+
const innerState = reactive({
|
|
496
496
|
value: props[key]
|
|
497
497
|
});
|
|
498
498
|
const defaultState = readonly(innerState);
|
|
499
499
|
const setState = (val) => {
|
|
500
500
|
innerState.value = val;
|
|
501
|
-
nextTick
|
|
502
|
-
emit?.(changeEvent, val, ...toRaw$1(unref
|
|
501
|
+
nextTick(() => {
|
|
502
|
+
emit?.(changeEvent, val, ...toRaw$1(unref(emitData)) || []);
|
|
503
503
|
});
|
|
504
504
|
};
|
|
505
505
|
watchEffect(() => {
|
|
506
506
|
innerState.value = props[key];
|
|
507
507
|
});
|
|
508
|
-
const state = computed
|
|
508
|
+
const state = computed({
|
|
509
509
|
get() {
|
|
510
510
|
return innerState.value;
|
|
511
511
|
},
|
|
@@ -513,14 +513,14 @@ function useFormValue(props, key = "value", changeEvent = "change", emitData) {
|
|
|
513
513
|
if (isEqual(value, defaultState.value))
|
|
514
514
|
return;
|
|
515
515
|
innerState.value = value;
|
|
516
|
-
nextTick
|
|
517
|
-
emit?.(changeEvent, value, ...toRaw$1(unref
|
|
516
|
+
nextTick(() => {
|
|
517
|
+
emit?.(changeEvent, value, ...toRaw$1(unref(emitData)) || []);
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
520
|
});
|
|
521
521
|
return [state, setState, defaultState];
|
|
522
522
|
}
|
|
523
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent
|
|
523
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
524
524
|
__name: "radioButton",
|
|
525
525
|
props: {
|
|
526
526
|
value: {
|
|
@@ -535,7 +535,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
535
535
|
const props = __props;
|
|
536
536
|
const attrs = useAttrs();
|
|
537
537
|
const [state] = useFormValue(props);
|
|
538
|
-
const getOptions = computed
|
|
538
|
+
const getOptions = computed(() => {
|
|
539
539
|
const { options } = props;
|
|
540
540
|
if (!options || options?.length === 0)
|
|
541
541
|
return [];
|
|
@@ -547,13 +547,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
547
547
|
return (_ctx, _cache) => {
|
|
548
548
|
const _component_ARadioButton = RadioButton;
|
|
549
549
|
const _component_ARadioGroup = RadioGroup;
|
|
550
|
-
return openBlock(), createBlock(_component_ARadioGroup, mergeProps(unref
|
|
551
|
-
value: unref
|
|
550
|
+
return openBlock(), createBlock(_component_ARadioGroup, mergeProps(unref(attrs), {
|
|
551
|
+
value: unref(state),
|
|
552
552
|
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => isRef(state) ? state.value = $event : null),
|
|
553
553
|
"button-style": "solid"
|
|
554
554
|
}), {
|
|
555
555
|
default: withCtx(() => [
|
|
556
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref
|
|
556
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptions), (item) => {
|
|
557
557
|
return openBlock(), createBlock(_component_ARadioButton, {
|
|
558
558
|
key: `${item.value}`,
|
|
559
559
|
value: item.value,
|
|
@@ -572,12 +572,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent$1({
|
|
|
572
572
|
}
|
|
573
573
|
});
|
|
574
574
|
const _hoisted_1$1 = { class: "input-with-dialog" };
|
|
575
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent
|
|
575
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
576
576
|
__name: "formInputUseDialog",
|
|
577
577
|
setup(__props) {
|
|
578
578
|
const { t } = useI18n("UI");
|
|
579
|
-
const attrs = useAttrs
|
|
580
|
-
const bindProps = computed
|
|
579
|
+
const attrs = useAttrs();
|
|
580
|
+
const bindProps = computed(() => {
|
|
581
581
|
return {
|
|
582
582
|
...omit(attrs, [
|
|
583
583
|
"formValues"
|
|
@@ -600,9 +600,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent$1({
|
|
|
600
600
|
return (_ctx, _cache) => {
|
|
601
601
|
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
602
602
|
createElementVNode("div", { onClick: onClickInput }, [
|
|
603
|
-
createVNode(unref
|
|
603
|
+
createVNode(unref(Input), normalizeProps(guardReactiveProps(unref(bindProps))), null, 16)
|
|
604
604
|
]),
|
|
605
|
-
unref
|
|
605
|
+
unref(attrs).formValues?.schema?.linkProps?.length ? (openBlock(), createElementBlock("i", {
|
|
606
606
|
key: 0,
|
|
607
607
|
class: "i mdi:close-circle",
|
|
608
608
|
onClick: clearProps
|
|
@@ -645,7 +645,7 @@ for (let item in components) {
|
|
|
645
645
|
function _isSlot(s) {
|
|
646
646
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
647
647
|
}
|
|
648
|
-
const _sfc_main$2 =
|
|
648
|
+
const _sfc_main$2 = {
|
|
649
649
|
name: "FormItem",
|
|
650
650
|
inheritAttrs: false,
|
|
651
651
|
props: {
|
|
@@ -1006,7 +1006,7 @@ const _sfc_main$2 = defineComponent({
|
|
|
1006
1006
|
});
|
|
1007
1007
|
};
|
|
1008
1008
|
}
|
|
1009
|
-
}
|
|
1009
|
+
};
|
|
1010
1010
|
const _hoisted_1 = {
|
|
1011
1011
|
key: 0,
|
|
1012
1012
|
className: "preIcon pr-1"
|
|
@@ -1020,7 +1020,7 @@ const _hoisted_4 = /* @__PURE__ */ createElementVNode("i", { class: "text-2xl i
|
|
|
1020
1020
|
const _hoisted_5 = [
|
|
1021
1021
|
_hoisted_4
|
|
1022
1022
|
];
|
|
1023
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent
|
|
1023
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1024
1024
|
__name: "FormButtons",
|
|
1025
1025
|
props: {
|
|
1026
1026
|
mode: {
|
|
@@ -1107,7 +1107,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1107
1107
|
const _component_ACol = Col$1;
|
|
1108
1108
|
const _directive_icon = resolveDirective("icon");
|
|
1109
1109
|
const _directive_auth = resolveDirective("auth");
|
|
1110
|
-
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref
|
|
1110
|
+
return __props.show ? (openBlock(), createBlock(_component_ACol, normalizeProps(mergeProps({ key: 0 }, unref(colOpt))), {
|
|
1111
1111
|
default: withCtx(() => [
|
|
1112
1112
|
createVNode(_component_AFormItem, {
|
|
1113
1113
|
class: "dt-form-btns",
|
|
@@ -1121,9 +1121,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1121
1121
|
(button.show === void 0 ? true : button.show) ? withDirectives((openBlock(), createBlock(_component_AButton, {
|
|
1122
1122
|
type: button.type,
|
|
1123
1123
|
class: normalizeClass(button.class),
|
|
1124
|
-
loading: button.loading,
|
|
1124
|
+
loading: button.loading?.value,
|
|
1125
1125
|
disabled: button.disabled,
|
|
1126
|
-
key: unref
|
|
1126
|
+
key: unref(key),
|
|
1127
1127
|
onClick: ($event) => handleBtnClick(button)
|
|
1128
1128
|
}, {
|
|
1129
1129
|
icon: withCtx(() => [
|
|
@@ -1132,7 +1132,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1132
1132
|
]) : createCommentVNode("", true)
|
|
1133
1133
|
]),
|
|
1134
1134
|
default: withCtx(() => [
|
|
1135
|
-
createTextVNode(" " + toDisplayString(unref
|
|
1135
|
+
createTextVNode(" " + toDisplayString(unref(t)(button.name)) + " ", 1),
|
|
1136
1136
|
button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
|
|
1137
1137
|
[_directive_icon, button.postIcon]
|
|
1138
1138
|
]) : createCommentVNode("", true)
|
|
@@ -1143,16 +1143,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent$1({
|
|
|
1143
1143
|
]) : createCommentVNode("", true)
|
|
1144
1144
|
], 64);
|
|
1145
1145
|
}), 256)),
|
|
1146
|
-
unref
|
|
1146
|
+
unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
|
|
1147
1147
|
key: 0,
|
|
1148
1148
|
type: "link",
|
|
1149
1149
|
class: "advanced",
|
|
1150
1150
|
onClick: toggleAdvanced
|
|
1151
1151
|
}, {
|
|
1152
1152
|
default: withCtx(() => [
|
|
1153
|
-
createElementVNode("span", _hoisted_3, toDisplayString(
|
|
1153
|
+
createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
|
|
1154
1154
|
createElementVNode("span", {
|
|
1155
|
-
class: normalizeClass(unref
|
|
1155
|
+
class: normalizeClass(unref(getAdvanceClass))
|
|
1156
1156
|
}, _hoisted_5, 2)
|
|
1157
1157
|
]),
|
|
1158
1158
|
_: 1
|
|
@@ -1186,7 +1186,7 @@ function useFormEvents({
|
|
|
1186
1186
|
const formEl = unref(formElRef);
|
|
1187
1187
|
if (!formEl)
|
|
1188
1188
|
return {};
|
|
1189
|
-
return handleFormValues(toRaw(unref(formModel)));
|
|
1189
|
+
return handleFormValues(toRaw$1(unref(formModel)));
|
|
1190
1190
|
}
|
|
1191
1191
|
function updateSchema(data) {
|
|
1192
1192
|
let updateItems = [];
|
|
@@ -1224,7 +1224,7 @@ function useFormEvents({
|
|
|
1224
1224
|
obj[name] = null;
|
|
1225
1225
|
if (!isNullAndUnDef(it.defaultValue))
|
|
1226
1226
|
return obj[name] = it.defaultValue;
|
|
1227
|
-
let props = isFunction(it.props) ? it.props(toRaw(unref(formModel))) : it.props;
|
|
1227
|
+
let props = isFunction(it.props) ? it.props(toRaw$1(unref(formModel))) : it.props;
|
|
1228
1228
|
if (!isNullAndUnDef(props?.defaultValue))
|
|
1229
1229
|
obj[name] = props.defaultValue;
|
|
1230
1230
|
});
|
|
@@ -1253,7 +1253,7 @@ function useFormEvents({
|
|
|
1253
1253
|
formModel[key] = isInput ? defaultValue.value[key] || "" : defaultValue.value[key];
|
|
1254
1254
|
});
|
|
1255
1255
|
nextTick(() => clearValidate());
|
|
1256
|
-
emits("reset", toRaw(formModel));
|
|
1256
|
+
emits("reset", toRaw$1(formModel));
|
|
1257
1257
|
}
|
|
1258
1258
|
function removeFormByName(names) {
|
|
1259
1259
|
if (!names)
|
|
@@ -1266,22 +1266,22 @@ function useFormEvents({
|
|
|
1266
1266
|
schemaRef.value = schemaList;
|
|
1267
1267
|
}
|
|
1268
1268
|
function _removeSchemaByName(name, schemaList) {
|
|
1269
|
-
const
|
|
1270
|
-
if (
|
|
1269
|
+
const index = schemaList.findIndex((schema) => schema.name === name);
|
|
1270
|
+
if (index !== -1) {
|
|
1271
1271
|
delete formModel[name];
|
|
1272
|
-
schemaList.splice(
|
|
1272
|
+
schemaList.splice(index, 1);
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
function appendFormItems(schema, prefixName, first = false) {
|
|
1276
1276
|
const schemaList = cloneDeep(unref(getSchema));
|
|
1277
|
-
const
|
|
1278
|
-
if (!prefixName ||
|
|
1277
|
+
const index = schemaList.findIndex((schema2) => schema2.name === prefixName);
|
|
1278
|
+
if (!prefixName || index === -1 || first) {
|
|
1279
1279
|
first ? schemaList.unshift(...schema) : schemaList.push(...schema);
|
|
1280
1280
|
schemaRef.value = schemaList;
|
|
1281
1281
|
return;
|
|
1282
1282
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
schemaList.splice(
|
|
1283
|
+
if (index !== -1) {
|
|
1284
|
+
schemaList.splice(index + 1, 0, ...schema);
|
|
1285
1285
|
}
|
|
1286
1286
|
schemaRef.value = schemaList;
|
|
1287
1287
|
}
|
|
@@ -1355,7 +1355,7 @@ function useFormValues({
|
|
|
1355
1355
|
}) {
|
|
1356
1356
|
const getComMap = () => {
|
|
1357
1357
|
let comMap = /* @__PURE__ */ new Map();
|
|
1358
|
-
unref
|
|
1358
|
+
unref(getSchema).map((it) => {
|
|
1359
1359
|
if (it.component && it.name) {
|
|
1360
1360
|
comMap.set(it.name, it);
|
|
1361
1361
|
}
|
|
@@ -1392,7 +1392,7 @@ function useFormValues({
|
|
|
1392
1392
|
return vals;
|
|
1393
1393
|
}
|
|
1394
1394
|
function initDefault() {
|
|
1395
|
-
const schema = unref
|
|
1395
|
+
const schema = unref(getSchema), obj = {};
|
|
1396
1396
|
schema.forEach((item) => {
|
|
1397
1397
|
const { props = {}, name, component, defaultValue: gDefaultValue, extraName } = item;
|
|
1398
1398
|
const { defaultValue: itemDefaultValue, mode, format, treeCheckable } = isFunction(props) ? props(formModel) : props;
|
|
@@ -1412,7 +1412,7 @@ function useFormValues({
|
|
|
1412
1412
|
if (isArray(defaultValue2)) {
|
|
1413
1413
|
let vals = defaultValue2.map((it) => format ? dayjs(it, format) : dayjs(it));
|
|
1414
1414
|
if (names.length > 1) {
|
|
1415
|
-
names.map((key,
|
|
1415
|
+
names.map((key, index) => obj[key] = vals[index] ?? null);
|
|
1416
1416
|
} else {
|
|
1417
1417
|
obj[names[0]] = vals;
|
|
1418
1418
|
}
|
|
@@ -1421,11 +1421,11 @@ function useFormValues({
|
|
|
1421
1421
|
}
|
|
1422
1422
|
} else {
|
|
1423
1423
|
if (names.length > 1) {
|
|
1424
|
-
names.forEach((key,
|
|
1425
|
-
if (!defaultValue2 || defaultValue2.length - 1 <
|
|
1424
|
+
names.forEach((key, index) => {
|
|
1425
|
+
if (!defaultValue2 || defaultValue2.length - 1 < index) {
|
|
1426
1426
|
obj[key] = null;
|
|
1427
1427
|
} else {
|
|
1428
|
-
obj[key] = defaultValue2[
|
|
1428
|
+
obj[key] = defaultValue2[index];
|
|
1429
1429
|
}
|
|
1430
1430
|
});
|
|
1431
1431
|
} else {
|
|
@@ -1457,8 +1457,8 @@ function useFormActions(opt) {
|
|
|
1457
1457
|
const { appConf } = useAppStore();
|
|
1458
1458
|
function handleAdvanced(isAdvanced) {
|
|
1459
1459
|
const { schemas, minShowColumn = appConf.ui.form?.minShowColumn || 2 } = unref(getProps);
|
|
1460
|
-
let schema = schemas.reduce((t, it,
|
|
1461
|
-
if (
|
|
1460
|
+
let schema = schemas.reduce((t, it, index) => {
|
|
1461
|
+
if (index > minShowColumn - 1)
|
|
1462
1462
|
it.isAdvanced = isAdvanced;
|
|
1463
1463
|
t.push(it);
|
|
1464
1464
|
return t;
|
|
@@ -1492,7 +1492,7 @@ const BasicProps = {
|
|
|
1492
1492
|
},
|
|
1493
1493
|
model: {
|
|
1494
1494
|
type: Object,
|
|
1495
|
-
default: {}
|
|
1495
|
+
default: () => ({})
|
|
1496
1496
|
},
|
|
1497
1497
|
layout: {
|
|
1498
1498
|
type: String,
|
|
@@ -1512,23 +1512,19 @@ const BasicProps = {
|
|
|
1512
1512
|
},
|
|
1513
1513
|
labelCol: {
|
|
1514
1514
|
type: Object,
|
|
1515
|
-
default: () => {
|
|
1516
|
-
}
|
|
1515
|
+
default: () => ({})
|
|
1517
1516
|
},
|
|
1518
1517
|
wrapperCol: {
|
|
1519
1518
|
type: Object,
|
|
1520
|
-
default: () => {
|
|
1521
|
-
}
|
|
1519
|
+
default: () => ({})
|
|
1522
1520
|
},
|
|
1523
1521
|
rowProps: {
|
|
1524
1522
|
type: Object,
|
|
1525
|
-
default: () => {
|
|
1526
|
-
}
|
|
1523
|
+
default: () => ({})
|
|
1527
1524
|
},
|
|
1528
1525
|
colProps: {
|
|
1529
1526
|
type: Object,
|
|
1530
|
-
default: () => {
|
|
1531
|
-
}
|
|
1527
|
+
default: () => ({})
|
|
1532
1528
|
},
|
|
1533
1529
|
size: {
|
|
1534
1530
|
type: String,
|
|
@@ -1604,7 +1600,7 @@ const BasicProps = {
|
|
|
1604
1600
|
type: Function
|
|
1605
1601
|
}
|
|
1606
1602
|
};
|
|
1607
|
-
const _sfc_main = /* @__PURE__ */ defineComponent
|
|
1603
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1608
1604
|
__name: "index",
|
|
1609
1605
|
props: BasicProps,
|
|
1610
1606
|
emits: ["register"],
|
|
@@ -1618,9 +1614,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1618
1614
|
const propsRef = ref();
|
|
1619
1615
|
const schemaRef = ref(null);
|
|
1620
1616
|
const getProps = computed(() => {
|
|
1617
|
+
let colProps = props.colProps;
|
|
1618
|
+
if (isEmpty(props.colProps)) {
|
|
1619
|
+
colProps = props.mode === "search" ? getAppConf.ui.form.searchColspan || { span: 8 } : getAppConf.ui.form.dialogColspan || { span: 12 };
|
|
1620
|
+
}
|
|
1621
1621
|
return {
|
|
1622
1622
|
...props,
|
|
1623
1623
|
...getAppConf.ui.form,
|
|
1624
|
+
colProps,
|
|
1624
1625
|
...unref(propsRef)
|
|
1625
1626
|
};
|
|
1626
1627
|
});
|
|
@@ -1769,26 +1770,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1769
1770
|
return (_ctx, _cache) => {
|
|
1770
1771
|
const _component_ARow = Row;
|
|
1771
1772
|
const _component_AForm = Form$1;
|
|
1772
|
-
return openBlock(), createBlock(_component_AForm, mergeProps(unref
|
|
1773
|
+
return openBlock(), createBlock(_component_AForm, mergeProps(unref(getBindValue), {
|
|
1773
1774
|
ref_key: "formElRef",
|
|
1774
1775
|
ref: formElRef,
|
|
1775
|
-
class: unref
|
|
1776
|
-
model:
|
|
1777
|
-
layout: unref
|
|
1776
|
+
class: unref(getFormClass),
|
|
1777
|
+
model: formModel,
|
|
1778
|
+
layout: unref(getProps).layout,
|
|
1778
1779
|
onKeypress: withKeys(handleEnterPress, ["enter"])
|
|
1779
1780
|
}), {
|
|
1780
1781
|
default: withCtx(() => [
|
|
1781
|
-
createVNode(_component_ARow, mergeProps(unref
|
|
1782
|
+
createVNode(_component_ARow, mergeProps(unref(getProps).rowProps, { style: {
|
|
1782
1783
|
margin: 0
|
|
1783
1784
|
} }), {
|
|
1784
1785
|
default: withCtx(() => [
|
|
1785
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref
|
|
1786
|
-
return openBlock(), createBlock(unref
|
|
1786
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSchema), (schema) => {
|
|
1787
|
+
return openBlock(), createBlock(unref(_sfc_main$2), {
|
|
1787
1788
|
key: schema.name,
|
|
1788
1789
|
schema,
|
|
1789
|
-
formProps: unref
|
|
1790
|
-
formModel
|
|
1791
|
-
defaultValues:
|
|
1790
|
+
formProps: unref(getProps),
|
|
1791
|
+
formModel,
|
|
1792
|
+
defaultValues: defaultValue.value,
|
|
1792
1793
|
setFormModel,
|
|
1793
1794
|
formActionType: formActionMethods
|
|
1794
1795
|
}, createSlots({ _: 2 }, [
|
|
@@ -1802,7 +1803,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent$1({
|
|
|
1802
1803
|
})
|
|
1803
1804
|
]), 1032, ["schema", "formProps", "formModel", "defaultValues"]);
|
|
1804
1805
|
}), 128)),
|
|
1805
|
-
unref
|
|
1806
|
+
unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(_sfc_main$1), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("", true)
|
|
1806
1807
|
]),
|
|
1807
1808
|
_: 3
|
|
1808
1809
|
}, 16)
|
|
@@ -79,10 +79,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
79
79
|
"onHandle-method"?: (...args: any[]) => any;
|
|
80
80
|
}, {
|
|
81
81
|
mode: "search" | "dialog";
|
|
82
|
-
minShowColumn: number;
|
|
83
|
-
showAdvancedButton: boolean;
|
|
84
82
|
show: boolean;
|
|
85
|
-
|
|
83
|
+
showAdvancedButton: boolean;
|
|
84
|
+
minShowColumn: number;
|
|
86
85
|
buttonList: ButtonProps[];
|
|
86
|
+
isAdvanced: boolean;
|
|
87
87
|
}>;
|
|
88
88
|
export default _sfc_main;
|