@dt-frames/ui 1.0.27 → 1.0.29

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.
Files changed (30) hide show
  1. package/es/components/curd/src/components/dialog.d.ts +4 -7
  2. package/es/components/curd/src/types/curd.type.d.ts +2 -2
  3. package/es/components/forms/src/components/formIcon.d.ts +23 -23
  4. package/es/components/forms/src/components/formInputUseDialog.d.ts +18 -18
  5. package/es/components/forms/src/types/form.type.d.ts +1 -0
  6. package/es/components/icons/src/pick-icon.d.ts +5 -5
  7. package/es/components/source/src/hooks/useDownload.d.ts +2 -1
  8. package/es/components/source/src/types/source.type.d.ts +2 -1
  9. package/es/components/table/index.d.ts +2 -1
  10. package/es/components/table/index.less +4 -0
  11. package/es/components/table/src/components/TableActions.d.ts +1 -0
  12. package/es/components/table/src/components/editable/EditTableCell.d.ts +0 -6
  13. package/es/components/table/src/components/editable/index.d.ts +1 -1
  14. package/es/components/table/src/components/setting/Column.d.ts +1 -0
  15. package/es/components/table/src/components/setting/Download.d.ts +1 -0
  16. package/es/components/table/src/components/setting/Fullscreen.d.ts +1 -0
  17. package/es/components/table/src/components/setting/Size.d.ts +1 -0
  18. package/es/components/table/src/hooks/useColumns.d.ts +4 -2
  19. package/es/components/table/src/hooks/useLoading.d.ts +12 -1
  20. package/es/components/table/src/hooks/useTableInstance.d.ts +1 -0
  21. package/es/components/table/src/hooks/useTableScroll.d.ts +2 -2
  22. package/es/components/table/src/index.d.ts +106 -7
  23. package/es/components/table/src/props.d.ts +4 -0
  24. package/es/components/table/src/types/table.type.d.ts +2 -1
  25. package/es/components/upload/src/props.d.ts +4 -0
  26. package/es/components/upload/src/upload.d.ts +119 -7
  27. package/es/index.js +481 -429
  28. package/es/theme/theme.less +2 -0
  29. package/es/theme/transition.less +6 -0
  30. 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, useFullscreen, useDebounceFn, useThrottleFn } from "@vueuse/core";
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";
@@ -4498,6 +4498,248 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
4498
4498
  };
4499
4499
  }
4500
4500
  });
