@yidun/antd-super-table 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +372 -74
- package/dist/index.js +3593 -0
- package/dist/typings.d.ts +1 -8
- package/package.json +2 -6
- package/dist/antd-super-table.css +0 -1
- package/dist/antd-super-table.es.js +0 -12523
package/dist/index.js
ADDED
|
@@ -0,0 +1,3593 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._ellipsisElement_6fog1_1{width:100%;overflow:hidden;display:flex}._ellipsisElement_6fog1_1 ._elementItem_6fog1_6{min-width:0}._ellipsisElementHasGap_6fog1_10{gap:8px}._flexWrap_6fog1_14{flex-wrap:wrap}._ellipsisTag_6fog1_18{cursor:pointer}._imageEllipsisTag_6fog1_22{line-height:30px;min-width:32px;padding:0;text-align:center}._ellipsisList_6fog1_29{max-width:500px;display:flex;gap:8px;flex-wrap:wrap}._tableCellContent_1chn7_1 ._antTypographyEllipsis_1chn7_1{width:100%}._tableCellContent_1chn7_1 ._draggableIcon_1chn7_4{cursor:grab}._textListItem_1chn7_8{width:100%;margin-bottom:4px}._configBtn_1rypj_1{position:absolute;z-index:999;right:0;top:12px}._tableConfig_1rypj_8{width:260px}._tableConfig_1rypj_8 ._tableConfigHead_1rypj_11{padding:8px 16px}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14{padding:8px 0;height:300px;overflow:auto}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._columnList_1rypj_19 ._columnItem_1rypj_19{display:flex;align-items:center;gap:8px;min-height:32px;padding:0 16px}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._columnList_1rypj_19 ._columnItem_1rypj_19 ._columnItemContent_1rypj_26{flex:1;cursor:pointer}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._columnList_1rypj_19 ._columnItem_1rypj_19 ._dragIcon_1rypj_30{cursor:grab}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._columnList_1rypj_19 ._columnItem_1rypj_19 ._dragIconDisabled_1rypj_33{cursor:not-allowed}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._columnList_1rypj_19 ._columnItem_1rypj_19 ._dragHandle_1rypj_36{cursor:grab}._tableConfig_1rypj_8 ._tableConfigContent_1rypj_14 ._emptyText_1rypj_39{line-height:200px;text-align:center}._tableConfig_1rypj_8 ._tableConfigFoot_1rypj_43{display:flex;align-items:center;justify-content:flex-end;border-top:1px solid #d9d9d9;padding:8px 16px}.pro-table-config-popover .ant-popover-inner-content{padding:0}._dynamicList_1woe5_1{list-style:none;padding:0;margin:0}._dynamicList_1woe5_1 ._dynamicListItem_1woe5_6{display:flex;align-items:center;gap:16px;padding:8px;background-color:#fff}._dynamicList_1woe5_1 ._dynamicListItem_1woe5_6 ._dynamicListItemContent_1woe5_13{flex:1;min-width:0}._dynamicList_1woe5_1 ._dynamicListItem_1woe5_6 ._actionsIcons_1woe5_17{display:flex;align-items:center}._dynamicList_1woe5_1 ._dynamicListItem_1woe5_6 ._actionsIcons_1woe5_17 ._dragIcon_1woe5_21{cursor:grab}._dynamicList_1woe5_1 ._dynamicListItem_1woe5_6:last-child{border-bottom:none;margin-bottom:16px}._inputGroup_eukv3_1,._inputNumberGroup_149g6_1{width:100%}._inputNumberGroup_149g6_1 ._inputNumberGroupContent_149g6_4{width:100%;display:flex;align-items:center}._inputNumberGroup_149g6_1 ._inputNumber_149g6_1{width:unset!important;flex:1}._inputNumberGroup_149g6_1 ._startInputNumber_149g6_13{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}._inputNumberGroup_149g6_1 ._startInputNumber_149g6_13:focus,._inputNumberGroup_149g6_1 ._startInputNumber_149g6_13:hover{border-right-color:#1677ff}._inputNumberGroup_149g6_1 ._endInputNumber_149g6_21{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:transparent}._inputNumberGroup_149g6_1 ._endInputNumber_149g6_21:focus,._inputNumberGroup_149g6_1 ._endInputNumber_149g6_21:hover{border-left-color:#1677ff}._inputNumberGroup_149g6_1 ._divider_149g6_29{display:inline-block;padding:0 8px;line-height:30px;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9}._formFieldItem_1imun_1{display:flex;align-items:center;min-width:0}._inputGroup_1imun_7{width:unset}._formFieldItemLabel_1imun_11{padding-left:8px;padding-right:8px;background-color:transparent!important;text-align:center;cursor:default!important;border-right:none!important}._customItemLabel_1imun_20{font-size:14px;padding-right:8px;color:#000000e0}.super-table-input-group{width:100%}.super-table-input-group .super-table-filter-form-item-label+.ant-input,.super-table-input-group .super-table-filter-form-item-label+.ant-input-number,.super-table-input-group .super-table-filter-form-item-label+.ant-select .ant-select-selector,.super-table-input-group .super-table-filter-form-item-label+.ant-picker,.super-table-input-group .super-table-filter-form-item-label+.ant-input-group{border-left-color:transparent!important}.super-table-input-group .super-table-filter-form-item-label+.ant-input:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-input:hover,.super-table-input-group .super-table-filter-form-item-label+.ant-input-number:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-input-number:hover,.super-table-input-group .super-table-filter-form-item-label+.ant-select .ant-select-selector:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-select .ant-select-selector:hover,.super-table-input-group .super-table-filter-form-item-label+.ant-picker:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-picker:hover,.super-table-input-group .super-table-filter-form-item-label+.ant-input-group:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-input-group:hover{border-left-color:#1677ff!important}.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-input{border-left-color:transparent!important}.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-input:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-input:hover{border-left-color:#1677ff!important;border-right-color:#1677ff!important}.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-select .ant-select-selector{border-start-start-radius:0!important;border-end-start-radius:0!important;border-left-color:transparent!important;border-right-color:transparent!important}.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-select .ant-select-selector:focus,.super-table-input-group .super-table-filter-form-item-label+.ant-input-group .ant-select .ant-select-selector:hover{border-left-color:#1677ff!important;border-right-color:#1677ff!important}.super-table-input-group .input-number-group .ant-input-number:first-child{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:transparent!important}.super-table-input-group .input-number-group .ant-input-number:first-child:focus,.super-table-input-group .input-number-group .ant-input-number:first-child:hover{border-left-color:#1677ff!important}._sceneForm_njdgy_1 ._queryFieldItem_njdgy_1{display:flex;align-items:center;gap:8px;min-width:0}._sceneForm_njdgy_1 ._queryFieldItem_njdgy_1 ._fieldSelect_njdgy_7{width:200px}._sceneForm_njdgy_1 ._queryFieldItem_njdgy_1 ._fieldComponent_njdgy_10{flex:1;min-width:0}._sceneList_3nrgr_1{max-height:50vh;overflow:auto}._sceneList_3nrgr_1 ._sceneListHead_3nrgr_5{background-color:#fafafa}._sceneList_3nrgr_1 ._sceneListItem_3nrgr_8{border-top:1px solid #d9d9d9;transition:all .3s;background-color:#fff}._sceneList_3nrgr_1 ._sceneListItem_3nrgr_8:hover{background-color:#f9f9f9}._sceneList_3nrgr_1 ._col_3nrgr_16{padding:12px 16px}._dragIcon_3nrgr_20{cursor:grab}._searchParams_1vdwi_1{flex:1;margin:12px 0}._superTable_1rx9j_1{background-color:#fff;padding:20px 24px}._superTable_1rx9j_1 ._superTableHeader_1rx9j_5{display:flex;gap:16px;border-bottom:1px solid #d9d9d9}._superTable_1rx9j_1 ._superTableHeader_1rx9j_5 ._searchForm_1rx9j_10{flex:1;padding-bottom:12px}._superTable_1rx9j_1 ._superTableHeader_1rx9j_5 ._searchForm_1rx9j_10 ._sceneSelect_1rx9j_14{width:240px}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._toolbar_1rx9j_17{padding-bottom:12px;display:flex;align-items:flex-start;justify-content:flex-end;gap:16px}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._toolbar_1rx9j_17 ._actionBtns_1rx9j_24{display:flex;align-items:center;gap:8px}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._toolbar_1rx9j_17 ._tableHeadWrapper_1rx9j_29{flex:1}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._tableContent_1rx9j_32{position:relative}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._headerCell_1rx9j_35{display:flex;align-items:center;gap:4px}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._headerCell_1rx9j_35 ._headerCellText_1rx9j_40{flex:1}._superTable_1rx9j_1 ._tableWrapper_1rx9j_17 ._headerCell_1rx9j_35 ._headerCellTooltipIcon_1rx9j_43{cursor:pointer}._sceneOpBtnWrapper_1rx9j_47{border-top:1px solid #d9d9d9;padding-top:8px}._sceneOpBtnWrapper_1rx9j_47 ._sceneOpBtn_1rx9j_47{text-align:left}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
var en = Object.defineProperty;
|
|
3
|
+
var tn = (r, e, n) => e in r ? en(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
4
|
+
var Ee = (r, e, n) => tn(r, typeof e != "symbol" ? e + "" : e, n);
|
|
5
|
+
import { h as X, defineComponent as ie, computed as L, resolveComponent as q, createElementBlock as U, openBlock as F, normalizeClass as w, unref as S, createCommentVNode as N, Fragment as Fe, renderList as st, normalizeStyle as we, renderSlot as pe, createBlock as E, withCtx as $, createVNode as O, createTextVNode as K, toDisplayString as _e, createElementVNode as J, withMemo as Et, resolveDynamicComponent as Ke, normalizeProps as rt, mergeProps as ae, ref as ee, watchEffect as Ct, watch as be, useAttrs as nn, reactive as Ze, toRaw as he, createApp as rn, onBeforeUnmount as an, getCurrentInstance as on, onMounted as sn, createSlots as ln, nextTick as un } from "vue";
|
|
6
|
+
import cn, { theme as dn, Form as pn, RangePicker as fn, DatePicker as mn, TreeSelect as yn, Cascader as gn, Select as vn, InputNumber as hn, Input as bn, Empty as _n, ConfigProvider as Cn, message as at } from "ant-design-vue";
|
|
7
|
+
import { DownOutlined as $n, HolderOutlined as De, EyeOutlined as wn, SettingOutlined as Sn, MinusCircleOutlined as $t, PlusOutlined as At, PlusCircleFilled as In, SettingFilled as Fn, FilterFilled as xn, ReloadOutlined as kn, InfoCircleFilled as Tn } from "@ant-design/icons-vue";
|
|
8
|
+
import { slice as wt, isFunction as Ce, get as Xe, castArray as qe, debounce as mt, pick as xe, cloneDeep as Ge, omit as Mt, set as Pe, sortBy as lt, unionBy as On, uniqueId as Pn, merge as qn } from "lodash-es";
|
|
9
|
+
import { useStorage as jn } from "@vueuse/core";
|
|
10
|
+
import Be from "dayjs";
|
|
11
|
+
import Ln from "sortablejs";
|
|
12
|
+
import { JSONPath as En } from "jsonpath-plus";
|
|
13
|
+
import { v5 as An } from "uuid";
|
|
14
|
+
import yt from "vuedraggable";
|
|
15
|
+
const Mn = {
|
|
16
|
+
// Options.jsx
|
|
17
|
+
items_per_page: "条/页",
|
|
18
|
+
jump_to: "跳至",
|
|
19
|
+
jump_to_confirm: "确定",
|
|
20
|
+
page: "页",
|
|
21
|
+
// Pagination.jsx
|
|
22
|
+
prev_page: "上一页",
|
|
23
|
+
next_page: "下一页",
|
|
24
|
+
prev_5: "向前 5 页",
|
|
25
|
+
next_5: "向后 5 页",
|
|
26
|
+
prev_3: "向前 3 页",
|
|
27
|
+
next_3: "向后 3 页"
|
|
28
|
+
};
|
|
29
|
+
function et() {
|
|
30
|
+
return et = Object.assign ? Object.assign.bind() : function(r) {
|
|
31
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
32
|
+
var n = arguments[e];
|
|
33
|
+
for (var t in n) ({}).hasOwnProperty.call(n, t) && (r[t] = n[t]);
|
|
34
|
+
}
|
|
35
|
+
return r;
|
|
36
|
+
}, et.apply(null, arguments);
|
|
37
|
+
}
|
|
38
|
+
const Nn = {
|
|
39
|
+
locale: "zh_CN",
|
|
40
|
+
today: "今天",
|
|
41
|
+
now: "此刻",
|
|
42
|
+
backToToday: "返回今天",
|
|
43
|
+
ok: "确定",
|
|
44
|
+
timeSelect: "选择时间",
|
|
45
|
+
dateSelect: "选择日期",
|
|
46
|
+
weekSelect: "选择周",
|
|
47
|
+
clear: "清除",
|
|
48
|
+
month: "月",
|
|
49
|
+
year: "年",
|
|
50
|
+
previousMonth: "上个月 (翻页上键)",
|
|
51
|
+
nextMonth: "下个月 (翻页下键)",
|
|
52
|
+
monthSelect: "选择月份",
|
|
53
|
+
yearSelect: "选择年份",
|
|
54
|
+
decadeSelect: "选择年代",
|
|
55
|
+
yearFormat: "YYYY年",
|
|
56
|
+
dayFormat: "D日",
|
|
57
|
+
dateFormat: "YYYY年M月D日",
|
|
58
|
+
dateTimeFormat: "YYYY年M月D日 HH时mm分ss秒",
|
|
59
|
+
previousYear: "上一年 (Control键加左方向键)",
|
|
60
|
+
nextYear: "下一年 (Control键加右方向键)",
|
|
61
|
+
previousDecade: "上一年代",
|
|
62
|
+
nextDecade: "下一年代",
|
|
63
|
+
previousCentury: "上一世纪",
|
|
64
|
+
nextCentury: "下一世纪"
|
|
65
|
+
}, Nt = {
|
|
66
|
+
placeholder: "请选择时间",
|
|
67
|
+
rangePlaceholder: ["开始时间", "结束时间"]
|
|
68
|
+
}, it = {
|
|
69
|
+
lang: et({
|
|
70
|
+
placeholder: "请选择日期",
|
|
71
|
+
yearPlaceholder: "请选择年份",
|
|
72
|
+
quarterPlaceholder: "请选择季度",
|
|
73
|
+
monthPlaceholder: "请选择月份",
|
|
74
|
+
weekPlaceholder: "请选择周",
|
|
75
|
+
rangePlaceholder: ["开始日期", "结束日期"],
|
|
76
|
+
rangeYearPlaceholder: ["开始年份", "结束年份"],
|
|
77
|
+
rangeMonthPlaceholder: ["开始月份", "结束月份"],
|
|
78
|
+
rangeQuarterPlaceholder: ["开始季度", "结束季度"],
|
|
79
|
+
rangeWeekPlaceholder: ["开始周", "结束周"]
|
|
80
|
+
}, Nn),
|
|
81
|
+
timePickerLocale: et({}, Nt)
|
|
82
|
+
};
|
|
83
|
+
it.lang.ok = "确定";
|
|
84
|
+
const se = "${label}不是一个有效的${type}", Dt = {
|
|
85
|
+
locale: "zh-cn",
|
|
86
|
+
Pagination: Mn,
|
|
87
|
+
DatePicker: it,
|
|
88
|
+
TimePicker: Nt,
|
|
89
|
+
Calendar: it,
|
|
90
|
+
// locales for all components
|
|
91
|
+
global: {
|
|
92
|
+
placeholder: "请选择"
|
|
93
|
+
},
|
|
94
|
+
Table: {
|
|
95
|
+
filterTitle: "筛选",
|
|
96
|
+
filterConfirm: "确定",
|
|
97
|
+
filterReset: "重置",
|
|
98
|
+
filterEmptyText: "无筛选项",
|
|
99
|
+
filterCheckall: "全选",
|
|
100
|
+
filterSearchPlaceholder: "在筛选项中搜索",
|
|
101
|
+
selectAll: "全选当页",
|
|
102
|
+
selectInvert: "反选当页",
|
|
103
|
+
selectNone: "清空所有",
|
|
104
|
+
selectionAll: "全选所有",
|
|
105
|
+
sortTitle: "排序",
|
|
106
|
+
expand: "展开行",
|
|
107
|
+
collapse: "关闭行",
|
|
108
|
+
triggerDesc: "点击降序",
|
|
109
|
+
triggerAsc: "点击升序",
|
|
110
|
+
cancelSort: "取消排序"
|
|
111
|
+
},
|
|
112
|
+
Tour: {
|
|
113
|
+
Next: "下一步",
|
|
114
|
+
Previous: "上一步",
|
|
115
|
+
Finish: "结束导览"
|
|
116
|
+
},
|
|
117
|
+
Modal: {
|
|
118
|
+
okText: "确定",
|
|
119
|
+
cancelText: "取消",
|
|
120
|
+
justOkText: "知道了"
|
|
121
|
+
},
|
|
122
|
+
Popconfirm: {
|
|
123
|
+
cancelText: "取消",
|
|
124
|
+
okText: "确定"
|
|
125
|
+
},
|
|
126
|
+
Transfer: {
|
|
127
|
+
searchPlaceholder: "请输入搜索内容",
|
|
128
|
+
itemUnit: "项",
|
|
129
|
+
itemsUnit: "项",
|
|
130
|
+
remove: "删除",
|
|
131
|
+
selectCurrent: "全选当页",
|
|
132
|
+
removeCurrent: "删除当页",
|
|
133
|
+
selectAll: "全选所有",
|
|
134
|
+
removeAll: "删除全部",
|
|
135
|
+
selectInvert: "反选当页"
|
|
136
|
+
},
|
|
137
|
+
Upload: {
|
|
138
|
+
uploading: "文件上传中",
|
|
139
|
+
removeFile: "删除文件",
|
|
140
|
+
uploadError: "上传错误",
|
|
141
|
+
previewFile: "预览文件",
|
|
142
|
+
downloadFile: "下载文件"
|
|
143
|
+
},
|
|
144
|
+
Empty: {
|
|
145
|
+
description: "暂无数据"
|
|
146
|
+
},
|
|
147
|
+
Icon: {
|
|
148
|
+
icon: "图标"
|
|
149
|
+
},
|
|
150
|
+
Text: {
|
|
151
|
+
edit: "编辑",
|
|
152
|
+
copy: "复制",
|
|
153
|
+
copied: "复制成功",
|
|
154
|
+
expand: "展开"
|
|
155
|
+
},
|
|
156
|
+
PageHeader: {
|
|
157
|
+
back: "返回"
|
|
158
|
+
},
|
|
159
|
+
Form: {
|
|
160
|
+
optional: "(可选)",
|
|
161
|
+
defaultValidateMessages: {
|
|
162
|
+
default: "字段验证错误${label}",
|
|
163
|
+
required: "请输入${label}",
|
|
164
|
+
enum: "${label}必须是其中一个[${enum}]",
|
|
165
|
+
whitespace: "${label}不能为空字符",
|
|
166
|
+
date: {
|
|
167
|
+
format: "${label}日期格式无效",
|
|
168
|
+
parse: "${label}不能转换为日期",
|
|
169
|
+
invalid: "${label}是一个无效日期"
|
|
170
|
+
},
|
|
171
|
+
types: {
|
|
172
|
+
string: se,
|
|
173
|
+
method: se,
|
|
174
|
+
array: se,
|
|
175
|
+
object: se,
|
|
176
|
+
number: se,
|
|
177
|
+
date: se,
|
|
178
|
+
boolean: se,
|
|
179
|
+
integer: se,
|
|
180
|
+
float: se,
|
|
181
|
+
regexp: se,
|
|
182
|
+
email: se,
|
|
183
|
+
url: se,
|
|
184
|
+
hex: se
|
|
185
|
+
},
|
|
186
|
+
string: {
|
|
187
|
+
len: "${label}须为${len}个字符",
|
|
188
|
+
min: "${label}最少${min}个字符",
|
|
189
|
+
max: "${label}最多${max}个字符",
|
|
190
|
+
range: "${label}须在${min}-${max}字符之间"
|
|
191
|
+
},
|
|
192
|
+
number: {
|
|
193
|
+
len: "${label}必须等于${len}",
|
|
194
|
+
min: "${label}最小值为${min}",
|
|
195
|
+
max: "${label}最大值为${max}",
|
|
196
|
+
range: "${label}须在${min}-${max}之间"
|
|
197
|
+
},
|
|
198
|
+
array: {
|
|
199
|
+
len: "须为${len}个${label}",
|
|
200
|
+
min: "最少${min}个${label}",
|
|
201
|
+
max: "最多${max}个${label}",
|
|
202
|
+
range: "${label}数量须在${min}-${max}之间"
|
|
203
|
+
},
|
|
204
|
+
pattern: {
|
|
205
|
+
mismatch: "${label}与模式不匹配${pattern}"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
Image: {
|
|
210
|
+
preview: "预览"
|
|
211
|
+
},
|
|
212
|
+
QRCode: {
|
|
213
|
+
expired: "二维码已过期",
|
|
214
|
+
refresh: "点击刷新",
|
|
215
|
+
scanned: "已扫描"
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var Je = { exports: {} }, Dn = Je.exports, St;
|
|
219
|
+
function Bn() {
|
|
220
|
+
return St || (St = 1, function(r, e) {
|
|
221
|
+
(function(n, t) {
|
|
222
|
+
r.exports = t(Be);
|
|
223
|
+
})(Dn, function(n) {
|
|
224
|
+
function t(s) {
|
|
225
|
+
return s && typeof s == "object" && "default" in s ? s : { default: s };
|
|
226
|
+
}
|
|
227
|
+
var a = t(n), o = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(s, i) {
|
|
228
|
+
return i === "W" ? s + "周" : s + "日";
|
|
229
|
+
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(s, i) {
|
|
230
|
+
var c = 100 * s + i;
|
|
231
|
+
return c < 600 ? "凌晨" : c < 900 ? "早上" : c < 1100 ? "上午" : c < 1300 ? "中午" : c < 1800 ? "下午" : "晚上";
|
|
232
|
+
} };
|
|
233
|
+
return a.default.locale(o, null, !0), o;
|
|
234
|
+
});
|
|
235
|
+
}(Je)), Je.exports;
|
|
236
|
+
}
|
|
237
|
+
Bn();
|
|
238
|
+
const { defaultAlgorithm: Rn, defaultSeed: Vn } = dn, Se = Rn(Vn);
|
|
239
|
+
var ge = /* @__PURE__ */ ((r) => (r.order = "_order", r.orderInScene = "_orderInScene", r.defaultValue = "_defaultValue", r.selected = "_selected", r))(ge || {});
|
|
240
|
+
const Bt = Object.values(ge), R = {
|
|
241
|
+
/** 文本(默认)*/
|
|
242
|
+
text: "text",
|
|
243
|
+
/** 链接 */
|
|
244
|
+
link: "link",
|
|
245
|
+
/** 按钮 */
|
|
246
|
+
button: "button",
|
|
247
|
+
/** 标签 */
|
|
248
|
+
tag: "tag",
|
|
249
|
+
/** 图片 */
|
|
250
|
+
image: "image",
|
|
251
|
+
/** 自定义组件 */
|
|
252
|
+
component: "component",
|
|
253
|
+
/** 排序 */
|
|
254
|
+
sort: "sort"
|
|
255
|
+
}, H = {
|
|
256
|
+
/** 输入框 */
|
|
257
|
+
input: "input",
|
|
258
|
+
/** 组合输入框 */
|
|
259
|
+
inputGroup: "inputGroup",
|
|
260
|
+
/** 数字输入框 */
|
|
261
|
+
inputNumber: "inputNumber",
|
|
262
|
+
/** 数字范围输入框 */
|
|
263
|
+
inputNumberRange: "inputNumberRange",
|
|
264
|
+
/** 下拉框 */
|
|
265
|
+
select: "select",
|
|
266
|
+
/** 级联选择 */
|
|
267
|
+
cascader: "cascader",
|
|
268
|
+
/** 树形选择 */
|
|
269
|
+
treeSelect: "treeSelect",
|
|
270
|
+
/** 时间选择 */
|
|
271
|
+
datePicker: "datePicker",
|
|
272
|
+
/** 时间范围选择 */
|
|
273
|
+
rangePicker: "rangePicker",
|
|
274
|
+
/** 自定义组件 */
|
|
275
|
+
component: "component"
|
|
276
|
+
}, ce = {
|
|
277
|
+
/** 新增 */
|
|
278
|
+
create: "create",
|
|
279
|
+
/** 更新 */
|
|
280
|
+
update: "update",
|
|
281
|
+
/** 设置查询条件 */
|
|
282
|
+
search: "search"
|
|
283
|
+
}, Rt = ["key", "index", "width", "visible"], Vt = {
|
|
284
|
+
query: "https://union-admin.nis.netease.com/gateway/union-user/v1/api/user-preference/query",
|
|
285
|
+
create: "https://union-admin.nis.netease.com/gateway/union-user/v1/api/user-preference/create",
|
|
286
|
+
update: "https://union-admin.nis.netease.com/gateway/union-user/v1/api/user-preference/update",
|
|
287
|
+
delete: "https://union-admin.nis.netease.com/gateway/union-user/v1/api/user-preference/delete"
|
|
288
|
+
};
|
|
289
|
+
function Ie() {
|
|
290
|
+
return Ie = Object.assign ? Object.assign.bind() : function(r) {
|
|
291
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
292
|
+
var n = arguments[e];
|
|
293
|
+
for (var t in n)
|
|
294
|
+
Object.prototype.hasOwnProperty.call(n, t) && (r[t] = n[t]);
|
|
295
|
+
}
|
|
296
|
+
return r;
|
|
297
|
+
}, Ie.apply(this, arguments);
|
|
298
|
+
}
|
|
299
|
+
function Yn(r, e) {
|
|
300
|
+
r.prototype = Object.create(e.prototype), r.prototype.constructor = r, Re(r, e);
|
|
301
|
+
}
|
|
302
|
+
function ut(r) {
|
|
303
|
+
return ut = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) {
|
|
304
|
+
return n.__proto__ || Object.getPrototypeOf(n);
|
|
305
|
+
}, ut(r);
|
|
306
|
+
}
|
|
307
|
+
function Re(r, e) {
|
|
308
|
+
return Re = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, a) {
|
|
309
|
+
return t.__proto__ = a, t;
|
|
310
|
+
}, Re(r, e);
|
|
311
|
+
}
|
|
312
|
+
function Hn() {
|
|
313
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
314
|
+
if (typeof Proxy == "function") return !0;
|
|
315
|
+
try {
|
|
316
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
317
|
+
})), !0;
|
|
318
|
+
} catch {
|
|
319
|
+
return !1;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function Qe(r, e, n) {
|
|
323
|
+
return Hn() ? Qe = Reflect.construct.bind() : Qe = function(a, o, s) {
|
|
324
|
+
var i = [null];
|
|
325
|
+
i.push.apply(i, o);
|
|
326
|
+
var c = Function.bind.apply(a, i), v = new c();
|
|
327
|
+
return s && Re(v, s.prototype), v;
|
|
328
|
+
}, Qe.apply(null, arguments);
|
|
329
|
+
}
|
|
330
|
+
function Un(r) {
|
|
331
|
+
return Function.toString.call(r).indexOf("[native code]") !== -1;
|
|
332
|
+
}
|
|
333
|
+
function ct(r) {
|
|
334
|
+
var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
335
|
+
return ct = function(t) {
|
|
336
|
+
if (t === null || !Un(t)) return t;
|
|
337
|
+
if (typeof t != "function")
|
|
338
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
339
|
+
if (typeof e < "u") {
|
|
340
|
+
if (e.has(t)) return e.get(t);
|
|
341
|
+
e.set(t, a);
|
|
342
|
+
}
|
|
343
|
+
function a() {
|
|
344
|
+
return Qe(t, arguments, ut(this).constructor);
|
|
345
|
+
}
|
|
346
|
+
return a.prototype = Object.create(t.prototype, {
|
|
347
|
+
constructor: {
|
|
348
|
+
value: a,
|
|
349
|
+
enumerable: !1,
|
|
350
|
+
writable: !0,
|
|
351
|
+
configurable: !0
|
|
352
|
+
}
|
|
353
|
+
}), Re(a, t);
|
|
354
|
+
}, ct(r);
|
|
355
|
+
}
|
|
356
|
+
var Wn = /%[sdj%]/g, Yt = function() {
|
|
357
|
+
};
|
|
358
|
+
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (Yt = function(e, n) {
|
|
359
|
+
typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && n.every(function(t) {
|
|
360
|
+
return typeof t == "string";
|
|
361
|
+
}) && console.warn(e, n);
|
|
362
|
+
});
|
|
363
|
+
function dt(r) {
|
|
364
|
+
if (!r || !r.length) return null;
|
|
365
|
+
var e = {};
|
|
366
|
+
return r.forEach(function(n) {
|
|
367
|
+
var t = n.field;
|
|
368
|
+
e[t] = e[t] || [], e[t].push(n);
|
|
369
|
+
}), e;
|
|
370
|
+
}
|
|
371
|
+
function le(r) {
|
|
372
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), t = 1; t < e; t++)
|
|
373
|
+
n[t - 1] = arguments[t];
|
|
374
|
+
var a = 0, o = n.length;
|
|
375
|
+
if (typeof r == "function")
|
|
376
|
+
return r.apply(null, n);
|
|
377
|
+
if (typeof r == "string") {
|
|
378
|
+
var s = r.replace(Wn, function(i) {
|
|
379
|
+
if (i === "%%")
|
|
380
|
+
return "%";
|
|
381
|
+
if (a >= o)
|
|
382
|
+
return i;
|
|
383
|
+
switch (i) {
|
|
384
|
+
case "%s":
|
|
385
|
+
return String(n[a++]);
|
|
386
|
+
case "%d":
|
|
387
|
+
return Number(n[a++]);
|
|
388
|
+
case "%j":
|
|
389
|
+
try {
|
|
390
|
+
return JSON.stringify(n[a++]);
|
|
391
|
+
} catch {
|
|
392
|
+
return "[Circular]";
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
default:
|
|
396
|
+
return i;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
return s;
|
|
400
|
+
}
|
|
401
|
+
return r;
|
|
402
|
+
}
|
|
403
|
+
function zn(r) {
|
|
404
|
+
return r === "string" || r === "url" || r === "hex" || r === "email" || r === "date" || r === "pattern";
|
|
405
|
+
}
|
|
406
|
+
function Z(r, e) {
|
|
407
|
+
return !!(r == null || e === "array" && Array.isArray(r) && !r.length || zn(e) && typeof r == "string" && !r);
|
|
408
|
+
}
|
|
409
|
+
function Gn(r, e, n) {
|
|
410
|
+
var t = [], a = 0, o = r.length;
|
|
411
|
+
function s(i) {
|
|
412
|
+
t.push.apply(t, i || []), a++, a === o && n(t);
|
|
413
|
+
}
|
|
414
|
+
r.forEach(function(i) {
|
|
415
|
+
e(i, s);
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
function It(r, e, n) {
|
|
419
|
+
var t = 0, a = r.length;
|
|
420
|
+
function o(s) {
|
|
421
|
+
if (s && s.length) {
|
|
422
|
+
n(s);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
var i = t;
|
|
426
|
+
t = t + 1, i < a ? e(r[i], o) : n([]);
|
|
427
|
+
}
|
|
428
|
+
o([]);
|
|
429
|
+
}
|
|
430
|
+
function Jn(r) {
|
|
431
|
+
var e = [];
|
|
432
|
+
return Object.keys(r).forEach(function(n) {
|
|
433
|
+
e.push.apply(e, r[n] || []);
|
|
434
|
+
}), e;
|
|
435
|
+
}
|
|
436
|
+
var Ft = /* @__PURE__ */ function(r) {
|
|
437
|
+
Yn(e, r);
|
|
438
|
+
function e(n, t) {
|
|
439
|
+
var a;
|
|
440
|
+
return a = r.call(this, "Async Validation Error") || this, a.errors = n, a.fields = t, a;
|
|
441
|
+
}
|
|
442
|
+
return e;
|
|
443
|
+
}(/* @__PURE__ */ ct(Error));
|
|
444
|
+
function Qn(r, e, n, t, a) {
|
|
445
|
+
if (e.first) {
|
|
446
|
+
var o = new Promise(function(d, y) {
|
|
447
|
+
var x = function(p) {
|
|
448
|
+
return t(p), p.length ? y(new Ft(p, dt(p))) : d(a);
|
|
449
|
+
}, g = Jn(r);
|
|
450
|
+
It(g, n, x);
|
|
451
|
+
});
|
|
452
|
+
return o.catch(function(d) {
|
|
453
|
+
return d;
|
|
454
|
+
}), o;
|
|
455
|
+
}
|
|
456
|
+
var s = e.firstFields === !0 ? Object.keys(r) : e.firstFields || [], i = Object.keys(r), c = i.length, v = 0, b = [], f = new Promise(function(d, y) {
|
|
457
|
+
var x = function(_) {
|
|
458
|
+
if (b.push.apply(b, _), v++, v === c)
|
|
459
|
+
return t(b), b.length ? y(new Ft(b, dt(b))) : d(a);
|
|
460
|
+
};
|
|
461
|
+
i.length || (t(b), d(a)), i.forEach(function(g) {
|
|
462
|
+
var _ = r[g];
|
|
463
|
+
s.indexOf(g) !== -1 ? It(_, n, x) : Gn(_, n, x);
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
return f.catch(function(d) {
|
|
467
|
+
return d;
|
|
468
|
+
}), f;
|
|
469
|
+
}
|
|
470
|
+
function Kn(r) {
|
|
471
|
+
return !!(r && r.message !== void 0);
|
|
472
|
+
}
|
|
473
|
+
function Zn(r, e) {
|
|
474
|
+
for (var n = r, t = 0; t < e.length; t++) {
|
|
475
|
+
if (n == null)
|
|
476
|
+
return n;
|
|
477
|
+
n = n[e[t]];
|
|
478
|
+
}
|
|
479
|
+
return n;
|
|
480
|
+
}
|
|
481
|
+
function xt(r, e) {
|
|
482
|
+
return function(n) {
|
|
483
|
+
var t;
|
|
484
|
+
return r.fullFields ? t = Zn(e, r.fullFields) : t = e[n.field || r.fullField], Kn(n) ? (n.field = n.field || r.fullField, n.fieldValue = t, n) : {
|
|
485
|
+
message: typeof n == "function" ? n() : n,
|
|
486
|
+
fieldValue: t,
|
|
487
|
+
field: n.field || r.fullField
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function kt(r, e) {
|
|
492
|
+
if (e) {
|
|
493
|
+
for (var n in e)
|
|
494
|
+
if (e.hasOwnProperty(n)) {
|
|
495
|
+
var t = e[n];
|
|
496
|
+
typeof t == "object" && typeof r[n] == "object" ? r[n] = Ie({}, r[n], t) : r[n] = t;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
var Ht = function(e, n, t, a, o, s) {
|
|
502
|
+
e.required && (!t.hasOwnProperty(e.field) || Z(n, s || e.type)) && a.push(le(o.messages.required, e.fullField));
|
|
503
|
+
}, Xn = function(e, n, t, a, o) {
|
|
504
|
+
(/^\s+$/.test(n) || n === "") && a.push(le(o.messages.whitespace, e.fullField));
|
|
505
|
+
}, Ue, er = function() {
|
|
506
|
+
if (Ue)
|
|
507
|
+
return Ue;
|
|
508
|
+
var r = "[a-fA-F\\d:]", e = function(m) {
|
|
509
|
+
return m && m.includeBoundaries ? "(?:(?<=\\s|^)(?=" + r + ")|(?<=" + r + ")(?=\\s|$))" : "";
|
|
510
|
+
}, n = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", t = "[a-fA-F\\d]{1,4}", a = (`
|
|
511
|
+
(?:
|
|
512
|
+
(?:` + t + ":){7}(?:" + t + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
513
|
+
(?:` + t + ":){6}(?:" + n + "|:" + t + `|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
514
|
+
(?:` + t + ":){5}(?::" + n + "|(?::" + t + `){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
515
|
+
(?:` + t + ":){4}(?:(?::" + t + "){0,1}:" + n + "|(?::" + t + `){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
516
|
+
(?:` + t + ":){3}(?:(?::" + t + "){0,2}:" + n + "|(?::" + t + `){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
517
|
+
(?:` + t + ":){2}(?:(?::" + t + "){0,3}:" + n + "|(?::" + t + `){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
518
|
+
(?:` + t + ":){1}(?:(?::" + t + "){0,4}:" + n + "|(?::" + t + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
519
|
+
(?::(?:(?::` + t + "){0,5}:" + n + "|(?::" + t + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
520
|
+
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
521
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), o = new RegExp("(?:^" + n + "$)|(?:^" + a + "$)"), s = new RegExp("^" + n + "$"), i = new RegExp("^" + a + "$"), c = function(m) {
|
|
522
|
+
return m && m.exact ? o : new RegExp("(?:" + e(m) + n + e(m) + ")|(?:" + e(m) + a + e(m) + ")", "g");
|
|
523
|
+
};
|
|
524
|
+
c.v4 = function(C) {
|
|
525
|
+
return C && C.exact ? s : new RegExp("" + e(C) + n + e(C), "g");
|
|
526
|
+
}, c.v6 = function(C) {
|
|
527
|
+
return C && C.exact ? i : new RegExp("" + e(C) + a + e(C), "g");
|
|
528
|
+
};
|
|
529
|
+
var v = "(?:(?:[a-z]+:)?//)", b = "(?:\\S+(?::\\S*)?@)?", f = c.v4().source, d = c.v6().source, y = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", x = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", g = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", _ = "(?::\\d{2,5})?", p = '(?:[/?#][^\\s"]*)?', I = "(?:" + v + "|www\\.)" + b + "(?:localhost|" + f + "|" + d + "|" + y + x + g + ")" + _ + p;
|
|
530
|
+
return Ue = new RegExp("(?:^" + I + "$)", "i"), Ue;
|
|
531
|
+
}, Tt = {
|
|
532
|
+
// http://emailregex.com/
|
|
533
|
+
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
534
|
+
// url: new RegExp(
|
|
535
|
+
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
|
|
536
|
+
// 'i',
|
|
537
|
+
// ),
|
|
538
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
539
|
+
}, Me = {
|
|
540
|
+
integer: function(e) {
|
|
541
|
+
return Me.number(e) && parseInt(e, 10) === e;
|
|
542
|
+
},
|
|
543
|
+
float: function(e) {
|
|
544
|
+
return Me.number(e) && !Me.integer(e);
|
|
545
|
+
},
|
|
546
|
+
array: function(e) {
|
|
547
|
+
return Array.isArray(e);
|
|
548
|
+
},
|
|
549
|
+
regexp: function(e) {
|
|
550
|
+
if (e instanceof RegExp)
|
|
551
|
+
return !0;
|
|
552
|
+
try {
|
|
553
|
+
return !!new RegExp(e);
|
|
554
|
+
} catch {
|
|
555
|
+
return !1;
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
date: function(e) {
|
|
559
|
+
return typeof e.getTime == "function" && typeof e.getMonth == "function" && typeof e.getYear == "function" && !isNaN(e.getTime());
|
|
560
|
+
},
|
|
561
|
+
number: function(e) {
|
|
562
|
+
return isNaN(e) ? !1 : typeof e == "number";
|
|
563
|
+
},
|
|
564
|
+
object: function(e) {
|
|
565
|
+
return typeof e == "object" && !Me.array(e);
|
|
566
|
+
},
|
|
567
|
+
method: function(e) {
|
|
568
|
+
return typeof e == "function";
|
|
569
|
+
},
|
|
570
|
+
email: function(e) {
|
|
571
|
+
return typeof e == "string" && e.length <= 320 && !!e.match(Tt.email);
|
|
572
|
+
},
|
|
573
|
+
url: function(e) {
|
|
574
|
+
return typeof e == "string" && e.length <= 2048 && !!e.match(er());
|
|
575
|
+
},
|
|
576
|
+
hex: function(e) {
|
|
577
|
+
return typeof e == "string" && !!e.match(Tt.hex);
|
|
578
|
+
}
|
|
579
|
+
}, tr = function(e, n, t, a, o) {
|
|
580
|
+
if (e.required && n === void 0) {
|
|
581
|
+
Ht(e, n, t, a, o);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
var s = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], i = e.type;
|
|
585
|
+
s.indexOf(i) > -1 ? Me[i](n) || a.push(le(o.messages.types[i], e.fullField, e.type)) : i && typeof n !== e.type && a.push(le(o.messages.types[i], e.fullField, e.type));
|
|
586
|
+
}, nr = function(e, n, t, a, o) {
|
|
587
|
+
var s = typeof e.len == "number", i = typeof e.min == "number", c = typeof e.max == "number", v = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, b = n, f = null, d = typeof n == "number", y = typeof n == "string", x = Array.isArray(n);
|
|
588
|
+
if (d ? f = "number" : y ? f = "string" : x && (f = "array"), !f)
|
|
589
|
+
return !1;
|
|
590
|
+
x && (b = n.length), y && (b = n.replace(v, "_").length), s ? b !== e.len && a.push(le(o.messages[f].len, e.fullField, e.len)) : i && !c && b < e.min ? a.push(le(o.messages[f].min, e.fullField, e.min)) : c && !i && b > e.max ? a.push(le(o.messages[f].max, e.fullField, e.max)) : i && c && (b < e.min || b > e.max) && a.push(le(o.messages[f].range, e.fullField, e.min, e.max));
|
|
591
|
+
}, Oe = "enum", rr = function(e, n, t, a, o) {
|
|
592
|
+
e[Oe] = Array.isArray(e[Oe]) ? e[Oe] : [], e[Oe].indexOf(n) === -1 && a.push(le(o.messages[Oe], e.fullField, e[Oe].join(", ")));
|
|
593
|
+
}, ar = function(e, n, t, a, o) {
|
|
594
|
+
if (e.pattern) {
|
|
595
|
+
if (e.pattern instanceof RegExp)
|
|
596
|
+
e.pattern.lastIndex = 0, e.pattern.test(n) || a.push(le(o.messages.pattern.mismatch, e.fullField, n, e.pattern));
|
|
597
|
+
else if (typeof e.pattern == "string") {
|
|
598
|
+
var s = new RegExp(e.pattern);
|
|
599
|
+
s.test(n) || a.push(le(o.messages.pattern.mismatch, e.fullField, n, e.pattern));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}, A = {
|
|
603
|
+
required: Ht,
|
|
604
|
+
whitespace: Xn,
|
|
605
|
+
type: tr,
|
|
606
|
+
range: nr,
|
|
607
|
+
enum: rr,
|
|
608
|
+
pattern: ar
|
|
609
|
+
}, or = function(e, n, t, a, o) {
|
|
610
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
611
|
+
if (i) {
|
|
612
|
+
if (Z(n, "string") && !e.required)
|
|
613
|
+
return t();
|
|
614
|
+
A.required(e, n, a, s, o, "string"), Z(n, "string") || (A.type(e, n, a, s, o), A.range(e, n, a, s, o), A.pattern(e, n, a, s, o), e.whitespace === !0 && A.whitespace(e, n, a, s, o));
|
|
615
|
+
}
|
|
616
|
+
t(s);
|
|
617
|
+
}, sr = function(e, n, t, a, o) {
|
|
618
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
619
|
+
if (i) {
|
|
620
|
+
if (Z(n) && !e.required)
|
|
621
|
+
return t();
|
|
622
|
+
A.required(e, n, a, s, o), n !== void 0 && A.type(e, n, a, s, o);
|
|
623
|
+
}
|
|
624
|
+
t(s);
|
|
625
|
+
}, lr = function(e, n, t, a, o) {
|
|
626
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
627
|
+
if (i) {
|
|
628
|
+
if (n === "" && (n = void 0), Z(n) && !e.required)
|
|
629
|
+
return t();
|
|
630
|
+
A.required(e, n, a, s, o), n !== void 0 && (A.type(e, n, a, s, o), A.range(e, n, a, s, o));
|
|
631
|
+
}
|
|
632
|
+
t(s);
|
|
633
|
+
}, ir = function(e, n, t, a, o) {
|
|
634
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
635
|
+
if (i) {
|
|
636
|
+
if (Z(n) && !e.required)
|
|
637
|
+
return t();
|
|
638
|
+
A.required(e, n, a, s, o), n !== void 0 && A.type(e, n, a, s, o);
|
|
639
|
+
}
|
|
640
|
+
t(s);
|
|
641
|
+
}, ur = function(e, n, t, a, o) {
|
|
642
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
643
|
+
if (i) {
|
|
644
|
+
if (Z(n) && !e.required)
|
|
645
|
+
return t();
|
|
646
|
+
A.required(e, n, a, s, o), Z(n) || A.type(e, n, a, s, o);
|
|
647
|
+
}
|
|
648
|
+
t(s);
|
|
649
|
+
}, cr = function(e, n, t, a, o) {
|
|
650
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
651
|
+
if (i) {
|
|
652
|
+
if (Z(n) && !e.required)
|
|
653
|
+
return t();
|
|
654
|
+
A.required(e, n, a, s, o), n !== void 0 && (A.type(e, n, a, s, o), A.range(e, n, a, s, o));
|
|
655
|
+
}
|
|
656
|
+
t(s);
|
|
657
|
+
}, dr = function(e, n, t, a, o) {
|
|
658
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
659
|
+
if (i) {
|
|
660
|
+
if (Z(n) && !e.required)
|
|
661
|
+
return t();
|
|
662
|
+
A.required(e, n, a, s, o), n !== void 0 && (A.type(e, n, a, s, o), A.range(e, n, a, s, o));
|
|
663
|
+
}
|
|
664
|
+
t(s);
|
|
665
|
+
}, pr = function(e, n, t, a, o) {
|
|
666
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
667
|
+
if (i) {
|
|
668
|
+
if (n == null && !e.required)
|
|
669
|
+
return t();
|
|
670
|
+
A.required(e, n, a, s, o, "array"), n != null && (A.type(e, n, a, s, o), A.range(e, n, a, s, o));
|
|
671
|
+
}
|
|
672
|
+
t(s);
|
|
673
|
+
}, fr = function(e, n, t, a, o) {
|
|
674
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
675
|
+
if (i) {
|
|
676
|
+
if (Z(n) && !e.required)
|
|
677
|
+
return t();
|
|
678
|
+
A.required(e, n, a, s, o), n !== void 0 && A.type(e, n, a, s, o);
|
|
679
|
+
}
|
|
680
|
+
t(s);
|
|
681
|
+
}, mr = "enum", yr = function(e, n, t, a, o) {
|
|
682
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
683
|
+
if (i) {
|
|
684
|
+
if (Z(n) && !e.required)
|
|
685
|
+
return t();
|
|
686
|
+
A.required(e, n, a, s, o), n !== void 0 && A[mr](e, n, a, s, o);
|
|
687
|
+
}
|
|
688
|
+
t(s);
|
|
689
|
+
}, gr = function(e, n, t, a, o) {
|
|
690
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
691
|
+
if (i) {
|
|
692
|
+
if (Z(n, "string") && !e.required)
|
|
693
|
+
return t();
|
|
694
|
+
A.required(e, n, a, s, o), Z(n, "string") || A.pattern(e, n, a, s, o);
|
|
695
|
+
}
|
|
696
|
+
t(s);
|
|
697
|
+
}, vr = function(e, n, t, a, o) {
|
|
698
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
699
|
+
if (i) {
|
|
700
|
+
if (Z(n, "date") && !e.required)
|
|
701
|
+
return t();
|
|
702
|
+
if (A.required(e, n, a, s, o), !Z(n, "date")) {
|
|
703
|
+
var c;
|
|
704
|
+
n instanceof Date ? c = n : c = new Date(n), A.type(e, c, a, s, o), c && A.range(e, c.getTime(), a, s, o);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
t(s);
|
|
708
|
+
}, hr = function(e, n, t, a, o) {
|
|
709
|
+
var s = [], i = Array.isArray(n) ? "array" : typeof n;
|
|
710
|
+
A.required(e, n, a, s, o, i), t(s);
|
|
711
|
+
}, ot = function(e, n, t, a, o) {
|
|
712
|
+
var s = e.type, i = [], c = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
713
|
+
if (c) {
|
|
714
|
+
if (Z(n, s) && !e.required)
|
|
715
|
+
return t();
|
|
716
|
+
A.required(e, n, a, i, o, s), Z(n, s) || A.type(e, n, a, i, o);
|
|
717
|
+
}
|
|
718
|
+
t(i);
|
|
719
|
+
}, br = function(e, n, t, a, o) {
|
|
720
|
+
var s = [], i = e.required || !e.required && a.hasOwnProperty(e.field);
|
|
721
|
+
if (i) {
|
|
722
|
+
if (Z(n) && !e.required)
|
|
723
|
+
return t();
|
|
724
|
+
A.required(e, n, a, s, o);
|
|
725
|
+
}
|
|
726
|
+
t(s);
|
|
727
|
+
}, Ne = {
|
|
728
|
+
string: or,
|
|
729
|
+
method: sr,
|
|
730
|
+
number: lr,
|
|
731
|
+
boolean: ir,
|
|
732
|
+
regexp: ur,
|
|
733
|
+
integer: cr,
|
|
734
|
+
float: dr,
|
|
735
|
+
array: pr,
|
|
736
|
+
object: fr,
|
|
737
|
+
enum: yr,
|
|
738
|
+
pattern: gr,
|
|
739
|
+
date: vr,
|
|
740
|
+
url: ot,
|
|
741
|
+
hex: ot,
|
|
742
|
+
email: ot,
|
|
743
|
+
required: hr,
|
|
744
|
+
any: br
|
|
745
|
+
};
|
|
746
|
+
function pt() {
|
|
747
|
+
return {
|
|
748
|
+
default: "Validation error on field %s",
|
|
749
|
+
required: "%s is required",
|
|
750
|
+
enum: "%s must be one of %s",
|
|
751
|
+
whitespace: "%s cannot be empty",
|
|
752
|
+
date: {
|
|
753
|
+
format: "%s date %s is invalid for format %s",
|
|
754
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
755
|
+
invalid: "%s date %s is invalid"
|
|
756
|
+
},
|
|
757
|
+
types: {
|
|
758
|
+
string: "%s is not a %s",
|
|
759
|
+
method: "%s is not a %s (function)",
|
|
760
|
+
array: "%s is not an %s",
|
|
761
|
+
object: "%s is not an %s",
|
|
762
|
+
number: "%s is not a %s",
|
|
763
|
+
date: "%s is not a %s",
|
|
764
|
+
boolean: "%s is not a %s",
|
|
765
|
+
integer: "%s is not an %s",
|
|
766
|
+
float: "%s is not a %s",
|
|
767
|
+
regexp: "%s is not a valid %s",
|
|
768
|
+
email: "%s is not a valid %s",
|
|
769
|
+
url: "%s is not a valid %s",
|
|
770
|
+
hex: "%s is not a valid %s"
|
|
771
|
+
},
|
|
772
|
+
string: {
|
|
773
|
+
len: "%s must be exactly %s characters",
|
|
774
|
+
min: "%s must be at least %s characters",
|
|
775
|
+
max: "%s cannot be longer than %s characters",
|
|
776
|
+
range: "%s must be between %s and %s characters"
|
|
777
|
+
},
|
|
778
|
+
number: {
|
|
779
|
+
len: "%s must equal %s",
|
|
780
|
+
min: "%s cannot be less than %s",
|
|
781
|
+
max: "%s cannot be greater than %s",
|
|
782
|
+
range: "%s must be between %s and %s"
|
|
783
|
+
},
|
|
784
|
+
array: {
|
|
785
|
+
len: "%s must be exactly %s in length",
|
|
786
|
+
min: "%s cannot be less than %s in length",
|
|
787
|
+
max: "%s cannot be greater than %s in length",
|
|
788
|
+
range: "%s must be between %s and %s in length"
|
|
789
|
+
},
|
|
790
|
+
pattern: {
|
|
791
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
792
|
+
},
|
|
793
|
+
clone: function() {
|
|
794
|
+
var e = JSON.parse(JSON.stringify(this));
|
|
795
|
+
return e.clone = this.clone, e;
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
var ft = pt(), je = /* @__PURE__ */ function() {
|
|
800
|
+
function r(n) {
|
|
801
|
+
this.rules = null, this._messages = ft, this.define(n);
|
|
802
|
+
}
|
|
803
|
+
var e = r.prototype;
|
|
804
|
+
return e.define = function(t) {
|
|
805
|
+
var a = this;
|
|
806
|
+
if (!t)
|
|
807
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
808
|
+
if (typeof t != "object" || Array.isArray(t))
|
|
809
|
+
throw new Error("Rules must be an object");
|
|
810
|
+
this.rules = {}, Object.keys(t).forEach(function(o) {
|
|
811
|
+
var s = t[o];
|
|
812
|
+
a.rules[o] = Array.isArray(s) ? s : [s];
|
|
813
|
+
});
|
|
814
|
+
}, e.messages = function(t) {
|
|
815
|
+
return t && (this._messages = kt(pt(), t)), this._messages;
|
|
816
|
+
}, e.validate = function(t, a, o) {
|
|
817
|
+
var s = this;
|
|
818
|
+
a === void 0 && (a = {}), o === void 0 && (o = function() {
|
|
819
|
+
});
|
|
820
|
+
var i = t, c = a, v = o;
|
|
821
|
+
if (typeof c == "function" && (v = c, c = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
822
|
+
return v && v(null, i), Promise.resolve(i);
|
|
823
|
+
function b(g) {
|
|
824
|
+
var _ = [], p = {};
|
|
825
|
+
function I(m) {
|
|
826
|
+
if (Array.isArray(m)) {
|
|
827
|
+
var V;
|
|
828
|
+
_ = (V = _).concat.apply(V, m);
|
|
829
|
+
} else
|
|
830
|
+
_.push(m);
|
|
831
|
+
}
|
|
832
|
+
for (var C = 0; C < g.length; C++)
|
|
833
|
+
I(g[C]);
|
|
834
|
+
_.length ? (p = dt(_), v(_, p)) : v(null, i);
|
|
835
|
+
}
|
|
836
|
+
if (c.messages) {
|
|
837
|
+
var f = this.messages();
|
|
838
|
+
f === ft && (f = pt()), kt(f, c.messages), c.messages = f;
|
|
839
|
+
} else
|
|
840
|
+
c.messages = this.messages();
|
|
841
|
+
var d = {}, y = c.keys || Object.keys(this.rules);
|
|
842
|
+
y.forEach(function(g) {
|
|
843
|
+
var _ = s.rules[g], p = i[g];
|
|
844
|
+
_.forEach(function(I) {
|
|
845
|
+
var C = I;
|
|
846
|
+
typeof C.transform == "function" && (i === t && (i = Ie({}, i)), p = i[g] = C.transform(p)), typeof C == "function" ? C = {
|
|
847
|
+
validator: C
|
|
848
|
+
} : C = Ie({}, C), C.validator = s.getValidationMethod(C), C.validator && (C.field = g, C.fullField = C.fullField || g, C.type = s.getType(C), d[g] = d[g] || [], d[g].push({
|
|
849
|
+
rule: C,
|
|
850
|
+
value: p,
|
|
851
|
+
source: i,
|
|
852
|
+
field: g
|
|
853
|
+
}));
|
|
854
|
+
});
|
|
855
|
+
});
|
|
856
|
+
var x = {};
|
|
857
|
+
return Qn(d, c, function(g, _) {
|
|
858
|
+
var p = g.rule, I = (p.type === "object" || p.type === "array") && (typeof p.fields == "object" || typeof p.defaultField == "object");
|
|
859
|
+
I = I && (p.required || !p.required && g.value), p.field = g.field;
|
|
860
|
+
function C(Y, te) {
|
|
861
|
+
return Ie({}, te, {
|
|
862
|
+
fullField: p.fullField + "." + Y,
|
|
863
|
+
fullFields: p.fullFields ? [].concat(p.fullFields, [Y]) : [Y]
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
function m(Y) {
|
|
867
|
+
Y === void 0 && (Y = []);
|
|
868
|
+
var te = Array.isArray(Y) ? Y : [Y];
|
|
869
|
+
!c.suppressWarning && te.length && r.warning("async-validator:", te), te.length && p.message !== void 0 && (te = [].concat(p.message));
|
|
870
|
+
var B = te.map(xt(p, i));
|
|
871
|
+
if (c.first && B.length)
|
|
872
|
+
return x[p.field] = 1, _(B);
|
|
873
|
+
if (!I)
|
|
874
|
+
_(B);
|
|
875
|
+
else {
|
|
876
|
+
if (p.required && !g.value)
|
|
877
|
+
return p.message !== void 0 ? B = [].concat(p.message).map(xt(p, i)) : c.error && (B = [c.error(p, le(c.messages.required, p.field))]), _(B);
|
|
878
|
+
var ue = {};
|
|
879
|
+
p.defaultField && Object.keys(g.value).map(function(oe) {
|
|
880
|
+
ue[oe] = p.defaultField;
|
|
881
|
+
}), ue = Ie({}, ue, g.rule.fields);
|
|
882
|
+
var ke = {};
|
|
883
|
+
Object.keys(ue).forEach(function(oe) {
|
|
884
|
+
var ne = ue[oe], D = Array.isArray(ne) ? ne : [ne];
|
|
885
|
+
ke[oe] = D.map(C.bind(null, oe));
|
|
886
|
+
});
|
|
887
|
+
var ve = new r(ke);
|
|
888
|
+
ve.messages(c.messages), g.rule.options && (g.rule.options.messages = c.messages, g.rule.options.error = c.error), ve.validate(g.value, g.rule.options || c, function(oe) {
|
|
889
|
+
var ne = [];
|
|
890
|
+
B && B.length && ne.push.apply(ne, B), oe && oe.length && ne.push.apply(ne, oe), _(ne.length ? ne : null);
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
var V;
|
|
895
|
+
if (p.asyncValidator)
|
|
896
|
+
V = p.asyncValidator(p, g.value, m, g.source, c);
|
|
897
|
+
else if (p.validator) {
|
|
898
|
+
try {
|
|
899
|
+
V = p.validator(p, g.value, m, g.source, c);
|
|
900
|
+
} catch (Y) {
|
|
901
|
+
console.error == null || console.error(Y), c.suppressValidatorError || setTimeout(function() {
|
|
902
|
+
throw Y;
|
|
903
|
+
}, 0), m(Y.message);
|
|
904
|
+
}
|
|
905
|
+
V === !0 ? m() : V === !1 ? m(typeof p.message == "function" ? p.message(p.fullField || p.field) : p.message || (p.fullField || p.field) + " fails") : V instanceof Array ? m(V) : V instanceof Error && m(V.message);
|
|
906
|
+
}
|
|
907
|
+
V && V.then && V.then(function() {
|
|
908
|
+
return m();
|
|
909
|
+
}, function(Y) {
|
|
910
|
+
return m(Y);
|
|
911
|
+
});
|
|
912
|
+
}, function(g) {
|
|
913
|
+
b(g);
|
|
914
|
+
}, i);
|
|
915
|
+
}, e.getType = function(t) {
|
|
916
|
+
if (t.type === void 0 && t.pattern instanceof RegExp && (t.type = "pattern"), typeof t.validator != "function" && t.type && !Ne.hasOwnProperty(t.type))
|
|
917
|
+
throw new Error(le("Unknown rule type %s", t.type));
|
|
918
|
+
return t.type || "string";
|
|
919
|
+
}, e.getValidationMethod = function(t) {
|
|
920
|
+
if (typeof t.validator == "function")
|
|
921
|
+
return t.validator;
|
|
922
|
+
var a = Object.keys(t), o = a.indexOf("message");
|
|
923
|
+
return o !== -1 && a.splice(o, 1), a.length === 1 && a[0] === "required" ? Ne.required : Ne[this.getType(t)] || void 0;
|
|
924
|
+
}, r;
|
|
925
|
+
}();
|
|
926
|
+
je.register = function(e, n) {
|
|
927
|
+
if (typeof n != "function")
|
|
928
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
929
|
+
Ne[e] = n;
|
|
930
|
+
};
|
|
931
|
+
je.warning = Yt;
|
|
932
|
+
je.messages = ft;
|
|
933
|
+
je.validators = Ne;
|
|
934
|
+
const ye = (r) => Object.prototype.toString.call(r).slice(8, -1).toLowerCase(), _r = (r) => ($r(r), r.map((e, n) => ({
|
|
935
|
+
...e,
|
|
936
|
+
props: e.props ?? {},
|
|
937
|
+
visible: e.visible ?? !0,
|
|
938
|
+
_order: n,
|
|
939
|
+
_defaultValue: e.value
|
|
940
|
+
}))), Ot = (r) => (wr(r), r.map((e, n) => {
|
|
941
|
+
const { content: t, width: a = 120, visible: o = !0, resizable: s = !0, ellipsis: i = !0, component: c } = e;
|
|
942
|
+
return {
|
|
943
|
+
...e,
|
|
944
|
+
dataIndex: typeof t == "string" ? t : void 0,
|
|
945
|
+
width: a,
|
|
946
|
+
visible: o,
|
|
947
|
+
resizable: s,
|
|
948
|
+
ellipsis: i,
|
|
949
|
+
component: c ? X(c) : void 0,
|
|
950
|
+
index: n
|
|
951
|
+
};
|
|
952
|
+
})), Cr = (r, e, n) => r.sort((t, a) => n.indexOf(t.code) - n.indexOf(a.code)).map((t) => {
|
|
953
|
+
const a = Ir(t.value ?? "", null);
|
|
954
|
+
if (a)
|
|
955
|
+
return {
|
|
956
|
+
...t,
|
|
957
|
+
items: a.map((o) => {
|
|
958
|
+
var i;
|
|
959
|
+
const s = e[o.name];
|
|
960
|
+
return s ? s.type !== o.type ? console.warn(`formItem type not match: name = ${o.name}, type = ${o.type}`) : o.type === H.datePicker && o.value ? {
|
|
961
|
+
...o,
|
|
962
|
+
value: o.value ? Be(o.value) : void 0
|
|
963
|
+
} : o.type === H.rangePicker && ((i = o.value) != null && i.length) ? {
|
|
964
|
+
...o,
|
|
965
|
+
value: o.value.map(Be)
|
|
966
|
+
} : o : console.warn(`formItem not exit: name = ${o.name}`);
|
|
967
|
+
}).filter(Boolean)
|
|
968
|
+
};
|
|
969
|
+
}).filter(Boolean);
|
|
970
|
+
function $e(...r) {
|
|
971
|
+
console.log("%c[pro-table]:", "color: #f00; padding: 2px 4px; font-weight: bold; font-size: 14px;", ...r);
|
|
972
|
+
}
|
|
973
|
+
const $r = (r) => {
|
|
974
|
+
r.forEach((e) => {
|
|
975
|
+
new je({
|
|
976
|
+
type: [
|
|
977
|
+
{ required: !0 },
|
|
978
|
+
{
|
|
979
|
+
validator(t, a, o) {
|
|
980
|
+
return ["string", "function"].includes(ye(a)) ? o() : o(new Error("type must be string or function"));
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
],
|
|
984
|
+
name: [{ required: !0 }, { type: "string" }],
|
|
985
|
+
label: [{ required: !0 }, { type: "string" }],
|
|
986
|
+
showLabel: {
|
|
987
|
+
type: "boolean"
|
|
988
|
+
},
|
|
989
|
+
span: { type: "number" },
|
|
990
|
+
component: {
|
|
991
|
+
required: e.type === "component"
|
|
992
|
+
},
|
|
993
|
+
props: {
|
|
994
|
+
validator: (t, a, o) => a && !["object", "function"].includes(ye(a)) ? o(new Error("props must be object or function")) : o()
|
|
995
|
+
}
|
|
996
|
+
}).validate(e, (t) => {
|
|
997
|
+
t && console.error(`[pro-table]: defineFormItems error, [${t[0].message}]`, {
|
|
998
|
+
formItem: e,
|
|
999
|
+
errors: t
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
}, wr = (r) => {
|
|
1004
|
+
r.forEach((e) => {
|
|
1005
|
+
new je({
|
|
1006
|
+
key: [{ required: !0, type: "string" }],
|
|
1007
|
+
type: [
|
|
1008
|
+
{
|
|
1009
|
+
validator(t, a, o) {
|
|
1010
|
+
return a ? ["string", "function"].includes(ye(a)) ? ye(a) === "string" && !Object.keys(R).includes(a) ? o(new Error(`type must be one of ${Object.keys(R).join(", ")}`)) : o() : o(new Error("type must be string or function")) : o();
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
],
|
|
1014
|
+
title: [{ required: !0 }, { type: "string" }],
|
|
1015
|
+
titleTooltip: {
|
|
1016
|
+
validator(t, a, o) {
|
|
1017
|
+
return a && !["string", "function"].includes(ye(a)) ? o(new Error("titleTooltip must be string or function")) : o();
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
content: {
|
|
1021
|
+
validator(t, a, o) {
|
|
1022
|
+
return a && !["string", "function"].includes(ye(a)) ? o(new Error("content must be string or function")) : o();
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
tooltip: {
|
|
1026
|
+
validator(t, a, o) {
|
|
1027
|
+
return a && !["string", "boolean", "function"].includes(ye(a)) ? o(new Error("tooltip must be string, boolean, or function")) : o();
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
component: {
|
|
1031
|
+
required: e.type === R.component
|
|
1032
|
+
},
|
|
1033
|
+
copyable: { type: "boolean" },
|
|
1034
|
+
ellipsis: { type: "boolean" },
|
|
1035
|
+
props: {
|
|
1036
|
+
validator(t, a, o) {
|
|
1037
|
+
return a && !["object", "function"].includes(ye(a)) ? o(new Error("props must be object or function")) : o();
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}).validate(e, (t) => {
|
|
1041
|
+
t && console.error(`[pro-table]: defineTableColumns error, ${t[0].message}`, {
|
|
1042
|
+
column: e,
|
|
1043
|
+
errors: t
|
|
1044
|
+
});
|
|
1045
|
+
});
|
|
1046
|
+
});
|
|
1047
|
+
}, Sr = (r, e) => {
|
|
1048
|
+
if (!r) return 0;
|
|
1049
|
+
const t = document.createElement("canvas").getContext("2d");
|
|
1050
|
+
return t ? (t.font = [
|
|
1051
|
+
400,
|
|
1052
|
+
`${Se.fontSize}px`,
|
|
1053
|
+
Se.fontFamily
|
|
1054
|
+
].join(" "), Math.ceil(t.measureText(r).width)) : 0;
|
|
1055
|
+
}, Ir = (r, e) => {
|
|
1056
|
+
if (r === "" || r === null)
|
|
1057
|
+
return e;
|
|
1058
|
+
try {
|
|
1059
|
+
return JSON.parse(r);
|
|
1060
|
+
} catch (n) {
|
|
1061
|
+
return $e(`[pro-table]: parseJsonSafe error, ${n}`, {
|
|
1062
|
+
jsonString: r,
|
|
1063
|
+
defaultVal: e
|
|
1064
|
+
}), e;
|
|
1065
|
+
}
|
|
1066
|
+
}, Fr = (r) => {
|
|
1067
|
+
let e = 0;
|
|
1068
|
+
for (let n = 0; n < r.length; n++)
|
|
1069
|
+
e = (e << 5) - e + r.charCodeAt(n), e |= 0;
|
|
1070
|
+
return e.toString(16);
|
|
1071
|
+
}, Ut = (r) => {
|
|
1072
|
+
const e = Fr(r);
|
|
1073
|
+
return An(e, "1b671a64-40d5-491e-99b0-da01ff1f3341").replace(/-/g, "");
|
|
1074
|
+
}, Pt = (r) => decodeURIComponent(
|
|
1075
|
+
document.cookie.replace(
|
|
1076
|
+
new RegExp(
|
|
1077
|
+
"(?:(?:^|.*;)\\s*" + encodeURIComponent(r).replace(/[-.+*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"
|
|
1078
|
+
),
|
|
1079
|
+
"$1"
|
|
1080
|
+
)
|
|
1081
|
+
) || "", xr = /* @__PURE__ */ ie({
|
|
1082
|
+
__name: "EllipsisElement",
|
|
1083
|
+
props: {
|
|
1084
|
+
/**
|
|
1085
|
+
* 当前行数据
|
|
1086
|
+
* @type {TableDataItem}
|
|
1087
|
+
*/
|
|
1088
|
+
record: {
|
|
1089
|
+
type: Object,
|
|
1090
|
+
required: !0
|
|
1091
|
+
},
|
|
1092
|
+
/**
|
|
1093
|
+
* 内容类型
|
|
1094
|
+
* @type {SuperTableColumnType}
|
|
1095
|
+
* @default SuperTableColumnTypeEnum.text
|
|
1096
|
+
*/
|
|
1097
|
+
type: {
|
|
1098
|
+
type: String,
|
|
1099
|
+
default: R.text
|
|
1100
|
+
},
|
|
1101
|
+
/**
|
|
1102
|
+
* 单元格宽度
|
|
1103
|
+
* @type {number}
|
|
1104
|
+
* @default 100
|
|
1105
|
+
*/
|
|
1106
|
+
cellWidth: {
|
|
1107
|
+
type: Number,
|
|
1108
|
+
default: 100
|
|
1109
|
+
},
|
|
1110
|
+
/**
|
|
1111
|
+
* 列表数据
|
|
1112
|
+
* @type {Record<string, any>[]}
|
|
1113
|
+
* @default []
|
|
1114
|
+
*/
|
|
1115
|
+
list: {
|
|
1116
|
+
type: Array,
|
|
1117
|
+
default: () => []
|
|
1118
|
+
},
|
|
1119
|
+
/**
|
|
1120
|
+
* 最多显示数量
|
|
1121
|
+
* @type {number}
|
|
1122
|
+
* @default 2
|
|
1123
|
+
*/
|
|
1124
|
+
maxCount: {
|
|
1125
|
+
type: Number,
|
|
1126
|
+
default: 2
|
|
1127
|
+
},
|
|
1128
|
+
/**
|
|
1129
|
+
* 更多节点展示类型
|
|
1130
|
+
* @type {string}
|
|
1131
|
+
* @default 'popover'
|
|
1132
|
+
*/
|
|
1133
|
+
displayType: {
|
|
1134
|
+
type: String,
|
|
1135
|
+
default: "popover"
|
|
1136
|
+
},
|
|
1137
|
+
/**
|
|
1138
|
+
* 触发显示方式
|
|
1139
|
+
* @type {string | string[]}
|
|
1140
|
+
* @default 'hover'
|
|
1141
|
+
*/
|
|
1142
|
+
trigger: {
|
|
1143
|
+
type: [String, Array],
|
|
1144
|
+
default: "hover"
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
setup(r) {
|
|
1148
|
+
const e = r, n = L(() => e.list.map((i) => ye(i) === "object" ? i : { label: i }).map((i, c) => ({ ...i, index: c, __key: i.key ?? `${c}-${String(i.label)}` }))), t = L(() => wt(n.value, 0, e.maxCount)), a = L(
|
|
1149
|
+
() => wt(n.value, e.maxCount, n.value.length)
|
|
1150
|
+
), o = L(() => a.value.map(({ index: i, disabled: c, label: v, onClick: b }) => ({
|
|
1151
|
+
key: i + e.maxCount,
|
|
1152
|
+
label: v,
|
|
1153
|
+
disabled: c,
|
|
1154
|
+
onClick: () => b == null ? void 0 : b(e.record)
|
|
1155
|
+
}))), s = L(() => {
|
|
1156
|
+
const i = {}, { maxCount: c, cellWidth: v, type: b } = e;
|
|
1157
|
+
return b === R.text && (i.flex = 1), b === R.link && t.value.length > 1 && (i.maxWidth = `${((v - 50) / v / c * 100).toFixed(2)}%`), i;
|
|
1158
|
+
});
|
|
1159
|
+
return (i, c) => {
|
|
1160
|
+
const v = q("a-tag"), b = q("a-popover"), f = q("a-button"), d = q("a-menu"), y = q("a-dropdown");
|
|
1161
|
+
return F(), U("div", {
|
|
1162
|
+
class: w([
|
|
1163
|
+
i.$style.ellipsisElement,
|
|
1164
|
+
{
|
|
1165
|
+
[i.$style.ellipsisElementHasGap]: ![S(R).button, S(R).tag].includes(r.type)
|
|
1166
|
+
}
|
|
1167
|
+
])
|
|
1168
|
+
}, [
|
|
1169
|
+
(F(!0), U(Fe, null, st(t.value, (x, g) => (F(), U("div", {
|
|
1170
|
+
key: x.__key,
|
|
1171
|
+
class: w(i.$style.elementItem),
|
|
1172
|
+
style: we(s.value)
|
|
1173
|
+
}, [
|
|
1174
|
+
pe(i.$slots, "default", {
|
|
1175
|
+
item: x,
|
|
1176
|
+
index: g
|
|
1177
|
+
})
|
|
1178
|
+
], 6))), 128)),
|
|
1179
|
+
a.value.length ? (F(), U(Fe, { key: 0 }, [
|
|
1180
|
+
r.displayType === "popover" ? (F(), E(b, {
|
|
1181
|
+
key: 0,
|
|
1182
|
+
trigger: r.trigger,
|
|
1183
|
+
"overlay-style": { maxWidth: "500px" },
|
|
1184
|
+
"destroy-on-close": ""
|
|
1185
|
+
}, {
|
|
1186
|
+
content: $(() => [
|
|
1187
|
+
J("div", {
|
|
1188
|
+
class: w(i.$style.ellipsisList)
|
|
1189
|
+
}, [
|
|
1190
|
+
(F(!0), U(Fe, null, st(a.value, (x, g) => pe(i.$slots, "default", {
|
|
1191
|
+
key: x.__key,
|
|
1192
|
+
item: x,
|
|
1193
|
+
index: g + r.maxCount,
|
|
1194
|
+
inPopover: !0
|
|
1195
|
+
})), 128))
|
|
1196
|
+
], 2)
|
|
1197
|
+
]),
|
|
1198
|
+
default: $(() => [
|
|
1199
|
+
O(v, {
|
|
1200
|
+
size: "mini",
|
|
1201
|
+
type: "info",
|
|
1202
|
+
class: w([
|
|
1203
|
+
i.$style.ellipsisTag,
|
|
1204
|
+
{
|
|
1205
|
+
[i.$style.imageEllipsisTag]: r.type === S(R).image
|
|
1206
|
+
}
|
|
1207
|
+
])
|
|
1208
|
+
}, {
|
|
1209
|
+
default: $(() => [
|
|
1210
|
+
K(_e(`+${a.value.length}...`), 1)
|
|
1211
|
+
]),
|
|
1212
|
+
_: 1
|
|
1213
|
+
}, 8, ["class"])
|
|
1214
|
+
]),
|
|
1215
|
+
_: 3
|
|
1216
|
+
}, 8, ["trigger"])) : N("", !0),
|
|
1217
|
+
r.displayType === "dropdown" ? (F(), E(y, {
|
|
1218
|
+
key: 1,
|
|
1219
|
+
"destroy-on-close": "",
|
|
1220
|
+
trigger: r.trigger
|
|
1221
|
+
}, {
|
|
1222
|
+
overlay: $(() => [
|
|
1223
|
+
O(d, { items: o.value }, null, 8, ["items"])
|
|
1224
|
+
]),
|
|
1225
|
+
default: $(() => [
|
|
1226
|
+
O(f, {
|
|
1227
|
+
type: "link",
|
|
1228
|
+
size: "small"
|
|
1229
|
+
}, {
|
|
1230
|
+
default: $(() => [
|
|
1231
|
+
c[0] || (c[0] = K(" 更多 ")),
|
|
1232
|
+
O(S($n))
|
|
1233
|
+
]),
|
|
1234
|
+
_: 1
|
|
1235
|
+
})
|
|
1236
|
+
]),
|
|
1237
|
+
_: 1
|
|
1238
|
+
}, 8, ["trigger"])) : N("", !0)
|
|
1239
|
+
], 64)) : N("", !0)
|
|
1240
|
+
], 2);
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
}), kr = "_ellipsisElement_6fog1_1", Tr = "_elementItem_6fog1_6", Or = "_ellipsisElementHasGap_6fog1_10", Pr = "_flexWrap_6fog1_14", qr = "_ellipsisTag_6fog1_18", jr = "_imageEllipsisTag_6fog1_22", Lr = "_ellipsisList_6fog1_29", Er = {
|
|
1244
|
+
ellipsisElement: kr,
|
|
1245
|
+
elementItem: Tr,
|
|
1246
|
+
ellipsisElementHasGap: Or,
|
|
1247
|
+
flexWrap: Pr,
|
|
1248
|
+
ellipsisTag: qr,
|
|
1249
|
+
imageEllipsisTag: jr,
|
|
1250
|
+
ellipsisList: Lr
|
|
1251
|
+
}, fe = (r, e) => {
|
|
1252
|
+
const n = r.__vccOpts || r;
|
|
1253
|
+
for (const [t, a] of e)
|
|
1254
|
+
n[t] = a;
|
|
1255
|
+
return n;
|
|
1256
|
+
}, Ar = {
|
|
1257
|
+
$style: Er
|
|
1258
|
+
}, Mr = /* @__PURE__ */ fe(xr, [["__cssModules", Ar]]), Nr = { key: 1 }, Dr = /* @__PURE__ */ ie({
|
|
1259
|
+
__name: "TableCellContent",
|
|
1260
|
+
props: {
|
|
1261
|
+
/**
|
|
1262
|
+
* 当前行索引
|
|
1263
|
+
* @type {number}
|
|
1264
|
+
*/
|
|
1265
|
+
index: {
|
|
1266
|
+
type: Number,
|
|
1267
|
+
required: !0
|
|
1268
|
+
},
|
|
1269
|
+
/**
|
|
1270
|
+
* 列配置
|
|
1271
|
+
* @type {SuperTableColumn}
|
|
1272
|
+
* @default {}
|
|
1273
|
+
*/
|
|
1274
|
+
column: {
|
|
1275
|
+
type: Object,
|
|
1276
|
+
required: !0,
|
|
1277
|
+
default: () => ({})
|
|
1278
|
+
},
|
|
1279
|
+
/**
|
|
1280
|
+
* 行数据
|
|
1281
|
+
* @type {TableDataItem}
|
|
1282
|
+
*/
|
|
1283
|
+
record: {
|
|
1284
|
+
type: Object,
|
|
1285
|
+
required: !0
|
|
1286
|
+
},
|
|
1287
|
+
/**
|
|
1288
|
+
* 是否支持vue-router
|
|
1289
|
+
* @type {boolean}
|
|
1290
|
+
* @default false
|
|
1291
|
+
*/
|
|
1292
|
+
hasRouter: {
|
|
1293
|
+
type: Boolean,
|
|
1294
|
+
default: !1
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
setup(r) {
|
|
1298
|
+
const e = r, n = /* @__PURE__ */ new Map(), t = L(() => {
|
|
1299
|
+
const { index: y, record: x, column: g } = e, _ = (g == null ? void 0 : g.type) ?? R.text;
|
|
1300
|
+
return Ce(_) ? _(x, y) : _;
|
|
1301
|
+
}), a = L(() => {
|
|
1302
|
+
const { index: y, record: x, column: g } = e, _ = g.content;
|
|
1303
|
+
if (Ce(_))
|
|
1304
|
+
return _(x, y);
|
|
1305
|
+
if (typeof _ == "string") {
|
|
1306
|
+
if (_.startsWith("$")) {
|
|
1307
|
+
let p = n.get(_);
|
|
1308
|
+
p || (p = /* @__PURE__ */ new WeakMap(), n.set(_, p));
|
|
1309
|
+
const I = p.get(x);
|
|
1310
|
+
if (I !== void 0) return I;
|
|
1311
|
+
const C = En({ path: _, json: x });
|
|
1312
|
+
return p.set(x, C), C;
|
|
1313
|
+
}
|
|
1314
|
+
return Xe(x, _, "");
|
|
1315
|
+
}
|
|
1316
|
+
return "";
|
|
1317
|
+
}), o = L(() => qe(a.value)), s = L(() => {
|
|
1318
|
+
const { index: y, record: x, column: g } = e;
|
|
1319
|
+
if (t.value === R.component) {
|
|
1320
|
+
const { props: _ = {} } = g;
|
|
1321
|
+
return Ce(_) ? _(x, y) : {
|
|
1322
|
+
..._,
|
|
1323
|
+
index: y,
|
|
1324
|
+
record: x
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
return {};
|
|
1328
|
+
}), i = L(() => {
|
|
1329
|
+
const { index: y, record: x, column: g } = e, _ = g.tooltip ?? [R.text, R.link].includes(t.value);
|
|
1330
|
+
if (!_) return "";
|
|
1331
|
+
if (Ce(_))
|
|
1332
|
+
return _(x, y);
|
|
1333
|
+
const p = o.value[0];
|
|
1334
|
+
return (p == null ? void 0 : p.label) || p;
|
|
1335
|
+
}), c = L(() => !(["", void 0, null].includes(a.value) && ![R.component, R.sort].includes(t.value))), v = (y) => typeof y == "string" && /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(y), b = (y) => e.hasRouter && !v(y), f = (y) => b(y) ? "router-link" : "a", d = (y, x) => b(y) ? { to: y, target: x ?? "_blank" } : { href: y, target: x ?? "_blank" };
|
|
1336
|
+
return (y, x) => {
|
|
1337
|
+
var C;
|
|
1338
|
+
const g = q("a-button"), _ = q("a-typography-text"), p = q("a-tag"), I = q("a-image");
|
|
1339
|
+
return c.value ? (F(), U("div", {
|
|
1340
|
+
key: 0,
|
|
1341
|
+
class: w(y.$style.tableCellContent)
|
|
1342
|
+
}, [
|
|
1343
|
+
t.value === S(R).sort ? (F(), E(g, {
|
|
1344
|
+
key: 0,
|
|
1345
|
+
type: "text",
|
|
1346
|
+
size: "small",
|
|
1347
|
+
icon: X(S(De)),
|
|
1348
|
+
class: w([y.$style.draggableIcon, "super-table-column-draggable-handle"])
|
|
1349
|
+
}, null, 8, ["icon", "class"])) : N("", !0),
|
|
1350
|
+
t.value === S(R).component ? (F(), E(Ke(r.column.component), rt(ae({ key: 1 }, s.value)), null, 16)) : Et([(C = r.column) == null ? void 0 : C.key, r.index, o.value], () => (F(), E(Mr, {
|
|
1351
|
+
key: 2,
|
|
1352
|
+
list: o.value,
|
|
1353
|
+
"max-count": t.value === S(R).text ? 1 : r.column.maxCount,
|
|
1354
|
+
record: r.record,
|
|
1355
|
+
type: t.value,
|
|
1356
|
+
"cell-width": r.column.width,
|
|
1357
|
+
"display-type": [S(R).button].includes(t.value) ? "dropdown" : "popover"
|
|
1358
|
+
}, {
|
|
1359
|
+
default: $(({ item: m, index: V, inPopover: Y }) => [
|
|
1360
|
+
t.value === S(R).text ? (F(), U(Fe, { key: 0 }, [
|
|
1361
|
+
V === 0 ? (F(), E(_, {
|
|
1362
|
+
key: 0,
|
|
1363
|
+
ellipsis: { tooltip: i.value },
|
|
1364
|
+
content: String(m.label),
|
|
1365
|
+
class: w(y.$style.antTypographyEllipsis)
|
|
1366
|
+
}, null, 8, ["ellipsis", "content", "class"])) : (F(), U("div", {
|
|
1367
|
+
key: 1,
|
|
1368
|
+
class: w(y.$style.textListItem)
|
|
1369
|
+
}, _e(m.label), 3))
|
|
1370
|
+
], 64)) : N("", !0),
|
|
1371
|
+
t.value === S(R).link ? (F(), E(Ke(f(m.to)), rt(ae({ key: 1 }, d(m.to, m.target))), {
|
|
1372
|
+
default: $(() => [
|
|
1373
|
+
r.column.ellipsis ? (F(), E(_, {
|
|
1374
|
+
key: 0,
|
|
1375
|
+
ellipsis: { tooltip: m.label },
|
|
1376
|
+
content: String(m.label),
|
|
1377
|
+
style: we({ color: S(Se).colorPrimary }),
|
|
1378
|
+
class: w(y.$style.antTypographyEllipsis)
|
|
1379
|
+
}, null, 8, ["ellipsis", "content", "style", "class"])) : (F(), U("span", Nr, _e(m.label), 1))
|
|
1380
|
+
]),
|
|
1381
|
+
_: 2
|
|
1382
|
+
}, 1040)) : N("", !0),
|
|
1383
|
+
t.value === S(R).tag ? (F(), E(p, rt(ae({ key: 2 }, m)), {
|
|
1384
|
+
default: $(() => [
|
|
1385
|
+
K(_e(m.label), 1)
|
|
1386
|
+
]),
|
|
1387
|
+
_: 2
|
|
1388
|
+
}, 1040)) : N("", !0),
|
|
1389
|
+
t.value === S(R).button ? (F(), E(g, ae({
|
|
1390
|
+
key: 3,
|
|
1391
|
+
type: "link",
|
|
1392
|
+
size: "small",
|
|
1393
|
+
disabled: m.disabled
|
|
1394
|
+
}, m.buttonProps, {
|
|
1395
|
+
onClick: (te) => {
|
|
1396
|
+
var B;
|
|
1397
|
+
return (B = m.onClick) == null ? void 0 : B.call(m, r.record, r.index);
|
|
1398
|
+
}
|
|
1399
|
+
}), {
|
|
1400
|
+
default: $(() => [
|
|
1401
|
+
K(_e(m.label), 1)
|
|
1402
|
+
]),
|
|
1403
|
+
_: 2
|
|
1404
|
+
}, 1040, ["disabled", "onClick"])) : N("", !0),
|
|
1405
|
+
t.value === S(R).image ? (F(), E(I, {
|
|
1406
|
+
key: 4,
|
|
1407
|
+
width: Y ? 100 : 32,
|
|
1408
|
+
height: Y ? 100 : 32,
|
|
1409
|
+
src: m.label,
|
|
1410
|
+
alt: m.label,
|
|
1411
|
+
style: { objectFit: "cover" }
|
|
1412
|
+
}, {
|
|
1413
|
+
previewMask: $(() => [
|
|
1414
|
+
O(S(wn))
|
|
1415
|
+
]),
|
|
1416
|
+
_: 2
|
|
1417
|
+
}, 1032, ["width", "height", "src", "alt"])) : N("", !0)
|
|
1418
|
+
]),
|
|
1419
|
+
_: 1
|
|
1420
|
+
}, 8, ["list", "max-count", "record", "type", "cell-width", "display-type"])), x, 0)
|
|
1421
|
+
], 2)) : N("", !0);
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
}), Br = "_tableCellContent_1chn7_1", Rr = "_antTypographyEllipsis_1chn7_1", Vr = "_draggableIcon_1chn7_4", Yr = "_textListItem_1chn7_8", Hr = {
|
|
1425
|
+
tableCellContent: Br,
|
|
1426
|
+
antTypographyEllipsis: Rr,
|
|
1427
|
+
draggableIcon: Vr,
|
|
1428
|
+
textListItem: Yr
|
|
1429
|
+
}, Ur = {
|
|
1430
|
+
$style: Hr
|
|
1431
|
+
}, Wr = /* @__PURE__ */ fe(Dr, [["__cssModules", Ur]]), zr = ie({
|
|
1432
|
+
name: "VNodes",
|
|
1433
|
+
props: {
|
|
1434
|
+
vnodes: {
|
|
1435
|
+
type: Object,
|
|
1436
|
+
required: !0
|
|
1437
|
+
}
|
|
1438
|
+
},
|
|
1439
|
+
render() {
|
|
1440
|
+
return this.vnodes;
|
|
1441
|
+
}
|
|
1442
|
+
}), Gr = /* @__PURE__ */ ie({
|
|
1443
|
+
__name: "TableConfig",
|
|
1444
|
+
props: {
|
|
1445
|
+
/**
|
|
1446
|
+
* 表格列配置数组
|
|
1447
|
+
* @type {SuperTableColumn[]}
|
|
1448
|
+
* @default []
|
|
1449
|
+
*/
|
|
1450
|
+
columns: {
|
|
1451
|
+
type: Array,
|
|
1452
|
+
default: () => []
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
emits: ["change"],
|
|
1456
|
+
setup(r, { emit: e }) {
|
|
1457
|
+
const n = ee(!1), t = r, a = e, o = ee([]), s = ee([]), i = ee(""), c = ee("");
|
|
1458
|
+
Ct(() => {
|
|
1459
|
+
o.value = t.columns;
|
|
1460
|
+
});
|
|
1461
|
+
const v = ({ title: p }) => {
|
|
1462
|
+
var C;
|
|
1463
|
+
const I = (C = c.value) == null ? void 0 : C.trim();
|
|
1464
|
+
return I ? p.toLocaleLowerCase().includes(I.toLocaleLowerCase()) : !0;
|
|
1465
|
+
}, b = L(() => o.value.every((p) => !v(p))), f = mt((p) => {
|
|
1466
|
+
c.value = p.target.value;
|
|
1467
|
+
}, 300), d = L(() => o.value.every((p) => p.visible === !1)), y = () => {
|
|
1468
|
+
n.value = !1, a(
|
|
1469
|
+
"change",
|
|
1470
|
+
o.value.map((p) => xe(p, Rt))
|
|
1471
|
+
);
|
|
1472
|
+
}, x = () => {
|
|
1473
|
+
n.value = !1, o.value = s.value, s.value = [];
|
|
1474
|
+
}, g = () => {
|
|
1475
|
+
n.value = !1, a("change", []);
|
|
1476
|
+
}, _ = (p) => {
|
|
1477
|
+
p && (s.value = Ge(o.value));
|
|
1478
|
+
};
|
|
1479
|
+
return Ct(() => {
|
|
1480
|
+
n.value || (i.value = "", c.value = "");
|
|
1481
|
+
}), (p, I) => {
|
|
1482
|
+
const C = q("a-button"), m = q("a-input"), V = q("a-checkbox"), Y = q("a-typography-text"), te = q("a-popover");
|
|
1483
|
+
return F(), E(te, {
|
|
1484
|
+
open: n.value,
|
|
1485
|
+
"onUpdate:open": I[1] || (I[1] = (B) => n.value = B),
|
|
1486
|
+
placement: "bottomRight",
|
|
1487
|
+
trigger: "click",
|
|
1488
|
+
"overlay-inner-style": { padding: 0 },
|
|
1489
|
+
"overlay-class-name": "pro-table-config-popover",
|
|
1490
|
+
onOpenChange: _
|
|
1491
|
+
}, {
|
|
1492
|
+
content: $(() => [
|
|
1493
|
+
J("div", {
|
|
1494
|
+
class: w(p.$style.tableConfig)
|
|
1495
|
+
}, [
|
|
1496
|
+
J("div", {
|
|
1497
|
+
class: w(p.$style.tableConfigHead)
|
|
1498
|
+
}, [
|
|
1499
|
+
O(m, {
|
|
1500
|
+
value: i.value,
|
|
1501
|
+
"onUpdate:value": I[0] || (I[0] = (B) => i.value = B),
|
|
1502
|
+
placeholder: "搜索标题",
|
|
1503
|
+
onChange: S(f)
|
|
1504
|
+
}, null, 8, ["value", "onChange"])
|
|
1505
|
+
], 2),
|
|
1506
|
+
J("div", {
|
|
1507
|
+
class: w(p.$style.tableConfigContent)
|
|
1508
|
+
}, [
|
|
1509
|
+
O(S(yt), {
|
|
1510
|
+
list: o.value,
|
|
1511
|
+
"item-key": "key",
|
|
1512
|
+
class: w(p.$style.columnList),
|
|
1513
|
+
handle: ".table-column-draggable-handle"
|
|
1514
|
+
}, {
|
|
1515
|
+
item: $(({ element: B }) => [
|
|
1516
|
+
v(B) ? (F(), U("div", {
|
|
1517
|
+
key: 0,
|
|
1518
|
+
class: w(p.$style.columnItem),
|
|
1519
|
+
style: we({ background: S(Se).colorBgContainer })
|
|
1520
|
+
}, [
|
|
1521
|
+
O(V, {
|
|
1522
|
+
checked: B.visible,
|
|
1523
|
+
"onUpdate:checked": (ue) => B.visible = ue
|
|
1524
|
+
}, null, 8, ["checked", "onUpdate:checked"]),
|
|
1525
|
+
O(Y, {
|
|
1526
|
+
ellipsis: { tooltip: B.title },
|
|
1527
|
+
content: B.title,
|
|
1528
|
+
class: w([p.$style.columnItemContent, p.$style.dragHandle, "table-column-draggable-handle"]),
|
|
1529
|
+
onClick: (ue) => B.visible = !B.visible
|
|
1530
|
+
}, null, 8, ["ellipsis", "content", "class", "onClick"]),
|
|
1531
|
+
O(C, {
|
|
1532
|
+
type: "text",
|
|
1533
|
+
size: "small",
|
|
1534
|
+
icon: X(S(De)),
|
|
1535
|
+
style: we({ color: S(Se).colorTextQuaternary }),
|
|
1536
|
+
class: w([B.fixed ? p.$style.dragIconDisabled : "table-column-draggable-handle", p.$style.dragIcon])
|
|
1537
|
+
}, null, 8, ["icon", "style", "class"])
|
|
1538
|
+
], 6)) : N("", !0)
|
|
1539
|
+
]),
|
|
1540
|
+
_: 1
|
|
1541
|
+
}, 8, ["list", "class"]),
|
|
1542
|
+
b.value ? (F(), U("div", {
|
|
1543
|
+
key: 0,
|
|
1544
|
+
class: w(p.$style.emptyText),
|
|
1545
|
+
style: we({ color: S(Se).colorTextSecondary })
|
|
1546
|
+
}, " 未找到相关查询项 ", 6)) : N("", !0)
|
|
1547
|
+
], 2),
|
|
1548
|
+
J("div", {
|
|
1549
|
+
class: w(p.$style.tableConfigFoot)
|
|
1550
|
+
}, [
|
|
1551
|
+
O(C, {
|
|
1552
|
+
type: "link",
|
|
1553
|
+
disabled: d.value,
|
|
1554
|
+
onClick: y
|
|
1555
|
+
}, {
|
|
1556
|
+
default: $(() => I[2] || (I[2] = [
|
|
1557
|
+
K(" 确定 ")
|
|
1558
|
+
])),
|
|
1559
|
+
_: 1
|
|
1560
|
+
}, 8, ["disabled"]),
|
|
1561
|
+
O(C, {
|
|
1562
|
+
type: "link",
|
|
1563
|
+
onClick: x
|
|
1564
|
+
}, {
|
|
1565
|
+
default: $(() => I[3] || (I[3] = [
|
|
1566
|
+
K(" 取消 ")
|
|
1567
|
+
])),
|
|
1568
|
+
_: 1
|
|
1569
|
+
}),
|
|
1570
|
+
O(C, {
|
|
1571
|
+
type: "link",
|
|
1572
|
+
onClick: g
|
|
1573
|
+
}, {
|
|
1574
|
+
default: $(() => I[4] || (I[4] = [
|
|
1575
|
+
K(" 重置 ")
|
|
1576
|
+
])),
|
|
1577
|
+
_: 1
|
|
1578
|
+
})
|
|
1579
|
+
], 2)
|
|
1580
|
+
], 2)
|
|
1581
|
+
]),
|
|
1582
|
+
default: $(() => [
|
|
1583
|
+
O(C, {
|
|
1584
|
+
type: "text",
|
|
1585
|
+
icon: X(S(Sn)),
|
|
1586
|
+
class: w(p.$style.configBtn)
|
|
1587
|
+
}, null, 8, ["icon", "class"])
|
|
1588
|
+
]),
|
|
1589
|
+
_: 1
|
|
1590
|
+
}, 8, ["open"]);
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
}), Jr = "_configBtn_1rypj_1", Qr = "_tableConfig_1rypj_8", Kr = "_tableConfigHead_1rypj_11", Zr = "_tableConfigContent_1rypj_14", Xr = "_columnList_1rypj_19", ea = "_columnItem_1rypj_19", ta = "_columnItemContent_1rypj_26", na = "_dragIcon_1rypj_30", ra = "_dragIconDisabled_1rypj_33", aa = "_dragHandle_1rypj_36", oa = "_emptyText_1rypj_39", sa = "_tableConfigFoot_1rypj_43", la = {
|
|
1594
|
+
configBtn: Jr,
|
|
1595
|
+
tableConfig: Qr,
|
|
1596
|
+
tableConfigHead: Kr,
|
|
1597
|
+
tableConfigContent: Zr,
|
|
1598
|
+
columnList: Xr,
|
|
1599
|
+
columnItem: ea,
|
|
1600
|
+
columnItemContent: ta,
|
|
1601
|
+
dragIcon: na,
|
|
1602
|
+
dragIconDisabled: ra,
|
|
1603
|
+
dragHandle: aa,
|
|
1604
|
+
emptyText: oa,
|
|
1605
|
+
tableConfigFoot: sa
|
|
1606
|
+
}, ia = {
|
|
1607
|
+
$style: la
|
|
1608
|
+
}, ua = /* @__PURE__ */ fe(Gr, [["__cssModules", ia]]), ca = /* @__PURE__ */ ie({
|
|
1609
|
+
__name: "DynamicList",
|
|
1610
|
+
props: {
|
|
1611
|
+
/**
|
|
1612
|
+
* 列表数据
|
|
1613
|
+
* @default []
|
|
1614
|
+
*/
|
|
1615
|
+
value: {
|
|
1616
|
+
type: Array,
|
|
1617
|
+
default: () => []
|
|
1618
|
+
},
|
|
1619
|
+
/**
|
|
1620
|
+
* 最大条数
|
|
1621
|
+
* @default 10
|
|
1622
|
+
*/
|
|
1623
|
+
maxLength: {
|
|
1624
|
+
type: Number,
|
|
1625
|
+
default: 10
|
|
1626
|
+
},
|
|
1627
|
+
/**
|
|
1628
|
+
* 组件class
|
|
1629
|
+
* @default ''
|
|
1630
|
+
*/
|
|
1631
|
+
className: {
|
|
1632
|
+
type: String,
|
|
1633
|
+
default: ""
|
|
1634
|
+
},
|
|
1635
|
+
/**
|
|
1636
|
+
* 列表中每一项对应的 class
|
|
1637
|
+
* @default ''
|
|
1638
|
+
*/
|
|
1639
|
+
itemClassName: {
|
|
1640
|
+
type: String,
|
|
1641
|
+
default: ""
|
|
1642
|
+
},
|
|
1643
|
+
/**
|
|
1644
|
+
* 添加按钮属性
|
|
1645
|
+
* @default () => ({})
|
|
1646
|
+
*/
|
|
1647
|
+
addButtonProps: {
|
|
1648
|
+
type: [Object, Function],
|
|
1649
|
+
default: () => ({})
|
|
1650
|
+
},
|
|
1651
|
+
/**
|
|
1652
|
+
* 添加按钮文案
|
|
1653
|
+
* @default '添加数据'
|
|
1654
|
+
*/
|
|
1655
|
+
addButtonText: {
|
|
1656
|
+
type: String,
|
|
1657
|
+
default: "添加数据"
|
|
1658
|
+
},
|
|
1659
|
+
/**
|
|
1660
|
+
* 删除按钮属性
|
|
1661
|
+
* @default () => ({ icon: h(MinusCircleOutlined) })
|
|
1662
|
+
*/
|
|
1663
|
+
deleteButtonProps: {
|
|
1664
|
+
type: [Object, Function],
|
|
1665
|
+
default: () => ({
|
|
1666
|
+
icon: X($t)
|
|
1667
|
+
})
|
|
1668
|
+
},
|
|
1669
|
+
/**
|
|
1670
|
+
* 删除按钮文案
|
|
1671
|
+
* @default ''
|
|
1672
|
+
*/
|
|
1673
|
+
deleteButtonText: {
|
|
1674
|
+
type: String,
|
|
1675
|
+
default: ""
|
|
1676
|
+
},
|
|
1677
|
+
/**
|
|
1678
|
+
* 排序按钮属性
|
|
1679
|
+
* @default () => ({ icon: h(HolderOutlined) })
|
|
1680
|
+
*/
|
|
1681
|
+
sortButtonProps: {
|
|
1682
|
+
type: [Object, Function],
|
|
1683
|
+
default: () => ({
|
|
1684
|
+
icon: X(De)
|
|
1685
|
+
})
|
|
1686
|
+
},
|
|
1687
|
+
/**
|
|
1688
|
+
* 是否开启拖拽排序
|
|
1689
|
+
* @default true
|
|
1690
|
+
*/
|
|
1691
|
+
sortable: {
|
|
1692
|
+
type: Boolean,
|
|
1693
|
+
default: !0
|
|
1694
|
+
},
|
|
1695
|
+
/**
|
|
1696
|
+
* vuedraggable itemKey
|
|
1697
|
+
* @default 'id'
|
|
1698
|
+
*/
|
|
1699
|
+
itemKey: {
|
|
1700
|
+
type: String,
|
|
1701
|
+
default: "id"
|
|
1702
|
+
},
|
|
1703
|
+
/**
|
|
1704
|
+
* 获取新增加的数据默认值
|
|
1705
|
+
* @param {Record<string, any>} item - 当前项数据
|
|
1706
|
+
* @returns {Record<string, any>} 新增项的默认数据
|
|
1707
|
+
* @default () => (item) => item
|
|
1708
|
+
*/
|
|
1709
|
+
getNewItemData: {
|
|
1710
|
+
type: Function,
|
|
1711
|
+
default: () => (r) => r
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
emits: ["update:value", "add", "remove", "change"],
|
|
1715
|
+
setup(r, { emit: e }) {
|
|
1716
|
+
const n = r, t = e, a = pn.useInjectFormItemContext(), o = ee(n.value), s = () => {
|
|
1717
|
+
const v = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
1718
|
+
return Array.from({ length: 16 }).map(() => v[Math.floor(Math.random() * v.length)]).join("");
|
|
1719
|
+
}, i = (v) => {
|
|
1720
|
+
var b;
|
|
1721
|
+
if (o.value.length < n.maxLength) {
|
|
1722
|
+
const f = {
|
|
1723
|
+
id: s(),
|
|
1724
|
+
...((b = n.getNewItemData) == null ? void 0 : b.call(n)) ?? {}
|
|
1725
|
+
};
|
|
1726
|
+
o.value.splice(v + 1, 0, f), t("add", f, v + 1);
|
|
1727
|
+
}
|
|
1728
|
+
}, c = (v) => {
|
|
1729
|
+
o.value.splice(v, 1), t("remove", v);
|
|
1730
|
+
};
|
|
1731
|
+
return be(
|
|
1732
|
+
() => o.value,
|
|
1733
|
+
() => {
|
|
1734
|
+
t("update:value", S(o.value)), t("change", S(o.value)), a.onFieldChange();
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
deep: !0,
|
|
1738
|
+
immediate: !0
|
|
1739
|
+
}
|
|
1740
|
+
), be(
|
|
1741
|
+
() => n.value,
|
|
1742
|
+
() => {
|
|
1743
|
+
o.value = S(n.value);
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
deep: !0,
|
|
1747
|
+
immediate: !0
|
|
1748
|
+
}
|
|
1749
|
+
), (v, b) => {
|
|
1750
|
+
const f = q("a-button");
|
|
1751
|
+
return F(), U(Fe, null, [
|
|
1752
|
+
O(S(yt), {
|
|
1753
|
+
list: o.value,
|
|
1754
|
+
"item-key": r.itemKey,
|
|
1755
|
+
disabled: !r.sortable,
|
|
1756
|
+
handle: ".draggable-icon",
|
|
1757
|
+
class: w([v.$style.dynamicList, r.className])
|
|
1758
|
+
}, {
|
|
1759
|
+
item: $(({ element: d, index: y }) => [
|
|
1760
|
+
J("div", {
|
|
1761
|
+
class: w([v.$style.dynamicListItem, r.itemClassName])
|
|
1762
|
+
}, [
|
|
1763
|
+
J("div", {
|
|
1764
|
+
class: w(v.$style.dynamicListItemContent)
|
|
1765
|
+
}, [
|
|
1766
|
+
pe(v.$slots, "default", {
|
|
1767
|
+
item: d,
|
|
1768
|
+
index: y
|
|
1769
|
+
})
|
|
1770
|
+
], 2),
|
|
1771
|
+
J("div", {
|
|
1772
|
+
class: w(v.$style.actionsIcons)
|
|
1773
|
+
}, [
|
|
1774
|
+
O(f, ae({
|
|
1775
|
+
type: "link",
|
|
1776
|
+
danger: "",
|
|
1777
|
+
size: "small",
|
|
1778
|
+
icon: X(S($t))
|
|
1779
|
+
}, S(Ce)(r.deleteButtonProps) ? r.deleteButtonProps(d, y) : r.deleteButtonProps, {
|
|
1780
|
+
onClick: (x) => c(y)
|
|
1781
|
+
}), {
|
|
1782
|
+
default: $(() => [
|
|
1783
|
+
K(_e(r.deleteButtonText), 1)
|
|
1784
|
+
]),
|
|
1785
|
+
_: 2
|
|
1786
|
+
}, 1040, ["icon", "onClick"]),
|
|
1787
|
+
r.sortable ? (F(), E(f, ae({
|
|
1788
|
+
key: 0,
|
|
1789
|
+
class: ["draggable-icon", v.$style.dragIcon],
|
|
1790
|
+
size: "small",
|
|
1791
|
+
type: "text",
|
|
1792
|
+
icon: X(S(De))
|
|
1793
|
+
}, S(Ce)(r.sortButtonProps) ? r.sortButtonProps(d, y) : r.sortButtonProps), null, 16, ["class", "icon"])) : N("", !0)
|
|
1794
|
+
], 2)
|
|
1795
|
+
], 2)
|
|
1796
|
+
]),
|
|
1797
|
+
_: 3
|
|
1798
|
+
}, 8, ["list", "item-key", "disabled", "class"]),
|
|
1799
|
+
J("div", null, [
|
|
1800
|
+
o.value.length < r.maxLength ? (F(), E(f, ae({
|
|
1801
|
+
key: 0,
|
|
1802
|
+
type: "link",
|
|
1803
|
+
icon: X(S(At))
|
|
1804
|
+
}, S(Ce)(r.addButtonProps) ? r.addButtonProps() : r.addButtonProps, {
|
|
1805
|
+
onClick: b[0] || (b[0] = (d) => i(o.value.length - 1))
|
|
1806
|
+
}), {
|
|
1807
|
+
default: $(() => [
|
|
1808
|
+
K(_e(r.addButtonText), 1)
|
|
1809
|
+
]),
|
|
1810
|
+
_: 1
|
|
1811
|
+
}, 16, ["icon"])) : N("", !0)
|
|
1812
|
+
])
|
|
1813
|
+
], 64);
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
}), da = "_dynamicList_1woe5_1", pa = "_dynamicListItem_1woe5_6", fa = "_dynamicListItemContent_1woe5_13", ma = "_actionsIcons_1woe5_17", ya = "_dragIcon_1woe5_21", ga = {
|
|
1817
|
+
dynamicList: da,
|
|
1818
|
+
dynamicListItem: pa,
|
|
1819
|
+
dynamicListItemContent: fa,
|
|
1820
|
+
actionsIcons: ma,
|
|
1821
|
+
dragIcon: ya
|
|
1822
|
+
}, va = {
|
|
1823
|
+
$style: ga
|
|
1824
|
+
}, ha = /* @__PURE__ */ fe(ca, [["__cssModules", va]]), ba = /* @__PURE__ */ ie({
|
|
1825
|
+
__name: "InputGroup",
|
|
1826
|
+
props: {
|
|
1827
|
+
/**
|
|
1828
|
+
* 输入框的值
|
|
1829
|
+
* @type {object}
|
|
1830
|
+
*/
|
|
1831
|
+
value: {
|
|
1832
|
+
type: Object
|
|
1833
|
+
},
|
|
1834
|
+
/**
|
|
1835
|
+
* 表单项配置
|
|
1836
|
+
* @type {SuperTableFormItem}
|
|
1837
|
+
*/
|
|
1838
|
+
formItem: {
|
|
1839
|
+
type: Object,
|
|
1840
|
+
required: !0
|
|
1841
|
+
},
|
|
1842
|
+
/**
|
|
1843
|
+
* 是否是在弹窗内显示
|
|
1844
|
+
* @type {boolean}
|
|
1845
|
+
* @default false
|
|
1846
|
+
*/
|
|
1847
|
+
inModal: {
|
|
1848
|
+
type: Boolean,
|
|
1849
|
+
default: !1
|
|
1850
|
+
}
|
|
1851
|
+
},
|
|
1852
|
+
emits: ["update:value", "change"],
|
|
1853
|
+
setup(r, { emit: e }) {
|
|
1854
|
+
const n = r, t = e, a = L({
|
|
1855
|
+
get() {
|
|
1856
|
+
return n.value;
|
|
1857
|
+
},
|
|
1858
|
+
set(s) {
|
|
1859
|
+
t("update:value", s), t("change", s);
|
|
1860
|
+
}
|
|
1861
|
+
}), o = L(() => {
|
|
1862
|
+
var i, c;
|
|
1863
|
+
const s = n.inModal ? "30%" : "50%";
|
|
1864
|
+
return ((c = (i = n.formItem.addonSelectProps) == null ? void 0 : i.style) == null ? void 0 : c.width) ?? s;
|
|
1865
|
+
});
|
|
1866
|
+
return (s, i) => {
|
|
1867
|
+
const c = q("a-select"), v = q("a-input"), b = q("a-input-group");
|
|
1868
|
+
return F(), E(b, {
|
|
1869
|
+
compact: "",
|
|
1870
|
+
class: w(s.$style.inputGroup)
|
|
1871
|
+
}, {
|
|
1872
|
+
default: $(() => [
|
|
1873
|
+
O(c, ae({
|
|
1874
|
+
value: a.value.select,
|
|
1875
|
+
"onUpdate:value": i[0] || (i[0] = (f) => a.value.select = f),
|
|
1876
|
+
style: {
|
|
1877
|
+
...S(Xe)(r.formItem, "addonBeforeProps.style", {}),
|
|
1878
|
+
width: o.value
|
|
1879
|
+
}
|
|
1880
|
+
}, S(Mt)(r.formItem.addonBeforeProps, ["style"])), null, 16, ["value", "style"]),
|
|
1881
|
+
O(v, ae({
|
|
1882
|
+
value: a.value.value,
|
|
1883
|
+
"onUpdate:value": i[1] || (i[1] = (f) => a.value.value = f),
|
|
1884
|
+
style: {
|
|
1885
|
+
...S(Xe)(r.formItem, "props.style", {}),
|
|
1886
|
+
width: `calc(100% - ${o.value})`
|
|
1887
|
+
}
|
|
1888
|
+
}, S(xe)(r.formItem, ["props"])), null, 16, ["value", "style"])
|
|
1889
|
+
]),
|
|
1890
|
+
_: 1
|
|
1891
|
+
}, 8, ["class"]);
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
}), _a = "_inputGroup_eukv3_1", Ca = {
|
|
1895
|
+
inputGroup: _a
|
|
1896
|
+
}, $a = {
|
|
1897
|
+
$style: Ca
|
|
1898
|
+
}, wa = /* @__PURE__ */ fe(ba, [["__cssModules", $a]]), We = null, Sa = /* @__PURE__ */ ie({
|
|
1899
|
+
__name: "InputNumberRange",
|
|
1900
|
+
props: {
|
|
1901
|
+
/**
|
|
1902
|
+
* 输入框的值
|
|
1903
|
+
* @type {object}
|
|
1904
|
+
*/
|
|
1905
|
+
value: {
|
|
1906
|
+
type: Array,
|
|
1907
|
+
default: () => []
|
|
1908
|
+
},
|
|
1909
|
+
/**
|
|
1910
|
+
* 表单项配置
|
|
1911
|
+
* @type {SuperTableFormItem}
|
|
1912
|
+
*/
|
|
1913
|
+
formItem: {
|
|
1914
|
+
type: Object,
|
|
1915
|
+
required: !0
|
|
1916
|
+
}
|
|
1917
|
+
},
|
|
1918
|
+
emits: ["update:value"],
|
|
1919
|
+
setup(r, { emit: e }) {
|
|
1920
|
+
const n = r, t = e, a = L({
|
|
1921
|
+
get() {
|
|
1922
|
+
var i;
|
|
1923
|
+
return ((i = n.value) == null ? void 0 : i[0]) ?? We;
|
|
1924
|
+
},
|
|
1925
|
+
set(i) {
|
|
1926
|
+
var c;
|
|
1927
|
+
t("update:value", [i, ((c = n.value) == null ? void 0 : c[1]) ?? We]);
|
|
1928
|
+
}
|
|
1929
|
+
}), o = L({
|
|
1930
|
+
get() {
|
|
1931
|
+
var i;
|
|
1932
|
+
return ((i = n.value) == null ? void 0 : i[1]) ?? We;
|
|
1933
|
+
},
|
|
1934
|
+
set(i) {
|
|
1935
|
+
var c;
|
|
1936
|
+
t("update:value", [((c = n.value) == null ? void 0 : c[0]) ?? We, i]);
|
|
1937
|
+
}
|
|
1938
|
+
}), s = L(() => Mt(n.formItem.props, ["placeholder"]));
|
|
1939
|
+
return (i, c) => {
|
|
1940
|
+
var b, f, d, y;
|
|
1941
|
+
const v = q("a-input-number");
|
|
1942
|
+
return F(), U("div", {
|
|
1943
|
+
class: w([i.$style.inputNumberGroup, "input-number-group"])
|
|
1944
|
+
}, [
|
|
1945
|
+
J("div", {
|
|
1946
|
+
class: w(i.$style.inputNumberGroupContent)
|
|
1947
|
+
}, [
|
|
1948
|
+
O(v, ae(s.value, {
|
|
1949
|
+
value: a.value,
|
|
1950
|
+
"onUpdate:value": c[0] || (c[0] = (x) => a.value = x),
|
|
1951
|
+
class: [i.$style.inputNumber, i.$style.startInputNumber],
|
|
1952
|
+
placeholder: ((f = S(qe)((b = n.formItem.props) == null ? void 0 : b.placeholder)) == null ? void 0 : f[0]) ?? "请输入"
|
|
1953
|
+
}), null, 16, ["value", "class", "placeholder"]),
|
|
1954
|
+
J("span", {
|
|
1955
|
+
class: w(i.$style.divider)
|
|
1956
|
+
}, "~", 2),
|
|
1957
|
+
O(v, ae(s.value, {
|
|
1958
|
+
value: o.value,
|
|
1959
|
+
"onUpdate:value": c[1] || (c[1] = (x) => o.value = x),
|
|
1960
|
+
class: [i.$style.inputNumber, i.$style.endInputNumber],
|
|
1961
|
+
placeholder: ((y = S(qe)((d = n.formItem.props) == null ? void 0 : d.placeholder)) == null ? void 0 : y[1]) ?? "请输入"
|
|
1962
|
+
}), null, 16, ["value", "class", "placeholder"])
|
|
1963
|
+
], 2)
|
|
1964
|
+
], 2);
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
}), Ia = "_inputNumberGroup_149g6_1", Fa = "_inputNumberGroupContent_149g6_4", xa = "_inputNumber_149g6_1", ka = "_startInputNumber_149g6_13", Ta = "_endInputNumber_149g6_21", Oa = "_divider_149g6_29", Pa = {
|
|
1968
|
+
inputNumberGroup: Ia,
|
|
1969
|
+
inputNumberGroupContent: Fa,
|
|
1970
|
+
inputNumber: xa,
|
|
1971
|
+
startInputNumber: ka,
|
|
1972
|
+
endInputNumber: Ta,
|
|
1973
|
+
divider: Oa
|
|
1974
|
+
}, qa = {
|
|
1975
|
+
$style: Pa
|
|
1976
|
+
}, ja = /* @__PURE__ */ fe(Sa, [["__cssModules", qa]]), La = 8, Ea = /* @__PURE__ */ ie({
|
|
1977
|
+
__name: "FormFieldItem",
|
|
1978
|
+
props: {
|
|
1979
|
+
/**
|
|
1980
|
+
* 表单项的值,支持任何类型
|
|
1981
|
+
*/
|
|
1982
|
+
value: {
|
|
1983
|
+
validator() {
|
|
1984
|
+
return !0;
|
|
1985
|
+
}
|
|
1986
|
+
},
|
|
1987
|
+
/**
|
|
1988
|
+
* 表单项配置
|
|
1989
|
+
* @type {SuperTableFormItem}
|
|
1990
|
+
* @default {}
|
|
1991
|
+
*/
|
|
1992
|
+
formItem: {
|
|
1993
|
+
type: Object,
|
|
1994
|
+
require: !0,
|
|
1995
|
+
default: () => ({})
|
|
1996
|
+
},
|
|
1997
|
+
/**
|
|
1998
|
+
* 是否显示标签
|
|
1999
|
+
* @type {boolean}
|
|
2000
|
+
* @default false
|
|
2001
|
+
*/
|
|
2002
|
+
showLabel: {
|
|
2003
|
+
type: Boolean,
|
|
2004
|
+
default: !1
|
|
2005
|
+
},
|
|
2006
|
+
/**
|
|
2007
|
+
* 是否是在弹窗内显示
|
|
2008
|
+
* @type {boolean}
|
|
2009
|
+
* @default false
|
|
2010
|
+
*/
|
|
2011
|
+
inModal: {
|
|
2012
|
+
type: Boolean,
|
|
2013
|
+
default: !1
|
|
2014
|
+
}
|
|
2015
|
+
},
|
|
2016
|
+
emits: ["update:value", "change"],
|
|
2017
|
+
setup(r, { emit: e }) {
|
|
2018
|
+
const n = {
|
|
2019
|
+
[H.input]: bn,
|
|
2020
|
+
[H.inputGroup]: wa,
|
|
2021
|
+
[H.inputNumber]: hn,
|
|
2022
|
+
[H.inputNumberRange]: ja,
|
|
2023
|
+
[H.select]: vn,
|
|
2024
|
+
[H.cascader]: gn,
|
|
2025
|
+
[H.treeSelect]: yn,
|
|
2026
|
+
[H.datePicker]: mn,
|
|
2027
|
+
[H.rangePicker]: fn
|
|
2028
|
+
}, t = r, a = e, o = nn(), s = L({
|
|
2029
|
+
get() {
|
|
2030
|
+
return t.value;
|
|
2031
|
+
},
|
|
2032
|
+
set(d) {
|
|
2033
|
+
a("update:value", d), a("change", d);
|
|
2034
|
+
}
|
|
2035
|
+
}), i = L(() => !t.inModal && t.formItem.showLabel !== !1), c = L(() => {
|
|
2036
|
+
const d = Sr(t.formItem.label);
|
|
2037
|
+
return Math.max(d, 20) + La * 2 + 2;
|
|
2038
|
+
}), v = L(() => {
|
|
2039
|
+
const { type: d, component: y } = t.formItem;
|
|
2040
|
+
return d === "component" ? y : n[d];
|
|
2041
|
+
}), b = L(() => {
|
|
2042
|
+
var g;
|
|
2043
|
+
const d = t.formItem, y = {
|
|
2044
|
+
[H.input]: {
|
|
2045
|
+
placeholder: "请输入",
|
|
2046
|
+
clearable: !0
|
|
2047
|
+
},
|
|
2048
|
+
[H.inputGroup]: {
|
|
2049
|
+
placeholder: "请输入",
|
|
2050
|
+
clearable: !0,
|
|
2051
|
+
formItem: d
|
|
2052
|
+
},
|
|
2053
|
+
[H.inputNumber]: {
|
|
2054
|
+
placeholder: "请输入"
|
|
2055
|
+
},
|
|
2056
|
+
[H.inputNumberRange]: {
|
|
2057
|
+
formItem: d
|
|
2058
|
+
},
|
|
2059
|
+
[H.select]: {
|
|
2060
|
+
placeholder: "请选择",
|
|
2061
|
+
optionFilterProp: "label",
|
|
2062
|
+
destroyedOnClose: !0,
|
|
2063
|
+
allowClear: !0,
|
|
2064
|
+
showSearch: !0,
|
|
2065
|
+
maxTagTextLength: 40,
|
|
2066
|
+
maxTagCount: "responsive"
|
|
2067
|
+
}
|
|
2068
|
+
}, x = {
|
|
2069
|
+
...o,
|
|
2070
|
+
...y[d.type] ?? {},
|
|
2071
|
+
...d.props ?? {},
|
|
2072
|
+
style: {
|
|
2073
|
+
...((g = d.props) == null ? void 0 : g.style) ?? {},
|
|
2074
|
+
width: d.type !== H.component ? "100%" : void 0
|
|
2075
|
+
},
|
|
2076
|
+
inModal: t.inModal
|
|
2077
|
+
};
|
|
2078
|
+
return t.inModal || (i.value && Pe(x, "style.width", `calc(100% - ${c.value}px)`), d.type === H.select && Pe(x, "maxTagCount", "responsive")), x;
|
|
2079
|
+
}), f = L(() => t.formItem.modelPropName ?? "value");
|
|
2080
|
+
return (d, y) => {
|
|
2081
|
+
const x = q("a-input"), g = q("a-input-group");
|
|
2082
|
+
return F(), U("div", {
|
|
2083
|
+
class: w(d.$style.formFieldItem)
|
|
2084
|
+
}, [
|
|
2085
|
+
i.value ? (F(), E(g, {
|
|
2086
|
+
key: 0,
|
|
2087
|
+
compact: "",
|
|
2088
|
+
class: w([d.$style.inputGroup, "super-table-input-group"])
|
|
2089
|
+
}, {
|
|
2090
|
+
default: $(() => [
|
|
2091
|
+
r.inModal ? N("", !0) : (F(), E(x, {
|
|
2092
|
+
key: 0,
|
|
2093
|
+
value: r.formItem.label,
|
|
2094
|
+
disabled: "",
|
|
2095
|
+
style: we({
|
|
2096
|
+
color: S(Se).colorText,
|
|
2097
|
+
width: `${c.value}px`
|
|
2098
|
+
}),
|
|
2099
|
+
class: w([d.$style.formFieldItemLabel, "super-table-filter-form-item-label"])
|
|
2100
|
+
}, null, 8, ["value", "style", "class"])),
|
|
2101
|
+
v.value ? (F(), E(Ke(v.value), ae({
|
|
2102
|
+
key: 1,
|
|
2103
|
+
[f.value]: s.value,
|
|
2104
|
+
["onUpdate:" + f.value]: y[0] || (y[0] = (_) => s.value = _)
|
|
2105
|
+
}, b.value), null, 16)) : N("", !0)
|
|
2106
|
+
]),
|
|
2107
|
+
_: 1
|
|
2108
|
+
}, 8, ["class"])) : (F(), U(Fe, { key: 1 }, [
|
|
2109
|
+
r.formItem.type === S(H).component && r.formItem.showLabel ? (F(), U("span", {
|
|
2110
|
+
key: 0,
|
|
2111
|
+
class: w(d.$style.customItemLabel)
|
|
2112
|
+
}, _e(r.formItem.label), 3)) : N("", !0),
|
|
2113
|
+
(F(), E(Ke(v.value), ae({
|
|
2114
|
+
[f.value]: s.value,
|
|
2115
|
+
["onUpdate:" + f.value]: y[1] || (y[1] = (_) => s.value = _)
|
|
2116
|
+
}, b.value), null, 16))
|
|
2117
|
+
], 64))
|
|
2118
|
+
], 2);
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
}), Aa = "_formFieldItem_1imun_1", Ma = "_inputGroup_1imun_7", Na = "_formFieldItemLabel_1imun_11", Da = "_customItemLabel_1imun_20", Ba = {
|
|
2122
|
+
formFieldItem: Aa,
|
|
2123
|
+
inputGroup: Ma,
|
|
2124
|
+
formFieldItemLabel: Na,
|
|
2125
|
+
customItemLabel: Da
|
|
2126
|
+
}, Ra = {
|
|
2127
|
+
$style: Ba
|
|
2128
|
+
}, Wt = /* @__PURE__ */ fe(Ea, [["__cssModules", Ra]]), Va = /* @__PURE__ */ ie({
|
|
2129
|
+
__name: "SceneConfigModal",
|
|
2130
|
+
props: {
|
|
2131
|
+
// 当前编辑的场景
|
|
2132
|
+
currentScene: {
|
|
2133
|
+
type: Object,
|
|
2134
|
+
default: null
|
|
2135
|
+
},
|
|
2136
|
+
formConfigMap: {
|
|
2137
|
+
type: Object,
|
|
2138
|
+
default: () => ({}),
|
|
2139
|
+
required: !0
|
|
2140
|
+
},
|
|
2141
|
+
// 选择的查询条件列表
|
|
2142
|
+
selectedFormItems: {
|
|
2143
|
+
type: Array,
|
|
2144
|
+
default: () => []
|
|
2145
|
+
},
|
|
2146
|
+
// 弹窗操作类型 新增、更新、设置查询条件
|
|
2147
|
+
actionType: {
|
|
2148
|
+
type: String,
|
|
2149
|
+
default: ce.create
|
|
2150
|
+
},
|
|
2151
|
+
// 是否允许新增
|
|
2152
|
+
allowCreateScene: {
|
|
2153
|
+
type: Boolean,
|
|
2154
|
+
default: !0
|
|
2155
|
+
},
|
|
2156
|
+
// 新增场景
|
|
2157
|
+
onCreate: {
|
|
2158
|
+
type: Function,
|
|
2159
|
+
required: !0
|
|
2160
|
+
},
|
|
2161
|
+
// 更新场景
|
|
2162
|
+
onUpdate: {
|
|
2163
|
+
type: Function,
|
|
2164
|
+
required: !0
|
|
2165
|
+
}
|
|
2166
|
+
},
|
|
2167
|
+
emits: ["cancel", "search", "form-item-change", "update-form-config"],
|
|
2168
|
+
setup(r, { expose: e, emit: n }) {
|
|
2169
|
+
var D, Ve;
|
|
2170
|
+
const t = r, a = n, o = ee(Ge(t.formConfigMap)), s = L(() => lt(
|
|
2171
|
+
Object.values(o.value).filter(({ visible: k }) => k !== !1),
|
|
2172
|
+
ge.order
|
|
2173
|
+
)), i = ["name", "value", "type"], c = s.value.filter((k) => k._selected).map((k) => xe(k, i)), v = ee(!0), b = ee(!1), f = ee(), d = Ze({
|
|
2174
|
+
name: ((D = t.currentScene) == null ? void 0 : D.name) ?? "",
|
|
2175
|
+
items: t.actionType === ce.search ? c : Ge(((Ve = t.currentScene) == null ? void 0 : Ve.items) ?? [])
|
|
2176
|
+
}), y = Ze({
|
|
2177
|
+
name: [
|
|
2178
|
+
{
|
|
2179
|
+
required: !0,
|
|
2180
|
+
message: "请输入场景名称"
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
min: 2,
|
|
2184
|
+
max: 30,
|
|
2185
|
+
message: "场景名称长度 2 到 30"
|
|
2186
|
+
}
|
|
2187
|
+
],
|
|
2188
|
+
items: [
|
|
2189
|
+
{
|
|
2190
|
+
required: !0,
|
|
2191
|
+
message: "请添加筛选条件",
|
|
2192
|
+
type: "array"
|
|
2193
|
+
}
|
|
2194
|
+
]
|
|
2195
|
+
}), x = L(() => d.items.map(({ name: k }) => k)), g = () => {
|
|
2196
|
+
const k = s.value.find((T) => !x.value.includes(T.name));
|
|
2197
|
+
return k ? xe(Ge(k), i) : {};
|
|
2198
|
+
}, _ = L(() => ({
|
|
2199
|
+
[ce.create]: "新建场景",
|
|
2200
|
+
[ce.update]: "更新场景",
|
|
2201
|
+
[ce.search]: "高级筛选"
|
|
2202
|
+
})[t.actionType]), p = (k, T) => {
|
|
2203
|
+
const M = t.formConfigMap[T.name];
|
|
2204
|
+
M && (T.type = M.type, T.value = M.value, T.label = M.label, C(T.name, T.value));
|
|
2205
|
+
}, I = (k) => {
|
|
2206
|
+
const T = t.formConfigMap[k], M = d.items.map((re) => re.name), W = s.value.filter((re) => !M.includes(re.name));
|
|
2207
|
+
return [T, ...W];
|
|
2208
|
+
}, C = (k, T) => {
|
|
2209
|
+
const M = d.items.reduce(
|
|
2210
|
+
(W, re) => (W[re.name] = re.value, W),
|
|
2211
|
+
{}
|
|
2212
|
+
);
|
|
2213
|
+
a("form-item-change", k, T, M);
|
|
2214
|
+
}, m = ({ name: k, value: T }) => {
|
|
2215
|
+
C(k, T);
|
|
2216
|
+
}, V = async () => {
|
|
2217
|
+
var M;
|
|
2218
|
+
const k = d.items.map((W, re) => {
|
|
2219
|
+
const de = o.value[W.name];
|
|
2220
|
+
return de && (de.value = W.value, de[ge.orderInScene] = re, de[ge.selected] = !0), de;
|
|
2221
|
+
}).filter(Boolean);
|
|
2222
|
+
if (t.actionType === ce.search && !b.value) {
|
|
2223
|
+
a("update-form-config", k), a("search", d.items, k), a("cancel");
|
|
2224
|
+
return;
|
|
2225
|
+
}
|
|
2226
|
+
await ((M = f.value) == null ? void 0 : M.validateFields());
|
|
2227
|
+
const T = he(d);
|
|
2228
|
+
t.currentScene ? await t.onUpdate({
|
|
2229
|
+
...t.currentScene,
|
|
2230
|
+
...T
|
|
2231
|
+
}) : await t.onCreate(T), a("update-form-config", k), a("cancel");
|
|
2232
|
+
};
|
|
2233
|
+
(() => {
|
|
2234
|
+
if (d.items.length) return;
|
|
2235
|
+
const k = On(
|
|
2236
|
+
s.value.filter(({ fixed: M, selected: W }) => M || W),
|
|
2237
|
+
"name"
|
|
2238
|
+
);
|
|
2239
|
+
if (k.length) {
|
|
2240
|
+
d.items = lt(k, "_order").map((M) => xe(M, i)), console.log("formState.items", d.items);
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
const T = g();
|
|
2244
|
+
T && d.items.push(T);
|
|
2245
|
+
})();
|
|
2246
|
+
const te = (k) => {
|
|
2247
|
+
var T;
|
|
2248
|
+
return {
|
|
2249
|
+
disabled: (T = o.value[k.name]) == null ? void 0 : T.fixed
|
|
2250
|
+
};
|
|
2251
|
+
}, B = (k) => o.value[k], ue = (k, T, M) => {
|
|
2252
|
+
if (Bt.includes(T))
|
|
2253
|
+
return $e("setFormItem error,", `form item with prop "${k}" is readonly`);
|
|
2254
|
+
if (!B(k))
|
|
2255
|
+
return $e("setFormItem error,", `Cannot find form item with name "${k}"`);
|
|
2256
|
+
if (T === "visible" && o.value[k].fixed)
|
|
2257
|
+
return $e("setFormItem error,", "Cannot change the visible of a fixed form item");
|
|
2258
|
+
Pe(o.value, `${k}.${T}`, M), o.value[k].visible || (d.items = d.items.filter((W) => W.name !== k));
|
|
2259
|
+
}, ke = (k) => {
|
|
2260
|
+
var T;
|
|
2261
|
+
return (T = d.items.find((M) => M.name === k)) == null ? void 0 : T.value;
|
|
2262
|
+
}, ve = (k, T) => {
|
|
2263
|
+
const M = d.items.find((W) => W.name === k);
|
|
2264
|
+
M && (M.value = T);
|
|
2265
|
+
}, oe = (k) => {
|
|
2266
|
+
Object.entries(k).forEach(([T, M]) => {
|
|
2267
|
+
ve(T, M);
|
|
2268
|
+
});
|
|
2269
|
+
};
|
|
2270
|
+
function ne(k) {
|
|
2271
|
+
return (k ? qe(k) : d.items.map((M) => M.name)).reduce(
|
|
2272
|
+
(M, W) => {
|
|
2273
|
+
const re = d.items.find((de) => de.name === W);
|
|
2274
|
+
return re && (M[W] = re.value), M;
|
|
2275
|
+
},
|
|
2276
|
+
{}
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
return e({
|
|
2280
|
+
getFormItem: B,
|
|
2281
|
+
setFormItem: ue,
|
|
2282
|
+
getFormValues: ne,
|
|
2283
|
+
setFormValues: oe,
|
|
2284
|
+
getFormValue: ke,
|
|
2285
|
+
setFormValue: ve
|
|
2286
|
+
}), (k, T) => {
|
|
2287
|
+
const M = q("a-input"), W = q("a-form-item"), re = q("a-select"), de = q("a-form"), tt = q("a-checkbox"), Te = q("a-modal");
|
|
2288
|
+
return F(), E(Te, {
|
|
2289
|
+
open: v.value,
|
|
2290
|
+
"onUpdate:open": T[3] || (T[3] = (Q) => v.value = Q),
|
|
2291
|
+
title: _.value,
|
|
2292
|
+
width: 720,
|
|
2293
|
+
"body-style": {
|
|
2294
|
+
maxHeight: "70vh",
|
|
2295
|
+
overflow: "auto"
|
|
2296
|
+
},
|
|
2297
|
+
onOk: V,
|
|
2298
|
+
onCancel: T[4] || (T[4] = (Q) => a("cancel"))
|
|
2299
|
+
}, {
|
|
2300
|
+
default: $(() => [
|
|
2301
|
+
O(de, {
|
|
2302
|
+
ref_key: "formRef",
|
|
2303
|
+
ref: f,
|
|
2304
|
+
model: d,
|
|
2305
|
+
rules: y,
|
|
2306
|
+
class: w(k.$style.sceneForm)
|
|
2307
|
+
}, {
|
|
2308
|
+
default: $(() => [
|
|
2309
|
+
r.actionType !== S(ce).search || b.value ? (F(), E(W, {
|
|
2310
|
+
key: 0,
|
|
2311
|
+
label: "场景名称",
|
|
2312
|
+
name: "name",
|
|
2313
|
+
"label-col": { span: 24 },
|
|
2314
|
+
"wrapper-col": { span: 12 }
|
|
2315
|
+
}, {
|
|
2316
|
+
default: $(() => [
|
|
2317
|
+
O(M, {
|
|
2318
|
+
value: d.name,
|
|
2319
|
+
"onUpdate:value": T[0] || (T[0] = (Q) => d.name = Q),
|
|
2320
|
+
placeholder: "请输入"
|
|
2321
|
+
}, null, 8, ["value"])
|
|
2322
|
+
]),
|
|
2323
|
+
_: 1
|
|
2324
|
+
})) : N("", !0),
|
|
2325
|
+
O(W, {
|
|
2326
|
+
label: "筛选条件",
|
|
2327
|
+
name: "items",
|
|
2328
|
+
"label-col": { span: 24 },
|
|
2329
|
+
"wrapper-col": { span: 24 }
|
|
2330
|
+
}, {
|
|
2331
|
+
default: $(() => [
|
|
2332
|
+
O(ha, {
|
|
2333
|
+
value: d.items,
|
|
2334
|
+
"onUpdate:value": T[1] || (T[1] = (Q) => d.items = Q),
|
|
2335
|
+
"add-button-text": "添加筛选条件",
|
|
2336
|
+
"get-new-item-data": g,
|
|
2337
|
+
"max-length": s.value.length,
|
|
2338
|
+
"delete-button-props": te,
|
|
2339
|
+
onAdd: m
|
|
2340
|
+
}, {
|
|
2341
|
+
default: $(({ item: Q }) => [
|
|
2342
|
+
J("div", {
|
|
2343
|
+
class: w(k.$style.queryFieldItem)
|
|
2344
|
+
}, [
|
|
2345
|
+
O(re, {
|
|
2346
|
+
value: Q.name,
|
|
2347
|
+
"onUpdate:value": (me) => Q.name = me,
|
|
2348
|
+
"show-search": "",
|
|
2349
|
+
options: I(Q.name),
|
|
2350
|
+
"field-names": { value: "name" },
|
|
2351
|
+
"option-filter-prop": "label",
|
|
2352
|
+
placeholder: "请选择要筛选的字段名",
|
|
2353
|
+
class: w(k.$style.fieldSelect),
|
|
2354
|
+
onChange: (me) => p(me, Q)
|
|
2355
|
+
}, null, 8, ["value", "onUpdate:value", "options", "class", "onChange"]),
|
|
2356
|
+
J("div", {
|
|
2357
|
+
class: w(k.$style.fieldComponent)
|
|
2358
|
+
}, [
|
|
2359
|
+
Q.name ? (F(), E(Wt, {
|
|
2360
|
+
key: 0,
|
|
2361
|
+
value: Q.value,
|
|
2362
|
+
"onUpdate:value": (me) => Q.value = me,
|
|
2363
|
+
"in-modal": "",
|
|
2364
|
+
"form-item": o.value[Q.name],
|
|
2365
|
+
onChange: (me) => C(Q.name, me)
|
|
2366
|
+
}, null, 8, ["value", "onUpdate:value", "form-item", "onChange"])) : N("", !0)
|
|
2367
|
+
], 2)
|
|
2368
|
+
], 2)
|
|
2369
|
+
]),
|
|
2370
|
+
_: 1
|
|
2371
|
+
}, 8, ["value", "max-length"])
|
|
2372
|
+
]),
|
|
2373
|
+
_: 1
|
|
2374
|
+
})
|
|
2375
|
+
]),
|
|
2376
|
+
_: 1
|
|
2377
|
+
}, 8, ["model", "rules", "class"]),
|
|
2378
|
+
r.actionType === S(ce).search && r.allowCreateScene ? (F(), E(tt, {
|
|
2379
|
+
key: 0,
|
|
2380
|
+
checked: b.value,
|
|
2381
|
+
"onUpdate:checked": T[2] || (T[2] = (Q) => b.value = Q)
|
|
2382
|
+
}, {
|
|
2383
|
+
default: $(() => T[5] || (T[5] = [
|
|
2384
|
+
K(" 保存为场景 ")
|
|
2385
|
+
])),
|
|
2386
|
+
_: 1
|
|
2387
|
+
}, 8, ["checked"])) : N("", !0)
|
|
2388
|
+
]),
|
|
2389
|
+
_: 1
|
|
2390
|
+
}, 8, ["open", "title"]);
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
}), Ya = "_sceneForm_njdgy_1", Ha = "_queryFieldItem_njdgy_1", Ua = "_fieldSelect_njdgy_7", Wa = "_fieldComponent_njdgy_10", za = {
|
|
2394
|
+
sceneForm: Ya,
|
|
2395
|
+
queryFieldItem: Ha,
|
|
2396
|
+
fieldSelect: Ua,
|
|
2397
|
+
fieldComponent: Wa
|
|
2398
|
+
}, Ga = {
|
|
2399
|
+
$style: za
|
|
2400
|
+
}, Ja = /* @__PURE__ */ fe(Va, [["__cssModules", Ga]]), Qa = /* @__PURE__ */ ie({
|
|
2401
|
+
__name: "SceneListModal",
|
|
2402
|
+
props: {
|
|
2403
|
+
/**
|
|
2404
|
+
* 场景列表数据
|
|
2405
|
+
* @type {SuperTableQueryScene[]}
|
|
2406
|
+
*/
|
|
2407
|
+
list: {
|
|
2408
|
+
type: Array,
|
|
2409
|
+
required: !0
|
|
2410
|
+
},
|
|
2411
|
+
/**
|
|
2412
|
+
* 是否允许新增场景
|
|
2413
|
+
* @type {boolean}
|
|
2414
|
+
* @default true
|
|
2415
|
+
*/
|
|
2416
|
+
allowCreateScene: {
|
|
2417
|
+
type: Boolean,
|
|
2418
|
+
default: !0
|
|
2419
|
+
},
|
|
2420
|
+
/**
|
|
2421
|
+
* 删除场景的回调函数
|
|
2422
|
+
* @param {string} sceneCode - 场景代码
|
|
2423
|
+
* @returns {Promise<boolean>} 删除操作的结果
|
|
2424
|
+
*/
|
|
2425
|
+
onDelete: {
|
|
2426
|
+
type: Function,
|
|
2427
|
+
required: !0
|
|
2428
|
+
},
|
|
2429
|
+
/**
|
|
2430
|
+
* 排序场景的回调函数
|
|
2431
|
+
* @param {SuperTableQueryScene[]} list - 排序后的场景列表
|
|
2432
|
+
* @returns {Promise<void>}
|
|
2433
|
+
*/
|
|
2434
|
+
onSort: {
|
|
2435
|
+
type: Function,
|
|
2436
|
+
required: !0
|
|
2437
|
+
}
|
|
2438
|
+
},
|
|
2439
|
+
emits: ["cancel", "create", "update", "delete", "sort"],
|
|
2440
|
+
setup(r, { emit: e }) {
|
|
2441
|
+
const n = r, t = e, a = ee(n.list), o = ee(!0), s = () => t("cancel"), i = async (f) => {
|
|
2442
|
+
await n.onDelete(f), a.value = a.value.filter((d) => d.code !== f);
|
|
2443
|
+
}, c = () => {
|
|
2444
|
+
s(), t("create");
|
|
2445
|
+
}, v = (f) => {
|
|
2446
|
+
s(), t("update", f);
|
|
2447
|
+
}, b = () => {
|
|
2448
|
+
t(
|
|
2449
|
+
"sort",
|
|
2450
|
+
a.value.map(({ code: f }) => f)
|
|
2451
|
+
);
|
|
2452
|
+
};
|
|
2453
|
+
return (f, d) => {
|
|
2454
|
+
const y = q("a-col"), x = q("a-row"), g = q("a-typography-text"), _ = q("a-button"), p = q("a-popconfirm"), I = q("a-empty"), C = q("a-modal");
|
|
2455
|
+
return F(), E(C, {
|
|
2456
|
+
open: o.value,
|
|
2457
|
+
"onUpdate:open": d[0] || (d[0] = (m) => o.value = m),
|
|
2458
|
+
title: "场景管理",
|
|
2459
|
+
width: 720,
|
|
2460
|
+
footer: null,
|
|
2461
|
+
onCancel: s
|
|
2462
|
+
}, {
|
|
2463
|
+
default: $(() => [
|
|
2464
|
+
J("div", {
|
|
2465
|
+
class: w(f.$style.sceneList)
|
|
2466
|
+
}, [
|
|
2467
|
+
O(x, {
|
|
2468
|
+
class: w(f.$style.sceneListHead)
|
|
2469
|
+
}, {
|
|
2470
|
+
default: $(() => [
|
|
2471
|
+
O(y, {
|
|
2472
|
+
span: 16,
|
|
2473
|
+
class: w(f.$style.col)
|
|
2474
|
+
}, {
|
|
2475
|
+
default: $(() => d[1] || (d[1] = [
|
|
2476
|
+
K(" 场景名称 ")
|
|
2477
|
+
])),
|
|
2478
|
+
_: 1
|
|
2479
|
+
}, 8, ["class"]),
|
|
2480
|
+
O(y, {
|
|
2481
|
+
span: 8,
|
|
2482
|
+
class: w(f.$style.col)
|
|
2483
|
+
}, {
|
|
2484
|
+
default: $(() => d[2] || (d[2] = [
|
|
2485
|
+
K(" 操作 ")
|
|
2486
|
+
])),
|
|
2487
|
+
_: 1
|
|
2488
|
+
}, 8, ["class"])
|
|
2489
|
+
]),
|
|
2490
|
+
_: 1
|
|
2491
|
+
}, 8, ["class"]),
|
|
2492
|
+
a.value.length ? (F(), E(S(yt), {
|
|
2493
|
+
key: 0,
|
|
2494
|
+
list: a.value,
|
|
2495
|
+
"item-key": "id",
|
|
2496
|
+
handle: ".table-column-draggable-icon",
|
|
2497
|
+
onChange: b
|
|
2498
|
+
}, {
|
|
2499
|
+
item: $(({ element: m }) => [
|
|
2500
|
+
O(x, {
|
|
2501
|
+
class: w(f.$style.sceneListItem)
|
|
2502
|
+
}, {
|
|
2503
|
+
default: $(() => [
|
|
2504
|
+
O(y, {
|
|
2505
|
+
span: 16,
|
|
2506
|
+
class: w(f.$style.col)
|
|
2507
|
+
}, {
|
|
2508
|
+
default: $(() => [
|
|
2509
|
+
O(g, {
|
|
2510
|
+
ellipsis: { tooltip: m.name },
|
|
2511
|
+
content: m.name
|
|
2512
|
+
}, null, 8, ["ellipsis", "content"])
|
|
2513
|
+
]),
|
|
2514
|
+
_: 2
|
|
2515
|
+
}, 1032, ["class"]),
|
|
2516
|
+
O(y, {
|
|
2517
|
+
span: 8,
|
|
2518
|
+
class: w(f.$style.col)
|
|
2519
|
+
}, {
|
|
2520
|
+
default: $(() => [
|
|
2521
|
+
O(_, {
|
|
2522
|
+
type: "link",
|
|
2523
|
+
size: "small",
|
|
2524
|
+
onClick: (V) => v(m)
|
|
2525
|
+
}, {
|
|
2526
|
+
default: $(() => d[3] || (d[3] = [
|
|
2527
|
+
K(" 编辑 ")
|
|
2528
|
+
])),
|
|
2529
|
+
_: 2
|
|
2530
|
+
}, 1032, ["onClick"]),
|
|
2531
|
+
O(p, {
|
|
2532
|
+
title: "确定删除?",
|
|
2533
|
+
onConfirm: (V) => i(m.code)
|
|
2534
|
+
}, {
|
|
2535
|
+
default: $(() => [
|
|
2536
|
+
O(_, {
|
|
2537
|
+
type: "link",
|
|
2538
|
+
size: "small",
|
|
2539
|
+
danger: ""
|
|
2540
|
+
}, {
|
|
2541
|
+
default: $(() => d[4] || (d[4] = [
|
|
2542
|
+
K(" 删除 ")
|
|
2543
|
+
])),
|
|
2544
|
+
_: 1
|
|
2545
|
+
})
|
|
2546
|
+
]),
|
|
2547
|
+
_: 2
|
|
2548
|
+
}, 1032, ["onConfirm"]),
|
|
2549
|
+
O(_, {
|
|
2550
|
+
type: "text",
|
|
2551
|
+
size: "small",
|
|
2552
|
+
icon: X(S(De)),
|
|
2553
|
+
class: w(["table-column-draggable-icon", f.$style.dragIcon])
|
|
2554
|
+
}, null, 8, ["icon", "class"])
|
|
2555
|
+
]),
|
|
2556
|
+
_: 2
|
|
2557
|
+
}, 1032, ["class"])
|
|
2558
|
+
]),
|
|
2559
|
+
_: 2
|
|
2560
|
+
}, 1032, ["class"])
|
|
2561
|
+
]),
|
|
2562
|
+
_: 1
|
|
2563
|
+
}, 8, ["list"])) : (F(), E(I, {
|
|
2564
|
+
key: 1,
|
|
2565
|
+
image: S(_n).PRESENTED_IMAGE_SIMPLE
|
|
2566
|
+
}, null, 8, ["image"]))
|
|
2567
|
+
], 2),
|
|
2568
|
+
r.allowCreateScene ? (F(), E(_, {
|
|
2569
|
+
key: 0,
|
|
2570
|
+
type: "link",
|
|
2571
|
+
icon: X(S(At)),
|
|
2572
|
+
onClick: c
|
|
2573
|
+
}, {
|
|
2574
|
+
default: $(() => d[5] || (d[5] = [
|
|
2575
|
+
K(" 新建场景 ")
|
|
2576
|
+
])),
|
|
2577
|
+
_: 1
|
|
2578
|
+
}, 8, ["icon"])) : N("", !0)
|
|
2579
|
+
]),
|
|
2580
|
+
_: 1
|
|
2581
|
+
}, 8, ["open"]);
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
}), Ka = "_sceneList_3nrgr_1", Za = "_sceneListHead_3nrgr_5", Xa = "_sceneListItem_3nrgr_8", eo = "_col_3nrgr_16", to = "_dragIcon_3nrgr_20", no = {
|
|
2585
|
+
sceneList: Ka,
|
|
2586
|
+
sceneListHead: Za,
|
|
2587
|
+
sceneListItem: Xa,
|
|
2588
|
+
col: eo,
|
|
2589
|
+
dragIcon: to
|
|
2590
|
+
}, ro = {
|
|
2591
|
+
$style: no
|
|
2592
|
+
}, ao = /* @__PURE__ */ fe(Qa, [["__cssModules", ro]]), oo = /* @__PURE__ */ ie({
|
|
2593
|
+
__name: "FormSearchParams",
|
|
2594
|
+
props: {
|
|
2595
|
+
/**
|
|
2596
|
+
* 查询条件配置映射表
|
|
2597
|
+
* @type {Record<string, SuperTableFormItem>}
|
|
2598
|
+
* @default {}
|
|
2599
|
+
*/
|
|
2600
|
+
formConfigMap: {
|
|
2601
|
+
type: Object,
|
|
2602
|
+
required: !0,
|
|
2603
|
+
default: () => ({})
|
|
2604
|
+
},
|
|
2605
|
+
/** 查询条件列数 */
|
|
2606
|
+
formItemColSpan: {
|
|
2607
|
+
type: Number,
|
|
2608
|
+
default: 6
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
emits: ["form-item-change"],
|
|
2612
|
+
setup(r, { emit: e }) {
|
|
2613
|
+
const n = r, t = e, a = L(() => lt(
|
|
2614
|
+
Object.values(n.formConfigMap).filter((c) => c[ge.selected]),
|
|
2615
|
+
ge.orderInScene
|
|
2616
|
+
)), o = (c, v) => {
|
|
2617
|
+
t("form-item-change", c, v);
|
|
2618
|
+
}, s = mt(o, 500), i = (c, v) => {
|
|
2619
|
+
[
|
|
2620
|
+
H.input,
|
|
2621
|
+
H.inputNumber,
|
|
2622
|
+
H.inputGroup,
|
|
2623
|
+
H.inputNumberRange
|
|
2624
|
+
].includes(n.formConfigMap[c].type) ? s(c, v) : o(c, v);
|
|
2625
|
+
};
|
|
2626
|
+
return (c, v) => {
|
|
2627
|
+
const b = q("a-col"), f = q("a-row");
|
|
2628
|
+
return F(), E(f, {
|
|
2629
|
+
gutter: [8, 8],
|
|
2630
|
+
class: w(c.$style.searchParams)
|
|
2631
|
+
}, {
|
|
2632
|
+
default: $(() => [
|
|
2633
|
+
(F(!0), U(Fe, null, st(a.value, (d) => (F(), E(b, {
|
|
2634
|
+
key: d.name,
|
|
2635
|
+
span: (r.formConfigMap[d.name].span ?? 1) * r.formItemColSpan
|
|
2636
|
+
}, {
|
|
2637
|
+
default: $(() => [
|
|
2638
|
+
O(Wt, {
|
|
2639
|
+
value: r.formConfigMap[d.name].value,
|
|
2640
|
+
"form-item": r.formConfigMap[d.name],
|
|
2641
|
+
onChange: (y) => i(d.name, y)
|
|
2642
|
+
}, null, 8, ["value", "form-item", "onChange"])
|
|
2643
|
+
]),
|
|
2644
|
+
_: 2
|
|
2645
|
+
}, 1032, ["span"]))), 128))
|
|
2646
|
+
]),
|
|
2647
|
+
_: 1
|
|
2648
|
+
}, 8, ["class"]);
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
}), so = "_searchParams_1vdwi_1", lo = {
|
|
2652
|
+
searchParams: so
|
|
2653
|
+
}, io = {
|
|
2654
|
+
$style: lo
|
|
2655
|
+
}, uo = /* @__PURE__ */ fe(oo, [["__cssModules", io]]);
|
|
2656
|
+
Be.locale("zh-cn");
|
|
2657
|
+
function qt(r) {
|
|
2658
|
+
return Array.from(document.body.children).includes(r);
|
|
2659
|
+
}
|
|
2660
|
+
class co {
|
|
2661
|
+
constructor(e = {}) {
|
|
2662
|
+
Ee(this, "currents");
|
|
2663
|
+
Ee(this, "dialogs");
|
|
2664
|
+
Ee(this, "staticDialogs");
|
|
2665
|
+
Ee(this, "rootVm");
|
|
2666
|
+
this.currents = [], this.dialogs = {}, this.staticDialogs = e, this.rootVm = null;
|
|
2667
|
+
}
|
|
2668
|
+
// 设置rootVm
|
|
2669
|
+
setRootVm(e) {
|
|
2670
|
+
this.rootVm = e;
|
|
2671
|
+
}
|
|
2672
|
+
// 注册dialog
|
|
2673
|
+
register(e, n) {
|
|
2674
|
+
this.dialogs[e] || (this.dialogs[e] = ie(n));
|
|
2675
|
+
}
|
|
2676
|
+
// 注销dialog
|
|
2677
|
+
unregister(e) {
|
|
2678
|
+
this.dialogs[e] && delete this.dialogs[e];
|
|
2679
|
+
}
|
|
2680
|
+
// 打开dialog
|
|
2681
|
+
open(e, n) {
|
|
2682
|
+
const { props: t, onCreated: a, onMounted: o } = n || {}, s = this.staticDialogs[e] || this.dialogs[e] || null;
|
|
2683
|
+
if (!s) {
|
|
2684
|
+
console.error(`Dialog "${e}" is not existing, please register it firstly.`);
|
|
2685
|
+
return;
|
|
2686
|
+
}
|
|
2687
|
+
const i = document.createElement("div"), c = `dialog_${Pn()}`;
|
|
2688
|
+
i.setAttribute("id", c), document.body.appendChild(i);
|
|
2689
|
+
const v = rn({
|
|
2690
|
+
data() {
|
|
2691
|
+
return {
|
|
2692
|
+
open: !0
|
|
2693
|
+
};
|
|
2694
|
+
},
|
|
2695
|
+
render() {
|
|
2696
|
+
return X(
|
|
2697
|
+
Cn,
|
|
2698
|
+
{
|
|
2699
|
+
key: c,
|
|
2700
|
+
locale: Dt
|
|
2701
|
+
},
|
|
2702
|
+
() => [
|
|
2703
|
+
X(s, {
|
|
2704
|
+
key: c,
|
|
2705
|
+
destroyOnClose: !0,
|
|
2706
|
+
...t,
|
|
2707
|
+
open: this.open,
|
|
2708
|
+
onCancel: () => {
|
|
2709
|
+
var f;
|
|
2710
|
+
this.open = !1, (f = t == null ? void 0 : t.onCancel) == null || f.call(t);
|
|
2711
|
+
}
|
|
2712
|
+
})
|
|
2713
|
+
]
|
|
2714
|
+
);
|
|
2715
|
+
}
|
|
2716
|
+
}).use(cn);
|
|
2717
|
+
a == null || a(v);
|
|
2718
|
+
const b = v.mount(`#${c}`);
|
|
2719
|
+
return o == null || o(b), b.$watch("open", (f) => {
|
|
2720
|
+
f || this.destroy();
|
|
2721
|
+
}), this.currents.push(v), v;
|
|
2722
|
+
}
|
|
2723
|
+
// 关闭dialog
|
|
2724
|
+
close() {
|
|
2725
|
+
var n;
|
|
2726
|
+
const e = [...this.currents].pop();
|
|
2727
|
+
e && ((n = e._instance) != null && n.data.open) && (e._instance.data.open = !1);
|
|
2728
|
+
}
|
|
2729
|
+
// 销毁dialog
|
|
2730
|
+
destroy() {
|
|
2731
|
+
var n, t, a;
|
|
2732
|
+
const e = this.currents.pop();
|
|
2733
|
+
if (e) {
|
|
2734
|
+
const o = qt((n = e._instance) == null ? void 0 : n.vnode.el) ? (t = e._instance) == null ? void 0 : t.vnode.el : (a = e._instance) == null ? void 0 : a.vnode.el.parentElement;
|
|
2735
|
+
qt(o) && document.body.removeChild(o), e.unmount();
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
const Ae = new co();
|
|
2740
|
+
function jt(r, e) {
|
|
2741
|
+
const n = Symbol("dialog");
|
|
2742
|
+
Ae.register(n, r);
|
|
2743
|
+
function t() {
|
|
2744
|
+
Ae.open(n, S(e));
|
|
2745
|
+
}
|
|
2746
|
+
function a() {
|
|
2747
|
+
Ae.close();
|
|
2748
|
+
}
|
|
2749
|
+
function o(s) {
|
|
2750
|
+
Ae.open(n, s);
|
|
2751
|
+
}
|
|
2752
|
+
return an(() => {
|
|
2753
|
+
Ae.unregister(n);
|
|
2754
|
+
}), {
|
|
2755
|
+
open: t,
|
|
2756
|
+
close: a,
|
|
2757
|
+
openByConfig: o
|
|
2758
|
+
};
|
|
2759
|
+
}
|
|
2760
|
+
const ze = 2e3, po = (r) => {
|
|
2761
|
+
const { getScenes: e, setScenes: n } = r;
|
|
2762
|
+
return {
|
|
2763
|
+
querySceneList: async (t) => {
|
|
2764
|
+
const a = e(), o = t.type ? a.filter((s) => s.type === t.type) : a;
|
|
2765
|
+
return {
|
|
2766
|
+
code: ze,
|
|
2767
|
+
data: o,
|
|
2768
|
+
msg: "success"
|
|
2769
|
+
};
|
|
2770
|
+
},
|
|
2771
|
+
createScene: async (t) => {
|
|
2772
|
+
const a = e(), o = Ut(Math.random().toString());
|
|
2773
|
+
return a.push({ ...t, code: o }), n(a), {
|
|
2774
|
+
code: ze,
|
|
2775
|
+
data: o,
|
|
2776
|
+
msg: "success"
|
|
2777
|
+
};
|
|
2778
|
+
},
|
|
2779
|
+
updateScene: async (t) => {
|
|
2780
|
+
const a = e(), o = a.findIndex((s) => s.code === t.code);
|
|
2781
|
+
return o === -1 ? {
|
|
2782
|
+
code: 404,
|
|
2783
|
+
data: null,
|
|
2784
|
+
msg: "Scene not found"
|
|
2785
|
+
} : (a[o] = { ...a[o], ...t }, n(a), {
|
|
2786
|
+
code: ze,
|
|
2787
|
+
data: a[o],
|
|
2788
|
+
msg: "success"
|
|
2789
|
+
});
|
|
2790
|
+
},
|
|
2791
|
+
deleteScene: async (t) => {
|
|
2792
|
+
const o = e().filter((s) => !t.includes(s.code));
|
|
2793
|
+
return n(o), {
|
|
2794
|
+
code: ze,
|
|
2795
|
+
data: null,
|
|
2796
|
+
msg: "success"
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
}, fo = (r = {}) => {
|
|
2801
|
+
const e = r.sceneRequestUrls ?? Vt, n = async (t, a = {}) => {
|
|
2802
|
+
try {
|
|
2803
|
+
const o = {
|
|
2804
|
+
"X-Requested-With": "XMLHttpRequest",
|
|
2805
|
+
"Content-Type": "application/json",
|
|
2806
|
+
Authorization: `Bearer ${Pt("NIST_TOKEN")}`,
|
|
2807
|
+
"Yidun-Token": Pt("Yidun-Token") || ""
|
|
2808
|
+
}, s = await fetch(t, {
|
|
2809
|
+
...a,
|
|
2810
|
+
headers: {
|
|
2811
|
+
...o,
|
|
2812
|
+
...a.headers
|
|
2813
|
+
}
|
|
2814
|
+
});
|
|
2815
|
+
if (!s.ok)
|
|
2816
|
+
throw new Error(`HTTP error! status: ${s.status}`);
|
|
2817
|
+
return await s.json();
|
|
2818
|
+
} catch (o) {
|
|
2819
|
+
throw console.error("API request failed:", o), o;
|
|
2820
|
+
}
|
|
2821
|
+
};
|
|
2822
|
+
return {
|
|
2823
|
+
querySceneList: async (t) => {
|
|
2824
|
+
const a = new URLSearchParams(t).toString();
|
|
2825
|
+
return n(`${e.query}?${a}`);
|
|
2826
|
+
},
|
|
2827
|
+
createScene: async (t) => n(e.create, {
|
|
2828
|
+
method: "POST",
|
|
2829
|
+
body: JSON.stringify(t)
|
|
2830
|
+
}),
|
|
2831
|
+
updateScene: async (t) => n(e.update, {
|
|
2832
|
+
method: "POST",
|
|
2833
|
+
body: JSON.stringify(t)
|
|
2834
|
+
}),
|
|
2835
|
+
deleteScene: async (t) => n(e.delete, {
|
|
2836
|
+
method: "POST",
|
|
2837
|
+
body: JSON.stringify(t)
|
|
2838
|
+
})
|
|
2839
|
+
};
|
|
2840
|
+
}, mo = () => {
|
|
2841
|
+
const r = {
|
|
2842
|
+
code: -1,
|
|
2843
|
+
data: [],
|
|
2844
|
+
msg: "场景功能已关闭"
|
|
2845
|
+
};
|
|
2846
|
+
return {
|
|
2847
|
+
querySceneList: async () => r,
|
|
2848
|
+
createScene: async () => r,
|
|
2849
|
+
updateScene: async () => r,
|
|
2850
|
+
deleteScene: async () => r
|
|
2851
|
+
};
|
|
2852
|
+
}, yo = ["innerHTML"], go = /* @__PURE__ */ ie({
|
|
2853
|
+
__name: "SuperTable",
|
|
2854
|
+
props: {
|
|
2855
|
+
/**
|
|
2856
|
+
* 查询场景类型,用于管理场景和缓存表格设置等
|
|
2857
|
+
* @type {string}
|
|
2858
|
+
* @default ''
|
|
2859
|
+
*/
|
|
2860
|
+
sceneType: {
|
|
2861
|
+
type: String,
|
|
2862
|
+
default: ""
|
|
2863
|
+
},
|
|
2864
|
+
/**
|
|
2865
|
+
* 最大场景数量
|
|
2866
|
+
* @type {number}
|
|
2867
|
+
* @default 100
|
|
2868
|
+
*/
|
|
2869
|
+
maxSceneCount: {
|
|
2870
|
+
type: Number,
|
|
2871
|
+
default: 100
|
|
2872
|
+
},
|
|
2873
|
+
/** 查询防抖时间,ms */
|
|
2874
|
+
debounceWait: {
|
|
2875
|
+
type: Number,
|
|
2876
|
+
default: 100
|
|
2877
|
+
},
|
|
2878
|
+
/** 查询条件配置 */
|
|
2879
|
+
formItems: {
|
|
2880
|
+
type: Array,
|
|
2881
|
+
default: () => []
|
|
2882
|
+
},
|
|
2883
|
+
/** 查询条件列数 */
|
|
2884
|
+
formItemColSpan: {
|
|
2885
|
+
type: Number,
|
|
2886
|
+
default: 6
|
|
2887
|
+
},
|
|
2888
|
+
/** 依赖刷新选项 */
|
|
2889
|
+
refreshDeps: {
|
|
2890
|
+
type: Array,
|
|
2891
|
+
default: () => []
|
|
2892
|
+
},
|
|
2893
|
+
/** 表格列配置 */
|
|
2894
|
+
columns: {
|
|
2895
|
+
type: Array,
|
|
2896
|
+
default: () => []
|
|
2897
|
+
},
|
|
2898
|
+
/** 数据请求方法 */
|
|
2899
|
+
request: {
|
|
2900
|
+
type: Function,
|
|
2901
|
+
required: !0
|
|
2902
|
+
},
|
|
2903
|
+
/** 表格属性,仅开发部分能力,与默认配置进行合并*/
|
|
2904
|
+
tableProps: {
|
|
2905
|
+
type: Object,
|
|
2906
|
+
default: () => ({})
|
|
2907
|
+
},
|
|
2908
|
+
/** 转换表格数据 */
|
|
2909
|
+
formatDataSource: {
|
|
2910
|
+
type: Function,
|
|
2911
|
+
default: (r) => r
|
|
2912
|
+
},
|
|
2913
|
+
/** 可排序 */
|
|
2914
|
+
sortable: {
|
|
2915
|
+
type: Boolean,
|
|
2916
|
+
default: !1
|
|
2917
|
+
},
|
|
2918
|
+
/** 容器样式 */
|
|
2919
|
+
wrapperStyle: {
|
|
2920
|
+
type: Object,
|
|
2921
|
+
default: () => ({})
|
|
2922
|
+
},
|
|
2923
|
+
/** 默认设置的查询条件,适用于url内带查询参数的场景,格式 { [name: string]: value } */
|
|
2924
|
+
customQueryParams: {
|
|
2925
|
+
type: Object,
|
|
2926
|
+
default: () => ({})
|
|
2927
|
+
},
|
|
2928
|
+
/** 展示刷新按钮*/
|
|
2929
|
+
showRefreshButton: {
|
|
2930
|
+
type: Boolean,
|
|
2931
|
+
default: !1
|
|
2932
|
+
},
|
|
2933
|
+
/** 是否使用场景 */
|
|
2934
|
+
enableScene: {
|
|
2935
|
+
type: Boolean,
|
|
2936
|
+
default: !0
|
|
2937
|
+
},
|
|
2938
|
+
/** 默认场景 */
|
|
2939
|
+
defaultScene: {
|
|
2940
|
+
type: [Object, Array],
|
|
2941
|
+
default: void 0
|
|
2942
|
+
},
|
|
2943
|
+
/** 场景存储位置 */
|
|
2944
|
+
sceneStorageType: {
|
|
2945
|
+
type: String,
|
|
2946
|
+
default: "local"
|
|
2947
|
+
},
|
|
2948
|
+
/** 场景请求地址配置 */
|
|
2949
|
+
sceneRequestUrls: {
|
|
2950
|
+
type: Object,
|
|
2951
|
+
default: () => Vt
|
|
2952
|
+
},
|
|
2953
|
+
/** 开启表格设置 */
|
|
2954
|
+
enableTableConfig: {
|
|
2955
|
+
type: Boolean,
|
|
2956
|
+
default: !0
|
|
2957
|
+
}
|
|
2958
|
+
},
|
|
2959
|
+
emits: ["sort-change", "row-sort-end", "form-item-change", "scene-change"],
|
|
2960
|
+
setup(r, { expose: e, emit: n }) {
|
|
2961
|
+
var bt;
|
|
2962
|
+
Be.locale("zh-cn");
|
|
2963
|
+
const t = r, a = n, o = L(() => {
|
|
2964
|
+
var u, h, P;
|
|
2965
|
+
const l = (u = on()) == null ? void 0 : u.appContext.app;
|
|
2966
|
+
return !!((P = (h = l == null ? void 0 : l.config) == null ? void 0 : h.globalProperties) != null && P.$router);
|
|
2967
|
+
}), s = ee(), { openByConfig: i } = jt(Ja), { openByConfig: c } = jt(ao), v = Ot(t.columns).reduce(
|
|
2968
|
+
(l, u) => (l[u.key] = xe(u, Rt), l),
|
|
2969
|
+
{}
|
|
2970
|
+
), b = Ut([location.hostname, location.pathname, t.sceneType].join("")), f = jn(`superTable_${b}`, {
|
|
2971
|
+
sceneCode: null,
|
|
2972
|
+
sceneSort: [],
|
|
2973
|
+
sceneList: [],
|
|
2974
|
+
columnConfig: v
|
|
2975
|
+
}), d = L(() => t.enableScene ? t.sceneStorageType === "local" ? po({
|
|
2976
|
+
getScenes: () => f.value.sceneList,
|
|
2977
|
+
setScenes: (l) => {
|
|
2978
|
+
f.value.sceneList = l;
|
|
2979
|
+
}
|
|
2980
|
+
}) : fo({ sceneRequestUrls: t.sceneRequestUrls }) : mo()), y = ee(!1), x = L(() => Object.keys(t.customQueryParams).length > 0), g = ee(!1), _ = mt(async () => {
|
|
2981
|
+
try {
|
|
2982
|
+
D.loading = !0;
|
|
2983
|
+
const { total: l, data: u } = await t.request({
|
|
2984
|
+
params: ht(),
|
|
2985
|
+
pageSize: D.pagination.pageSize,
|
|
2986
|
+
pageNum: D.pagination.current
|
|
2987
|
+
});
|
|
2988
|
+
D.dataSource = u, D.pagination.total = l;
|
|
2989
|
+
} catch (l) {
|
|
2990
|
+
D.dataSource = [], console.error(l);
|
|
2991
|
+
} finally {
|
|
2992
|
+
D.loading = !1;
|
|
2993
|
+
}
|
|
2994
|
+
}, t.debounceWait), p = () => {
|
|
2995
|
+
t.enableScene && !m.loaded || (D.pagination.current = 1, _());
|
|
2996
|
+
}, I = ee({}), C = (l = []) => {
|
|
2997
|
+
for (const u in I.value) {
|
|
2998
|
+
const h = I.value[u], P = l.find((j) => j.name === u);
|
|
2999
|
+
h.value = P ? P.value : h._defaultValue, h[ge.selected] = !!P, h[ge.orderInScene] = P ? l.findIndex((j) => j.name === (P == null ? void 0 : P.name)) : void 0;
|
|
3000
|
+
}
|
|
3001
|
+
p();
|
|
3002
|
+
}, m = Ze({
|
|
3003
|
+
list: [],
|
|
3004
|
+
loading: !1,
|
|
3005
|
+
submiting: !1,
|
|
3006
|
+
loaded: !1
|
|
3007
|
+
}), V = L(() => qe(he(t.defaultScene)).filter(Boolean).map(({ name: u = "默认场景", code: h = "default_scene", items: P }) => ({
|
|
3008
|
+
name: u,
|
|
3009
|
+
code: h,
|
|
3010
|
+
isCustom: !0,
|
|
3011
|
+
items: P.filter((j) => !!I.value[j.name]).map((j) => {
|
|
3012
|
+
var z;
|
|
3013
|
+
return {
|
|
3014
|
+
name: j.name,
|
|
3015
|
+
value: j.value ?? I.value[j.name]._defaultValue,
|
|
3016
|
+
type: (z = I.value[j.name]) == null ? void 0 : z.type
|
|
3017
|
+
};
|
|
3018
|
+
})
|
|
3019
|
+
})));
|
|
3020
|
+
be(
|
|
3021
|
+
() => t.formItems,
|
|
3022
|
+
() => {
|
|
3023
|
+
_r(he(t.formItems)).forEach((l) => {
|
|
3024
|
+
I.value[l.name] = qn(he(I.value[l.name]) ?? {}, l);
|
|
3025
|
+
});
|
|
3026
|
+
},
|
|
3027
|
+
{
|
|
3028
|
+
immediate: !0,
|
|
3029
|
+
deep: !0
|
|
3030
|
+
}
|
|
3031
|
+
);
|
|
3032
|
+
const Y = async () => {
|
|
3033
|
+
try {
|
|
3034
|
+
m.loading = !0;
|
|
3035
|
+
const { code: l, data: u = [], msg: h } = await d.value.querySceneList({ type: b });
|
|
3036
|
+
if (l === 2e3) {
|
|
3037
|
+
const P = m.list.find((z) => z.code === f.value.sceneCode);
|
|
3038
|
+
m.list = Cr(u, I.value, f.value.sceneSort);
|
|
3039
|
+
const j = m.list.find((z) => z.code === f.value.sceneCode);
|
|
3040
|
+
if (!m.loaded && x.value) {
|
|
3041
|
+
f.value.sceneCode = null, m.loaded = !0;
|
|
3042
|
+
const z = Object.entries(t.customQueryParams).map(([Ye, nt]) => {
|
|
3043
|
+
var He;
|
|
3044
|
+
return {
|
|
3045
|
+
name: Ye,
|
|
3046
|
+
value: nt,
|
|
3047
|
+
type: (He = I.value[Ye]) == null ? void 0 : He.type
|
|
3048
|
+
};
|
|
3049
|
+
});
|
|
3050
|
+
C(z);
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
(!m.loaded || P && P.value !== (j == null ? void 0 : j.value)) && C(j == null ? void 0 : j.items), m.loaded = !0;
|
|
3054
|
+
} else
|
|
3055
|
+
at.error(h);
|
|
3056
|
+
} finally {
|
|
3057
|
+
m.loading = !1;
|
|
3058
|
+
}
|
|
3059
|
+
}, te = ({ code: l, msg: u }) => l === 2e3 ? (at.success("操作成功"), Y(), Promise.resolve(u)) : (at.error(u), Promise.reject(u)), B = async ({ name: l, items: u }) => {
|
|
3060
|
+
try {
|
|
3061
|
+
const h = await d.value.createScene({
|
|
3062
|
+
type: b,
|
|
3063
|
+
name: l,
|
|
3064
|
+
value: JSON.stringify(u),
|
|
3065
|
+
asPrivate: !0
|
|
3066
|
+
});
|
|
3067
|
+
f.value.sceneCode = h == null ? void 0 : h.data, te(h);
|
|
3068
|
+
} catch (h) {
|
|
3069
|
+
return Promise.reject(h);
|
|
3070
|
+
}
|
|
3071
|
+
}, ue = async (l) => {
|
|
3072
|
+
try {
|
|
3073
|
+
const u = await d.value.updateScene({
|
|
3074
|
+
code: l.code,
|
|
3075
|
+
name: l.name,
|
|
3076
|
+
value: JSON.stringify(l.items)
|
|
3077
|
+
});
|
|
3078
|
+
return te(u);
|
|
3079
|
+
} catch (u) {
|
|
3080
|
+
return Promise.reject(u);
|
|
3081
|
+
}
|
|
3082
|
+
}, ke = async (l) => {
|
|
3083
|
+
try {
|
|
3084
|
+
const u = await d.value.deleteScene([l]);
|
|
3085
|
+
u.code === 2e3 && (f.value.sceneCode = null, l === f.value.sceneCode && (C([]), f.value.sceneCode = void 0)), te(u);
|
|
3086
|
+
} catch (u) {
|
|
3087
|
+
return Promise.reject(u);
|
|
3088
|
+
}
|
|
3089
|
+
}, ve = L(() => m.list.length < t.maxSceneCount);
|
|
3090
|
+
be(
|
|
3091
|
+
() => [f.value.sceneCode, m.list],
|
|
3092
|
+
() => {
|
|
3093
|
+
if (x.value && !g.value) {
|
|
3094
|
+
g.value = !0;
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
const l = [...V.value, ...m.list].find(
|
|
3098
|
+
(u) => u.code === f.value.sceneCode
|
|
3099
|
+
);
|
|
3100
|
+
C((l == null ? void 0 : l.items) ?? []);
|
|
3101
|
+
}
|
|
3102
|
+
);
|
|
3103
|
+
const oe = L(() => `super_table_row_${b}`), ne = ee(), D = Ze({
|
|
3104
|
+
...t.tableProps,
|
|
3105
|
+
dataSource: [],
|
|
3106
|
+
columns: [],
|
|
3107
|
+
loading: !1,
|
|
3108
|
+
rowKey: "id",
|
|
3109
|
+
pagination: {
|
|
3110
|
+
total: 0,
|
|
3111
|
+
pageSize: 20,
|
|
3112
|
+
current: 1,
|
|
3113
|
+
showQuickJumper: !0,
|
|
3114
|
+
showSizeChanger: !0,
|
|
3115
|
+
showTotal: (l) => `共${l}条数据`,
|
|
3116
|
+
...Xe(t.tableProps, "pagination", {}),
|
|
3117
|
+
onShowSizeChange: (l, u) => {
|
|
3118
|
+
var h, P, j, z;
|
|
3119
|
+
((h = t.tableProps) == null ? void 0 : h.pagination) !== !1 && ((z = (j = (P = t.tableProps) == null ? void 0 : P.pagination) == null ? void 0 : j.onShowSizeChange) == null || z.call(j, 1, u));
|
|
3120
|
+
},
|
|
3121
|
+
onChange: (l, u) => {
|
|
3122
|
+
var h, P, j, z;
|
|
3123
|
+
D.pagination.current = u !== D.pagination.pageSize ? 1 : l, D.pagination.pageSize = u, ((h = t.tableProps) == null ? void 0 : h.pagination) !== !1 && ((z = (j = (P = t.tableProps) == null ? void 0 : P.pagination) == null ? void 0 : j.onChange) == null || z.call(j, l, u)), _();
|
|
3124
|
+
}
|
|
3125
|
+
},
|
|
3126
|
+
tableLayout: "fixed",
|
|
3127
|
+
scroll: {
|
|
3128
|
+
x: "100%",
|
|
3129
|
+
y: Math.max(500, window.innerWidth * 0.8),
|
|
3130
|
+
scrollToFirstRowOnChange: !0,
|
|
3131
|
+
...((bt = t.tableProps) == null ? void 0 : bt.scroll) ?? {}
|
|
3132
|
+
},
|
|
3133
|
+
rowClassName: (l, u, h) => {
|
|
3134
|
+
var z;
|
|
3135
|
+
let P = "";
|
|
3136
|
+
const j = (z = t.tableProps) == null ? void 0 : z.rowClassName;
|
|
3137
|
+
return Ce(j) ? P = j(l, u, h) : typeof j == "string" && (P = j), [P, oe.value].join(" ");
|
|
3138
|
+
}
|
|
3139
|
+
}), Ve = L(() => {
|
|
3140
|
+
try {
|
|
3141
|
+
return t.formatDataSource(he(D.dataSource));
|
|
3142
|
+
} catch {
|
|
3143
|
+
return he(D.dataSource);
|
|
3144
|
+
}
|
|
3145
|
+
}), k = L(() => ({
|
|
3146
|
+
columns: D.columns,
|
|
3147
|
+
loading: D.loading,
|
|
3148
|
+
rowKey: D.rowKey,
|
|
3149
|
+
pagination: D.pagination,
|
|
3150
|
+
tableLayout: D.tableLayout,
|
|
3151
|
+
scroll: D.scroll,
|
|
3152
|
+
rowClassName: D.rowClassName
|
|
3153
|
+
})), T = L(() => Ot(t.columns).map((l) => {
|
|
3154
|
+
const u = f.value.columnConfig[l.key];
|
|
3155
|
+
return {
|
|
3156
|
+
...l,
|
|
3157
|
+
width: (u == null ? void 0 : u.width) ?? l.width,
|
|
3158
|
+
visible: (u == null ? void 0 : u.visible) ?? l.visible,
|
|
3159
|
+
index: (u == null ? void 0 : u.index) ?? l.index
|
|
3160
|
+
};
|
|
3161
|
+
})), M = (l, u) => {
|
|
3162
|
+
f.value.columnConfig[u.key] = {
|
|
3163
|
+
...f.value.columnConfig[u.key] ?? {},
|
|
3164
|
+
width: l
|
|
3165
|
+
};
|
|
3166
|
+
}, W = (l) => {
|
|
3167
|
+
f.value.columnConfig = l.reduce(
|
|
3168
|
+
(u, h, P) => (u[h.key] = {
|
|
3169
|
+
...h,
|
|
3170
|
+
index: P
|
|
3171
|
+
}, u),
|
|
3172
|
+
{}
|
|
3173
|
+
);
|
|
3174
|
+
};
|
|
3175
|
+
be(
|
|
3176
|
+
() => [T.value, t.sortable],
|
|
3177
|
+
() => {
|
|
3178
|
+
const l = {
|
|
3179
|
+
key: R.sort,
|
|
3180
|
+
type: R.sort,
|
|
3181
|
+
title: "",
|
|
3182
|
+
fixed: !0,
|
|
3183
|
+
width: 60
|
|
3184
|
+
};
|
|
3185
|
+
D.columns = [
|
|
3186
|
+
...t.sortable ? [l] : [],
|
|
3187
|
+
...T.value.filter(({ visible: u }) => u).sort((u, h) => u.index - h.index)
|
|
3188
|
+
];
|
|
3189
|
+
},
|
|
3190
|
+
{
|
|
3191
|
+
deep: !0,
|
|
3192
|
+
immediate: !0
|
|
3193
|
+
}
|
|
3194
|
+
);
|
|
3195
|
+
const re = () => new Promise((l) => {
|
|
3196
|
+
const u = () => {
|
|
3197
|
+
var P, j;
|
|
3198
|
+
const h = (j = (P = ne.value) == null ? void 0 : P.$el) == null ? void 0 : j.querySelector(".ant-table-tbody");
|
|
3199
|
+
if (h) {
|
|
3200
|
+
l(h);
|
|
3201
|
+
return;
|
|
3202
|
+
}
|
|
3203
|
+
requestAnimationFrame(u);
|
|
3204
|
+
};
|
|
3205
|
+
u();
|
|
3206
|
+
}), de = async () => {
|
|
3207
|
+
const l = await re();
|
|
3208
|
+
l && new Ln(l, {
|
|
3209
|
+
animation: 150,
|
|
3210
|
+
handle: ".super-table-column-draggable-handle",
|
|
3211
|
+
setData: (u) => {
|
|
3212
|
+
const h = new Image();
|
|
3213
|
+
h.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", u.setDragImage(h, 0, 0);
|
|
3214
|
+
},
|
|
3215
|
+
onEnd: (u) => {
|
|
3216
|
+
const { oldIndex: h, newIndex: P } = u;
|
|
3217
|
+
if (h === void 0 || P === void 0) return;
|
|
3218
|
+
const j = he(D.dataSource), [z] = j.splice(h, 1);
|
|
3219
|
+
j.splice(P, 0, z), a("row-sort-end", j);
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
}, tt = (l, u) => {
|
|
3223
|
+
I.value[l].value = u, a("form-item-change", l, u, I.value[l]), I.value[l].quiet !== !0 && p();
|
|
3224
|
+
}, Te = (l, u) => {
|
|
3225
|
+
y.value = !1, i({
|
|
3226
|
+
props: {
|
|
3227
|
+
ref: s,
|
|
3228
|
+
currentScene: u,
|
|
3229
|
+
actionType: l,
|
|
3230
|
+
formConfigMap: I.value,
|
|
3231
|
+
onCreate: B,
|
|
3232
|
+
onUpdate: ue,
|
|
3233
|
+
onUpdateFormConfig: (h) => {
|
|
3234
|
+
h.forEach((P) => {
|
|
3235
|
+
Pe(I.value, P.name, P);
|
|
3236
|
+
});
|
|
3237
|
+
},
|
|
3238
|
+
onSearch: (h) => {
|
|
3239
|
+
C(h);
|
|
3240
|
+
},
|
|
3241
|
+
onFormItemChange(h, P) {
|
|
3242
|
+
a("form-item-change", h, P, I.value[h]);
|
|
3243
|
+
},
|
|
3244
|
+
onCancel() {
|
|
3245
|
+
s.value = void 0;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
});
|
|
3249
|
+
}, Q = () => {
|
|
3250
|
+
y.value = !1, c({
|
|
3251
|
+
props: {
|
|
3252
|
+
list: m.list,
|
|
3253
|
+
allowCreateScene: S(ve),
|
|
3254
|
+
onCreate: () => Te(ce.create),
|
|
3255
|
+
onUpdate: (l) => Te(ce.update, l),
|
|
3256
|
+
onDelete: (l) => ke(l),
|
|
3257
|
+
onSort: (l) => {
|
|
3258
|
+
f.value.sceneSort = l, m.list = m.list.sort((u, h) => l.indexOf(u.code) - l.indexOf(h.code));
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3262
|
+
}, me = async (l) => {
|
|
3263
|
+
await un();
|
|
3264
|
+
const u = m.list.find((h) => h.code === l);
|
|
3265
|
+
a("scene-change", u);
|
|
3266
|
+
}, zt = ({ name: l }) => {
|
|
3267
|
+
Pe(I.value, `${l}._selected`, !1), p();
|
|
3268
|
+
}, gt = (l) => I.value[l], Gt = (l, u, h) => {
|
|
3269
|
+
if (Bt.includes(u))
|
|
3270
|
+
return $e("setFormItem error,", `form item with prop "${l}" is readonly`);
|
|
3271
|
+
if (!gt(l))
|
|
3272
|
+
return $e("setFormItem error,", `Cannot find form item with name "${l}"`);
|
|
3273
|
+
if (u === "visible" && I.value[l].fixed)
|
|
3274
|
+
return $e("setFormItem error,", "Cannot change the visible of a fixed form item");
|
|
3275
|
+
Pe(I.value, `${l}.${u}`, h);
|
|
3276
|
+
}, vt = (l, u) => {
|
|
3277
|
+
if (!I.value[l])
|
|
3278
|
+
return $e("setFormValue error,", `Cannot find form item with name "${l}"`);
|
|
3279
|
+
I.value[l].value = u;
|
|
3280
|
+
}, Jt = (l) => {
|
|
3281
|
+
Object.entries(l).forEach(([u, h]) => {
|
|
3282
|
+
vt(u, h);
|
|
3283
|
+
});
|
|
3284
|
+
}, Qt = (l) => {
|
|
3285
|
+
var u;
|
|
3286
|
+
return (u = I.value[l]) == null ? void 0 : u.value;
|
|
3287
|
+
}, ht = (l) => {
|
|
3288
|
+
const u = {}, h = l ? xe(I.value, qe(l)) : I.value;
|
|
3289
|
+
for (const P in h) {
|
|
3290
|
+
const j = h[P];
|
|
3291
|
+
j._selected && (u[P] = he(j.value));
|
|
3292
|
+
}
|
|
3293
|
+
return u;
|
|
3294
|
+
};
|
|
3295
|
+
return e({
|
|
3296
|
+
getFormItem(l) {
|
|
3297
|
+
return s.value ? s.value.getFormItem(l) : gt(l);
|
|
3298
|
+
},
|
|
3299
|
+
setFormItem(l, u, h) {
|
|
3300
|
+
s.value ? s.value.setFormItem(l, u, h) : Gt(l, u, h);
|
|
3301
|
+
},
|
|
3302
|
+
getFormValues(l) {
|
|
3303
|
+
return s.value ? s.value.getFormValues(l) : ht(l);
|
|
3304
|
+
},
|
|
3305
|
+
setFormValues(l) {
|
|
3306
|
+
s.value ? s.value.setFormValues(l) : Jt(l);
|
|
3307
|
+
},
|
|
3308
|
+
getFormValue(l) {
|
|
3309
|
+
return s.value ? s.value.getFormValue(l) : Qt(l);
|
|
3310
|
+
},
|
|
3311
|
+
setFormValue(l, u) {
|
|
3312
|
+
s.value ? s.value.setFormValue(l, u) : vt(l, u);
|
|
3313
|
+
},
|
|
3314
|
+
getTableData: () => D.dataSource,
|
|
3315
|
+
setTableData: (l) => {
|
|
3316
|
+
D.dataSource = l;
|
|
3317
|
+
},
|
|
3318
|
+
setTableDataItem: (l, u) => {
|
|
3319
|
+
D.dataSource[l] = u;
|
|
3320
|
+
},
|
|
3321
|
+
onRefresh: p
|
|
3322
|
+
}), be(() => [...t.refreshDeps], p, {
|
|
3323
|
+
deep: !0,
|
|
3324
|
+
immediate: !0
|
|
3325
|
+
}), be(
|
|
3326
|
+
() => t.enableScene,
|
|
3327
|
+
(l) => {
|
|
3328
|
+
l ? Y() : C([]);
|
|
3329
|
+
}
|
|
3330
|
+
), be(
|
|
3331
|
+
() => t.sortable,
|
|
3332
|
+
(l) => {
|
|
3333
|
+
l && de();
|
|
3334
|
+
},
|
|
3335
|
+
{
|
|
3336
|
+
immediate: !0
|
|
3337
|
+
}
|
|
3338
|
+
), sn(() => {
|
|
3339
|
+
t.enableScene ? Y() : _();
|
|
3340
|
+
}), (l, u) => {
|
|
3341
|
+
const h = q("a-form-item"), P = q("a-button"), j = q("a-select"), z = q("a-divider"), Ye = q("a-space"), nt = q("a-form"), He = q("a-typography-text"), Kt = q("a-tooltip"), Zt = q("a-table"), Xt = q("a-config-provider");
|
|
3342
|
+
return F(), E(Xt, { locale: S(Dt) }, {
|
|
3343
|
+
default: $(() => [
|
|
3344
|
+
J("div", {
|
|
3345
|
+
class: w(l.$style.superTable),
|
|
3346
|
+
style: we(r.wrapperStyle)
|
|
3347
|
+
}, [
|
|
3348
|
+
r.enableScene || l.$slots.extra ? (F(), U("div", {
|
|
3349
|
+
key: 0,
|
|
3350
|
+
class: w(l.$style.superTableHeader)
|
|
3351
|
+
}, [
|
|
3352
|
+
r.enableScene ? (F(), E(nt, {
|
|
3353
|
+
key: 0,
|
|
3354
|
+
layout: "inline",
|
|
3355
|
+
class: w(l.$style.searchForm)
|
|
3356
|
+
}, {
|
|
3357
|
+
default: $(() => [
|
|
3358
|
+
l.$slots.sceneAddonBefore ? (F(), E(h, { key: 0 }, {
|
|
3359
|
+
default: $(() => [
|
|
3360
|
+
pe(l.$slots, "sceneAddonBefore")
|
|
3361
|
+
]),
|
|
3362
|
+
_: 3
|
|
3363
|
+
})) : N("", !0),
|
|
3364
|
+
O(h, { label: "场景选择" }, {
|
|
3365
|
+
default: $(() => [
|
|
3366
|
+
O(j, {
|
|
3367
|
+
value: S(f).sceneCode,
|
|
3368
|
+
"onUpdate:value": u[1] || (u[1] = (G) => S(f).sceneCode = G),
|
|
3369
|
+
class: w(l.$style.sceneSelect),
|
|
3370
|
+
placeholder: "请选择",
|
|
3371
|
+
"allow-clear": "",
|
|
3372
|
+
"show-search": "",
|
|
3373
|
+
"option-filter-prop": "name",
|
|
3374
|
+
options: [...V.value, ...m.list],
|
|
3375
|
+
"field-names": { value: "code", label: "name" },
|
|
3376
|
+
open: y.value,
|
|
3377
|
+
loading: m.loading,
|
|
3378
|
+
onChange: me,
|
|
3379
|
+
onDropdownVisibleChange: u[2] || (u[2] = (G) => y.value = G)
|
|
3380
|
+
}, {
|
|
3381
|
+
dropdownRender: $(({ menuNode: G }) => [
|
|
3382
|
+
O(S(zr), { vnodes: G }, null, 8, ["vnodes"]),
|
|
3383
|
+
J("div", {
|
|
3384
|
+
class: w(l.$style.sceneOpBtnWrapper)
|
|
3385
|
+
}, [
|
|
3386
|
+
O(P, {
|
|
3387
|
+
type: "link",
|
|
3388
|
+
block: "",
|
|
3389
|
+
icon: X(S(In)),
|
|
3390
|
+
class: w(l.$style.sceneOpBtn),
|
|
3391
|
+
disabled: !ve.value,
|
|
3392
|
+
onClick: u[0] || (u[0] = (Le) => Te(S(ce).create))
|
|
3393
|
+
}, {
|
|
3394
|
+
default: $(() => u[6] || (u[6] = [
|
|
3395
|
+
K(" 新建场景 ")
|
|
3396
|
+
])),
|
|
3397
|
+
_: 1
|
|
3398
|
+
}, 8, ["icon", "class", "disabled"]),
|
|
3399
|
+
O(P, {
|
|
3400
|
+
type: "link",
|
|
3401
|
+
block: "",
|
|
3402
|
+
icon: X(S(Fn)),
|
|
3403
|
+
class: w(l.$style.sceneOpBtn),
|
|
3404
|
+
onClick: Q
|
|
3405
|
+
}, {
|
|
3406
|
+
default: $(() => u[7] || (u[7] = [
|
|
3407
|
+
K(" 场景管理 ")
|
|
3408
|
+
])),
|
|
3409
|
+
_: 1
|
|
3410
|
+
}, 8, ["icon", "class"])
|
|
3411
|
+
], 2)
|
|
3412
|
+
]),
|
|
3413
|
+
_: 1
|
|
3414
|
+
}, 8, ["value", "class", "options", "open", "loading"])
|
|
3415
|
+
]),
|
|
3416
|
+
_: 1
|
|
3417
|
+
}),
|
|
3418
|
+
O(h, null, {
|
|
3419
|
+
default: $(() => [
|
|
3420
|
+
O(Ye, null, {
|
|
3421
|
+
split: $(() => [
|
|
3422
|
+
O(z, { type: "vertical" })
|
|
3423
|
+
]),
|
|
3424
|
+
default: $(() => [
|
|
3425
|
+
O(P, {
|
|
3426
|
+
type: "primary",
|
|
3427
|
+
icon: X(S(xn)),
|
|
3428
|
+
onClick: u[3] || (u[3] = (G) => Te(S(ce).search))
|
|
3429
|
+
}, {
|
|
3430
|
+
default: $(() => u[8] || (u[8] = [
|
|
3431
|
+
K(" 高级筛选 ")
|
|
3432
|
+
])),
|
|
3433
|
+
_: 1
|
|
3434
|
+
}, 8, ["icon"]),
|
|
3435
|
+
r.showRefreshButton ? (F(), E(P, {
|
|
3436
|
+
key: 0,
|
|
3437
|
+
type: "primary",
|
|
3438
|
+
ghost: "",
|
|
3439
|
+
icon: X(S(kn)),
|
|
3440
|
+
loading: D.loading,
|
|
3441
|
+
onClick: p
|
|
3442
|
+
}, {
|
|
3443
|
+
default: $(() => u[9] || (u[9] = [
|
|
3444
|
+
K(" 刷新 ")
|
|
3445
|
+
])),
|
|
3446
|
+
_: 1
|
|
3447
|
+
}, 8, ["icon", "loading"])) : N("", !0)
|
|
3448
|
+
]),
|
|
3449
|
+
_: 1
|
|
3450
|
+
})
|
|
3451
|
+
]),
|
|
3452
|
+
_: 1
|
|
3453
|
+
}),
|
|
3454
|
+
l.$slots.sceneAddonAfter ? (F(), E(h, { key: 1 }, {
|
|
3455
|
+
default: $(() => [
|
|
3456
|
+
pe(l.$slots, "sceneAddonAfter")
|
|
3457
|
+
]),
|
|
3458
|
+
_: 3
|
|
3459
|
+
})) : N("", !0)
|
|
3460
|
+
]),
|
|
3461
|
+
_: 3
|
|
3462
|
+
}, 8, ["class"])) : N("", !0),
|
|
3463
|
+
l.$slots.extra ? (F(), U("div", {
|
|
3464
|
+
key: 1,
|
|
3465
|
+
class: w(l.$style.superTableExtra)
|
|
3466
|
+
}, [
|
|
3467
|
+
pe(l.$slots, "extra")
|
|
3468
|
+
], 2)) : N("", !0)
|
|
3469
|
+
], 2)) : N("", !0),
|
|
3470
|
+
O(uo, {
|
|
3471
|
+
"form-config-map": I.value,
|
|
3472
|
+
"form-item-col-span": r.formItemColSpan,
|
|
3473
|
+
onFormItemChange: tt,
|
|
3474
|
+
onDelete: u[4] || (u[4] = (G) => zt(G))
|
|
3475
|
+
}, null, 8, ["form-config-map", "form-item-col-span"]),
|
|
3476
|
+
J("div", {
|
|
3477
|
+
class: w(l.$style.tableWrapper)
|
|
3478
|
+
}, [
|
|
3479
|
+
l.$slots.tableHead || l.$slots.toolBar ? (F(), U("div", {
|
|
3480
|
+
key: 0,
|
|
3481
|
+
class: w(l.$style.toolbar)
|
|
3482
|
+
}, [
|
|
3483
|
+
J("div", {
|
|
3484
|
+
class: w(l.$style.tableHeadWrapper)
|
|
3485
|
+
}, [
|
|
3486
|
+
pe(l.$slots, "tableHead")
|
|
3487
|
+
], 2),
|
|
3488
|
+
J("div", {
|
|
3489
|
+
class: w(l.$style.actionBtns)
|
|
3490
|
+
}, [
|
|
3491
|
+
pe(l.$slots, "toolBarExtra")
|
|
3492
|
+
], 2)
|
|
3493
|
+
], 2)) : N("", !0),
|
|
3494
|
+
J("div", {
|
|
3495
|
+
class: w(l.$style.tableContent)
|
|
3496
|
+
}, [
|
|
3497
|
+
r.enableTableConfig ? (F(), E(ua, {
|
|
3498
|
+
key: 0,
|
|
3499
|
+
columns: T.value,
|
|
3500
|
+
onChange: W
|
|
3501
|
+
}, null, 8, ["columns"])) : N("", !0),
|
|
3502
|
+
O(Zt, ae({
|
|
3503
|
+
ref_key: "tableRef",
|
|
3504
|
+
ref: ne,
|
|
3505
|
+
"data-source": Ve.value
|
|
3506
|
+
}, k.value, { onResizeColumn: M }), ln({
|
|
3507
|
+
headerCell: $(({ column: G }) => [
|
|
3508
|
+
G.class !== "ant-table-row-expand-icon-cell" ? (F(), U("div", {
|
|
3509
|
+
key: 0,
|
|
3510
|
+
class: w(l.$style.headerCell)
|
|
3511
|
+
}, [
|
|
3512
|
+
O(He, {
|
|
3513
|
+
ellipsis: { tooltip: G.title },
|
|
3514
|
+
content: G.title,
|
|
3515
|
+
class: w(l.$style.headerCellText)
|
|
3516
|
+
}, null, 8, ["ellipsis", "content", "class"]),
|
|
3517
|
+
G.titleTooltip ? (F(), E(Kt, { key: 0 }, {
|
|
3518
|
+
title: $(() => [
|
|
3519
|
+
J("span", {
|
|
3520
|
+
innerHTML: G.titleTooltip
|
|
3521
|
+
}, null, 8, yo)
|
|
3522
|
+
]),
|
|
3523
|
+
default: $(() => [
|
|
3524
|
+
O(S(Tn), {
|
|
3525
|
+
style: we({ color: S(Se).colorTextQuaternary }),
|
|
3526
|
+
class: w(l.$style.headerCellTooltipIcon)
|
|
3527
|
+
}, null, 8, ["style", "class"])
|
|
3528
|
+
]),
|
|
3529
|
+
_: 2
|
|
3530
|
+
}, 1024)) : N("", !0)
|
|
3531
|
+
], 2)) : N("", !0)
|
|
3532
|
+
]),
|
|
3533
|
+
bodyCell: $(({ column: G, record: Le, index: _t }) => [
|
|
3534
|
+
Et([Le == null ? void 0 : Le[D.rowKey], G == null ? void 0 : G.key, _t], () => O(Wr, {
|
|
3535
|
+
column: G,
|
|
3536
|
+
record: Le,
|
|
3537
|
+
index: _t,
|
|
3538
|
+
hasRouter: o.value
|
|
3539
|
+
}, null, 8, ["column", "record", "index", "hasRouter"]), u, 5)
|
|
3540
|
+
]),
|
|
3541
|
+
default: $(() => [
|
|
3542
|
+
l.$slots.expandColumnTitle ? pe(l.$slots, "expandColumnTitle", { key: 0 }) : N("", !0)
|
|
3543
|
+
]),
|
|
3544
|
+
_: 2
|
|
3545
|
+
}, [
|
|
3546
|
+
l.$slots.expandedRowRender ? {
|
|
3547
|
+
name: "expandedRowRender",
|
|
3548
|
+
fn: $(({ record: G }) => [
|
|
3549
|
+
pe(l.$slots, "expandedRowRender", { record: G })
|
|
3550
|
+
]),
|
|
3551
|
+
key: "0"
|
|
3552
|
+
} : void 0
|
|
3553
|
+
]), 1040, ["data-source"])
|
|
3554
|
+
], 2),
|
|
3555
|
+
l.$slots.tableFoot ? (F(), U("div", {
|
|
3556
|
+
key: 1,
|
|
3557
|
+
class: w(l.$style.tableFootWrapper)
|
|
3558
|
+
}, [
|
|
3559
|
+
pe(l.$slots, "tableFoot")
|
|
3560
|
+
], 2)) : N("", !0)
|
|
3561
|
+
], 2)
|
|
3562
|
+
], 6)
|
|
3563
|
+
]),
|
|
3564
|
+
_: 3
|
|
3565
|
+
}, 8, ["locale"]);
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
}), vo = "_superTable_1rx9j_1", ho = "_superTableHeader_1rx9j_5", bo = "_searchForm_1rx9j_10", _o = "_sceneSelect_1rx9j_14", Co = "_tableWrapper_1rx9j_17", $o = "_toolbar_1rx9j_17", wo = "_actionBtns_1rx9j_24", So = "_tableHeadWrapper_1rx9j_29", Io = "_tableContent_1rx9j_32", Fo = "_headerCell_1rx9j_35", xo = "_headerCellText_1rx9j_40", ko = "_headerCellTooltipIcon_1rx9j_43", To = "_sceneOpBtnWrapper_1rx9j_47", Oo = "_sceneOpBtn_1rx9j_47", Po = {
|
|
3569
|
+
superTable: vo,
|
|
3570
|
+
superTableHeader: ho,
|
|
3571
|
+
searchForm: bo,
|
|
3572
|
+
sceneSelect: _o,
|
|
3573
|
+
tableWrapper: Co,
|
|
3574
|
+
toolbar: $o,
|
|
3575
|
+
actionBtns: wo,
|
|
3576
|
+
tableHeadWrapper: So,
|
|
3577
|
+
tableContent: Io,
|
|
3578
|
+
headerCell: Fo,
|
|
3579
|
+
headerCellText: xo,
|
|
3580
|
+
headerCellTooltipIcon: ko,
|
|
3581
|
+
sceneOpBtnWrapper: To,
|
|
3582
|
+
sceneOpBtn: Oo
|
|
3583
|
+
}, qo = {
|
|
3584
|
+
$style: Po
|
|
3585
|
+
}, Lt = /* @__PURE__ */ fe(go, [["__cssModules", qo]]);
|
|
3586
|
+
Lt.install = (r) => {
|
|
3587
|
+
r.component("SuperTable", Lt);
|
|
3588
|
+
};
|
|
3589
|
+
export {
|
|
3590
|
+
R as SuperTableColumnTypeEnum,
|
|
3591
|
+
H as SuperTableFormItemTypeEnum,
|
|
3592
|
+
Lt as default
|
|
3593
|
+
};
|