@dt-frames/ui 1.0.27 → 1.0.28
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/curd/src/components/dialog.d.ts +4 -7
- package/es/components/curd/src/types/curd.type.d.ts +2 -2
- package/es/components/forms/src/components/formIcon.d.ts +23 -23
- package/es/components/forms/src/components/formInputUseDialog.d.ts +18 -18
- package/es/components/forms/src/types/form.type.d.ts +1 -0
- package/es/components/icons/src/pick-icon.d.ts +5 -5
- package/es/components/source/src/hooks/useDownload.d.ts +2 -1
- package/es/components/source/src/types/source.type.d.ts +2 -1
- package/es/components/table/index.less +4 -0
- package/es/components/table/src/components/TableActions.d.ts +1 -0
- package/es/components/table/src/components/setting/Column.d.ts +1 -0
- package/es/components/table/src/components/setting/Download.d.ts +1 -0
- package/es/components/table/src/components/setting/Fullscreen.d.ts +1 -0
- package/es/components/table/src/components/setting/Size.d.ts +1 -0
- package/es/components/table/src/hooks/useColumns.d.ts +4 -2
- package/es/components/table/src/hooks/useLoading.d.ts +12 -1
- package/es/components/table/src/hooks/useTableInstance.d.ts +1 -0
- package/es/components/table/src/hooks/useTableScroll.d.ts +2 -2
- package/es/components/table/src/index.d.ts +96 -7
- package/es/components/table/src/types/table.type.d.ts +2 -1
- package/es/components/upload/src/props.d.ts +4 -0
- package/es/components/upload/src/upload.d.ts +109 -7
- package/es/index.js +77 -31
- package/es/theme/theme.less +2 -0
- package/es/theme/transition.less +6 -0
- package/package.json +2 -2
package/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent, resolveComponent, openBlock, createBlock, computed, un
|
|
|
2
2
|
import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, dispatchResize, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, http, getDynamicProps, getDictValueByCode, formatNumber, isVnode, getPopupContainer, isNullAndUnDef, useMessage, isEmpty, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
|
|
3
3
|
import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Popover, Spin, Dropdown, Menu, MenuItem, CheckboxGroup, Table, Upload, Image, MenuDivider, Tree, Empty, BackTop, Breadcrumb, Avatar, Drawer, SubMenu, LayoutHeader, LayoutSider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
|
|
4
4
|
import { isEqual, omit, cloneDeep, upperFirst, set, uniqBy, difference, get, trim } from "lodash-es";
|
|
5
|
-
import { tryOnUnmounted, isFunction as isFunction$1,
|
|
5
|
+
import { tryOnUnmounted, isFunction as isFunction$1, useDebounceFn, useFullscreen, useThrottleFn } from "@vueuse/core";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
7
|
import Sortablejs from "sortablejs";
|
|
8
8
|
import * as xlsx from "xlsx";
|
|
@@ -5338,9 +5338,13 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5338
5338
|
},
|
|
5339
5339
|
setup(__props) {
|
|
5340
5340
|
const props = __props;
|
|
5341
|
+
const actionBtns = ref([]);
|
|
5341
5342
|
watch(() => props.btns, (btns) => {
|
|
5342
|
-
btns.map((it) => {
|
|
5343
|
-
|
|
5343
|
+
actionBtns.value = [...btns].map((it) => {
|
|
5344
|
+
return {
|
|
5345
|
+
...it,
|
|
5346
|
+
ifShow: isBoolean(it.ifShow) ? it.ifShow : isFunction(it.ifShow) ? it.ifShow(props.record) : true
|
|
5347
|
+
};
|
|
5344
5348
|
});
|
|
5345
5349
|
}, {
|
|
5346
5350
|
immediate: true
|
|
@@ -5388,7 +5392,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5388
5392
|
overlay: withCtx(() => [
|
|
5389
5393
|
createVNode(unref(Menu), { class: "dt-action-select" }, {
|
|
5390
5394
|
default: withCtx(() => [
|
|
5391
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5395
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(actionBtns.value, (item) => {
|
|
5392
5396
|
return withDirectives((openBlock(), createElementBlock("span", null, [
|
|
5393
5397
|
item.ifShow ? (openBlock(), createBlock(unref(MenuItem), {
|
|
5394
5398
|
key: 0,
|
|
@@ -5542,22 +5546,18 @@ function handleActionColumn(propsRef, columns) {
|
|
|
5542
5546
|
});
|
|
5543
5547
|
}
|
|
5544
5548
|
}
|
|
5545
|
-
function useColumns(propsRef, getPaginationRef) {
|
|
5549
|
+
function useColumns(propsRef, getPaginationRef, tableElRef) {
|
|
5546
5550
|
const columnsRef = ref(unref(propsRef).columns);
|
|
5547
5551
|
let cacheColumns = unref(propsRef).columns;
|
|
5548
5552
|
const getColumnsRef = computed(() => {
|
|
5549
5553
|
const columns = cloneDeep(unref(columnsRef));
|
|
5550
5554
|
if (!columns)
|
|
5551
5555
|
return [];
|
|
5552
|
-
const { ellipsis
|
|
5556
|
+
const { ellipsis } = unref(propsRef);
|
|
5553
5557
|
columns.forEach((it, index) => {
|
|
5558
|
+
var _a;
|
|
5559
|
+
it.class = `${(_a = it.class) != null ? _a : ""} __column`;
|
|
5554
5560
|
const { slots } = it;
|
|
5555
|
-
it.width = it.width || (index === columns.length - 1 ? 119.9 : 120);
|
|
5556
|
-
if (Reflect.has(it, "resizable") ? !!it.resizable : resizable) {
|
|
5557
|
-
it.resizable = true;
|
|
5558
|
-
it.minWidth = it.minWidth || minWidth;
|
|
5559
|
-
it.maxWidth = it.maxWidth || maxWidth;
|
|
5560
|
-
}
|
|
5561
5561
|
if (it.sorter) {
|
|
5562
5562
|
it.sorter = {
|
|
5563
5563
|
multiple: Number(it.sorter)
|
|
@@ -5583,10 +5583,41 @@ function useColumns(propsRef, getPaginationRef) {
|
|
|
5583
5583
|
const ifShow = column.ifShow;
|
|
5584
5584
|
return isBoolean(ifShow) ? ifShow : isFunction(ifShow) ? ifShow(column) : true;
|
|
5585
5585
|
}
|
|
5586
|
+
function addResize() {
|
|
5587
|
+
const { resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
|
|
5588
|
+
useDebounceFn(() => {
|
|
5589
|
+
var _a, _b;
|
|
5590
|
+
let els = (_a = unref(tableElRef)) == null ? void 0 : _a.$el.querySelectorAll(".__column");
|
|
5591
|
+
let allWidth = 0;
|
|
5592
|
+
for (let i = 0; i < els.length; i++) {
|
|
5593
|
+
allWidth += (_b = els[i].offsetWidth) != null ? _b : 0;
|
|
5594
|
+
}
|
|
5595
|
+
let columnAllWidth = 0, noWidthNum = 0;
|
|
5596
|
+
columnsRef.value.forEach((it) => {
|
|
5597
|
+
if (it.ifShow) {
|
|
5598
|
+
if (it.width) {
|
|
5599
|
+
columnAllWidth += parseInt(`${it.width}`);
|
|
5600
|
+
} else {
|
|
5601
|
+
noWidthNum++;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
});
|
|
5605
|
+
let avgWidth = (allWidth - columnAllWidth) / noWidthNum;
|
|
5606
|
+
columnsRef.value.forEach((it) => {
|
|
5607
|
+
it.width = it.width || avgWidth - 1;
|
|
5608
|
+
if (Reflect.has(it, "resizable") ? !!it.resizable : resizable) {
|
|
5609
|
+
it.resizable = true;
|
|
5610
|
+
it.minWidth = it.minWidth || minWidth;
|
|
5611
|
+
it.maxWidth = it.maxWidth || maxWidth;
|
|
5612
|
+
}
|
|
5613
|
+
});
|
|
5614
|
+
}, 100)();
|
|
5615
|
+
}
|
|
5586
5616
|
watch(() => unref(propsRef).columns, (columns) => {
|
|
5587
5617
|
var _a;
|
|
5588
5618
|
columnsRef.value = columns;
|
|
5589
5619
|
cacheColumns = (_a = columns.filter((it) => !it.flag)) != null ? _a : [];
|
|
5620
|
+
nextTick(() => addResize());
|
|
5590
5621
|
});
|
|
5591
5622
|
function getColumns(opt) {
|
|
5592
5623
|
const { ignoreIndex, ignoreAction, sort } = opt || {};
|
|
@@ -5656,7 +5687,7 @@ const _hoisted_1$r = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u6
|
|
|
5656
5687
|
const _hoisted_2$i = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
|
|
5657
5688
|
const _hoisted_3$b = /* @__PURE__ */ createTextVNode(" \u5E8F\u5217\u53F7 ");
|
|
5658
5689
|
const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" \u590D\u9009\u6846 ");
|
|
5659
|
-
const _hoisted_5$
|
|
5690
|
+
const _hoisted_5$4 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
|
|
5660
5691
|
const _hoisted_6$2 = {
|
|
5661
5692
|
size: 16,
|
|
5662
5693
|
className: "drag-icon"
|
|
@@ -5894,7 +5925,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
|
|
|
5894
5925
|
onClick: reset
|
|
5895
5926
|
}, {
|
|
5896
5927
|
default: withCtx(() => [
|
|
5897
|
-
_hoisted_5$
|
|
5928
|
+
_hoisted_5$4
|
|
5898
5929
|
]),
|
|
5899
5930
|
_: 1
|
|
5900
5931
|
})
|
|
@@ -6375,7 +6406,7 @@ const _hoisted_4$5 = {
|
|
|
6375
6406
|
key: 0,
|
|
6376
6407
|
class: "dt-table-header-actions__right"
|
|
6377
6408
|
};
|
|
6378
|
-
const _hoisted_5$
|
|
6409
|
+
const _hoisted_5$3 = {
|
|
6379
6410
|
key: 0,
|
|
6380
6411
|
style: { "margin": "5px" }
|
|
6381
6412
|
};
|
|
@@ -6395,7 +6426,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6395
6426
|
}, null, 8, ["setting", "onColumnsChange"])
|
|
6396
6427
|
])) : createCommentVNode("", true)
|
|
6397
6428
|
]),
|
|
6398
|
-
_ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
6429
|
+
_ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
|
|
6399
6430
|
renderSlot(_ctx.$slots, "headerTop")
|
|
6400
6431
|
])) : createCommentVNode("", true)
|
|
6401
6432
|
]);
|
|
@@ -6432,9 +6463,10 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
|
|
|
6432
6463
|
watch(() => propsRef.value.dataSource, (v) => {
|
|
6433
6464
|
debounceRedoHeight();
|
|
6434
6465
|
}, {
|
|
6466
|
+
deep: true,
|
|
6435
6467
|
flush: "post"
|
|
6436
6468
|
});
|
|
6437
|
-
windowResizeFn(calcTableHeight,
|
|
6469
|
+
windowResizeFn(calcTableHeight, 10);
|
|
6438
6470
|
function redoHeight() {
|
|
6439
6471
|
nextTick(() => {
|
|
6440
6472
|
calcTableHeight();
|
|
@@ -6684,7 +6716,7 @@ const _sfc_main$A = defineComponent({
|
|
|
6684
6716
|
setColumns,
|
|
6685
6717
|
setCacheColumnsByField,
|
|
6686
6718
|
getCacheColumns
|
|
6687
|
-
} = useColumns(getProps, getPaginationInfo);
|
|
6719
|
+
} = useColumns(getProps, getPaginationInfo, tableElRef);
|
|
6688
6720
|
const {
|
|
6689
6721
|
getRowSelectionRef,
|
|
6690
6722
|
clearSelectedRowKeys,
|
|
@@ -6841,14 +6873,14 @@ function useDownload(exportUrl, exportName) {
|
|
|
6841
6873
|
case "all":
|
|
6842
6874
|
http.exportFile(exportUrl, {
|
|
6843
6875
|
fields: setDownloadAllHeaders(columns),
|
|
6844
|
-
tableName: exportName,
|
|
6876
|
+
tableName: unref(exportName),
|
|
6845
6877
|
fileType: "xlsx",
|
|
6846
6878
|
searchDTO
|
|
6847
|
-
}, `${exportName}.xlsx`);
|
|
6879
|
+
}, `${unref(exportName)}.xlsx`);
|
|
6848
6880
|
break;
|
|
6849
6881
|
case "current":
|
|
6850
6882
|
case "select":
|
|
6851
|
-
handleDownloadPage(excelData, exportName);
|
|
6883
|
+
handleDownloadPage(excelData, unref(exportName));
|
|
6852
6884
|
break;
|
|
6853
6885
|
}
|
|
6854
6886
|
}
|
|
@@ -7122,6 +7154,9 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
7122
7154
|
__name: "dialog",
|
|
7123
7155
|
props: {
|
|
7124
7156
|
...basicProps,
|
|
7157
|
+
title: {
|
|
7158
|
+
type: Object
|
|
7159
|
+
},
|
|
7125
7160
|
...{
|
|
7126
7161
|
onRegister: { type: Function },
|
|
7127
7162
|
formProps: {
|
|
@@ -7135,7 +7170,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
7135
7170
|
},
|
|
7136
7171
|
setup(__props) {
|
|
7137
7172
|
const props = __props;
|
|
7138
|
-
const [registerDialog, { closeModal }] = useModal({
|
|
7173
|
+
const [registerDialog, { closeModal, setModalProps }] = useModal({
|
|
7139
7174
|
...omit(toRaw(props), [
|
|
7140
7175
|
"curd",
|
|
7141
7176
|
"formProps",
|
|
@@ -7189,19 +7224,23 @@ function useCurd(curdOpt) {
|
|
|
7189
7224
|
closeModal
|
|
7190
7225
|
}] = useModalOut();
|
|
7191
7226
|
const {
|
|
7192
|
-
confirm
|
|
7227
|
+
confirm,
|
|
7228
|
+
message
|
|
7193
7229
|
} = useMessage();
|
|
7230
|
+
const actType = ref(null);
|
|
7231
|
+
const title = computed(() => unref(actType) + unref(curdOpt.title));
|
|
7194
7232
|
const DtCurdModal = () => {
|
|
7195
7233
|
return h(createVNode("div", {
|
|
7196
7234
|
"class": "curdModal"
|
|
7197
7235
|
}, [createVNode(_sfc_main$z, mergeProps(curdOpt, {
|
|
7236
|
+
"title": title,
|
|
7198
7237
|
"formsVal": formsVal,
|
|
7199
7238
|
"formProps": curdOpt.formProps,
|
|
7200
7239
|
"onRegister": register
|
|
7201
7240
|
}), null)]));
|
|
7202
7241
|
};
|
|
7203
7242
|
function add() {
|
|
7204
|
-
|
|
7243
|
+
actType.value = "\u65B0\u589E";
|
|
7205
7244
|
formsVal.value = null;
|
|
7206
7245
|
openModal();
|
|
7207
7246
|
}
|
|
@@ -7232,7 +7271,7 @@ function useCurd(curdOpt) {
|
|
|
7232
7271
|
primaryKey = "id",
|
|
7233
7272
|
curd
|
|
7234
7273
|
} = curdOpt;
|
|
7235
|
-
|
|
7274
|
+
actType.value = "\u7F16\u8F91";
|
|
7236
7275
|
curd.onQueryById(row[primaryKey]).then((rsp) => {
|
|
7237
7276
|
formsVal.value = rsp;
|
|
7238
7277
|
nextTick(() => dispatchResize());
|
|
@@ -7240,6 +7279,10 @@ function useCurd(curdOpt) {
|
|
|
7240
7279
|
openModal();
|
|
7241
7280
|
}
|
|
7242
7281
|
function dels(ids = []) {
|
|
7282
|
+
if (!ids.length) {
|
|
7283
|
+
message.error("\u6682\u65E0\u9009\u4E2D\u7684\u6570\u636E!");
|
|
7284
|
+
return;
|
|
7285
|
+
}
|
|
7243
7286
|
const {
|
|
7244
7287
|
curd
|
|
7245
7288
|
} = curdOpt;
|
|
@@ -7318,6 +7361,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
7318
7361
|
}
|
|
7319
7362
|
});
|
|
7320
7363
|
const basicUploadProps = {
|
|
7364
|
+
uploadText: {
|
|
7365
|
+
type: String,
|
|
7366
|
+
default: "\u6587\u4EF6\u4E0A\u4F20"
|
|
7367
|
+
},
|
|
7321
7368
|
showTemplateDownload: {
|
|
7322
7369
|
type: Boolean,
|
|
7323
7370
|
default: false
|
|
@@ -7807,9 +7854,8 @@ var sparkMd5 = { exports: {} };
|
|
|
7807
7854
|
})(sparkMd5);
|
|
7808
7855
|
const _hoisted_1$j = { class: "dt-file" };
|
|
7809
7856
|
const _hoisted_2$b = { class: "file-header" };
|
|
7810
|
-
const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \
|
|
7811
|
-
const _hoisted_4$4 =
|
|
7812
|
-
const _hoisted_5$3 = { class: "file-type-tips ant-alert-info" };
|
|
7857
|
+
const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u4E0B\u8F7D ");
|
|
7858
|
+
const _hoisted_4$4 = { class: "file-type-tips ant-alert-info" };
|
|
7813
7859
|
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
7814
7860
|
__name: "upload",
|
|
7815
7861
|
props: basicUploadProps,
|
|
@@ -7940,7 +7986,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
7940
7986
|
withDirectives(createElementVNode("span", null, null, 512), [
|
|
7941
7987
|
[_directive_icon, "ic:baseline-file-upload"]
|
|
7942
7988
|
]),
|
|
7943
|
-
|
|
7989
|
+
createTextVNode(" " + toDisplayString(_ctx.uploadText), 1)
|
|
7944
7990
|
]),
|
|
7945
7991
|
_: 1
|
|
7946
7992
|
})
|
|
@@ -7956,14 +8002,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
7956
8002
|
withDirectives(createElementVNode("span", null, null, 512), [
|
|
7957
8003
|
[_directive_icon, "ic:baseline-file-download"]
|
|
7958
8004
|
]),
|
|
7959
|
-
|
|
8005
|
+
_hoisted_3$6
|
|
7960
8006
|
]),
|
|
7961
8007
|
_: 1
|
|
7962
8008
|
}, 8, ["onClick"])) : createCommentVNode("", true)
|
|
7963
8009
|
]),
|
|
7964
8010
|
renderSlot(_ctx.$slots, "default")
|
|
7965
8011
|
]),
|
|
7966
|
-
createElementVNode("div",
|
|
8012
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
7967
8013
|
withDirectives(createElementVNode("span", null, null, 512), [
|
|
7968
8014
|
[_directive_icon, "ant-design:info-circle-outlined"]
|
|
7969
8015
|
]),
|
package/es/theme/theme.less
CHANGED
package/es/theme/transition.less
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dt-frames/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ui",
|
|
6
6
|
"dt-ui"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "
|
|
13
|
+
"dev": "vite dev",
|
|
14
14
|
"build": "vite build"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|