4501
+ const componentMap = /* @__PURE__ */ new Map();
4502
+ componentMap.set("Input", Input);
4503
+ componentMap.set("InputNumber", InputNumber);
4504
+ componentMap.set("Select", Select);
4505
+ componentMap.set("TreeSelect", TreeSelect);
4506
+ componentMap.set("Switch", Switch);
4507
+ componentMap.set("Checkbox", Checkbox);
4508
+ componentMap.set("DatePicker", DatePicker);
4509
+ componentMap.set("TimePicker", TimePicker);
4510
+ const CellComponent = ({
4511
+ component = "Input",
4512
+ rule = true,
4513
+ ruleMessage,
4514
+ popoverVisible,
4515
+ getPopupContainer: getPopupContainer2
4516
+ }, { attrs }) => {
4517
+ const Comp = componentMap.get(component);
4518
+ const DefaultComp = h(Comp, attrs);
4519
+ if (!rule)
4520
+ return DefaultComp;
4521
+ return h(Popover, {
4522
+ overlayClassName: "edit-cell-rule-popover",
4523
+ visible: !!popoverVisible,
4524
+ ...getPopupContainer2 ? { getPopupContainer: getPopupContainer2 } : {}
4525
+ }, {
4526
+ default: () => DefaultComp,
4527
+ content: () => ruleMessage
4528
+ });
4529
+ };
4530
+ const tableKey = Symbol("dt-page");
4531
+ function createTableInstance(instance) {
4532
+ provide(tableKey, instance);
4533
+ }
4534
+ function getTableInstance() {
4535
+ return inject(tableKey);
4536
+ }
4537
+ var _sfc_main$K = defineComponent({
4538
+ name: "EditableCell",
4539
+ components: {
4540
+ Spin,
4541
+ CellComponent
4542
+ },
4543
+ props: {
4544
+ value: {
4545
+ type: [String, Number, Boolean, Object],
4546
+ default: ""
4547
+ },
4548
+ record: {
4549
+ type: Object
4550
+ },
4551
+ column: {
4552
+ type: Object,
4553
+ default: () => ({})
4554
+ },
4555
+ index: Number
4556
+ },
4557
+ setup(props) {
4558
+ const table = getTableInstance();
4559
+ ref();
4560
+ const {
4561
+ editRule,
4562
+ align = "left"
4563
+ } = props.column;
4564
+ const ruleMessage = ref("");
4565
+ const ruleVisible = ref(false);
4566
+ const optionsRef = ref([]);
4567
+ const currentValueRef = ref(props.value);
4568
+ const getComponent = computed(() => {
4569
+ var _a;
4570
+ return ((_a = props.column) == null ? void 0 : _a.editComponent) || "Input";
4571
+ });
4572
+ const getRuleVisible = computed(() => {
4573
+ return unref(ruleMessage) && unref(ruleVisible);
4574
+ });
4575
+ const getWrapperClass = computed(() => {
4576
+ return `edit-cell-align-${align}`;
4577
+ });
4578
+ const getIsCheckComp = computed(() => {
4579
+ const component = unref(getComponent);
4580
+ return ["Checkbox", "Switch"].includes(component);
4581
+ });
4582
+ const createPlaceholderMessage = (component) => {
4583
+ if (component.includes("Input")) {
4584
+ return "\u8BF7\u8F93\u5165";
4585
+ }
4586
+ return "\u8BF7\u9009\u62E9";
4587
+ };
4588
+ const setTableValue = () => {
4589
+ props.record[props.column.dataIndex] = unref(currentValueRef);
4590
+ };
4591
+ const getComponentProps = computed(() => {
4592
+ var _a, _b, _c;
4593
+ const isCheckValue = unref(getIsCheckComp);
4594
+ const valueField = isCheckValue ? "checked" : "value";
4595
+ const val = unref(currentValueRef);
4596
+ const value = isCheckValue ? isNumber(val) && isBoolean(val) ? val : !!val : val;
4597
+ let compProps = (_b = (_a = props.column) == null ? void 0 : _a.editComponentProps) != null ? _b : {};
4598
+ const {
4599
+ record,
4600
+ column,
4601
+ index
4602
+ } = props;
4603
+ if (isFunction$1(compProps)) {
4604
+ compProps = (_c = compProps({
4605
+ text: val,
4606
+ record,
4607
+ column,
4608
+ index
4609
+ })) != null ? _c : {};
4610
+ }
4611
+ return {
4612
+ size: "small",
4613
+ getPopupContainer: () => document.body,
4614
+ placeholder: createPlaceholderMessage(unref(getComponent)),
4615
+ ...omit(compProps, "onChange"),
4616
+ [valueField]: value
4617
+ };
4618
+ });
4619
+ async function handleChange(e) {
4620
+ var _a, _b;
4621
+ const component = unref(getComponent);
4622
+ if (!e) {
4623
+ currentValueRef.value = e;
4624
+ } else if (component === "Checkbox") {
4625
+ currentValueRef.value = e.target.checked;
4626
+ } else if (component === "Switch") {
4627
+ currentValueRef.value = e;
4628
+ } else if ((e == null ? void 0 : e.target) && Reflect.has(e.target, "value")) {
4629
+ currentValueRef.value = e.target.value;
4630
+ } else if (isString(e) || isBoolean(e) || isNumber(e)) {
4631
+ currentValueRef.value = e;
4632
+ }
4633
+ const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
4634
+ if (onChange && isFunction$1(onChange))
4635
+ onChange(...arguments);
4636
+ setTableValue();
4637
+ (_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
4638
+ column: props.column,
4639
+ value: unref(currentValueRef),
4640
+ record: toRaw(props.record),
4641
+ index: props.index
4642
+ });
4643
+ handleSubmitRule();
4644
+ }
4645
+ async function handleSubmitRule() {
4646
+ const {
4647
+ column,
4648
+ record
4649
+ } = props;
4650
+ const {
4651
+ editRule: editRule2
4652
+ } = column;
4653
+ const currentValue = unref(currentValueRef);
4654
+ if (editRule2) {
4655
+ if (isBoolean(editRule2) && !currentValue && !isNumber(currentValue)) {
4656
+ ruleVisible.value = true;
4657
+ const component = unref(getComponent);
4658
+ ruleMessage.value = createPlaceholderMessage(component);
4659
+ return false;
4660
+ }
4661
+ if (isFunction$1(editRule2)) {
4662
+ const res = await editRule2(currentValue, record);
4663
+ if (!!res) {
4664
+ ruleMessage.value = res;
4665
+ ruleVisible.value = true;
4666
+ return false;
4667
+ }
4668
+ }
4669
+ }
4670
+ ruleMessage.value = "";
4671
+ return true;
4672
+ }
4673
+ function handleOptionsChange(options) {
4674
+ optionsRef.value = options;
4675
+ }
4676
+ return {
4677
+ props,
4678
+ getComponentProps,
4679
+ getRuleVisible,
4680
+ editRule,
4681
+ ruleMessage,
4682
+ getWrapperClass,
4683
+ handleChange,
4684
+ handleOptionsChange
4685
+ };
4686
+ }
4687
+ });
4688
+ const _hoisted_1$t = { class: "editable-cell" };
4689
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
4690
+ var _a;
4691
+ const _component_CellComponent = resolveComponent("CellComponent");
4692
+ return openBlock(), createElementBlock("div", _hoisted_1$t, [
4693
+ createVNode(_component_CellComponent, mergeProps({ ref: "elRef" }, _ctx.getComponentProps, {
4694
+ component: (_a = _ctx.column) == null ? void 0 : _a.editComponent,
4695
+ popoverVisible: _ctx.getRuleVisible,
4696
+ rule: _ctx.editRule,
4697
+ ruleMessage: _ctx.ruleMessage,
4698
+ class: _ctx.getWrapperClass,
4699
+ onChange: _ctx.handleChange,
4700
+ onOptionsChange: _ctx.handleOptionsChange
4701
+ }), null, 16, ["component", "popoverVisible", "rule", "ruleMessage", "class", "onChange", "onOptionsChange"])
4702
+ ]);
4703
+ }
4704
+ var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$3]]);
4705
+ function renderEditCell(column) {
4706
+ return ({ text: value, record, index }) => {
4707
+ record.onValid = async () => {
4708
+ if (isArray$1(record == null ? void 0 : record.validCbs)) {
4709
+ const validFns = ((record == null ? void 0 : record.validCbs) || []).map((fn) => fn());
4710
+ const res = await Promise.all(validFns);
4711
+ return res.every((item) => !!item);
4712
+ }
4713
+ return false;
4714
+ };
4715
+ record.onEdit = async (edit, submit = false) => {
4716
+ var _a, _b;
4717
+ if (!submit) {
4718
+ record.editable = edit;
4719
+ }
4720
+ if (!edit && submit) {
4721
+ if (!await record.onValid())
4722
+ return false;
4723
+ const res = await ((_a = record.onSubmitEdit) == null ? void 0 : _a.call(record));
4724
+ if (res) {
4725
+ record.editable = false;
4726
+ return true;
4727
+ }
4728
+ return false;
4729
+ }
4730
+ if (!edit && !submit) {
4731
+ (_b = record.onCancelEdit) == null ? void 0 : _b.call(record);
4732
+ }
4733
+ return true;
4734
+ };
4735
+ return h(EditableCell, {
4736
+ value,
4737
+ record,
4738
+ column,
4739
+ index
4740
+ });
4741
+ };
4742
+ }
4501
4743
  const codeMap = /* @__PURE__ */ new Map();
4502
4744
  function useHeaderCode(code, templates = {}, changeColumns) {
4503
4745
  const { appConf } = useAppStore();
@@ -4663,6 +4905,7 @@ const TableProps = {
4663
4905
  ellipsis: { type: Boolean, default: true },
4664
4906
  dataSource: { type: Array, default: null },
4665
4907
  bordered: { type: Boolean, default: true },
4908
+ canResize: { type: Boolean, default: false },
4666
4909
  pagination: {
4667
4910
  type: [Object, Boolean],
4668
4911
  default: {}
@@ -4918,391 +5161,149 @@ function useRowSelection(propsRef, emit) {
4918
5161
  });
4919
5162
  watch(() => unref(selectedRowKeysRef), () => {
4920
5163
  nextTick(() => {
4921
- const { rowSelection } = unref(propsRef);
4922
- if (rowSelection) {
4923
- const { onChange } = rowSelection;
4924
- if (onChange && isFunction(onChange))
4925
- onChange(getSelectRowKeys(), getSelectRows());
4926
- }
4927
- emit("selection-change", {
4928
- keys: getSelectRowKeys(),
4929
- rows: getSelectRows()
4930
- });
4931
- });
4932
- }, { deep: true });
4933
- function findeNodeAll(tree, func, config = {}) {
4934
- config = Object.assign({}, DEFAULT_CONFIG, config);
4935
- const result = [];
4936
- const list = [...tree];
4937
- for (const node of list) {
4938
- func(node) && result.push(node);
4939
- node.children && list.push(...node.children);
4940
- }
4941
- return result;
4942
- }
4943
- function setSelectedRowKeys(rowKeys) {
4944
- var _a;
4945
- selectedRowKeysRef.value = rowKeys;
4946
- const allSelectedRows = findeNodeAll(toRaw(unref(propsRef).dataSource).concat(toRaw(unref(selectedRowRef))), (item) => rowKeys.includes(item[unref(propsRef).rowKey]), {
4947
- children: (_a = propsRef.value.childrenColumnName) != null ? _a : "children"
4948
- });
4949
- const trueSelectedRows = [];
4950
- rowKeys.forEach((key) => {
4951
- const found = allSelectedRows.find((item) => item[unref(propsRef).rowKey] === key);
4952
- found && trueSelectedRows.push(found);
4953
- });
4954
- selectedRowRef.value = trueSelectedRows;
4955
- }
4956
- function clearSelectedRowKeys() {
4957
- selectedRowKeysRef.value = [];
4958
- selectedRowRef.value = [];
4959
- }
4960
- function getRowSelection() {
4961
- return unref(getRowSelectionRef);
4962
- }
4963
- function getSelectRowKeys() {
4964
- return unref(selectedRowKeysRef);
4965
- }
4966
- function getSelectRows() {
4967
- return unref(selectedRowRef);
4968
- }
4969
- return {
4970
- getRowSelectionRef,
4971
- clearSelectedRowKeys,
4972
- getRowSelection,
4973
- getSelectRowKeys,
4974
- getSelectRows,
4975
- setSelectedRowKeys
4976
- };
4977
- }
4978
- var _sfc_main$K = defineComponent({
4979
- name: "TableFormat",
4980
- props: {
4981
- column: {
4982
- type: Object
4983
- },
4984
- record: {
4985
- type: Object
4986
- },
4987
- index: {
4988
- type: Number
4989
- }
4990
- },
4991
- setup(props) {
4992
- let renderText = ref();
4993
- function renderCell() {
4994
- const {
4995
- column,
4996
- record,
4997
- index
4998
- } = props;
4999
- const {
5000
- render: render2,
5001
- dataIndex
5002
- } = column;
5003
- const text = record[dataIndex.toString()];
5004
- if (isObject(render2)) {
5005
- const {
5006
- dict,
5007
- date,
5008
- number,
5009
- percent,
5010
- struc
5011
- } = render2;
5012
- if (struc) {
5013
- const {
5014
- appConf
5015
- } = useAppStore();
5016
- let apiStruc = appConf.structure[struc];
5017
- if (!apiStruc) {
5018
- error(`${struc}\u672A\u5728structure\u4E2D\u914D\u7F6E`);
5019
- } else {
5020
- renderText = getDictValueByCode(text, apiStruc);
5021
- }
5022
- }
5023
- if (dict) {
5024
- renderText = getDictValueByCode(text, dict);
5025
- }
5026
- if (date) {
5027
- renderText.value = dayjs(text).format(date || "YYYY-MM-DD");
5028
- }
5029
- if (number) {
5030
- renderText.value = formatNumber(text, number);
5031
- }
5032
- if (percent) {
5033
- renderText.value = formatNumber((text || 0) * 100, percent) + "%";
5034
- }
5035
- if (isVnode(render2)) {
5036
- renderText.value = createVNode(Fragment, null, [createTextVNode(" "), render2, createTextVNode(" ")]);
5037
- }
5038
- if (render2["setup"]) {
5039
- renderText.value = createVNode(render2, {
5040
- text
5041
- });
5042
- }
5043
- } else {
5044
- renderText.value = text;
5045
- }
5046
- if (isFunction(render2)) {
5047
- let afterRenderData = render2(record, index, text);
5048
- if (afterRenderData.__v_isRef) {
5049
- renderText = afterRenderData;
5050
- } else {
5051
- renderText.value = isVnode(afterRenderData) ? createVNode(Fragment, null, [afterRenderData]) : afterRenderData;
5052
- }
5053
- }
5054
- }
5055
- renderCell();
5056
- return () => createVNode("span", null, [unref(renderText)]);
5057
- }
5058
- });
5059
- const tableKey = Symbol("dt-page");
5060
- function createTableInstance(instance) {
5061
- provide(tableKey, instance);
5062
- }
5063
- function getTableInstance() {
5064
- return inject(tableKey);
5065
- }
5066
- const componentMap = /* @__PURE__ */ new Map();
5067
- componentMap.set("Input", Input);
5068
- componentMap.set("InputNumber", InputNumber);
5069
- componentMap.set("Select", Select);
5070
- componentMap.set("TreeSelect", TreeSelect);
5071
- componentMap.set("Switch", Switch);
5072
- componentMap.set("Checkbox", Checkbox);
5073
- componentMap.set("DatePicker", DatePicker);
5074
- componentMap.set("TimePicker", TimePicker);
5075
- const CellComponent = ({
5076
- component = "Input",
5077
- rule = true,
5078
- ruleMessage,
5079
- popoverVisible,
5080
- getPopupContainer: getPopupContainer2
5081
- }, { attrs }) => {
5082
- const Comp = componentMap.get(component);
5083
- const DefaultComp = h(Comp, attrs);
5084
- if (!rule)
5085
- return DefaultComp;
5086
- return h(Popover, {
5087
- overlayClassName: "edit-cell-rule-popover",
5088
- visible: !!popoverVisible,
5089
- ...getPopupContainer2 ? { getPopupContainer: getPopupContainer2 } : {}
5090
- }, {
5091
- default: () => DefaultComp,
5092
- content: () => ruleMessage
5093
- });
5094
- };
5095
- var _sfc_main$J = defineComponent({
5096
- name: "EditableCell",
5097
- components: {
5098
- Spin,
5099
- CellComponent
5100
- },
5101
- props: {
5102
- value: {
5103
- type: [String, Number, Boolean, Object],
5104
- default: ""
5105
- },
5106
- record: {
5107
- type: Object
5108
- },
5109
- row: Object,
5110
- column: {
5111
- type: Object,
5112
- default: () => ({})
5113
- },
5114
- index: Number,
5115
- dataSource: Array
5116
- },
5117
- setup(props) {
5118
- const table = getTableInstance();
5119
- ref();
5120
- const {
5121
- editRule,
5122
- align = "left"
5123
- } = props.column;
5124
- const ruleMessage = ref("");
5125
- const ruleVisible = ref(false);
5126
- const optionsRef = ref([]);
5127
- const currentValueRef = ref(props.value);
5128
- const getComponent = computed(() => {
5129
- var _a;
5130
- return ((_a = props.column) == null ? void 0 : _a.editComponent) || "Input";
5131
- });
5132
- const getRuleVisible = computed(() => {
5133
- return unref(ruleMessage) && unref(ruleVisible);
5134
- });
5135
- const getWrapperClass = computed(() => {
5136
- return `edit-cell-align-${align}`;
5137
- });
5138
- const getIsCheckComp = computed(() => {
5139
- const component = unref(getComponent);
5140
- return ["Checkbox", "Switch"].includes(component);
5141
- });
5142
- const createPlaceholderMessage = (component) => {
5143
- if (component.includes("Input")) {
5144
- return "\u8BF7\u8F93\u5165";
5145
- }
5146
- return "\u8BF7\u9009\u62E9";
5147
- };
5148
- const setTableValue = () => {
5149
- props.row[props.column.dataIndex] = unref(currentValueRef);
5150
- };
5151
- const getComponentProps = computed(() => {
5152
- var _a, _b, _c;
5153
- const isCheckValue = unref(getIsCheckComp);
5154
- const valueField = isCheckValue ? "checked" : "value";
5155
- const val = unref(currentValueRef);
5156
- const value = isCheckValue ? isNumber(val) && isBoolean(val) ? val : !!val : val;
5157
- let compProps = (_b = (_a = props.column) == null ? void 0 : _a.editComponentProps) != null ? _b : {};
5158
- const {
5159
- record,
5160
- column,
5161
- index
5162
- } = props;
5163
- if (isFunction$1(compProps)) {
5164
- compProps = (_c = compProps({
5165
- text: val,
5166
- record,
5167
- column,
5168
- index
5169
- })) != null ? _c : {};
5170
- }
5171
- return {
5172
- size: "small",
5173
- getPopupContainer: () => document.body,
5174
- placeholder: createPlaceholderMessage(unref(getComponent)),
5175
- ...omit(compProps, "onChange"),
5176
- [valueField]: value
5177
- };
5178
- });
5179
- async function handleChange(e) {
5180
- var _a, _b;
5181
- const component = unref(getComponent);
5182
- if (!e) {
5183
- currentValueRef.value = e;
5184
- } else if (component === "Checkbox") {
5185
- currentValueRef.value = e.target.checked;
5186
- } else if (component === "Switch") {
5187
- currentValueRef.value = e;
5188
- } else if ((e == null ? void 0 : e.target) && Reflect.has(e.target, "value")) {
5189
- currentValueRef.value = e.target.value;
5190
- } else if (isString(e) || isBoolean(e) || isNumber(e)) {
5191
- currentValueRef.value = e;
5164
+ const { rowSelection } = unref(propsRef);
5165
+ if (rowSelection) {
5166
+ const { onChange } = rowSelection;
5167
+ if (onChange && isFunction(onChange))
5168
+ onChange(getSelectRowKeys(), getSelectRows());
5192
5169
  }
5193
- const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
5194
- if (onChange && isFunction$1(onChange))
5195
- onChange(...arguments);
5196
- setTableValue();
5197
- (_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
5198
- column: props.column,
5199
- value: unref(currentValueRef),
5200
- record: toRaw(props.record),
5201
- index: props.index
5170
+ emit("selection-change", {
5171
+ keys: getSelectRowKeys(),
5172
+ rows: getSelectRows()
5202
5173
  });
5203
- handleSubmitRule();
5174
+ });
5175
+ }, { deep: true });
5176
+ function findeNodeAll(tree, func, config = {}) {
5177
+ config = Object.assign({}, DEFAULT_CONFIG, config);
5178
+ const result = [];
5179
+ const list = [...tree];
5180
+ for (const node of list) {
5181
+ func(node) && result.push(node);
5182
+ node.children && list.push(...node.children);
5204
5183
  }
5205
- async function handleSubmitRule() {
5184
+ return result;
5185
+ }
5186
+ function setSelectedRowKeys(rowKeys) {
5187
+ var _a;
5188
+ selectedRowKeysRef.value = rowKeys;
5189
+ const allSelectedRows = findeNodeAll(toRaw(unref(propsRef).dataSource).concat(toRaw(unref(selectedRowRef))), (item) => rowKeys.includes(item[unref(propsRef).rowKey]), {
5190
+ children: (_a = propsRef.value.childrenColumnName) != null ? _a : "children"
5191
+ });
5192
+ const trueSelectedRows = [];
5193
+ rowKeys.forEach((key) => {
5194
+ const found = allSelectedRows.find((item) => item[unref(propsRef).rowKey] === key);
5195
+ found && trueSelectedRows.push(found);
5196
+ });
5197
+ selectedRowRef.value = trueSelectedRows;
5198
+ }
5199
+ function clearSelectedRowKeys() {
5200
+ selectedRowKeysRef.value = [];
5201
+ selectedRowRef.value = [];
5202
+ }
5203
+ function getRowSelection() {
5204
+ return unref(getRowSelectionRef);
5205
+ }
5206
+ function getSelectRowKeys() {
5207
+ return unref(selectedRowKeysRef);
5208
+ }
5209
+ function getSelectRows() {
5210
+ return unref(selectedRowRef);
5211
+ }
5212
+ return {
5213
+ getRowSelectionRef,
5214
+ clearSelectedRowKeys,
5215
+ getRowSelection,
5216
+ getSelectRowKeys,
5217
+ getSelectRows,
5218
+ setSelectedRowKeys
5219
+ };
5220
+ }
5221
+ var _sfc_main$J = defineComponent({
5222
+ name: "TableFormat",
5223
+ props: {
5224
+ column: {
5225
+ type: Object
5226
+ },
5227
+ record: {
5228
+ type: Object
5229
+ },
5230
+ index: {
5231
+ type: Number
5232
+ }
5233
+ },
5234
+ setup(props) {
5235
+ let renderText = ref();
5236
+ function renderCell() {
5237
+ var _a;
5206
5238
  const {
5207
5239
  column,
5208
- record
5240
+ record,
5241
+ index
5209
5242
  } = props;
5210
5243
  const {
5211
- editRule: editRule2
5244
+ render: render2,
5245
+ dataIndex
5212
5246
  } = column;
5213
- const currentValue = unref(currentValueRef);
5214
- if (editRule2) {
5215
- if (isBoolean(editRule2) && !currentValue && !isNumber(currentValue)) {
5216
- ruleVisible.value = true;
5217
- const component = unref(getComponent);
5218
- ruleMessage.value = createPlaceholderMessage(component);
5219
- return false;
5220
- }
5221
- if (isFunction$1(editRule2)) {
5222
- const res = await editRule2(currentValue, record);
5223
- if (!!res) {
5224
- ruleMessage.value = res;
5225
- ruleVisible.value = true;
5226
- return false;
5247
+ const text = record[dataIndex.toString()];
5248
+ if (isObject(render2)) {
5249
+ const {
5250
+ dict,
5251
+ date,
5252
+ number,
5253
+ percent,
5254
+ struc
5255
+ } = render2;
5256
+ if (struc) {
5257
+ const {
5258
+ appConf
5259
+ } = useAppStore();
5260
+ let apiStruc = appConf.structure[struc];
5261
+ if (!apiStruc) {
5262
+ error(`${struc}\u672A\u5728structure\u4E2D\u914D\u7F6E`);
5263
+ } else {
5264
+ renderText = getDictValueByCode(text, apiStruc);
5227
5265
  }
5228
5266
  }
5267
+ if (dict) {
5268
+ renderText = getDictValueByCode(text, dict);
5269
+ }
5270
+ if (date) {
5271
+ renderText.value = (_a = text && dayjs(text).format(date || "YYYY-MM-DD")) != null ? _a : "";
5272
+ }
5273
+ if (number) {
5274
+ renderText.value = formatNumber(text, number);
5275
+ }
5276
+ if (percent) {
5277
+ renderText.value = formatNumber((text || 0) * 100, percent) + "%";
5278
+ }
5279
+ if (isVnode(render2)) {
5280
+ renderText.value = createVNode(Fragment, null, [createTextVNode(" "), render2, createTextVNode(" ")]);
5281
+ }
5282
+ if (render2["setup"]) {
5283
+ renderText.value = createVNode(render2, {
5284
+ text
5285
+ });
5286
+ }
5287
+ } else {
5288
+ renderText.value = text;
5289
+ }
5290
+ if (isFunction(render2)) {
5291
+ let afterRenderData = render2(record, index, text);
5292
+ if (afterRenderData.__v_isRef) {
5293
+ renderText = afterRenderData;
5294
+ } else {
5295
+ renderText.value = isVnode(afterRenderData) ? createVNode(Fragment, null, [afterRenderData]) : afterRenderData;
5296
+ }
5229
5297
  }
5230
- ruleMessage.value = "";
5231
- return true;
5232
- }
5233
- function handleOptionsChange(options) {
5234
- optionsRef.value = options;
5235
5298
  }
5236
- return {
5237
- props,
5238
- getComponentProps,
5239
- getRuleVisible,
5240
- editRule,
5241
- ruleMessage,
5242
- getWrapperClass,
5243
- handleChange,
5244
- handleOptionsChange
5245
- };
5299
+ renderCell();
5300
+ return () => createVNode("span", null, [unref(renderText)]);
5246
5301
  }
5247
5302
  });
5248
- const _hoisted_1$t = { class: "editable-cell" };
5249
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
5250
- var _a;
5251
- const _component_CellComponent = resolveComponent("CellComponent");
5252
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
5253
- createVNode(_component_CellComponent, mergeProps({ ref: "elRef" }, _ctx.getComponentProps, {
5254
- component: (_a = _ctx.column) == null ? void 0 : _a.editComponent,
5255
- popoverVisible: _ctx.getRuleVisible,
5256
- rule: _ctx.editRule,
5257
- ruleMessage: _ctx.ruleMessage,
5258
- class: _ctx.getWrapperClass,
5259
- onChange: _ctx.handleChange,
5260
- onOptionsChange: _ctx.handleOptionsChange
5261
- }), null, 16, ["component", "popoverVisible", "rule", "ruleMessage", "class", "onChange", "onOptionsChange"])
5262
- ]);
5263
- }
5264
- var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$3]]);
5265
- function renderEditCell(column, dataSource) {
5266
- return ({ text: value, record, index }) => {
5267
- record.onValid = async () => {
5268
- if (isArray$1(record == null ? void 0 : record.validCbs)) {
5269
- const validFns = ((record == null ? void 0 : record.validCbs) || []).map((fn) => fn());
5270
- const res = await Promise.all(validFns);
5271
- return res.every((item) => !!item);
5272
- }
5273
- return false;
5274
- };
5275
- record.onEdit = async (edit, submit = false) => {
5276
- var _a, _b;
5277
- if (!submit) {
5278
- record.editable = edit;
5279
- }
5280
- if (!edit && submit) {
5281
- if (!await record.onValid())
5282
- return false;
5283
- const res = await ((_a = record.onSubmitEdit) == null ? void 0 : _a.call(record));
5284
- if (res) {
5285
- record.editable = false;
5286
- return true;
5287
- }
5288
- return false;
5289
- }
5290
- if (!edit && !submit) {
5291
- (_b = record.onCancelEdit) == null ? void 0 : _b.call(record);
5292
- }
5293
- return true;
5294
- };
5295
- return h(EditableCell, {
5296
- value,
5297
- record,
5298
- column,
5299
- row: dataSource[index],
5300
- index,
5301
- dataSource
5302
- });
5303
- };
5304
- }
5305
- const _hoisted_1$s = { class: "dt-table-action-btn" };
5303
+ const _hoisted_1$s = {
5304
+ key: 0,
5305
+ class: "dt-table-action-btn"
5306
+ };
5306
5307
  const _hoisted_2$j = ["color", "onClick"];
5307
5308
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
5308
5309
  __name: "TableActions",
@@ -5338,9 +5339,13 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5338
5339
  },
5339
5340
  setup(__props) {
5340
5341
  const props = __props;
5342
+ const actionBtns = ref([]);
5341
5343
  watch(() => props.btns, (btns) => {
5342
- btns.map((it) => {
5343
- it.ifShow = isBoolean(it.ifShow) ? it.ifShow : isFunction(it.ifShow) ? it.ifShow(props.record) : true;
5344
+ actionBtns.value = [...btns].map((it) => {
5345
+ return {
5346
+ ...it,
5347
+ ifShow: isBoolean(it.ifShow) ? it.ifShow : isFunction(it.ifShow) ? it.ifShow(props.record) : true
5348
+ };
5344
5349
  });
5345
5350
  }, {
5346
5351
  immediate: true
@@ -5360,26 +5365,27 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5360
5365
  return (_ctx, _cache) => {
5361
5366
  const _directive_icon = resolveDirective("icon");
5362
5367
  const _directive_auth = resolveDirective("auth");
5363
- return props.expand ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(props.btns, (item) => {
5364
- return openBlock(), createElementBlock("span", _hoisted_1$s, [
5365
- item.ifShow ? (openBlock(), createBlock(unref(Tooltip), {
5366
- key: 0,
5367
- placement: "bottom"
5368
- }, {
5369
- title: withCtx(() => [
5370
- createTextVNode(toDisplayString(item.title), 1)
5371
- ]),
5372
- default: withCtx(() => [
5373
- withDirectives(createElementVNode("span", {
5374
- color: item.color,
5375
- onClick: ($event) => handleAction(item)
5376
- }, null, 8, _hoisted_2$j), [
5377
- [_directive_icon, item.icon]
5378
- ])
5379
- ]),
5380
- _: 2
5381
- }, 1024)) : createCommentVNode("", true)
5382
- ]);
5368
+ return props.expand ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(actionBtns.value, (item) => {
5369
+ return openBlock(), createElementBlock(Fragment, null, [
5370
+ item.ifShow ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1$s, [
5371
+ createVNode(unref(Tooltip), { placement: "bottom" }, {
5372
+ title: withCtx(() => [
5373
+ createTextVNode(toDisplayString(item.title), 1)
5374
+ ]),
5375
+ default: withCtx(() => [
5376
+ withDirectives(createElementVNode("span", {
5377
+ color: item.color,
5378
+ onClick: ($event) => handleAction(item)
5379
+ }, null, 8, _hoisted_2$j), [
5380
+ [_directive_icon, item.icon]
5381
+ ])
5382
+ ]),
5383
+ _: 2
5384
+ }, 1024)
5385
+ ])), [
5386
+ [_directive_auth, item.auth]
5387
+ ]) : createCommentVNode("", true)
5388
+ ], 64);
5383
5389
  }), 256)) : (openBlock(), createBlock(unref(Dropdown), {
5384
5390
  key: 1,
5385
5391
  getPopupContainer: getPopupContainer$1,
@@ -5388,7 +5394,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
5388
5394
  overlay: withCtx(() => [
5389
5395
  createVNode(unref(Menu), { class: "dt-action-select" }, {
5390
5396
  default: withCtx(() => [
5391
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.btns, (item) => {
5397
+ (openBlock(true), createElementBlock(Fragment, null, renderList(actionBtns.value, (item) => {
5392
5398
  return withDirectives((openBlock(), createElementBlock("span", null, [
5393
5399
  item.ifShow ? (openBlock(), createBlock(unref(MenuItem), {
5394
5400
  key: 0,
@@ -5542,22 +5548,18 @@ function handleActionColumn(propsRef, columns) {
5542
5548
  });
5543
5549
  }
5544
5550
  }
5545
- function useColumns(propsRef, getPaginationRef) {
5551
+ function useColumns(propsRef, getPaginationRef, tableElRef) {
5546
5552
  const columnsRef = ref(unref(propsRef).columns);
5547
5553
  let cacheColumns = unref(propsRef).columns;
5548
5554
  const getColumnsRef = computed(() => {
5549
5555
  const columns = cloneDeep(unref(columnsRef));
5550
5556
  if (!columns)
5551
5557
  return [];
5552
- const { ellipsis, resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
5558
+ const { ellipsis } = unref(propsRef);
5553
5559
  columns.forEach((it, index) => {
5560
+ var _a;
5561
+ it.class = `${(_a = it.class) != null ? _a : ""} __column`;
5554
5562
  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
5563
  if (it.sorter) {
5562
5564
  it.sorter = {
5563
5565
  multiple: Number(it.sorter)
@@ -5574,7 +5576,7 @@ function useColumns(propsRef, getPaginationRef) {
5574
5576
  const columns = cloneDeep(viewColumns);
5575
5577
  return columns.filter((column) => isIfShow(column)).map((column) => {
5576
5578
  if (column.edit) {
5577
- column.customRender = renderEditCell(column, unref(propsRef).dataSource);
5579
+ column.customRender = renderEditCell(column);
5578
5580
  }
5579
5581
  return column;
5580
5582
  });
@@ -5583,10 +5585,41 @@ function useColumns(propsRef, getPaginationRef) {
5583
5585
  const ifShow = column.ifShow;
5584
5586
  return isBoolean(ifShow) ? ifShow : isFunction(ifShow) ? ifShow(column) : true;
5585
5587
  }
5588
+ function addResize() {
5589
+ const { resizable, minWidth = 50, maxWidth = 700 } = unref(propsRef);
5590
+ useDebounceFn(() => {
5591
+ var _a, _b;
5592
+ let els = (_a = unref(tableElRef)) == null ? void 0 : _a.$el.querySelectorAll(".__column");
5593
+ let allWidth = 0;
5594
+ for (let i = 0; i < els.length; i++) {
5595
+ allWidth += (_b = els[i].offsetWidth) != null ? _b : 0;
5596
+ }
5597
+ let columnAllWidth = 0, noWidthNum = 0;
5598
+ columnsRef.value.forEach((it) => {
5599
+ if (it.ifShow) {
5600
+ if (it.width) {
5601
+ columnAllWidth += parseInt(`${it.width}`);
5602
+ } else {
5603
+ noWidthNum++;
5604
+ }
5605
+ }
5606
+ });
5607
+ let avgWidth = (allWidth - columnAllWidth) / noWidthNum;
5608
+ columnsRef.value.forEach((it) => {
5609
+ it.width = it.width || avgWidth - 1;
5610
+ if (Reflect.has(it, "resizable") ? !!it.resizable : resizable) {
5611
+ it.resizable = true;
5612
+ it.minWidth = it.minWidth || minWidth;
5613
+ it.maxWidth = it.maxWidth || maxWidth;
5614
+ }
5615
+ });
5616
+ }, 100)();
5617
+ }
5586
5618
  watch(() => unref(propsRef).columns, (columns) => {
5587
5619
  var _a;
5588
5620
  columnsRef.value = columns;
5589
5621
  cacheColumns = (_a = columns.filter((it) => !it.flag)) != null ? _a : [];
5622
+ nextTick(() => addResize());
5590
5623
  });
5591
5624
  function getColumns(opt) {
5592
5625
  const { ignoreIndex, ignoreAction, sort } = opt || {};
@@ -5656,7 +5689,7 @@ const _hoisted_1$r = /* @__PURE__ */ createElementVNode("span", null, "\u5217\u6
5656
5689
  const _hoisted_2$i = /* @__PURE__ */ createTextVNode(" \u5217\u5C55\u793A ");
5657
5690
  const _hoisted_3$b = /* @__PURE__ */ createTextVNode(" \u5E8F\u5217\u53F7 ");
5658
5691
  const _hoisted_4$8 = /* @__PURE__ */ createTextVNode(" \u590D\u9009\u6846 ");
5659
- const _hoisted_5$5 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
5692
+ const _hoisted_5$4 = /* @__PURE__ */ createTextVNode("\u91CD\u7F6E");
5660
5693
  const _hoisted_6$2 = {
5661
5694
  size: 16,
5662
5695
  className: "drag-icon"
@@ -5894,7 +5927,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5894
5927
  onClick: reset
5895
5928
  }, {
5896
5929
  default: withCtx(() => [
5897
- _hoisted_5$5
5930
+ _hoisted_5$4
5898
5931
  ]),
5899
5932
  _: 1
5900
5933
  })
@@ -6375,7 +6408,7 @@ const _hoisted_4$5 = {
6375
6408
  key: 0,
6376
6409
  class: "dt-table-header-actions__right"
6377
6410
  };
6378
- const _hoisted_5$4 = {
6411
+ const _hoisted_5$3 = {
6379
6412
  key: 0,
6380
6413
  style: { "margin": "5px" }
6381
6414
  };
@@ -6395,7 +6428,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6395
6428
  }, null, 8, ["setting", "onColumnsChange"])
6396
6429
  ])) : createCommentVNode("", true)
6397
6430
  ]),
6398
- _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
6431
+ _ctx.$slots.headerTop ? (openBlock(), createElementBlock("div", _hoisted_5$3, [
6399
6432
  renderSlot(_ctx.$slots, "headerTop")
6400
6433
  ])) : createCommentVNode("", true)
6401
6434
  ]);
@@ -6428,10 +6461,12 @@ function useTableHeader(propsRef, slots, handlers) {
6428
6461
  function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
6429
6462
  const tableHeightRef = ref(0);
6430
6463
  const filterSource = ref([]);
6464
+ const tableScrollTopRef = ref(null);
6431
6465
  const debounceRedoHeight = useDebounceFn(redoHeight, 100);
6432
6466
  watch(() => propsRef.value.dataSource, (v) => {
6433
6467
  debounceRedoHeight();
6434
6468
  }, {
6469
+ deep: true,
6435
6470
  flush: "post"
6436
6471
  });
6437
6472
  windowResizeFn(calcTableHeight, 280);
@@ -6470,7 +6505,6 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
6470
6505
  !tableEl.classList.contains("hide-scrollbar-x") && tableEl.classList.add("hide-scrollbar-x");
6471
6506
  }
6472
6507
  bodyEl.style.height = "unset";
6473
- filterSource.value = [];
6474
6508
  await nextTick();
6475
6509
  let headerHeight = 0, paginationHeight = 2, footerHeight = 0, titleHeight = (_b = (_a = tableEl.querySelector(".ant-table-title")) == null ? void 0 : _a.offsetHeight) != null ? _b : 0, marginHeight = 15;
6476
6510
  const headEl = tableEl.querySelector(".ant-table-thead ");
@@ -6524,7 +6558,7 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
6524
6558
  });
6525
6559
  const getScrollRef = computed(() => {
6526
6560
  const tableHeight = unref(tableHeightRef);
6527
- const { scroll } = unref(propsRef);
6561
+ const { canResize, scroll } = unref(propsRef);
6528
6562
  return {
6529
6563
  x: unref(getScrollX),
6530
6564
  y: tableHeight,
@@ -6565,11 +6599,15 @@ function useTableScroll(propsRef, tableElRef, columnsRef, rowSelectionRef) {
6565
6599
  const { size } = unref(propsRef);
6566
6600
  const rowHeight = TABLE_SIZE_HEIGHT[size];
6567
6601
  const scrollTop = el.scrollTop;
6568
- const remainCount = 3;
6602
+ if (tableScrollTopRef.value === scrollTop && scrollTop !== 0) {
6603
+ return;
6604
+ }
6605
+ tableScrollTopRef.value = scrollTop;
6606
+ const remainCount = 6;
6569
6607
  const remainH = remainCount * rowHeight;
6570
6608
  const minItemHeight = scrollTop > remainH ? Math.floor((scrollTop - remainH) / rowHeight) * rowHeight : 0;
6571
- const minIndex = minItemHeight / rowHeight;
6572
- const maxIndex = minIndex + Math.ceil(tableHeightRef.value / rowHeight) + (minItemHeight && remainCount) + remainCount * 2;
6609
+ let minIndex = minItemHeight / rowHeight;
6610
+ const maxIndex = minIndex + Math.ceil(tableHeightRef.value / rowHeight) + (minItemHeight && remainCount);
6573
6611
  bodyEl.querySelector("table").style.transform = `translateY(${minItemHeight}px)`;
6574
6612
  filterSource.value = (_a = unref(propsRef)) == null ? void 0 : _a.dataSource.slice(minIndex, maxIndex);
6575
6613
  }
@@ -6648,7 +6686,7 @@ const _sfc_main$A = defineComponent({
6648
6686
  props: TableProps,
6649
6687
  components: {
6650
6688
  Table,
6651
- TableRender: _sfc_main$K
6689
+ TableRender: _sfc_main$J
6652
6690
  },
6653
6691
  emits: [
6654
6692
  "register",
@@ -6684,7 +6722,7 @@ const _sfc_main$A = defineComponent({
6684
6722
  setColumns,
6685
6723
  setCacheColumnsByField,
6686
6724
  getCacheColumns
6687
- } = useColumns(getProps, getPaginationInfo);
6725
+ } = useColumns(getProps, getPaginationInfo, tableElRef);
6688
6726
  const {
6689
6727
  getRowSelectionRef,
6690
6728
  clearSelectedRowKeys,
@@ -6841,14 +6879,14 @@ function useDownload(exportUrl, exportName) {
6841
6879
  case "all":
6842
6880
  http.exportFile(exportUrl, {
6843
6881
  fields: setDownloadAllHeaders(columns),
6844
- tableName: exportName,
6882
+ tableName: unref(exportName),
6845
6883
  fileType: "xlsx",
6846
6884
  searchDTO
6847
- }, `${exportName}.xlsx`);
6885
+ }, `${unref(exportName)}.xlsx`);
6848
6886
  break;
6849
6887
  case "current":
6850
6888
  case "select":
6851
- handleDownloadPage(excelData, exportName);
6889
+ handleDownloadPage(excelData, unref(exportName));
6852
6890
  break;
6853
6891
  }
6854
6892
  }
@@ -7122,6 +7160,9 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
7122
7160
  __name: "dialog",
7123
7161
  props: {
7124
7162
  ...basicProps,
7163
+ title: {
7164
+ type: Object
7165
+ },
7125
7166
  ...{
7126
7167
  onRegister: { type: Function },
7127
7168
  formProps: {
@@ -7135,7 +7176,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
7135
7176
  },
7136
7177
  setup(__props) {
7137
7178
  const props = __props;
7138
- const [registerDialog, { closeModal }] = useModal({
7179
+ const [registerDialog, { closeModal, setModalProps }] = useModal({
7139
7180
  ...omit(toRaw(props), [
7140
7181
  "curd",
7141
7182
  "formProps",
@@ -7189,19 +7230,23 @@ function useCurd(curdOpt) {
7189
7230
  closeModal
7190
7231
  }] = useModalOut();
7191
7232
  const {
7192
- confirm
7233
+ confirm,
7234
+ message
7193
7235
  } = useMessage();
7236
+ const actType = ref(null);
7237
+ const title = computed(() => unref(actType) + unref(curdOpt.title));
7194
7238
  const DtCurdModal = () => {
7195
7239
  return h(createVNode("div", {
7196
7240
  "class": "curdModal"
7197
7241
  }, [createVNode(_sfc_main$z, mergeProps(curdOpt, {
7242
+ "title": title,
7198
7243
  "formsVal": formsVal,
7199
7244
  "formProps": curdOpt.formProps,
7200
7245
  "onRegister": register
7201
7246
  }), null)]));
7202
7247
  };
7203
7248
  function add() {
7204
- curdOpt.title = `\u65B0\u589E${curdOpt.title}`;
7249
+ actType.value = "\u65B0\u589E";
7205
7250
  formsVal.value = null;
7206
7251
  openModal();
7207
7252
  }
@@ -7232,7 +7277,7 @@ function useCurd(curdOpt) {
7232
7277
  primaryKey = "id",
7233
7278
  curd
7234
7279
  } = curdOpt;
7235
- curdOpt.title = `\u7F16\u8F91${curdOpt.title}`;
7280
+ actType.value = "\u7F16\u8F91";
7236
7281
  curd.onQueryById(row[primaryKey]).then((rsp) => {
7237
7282
  formsVal.value = rsp;
7238
7283
  nextTick(() => dispatchResize());
@@ -7240,6 +7285,10 @@ function useCurd(curdOpt) {
7240
7285
  openModal();
7241
7286
  }
7242
7287
  function dels(ids = []) {
7288
+ if (!ids.length) {
7289
+ message.error("\u6682\u65E0\u9009\u4E2D\u7684\u6570\u636E!");
7290
+ return;
7291
+ }
7243
7292
  const {
7244
7293
  curd
7245
7294
  } = curdOpt;
@@ -7318,6 +7367,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
7318
7367
  }
7319
7368
  });
7320
7369
  const basicUploadProps = {
7370
+ uploadText: {
7371
+ type: String,
7372
+ default: "\u6587\u4EF6\u4E0A\u4F20"
7373
+ },
7321
7374
  showTemplateDownload: {
7322
7375
  type: Boolean,
7323
7376
  default: false
@@ -7807,9 +7860,8 @@ var sparkMd5 = { exports: {} };
7807
7860
  })(sparkMd5);
7808
7861
  const _hoisted_1$j = { class: "dt-file" };
7809
7862
  const _hoisted_2$b = { class: "file-header" };
7810
- const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \u6587\u4EF6\u4E0A\u4F20 ");
7811
- const _hoisted_4$4 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u4E0B\u8F7D ");
7812
- const _hoisted_5$3 = { class: "file-type-tips ant-alert-info" };
7863
+ const _hoisted_3$6 = /* @__PURE__ */ createTextVNode(" \u6A21\u677F\u4E0B\u8F7D ");
7864
+ const _hoisted_4$4 = { class: "file-type-tips ant-alert-info" };
7813
7865
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
7814
7866
  __name: "upload",
7815
7867
  props: basicUploadProps,
@@ -7856,7 +7908,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7856
7908
  }
7857
7909
  }
7858
7910
  },
7859
- { title: "\u5220\u9664", icon: "mdi:delete-outline", action: ({ row }) => {
7911
+ { title: "\u5220\u9664", icon: "mdi:delete-outline", ifShow: true, action: ({ row }) => {
7860
7912
  if (!row.status)
7861
7913
  historyFilesRef.value = historyFilesRef.value.filter((it) => it.fileId !== row.fileId);
7862
7914
  else {
@@ -7940,7 +7992,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7940
7992
  withDirectives(createElementVNode("span", null, null, 512), [
7941
7993
  [_directive_icon, "ic:baseline-file-upload"]
7942
7994
  ]),
7943
- _hoisted_3$6
7995
+ createTextVNode(" " + toDisplayString(_ctx.uploadText), 1)
7944
7996
  ]),
7945
7997
  _: 1
7946
7998
  })
@@ -7956,14 +8008,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7956
8008
  withDirectives(createElementVNode("span", null, null, 512), [
7957
8009
  [_directive_icon, "ic:baseline-file-download"]
7958
8010
  ]),
7959
- _hoisted_4$4
8011
+ _hoisted_3$6
7960
8012
  ]),
7961
8013
  _: 1
7962
8014
  }, 8, ["onClick"])) : createCommentVNode("", true)
7963
8015
  ]),
7964
8016
  renderSlot(_ctx.$slots, "default")
7965
8017
  ]),
7966
- createElementVNode("div", _hoisted_5$3, [
8018
+ createElementVNode("div", _hoisted_4$4, [
7967
8019
  withDirectives(createElementVNode("span", null, null, 512), [
7968
8020
  [_directive_icon, "ant-design:info-circle-outlined"]
7969
8021
  ]),