vome-core 0.0.49 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/admin/config/plugin-dev.js +1 -54
  2. package/dist/admin/crud/components/vm-richtext.vue +115 -2
  3. package/dist/admin/crud/components/vm-upload.vue +1 -1
  4. package/dist/admin/crud/config.js +1 -33
  5. package/dist/admin/crud/confirm.js +1 -97
  6. package/dist/admin/crud/dict.js +1 -48
  7. package/dist/admin/crud/index.js +1 -74
  8. package/dist/admin/crud/key.js +1 -20
  9. package/dist/admin/crud/mitt.js +1 -21
  10. package/dist/admin/crud/plugins.js +1 -216
  11. package/dist/admin/crud/span.js +1 -35
  12. package/dist/admin/crud/style.js +1 -74
  13. package/dist/admin/crud/validate.js +1 -92
  14. package/dist/admin/crud/vm-search.vue +12 -4
  15. package/dist/admin/crud/vm-tabs.vue +94 -0
  16. package/dist/admin/crud/vm-toolbar.vue +16 -57
  17. package/dist/admin/directives/perm.js +1 -14
  18. package/dist/admin/hooks/useUpload.js +1 -63
  19. package/dist/admin/lib/browser.js +1 -24
  20. package/dist/admin/lib/cn.js +1 -5
  21. package/dist/admin/lib/dialog-float.js +1 -13
  22. package/dist/admin/lib/export-excel.js +1 -64
  23. package/dist/admin/lib/file-preview.js +1 -74
  24. package/dist/admin/lib/import-excel.js +1 -61
  25. package/dist/admin/lib/json.js +1 -42
  26. package/dist/admin/lib/menu.js +1 -11
  27. package/dist/admin/lib/tree.js +1 -1
  28. package/dist/admin/lib/upload.js +1 -88
  29. package/dist/admin/lib/video-frame.js +1 -80
  30. package/dist/index.js +1 -28021
  31. package/dist/server/index.js +1 -31407
  32. package/dist/shared/excel.js +1 -93
  33. package/dist/shared/index.js +1 -14
  34. package/dist/shared/tree.js +1 -39
  35. package/dist/src/orm/join-tables.d.ts +12 -0
  36. package/dist/src/orm/query-op.d.ts +10 -1
  37. package/dist/typings/routing/crud.d.ts +18 -4
  38. package/package.json +1 -1
  39. package/typings/admin/comm/crud.d.ts +2 -2
  40. package/typings/admin/comm/crud.ts +1 -1
@@ -1,216 +1 @@
1
- import { findEpsEntity } from "../lib/eps";
2
- import { getCrudStyle } from "./style";
3
- export function toTree(options = {}) {
4
- return {
5
- __plugin: "toTree",
6
- tree: true,
7
- lazy: options.lazy ?? false
8
- };
9
- }
10
- export function setFocus(prop) {
11
- return {
12
- __plugin: "setFocus",
13
- prop: prop ?? ""
14
- };
15
- }
16
- export function setRules() {
17
- return {
18
- __plugin: "setRules"
19
- };
20
- }
21
- export function setAuto(options = { hideLabel: true }) {
22
- return {
23
- __plugin: "setAuto",
24
- ...options
25
- };
26
- }
27
- export const Plugins = {
28
- Table: { toTree },
29
- Form: { setFocus, setRules },
30
- Search: { setAuto }
31
- };
32
- export function applyTablePlugins(options) {
33
- const style = getCrudStyle().table;
34
- const base = {
35
- border: style.border,
36
- autoHeight: style.autoHeight,
37
- contextMenu: style.contextMenu,
38
- ...options
39
- };
40
- const plugins = [
41
- ...style.plugins,
42
- ...options?.plugins || []
43
- ];
44
- const next = { ...base };
45
- delete next.plugins;
46
- for (const p of plugins) {
47
- if (!p || typeof p !== "object")
48
- continue;
49
- if (p.__plugin === "toTree") {
50
- next.tree = true;
51
- next.treeLazy = Boolean(p.lazy);
52
- }
53
- }
54
- return next;
55
- }
56
- function stripAlias(name) {
57
- return name.includes(".") ? name.split(".").pop() : name;
58
- }
59
- function parseRef(ref) {
60
- if (typeof ref === "string") {
61
- const column = stripAlias(ref);
62
- return { column, param: column, multiple: true, none: false };
63
- }
64
- if (!ref || typeof ref !== "object")
65
- return null;
66
- const o = ref;
67
- if (!o.column)
68
- return null;
69
- const column = stripAlias(o.column);
70
- return {
71
- column,
72
- param: o.requestParam || column,
73
- label: o.label,
74
- dict: o.dict,
75
- multiple: o.multiple !== false,
76
- none: Boolean(o.none)
77
- };
78
- }
79
- function displayName(ref, meta) {
80
- return ref.label || meta?.comment || ref.column;
81
- }
82
- export function buildAutoSearchItems(service, options = {}) {
83
- const ignore = new Set(options.ignoreFields || []);
84
- const search = service.search || {};
85
- let fieldEq = search.fieldEq || [];
86
- let fieldLike = search.fieldLike || [];
87
- let fieldArray = search.fieldArray || [];
88
- let fieldRange = search.fieldRange || [];
89
- let keyWordLikeFields = search.keyWordLikeFields || [];
90
- let cols = [];
91
- const entity = service.namespace ? findEpsEntity(`/${service.namespace}`) : undefined;
92
- if (entity) {
93
- cols = [
94
- ...entity.columns || [],
95
- ...entity.pageColumns || []
96
- ];
97
- if (!service.search) {
98
- const op = entity.pageQueryOp;
99
- if (op) {
100
- fieldEq = op.fieldEq || [];
101
- fieldLike = op.fieldLike || [];
102
- fieldArray = op.fieldArray || [];
103
- fieldRange = op.fieldRange || [];
104
- keyWordLikeFields = op.keyWordLikeFields || [];
105
- }
106
- }
107
- }
108
- const colOf = (name) => cols.find((c) => c.propertyName === name);
109
- const items = [];
110
- const usedProps = new Set;
111
- const pushItem = (item) => {
112
- if (!item.prop || usedProps.has(item.prop))
113
- return;
114
- usedProps.add(item.prop);
115
- items.push(item);
116
- };
117
- for (const raw of fieldLike) {
118
- const ref = parseRef(raw);
119
- if (!ref || ref.none || ignore.has(ref.param))
120
- continue;
121
- const meta = colOf(ref.column);
122
- const name = displayName(ref, meta);
123
- pushItem({
124
- prop: ref.param,
125
- label: options.hideLabel ? "" : name,
126
- placeholder: `搜索${name}`,
127
- type: "input"
128
- });
129
- }
130
- for (const raw of fieldArray) {
131
- const ref = parseRef(raw);
132
- if (!ref || ref.none || ignore.has(ref.param))
133
- continue;
134
- const meta = colOf(ref.column);
135
- const name = displayName(ref, meta);
136
- pushItem({
137
- prop: ref.param,
138
- label: options.hideLabel ? "" : name,
139
- placeholder: `搜索${name}`,
140
- type: "input"
141
- });
142
- }
143
- for (const raw of fieldEq) {
144
- const ref = parseRef(raw);
145
- if (!ref || ref.none || ignore.has(ref.param))
146
- continue;
147
- const meta = colOf(ref.column);
148
- const dictKey = ref.dict || (typeof meta?.dict === "string" ? meta.dict : Array.isArray(meta?.dict) ? meta.dict[0] : undefined);
149
- const name = displayName(ref, meta);
150
- const label = options.hideLabel ? "" : name;
151
- if (dictKey) {
152
- pushItem({
153
- prop: ref.param,
154
- label,
155
- placeholder: `选择${name}`,
156
- type: "select",
157
- dict: dictKey,
158
- multiple: ref.multiple
159
- });
160
- } else {
161
- pushItem({
162
- prop: ref.param,
163
- label,
164
- placeholder: `搜索${name}`,
165
- type: "input"
166
- });
167
- }
168
- }
169
- for (const r of fieldRange) {
170
- if (!r?.column || r.none)
171
- continue;
172
- if (ignore.has(r.min) || ignore.has(r.max))
173
- continue;
174
- const col = stripAlias(r.column);
175
- const meta = colOf(col);
176
- const name = r.label || meta?.comment || col;
177
- const label = options.hideLabel ? "" : name;
178
- const isNum = r.type === "int" || r.type === "float";
179
- const startHint = isNum ? "最小值" : "开始";
180
- const endHint = isNum ? "最大值" : "结束";
181
- pushItem({
182
- prop: `__range_${r.min}_${r.max}`,
183
- label,
184
- placeholder: name || "区间",
185
- type: isNum ? "number-range" : "daterange",
186
- range: { min: r.min, max: r.max, rangeType: r.type },
187
- component: {
188
- name: isNum ? "vm-number-range" : "vm-date-range",
189
- props: isNum ? {
190
- mode: r.type,
191
- startPlaceholder: `${name}${startHint}`,
192
- endPlaceholder: `${name}${endHint}`
193
- } : {
194
- precision: r.type,
195
- startPlaceholder: `${name}${startHint}`,
196
- endPlaceholder: `${name}${endHint}`
197
- }
198
- }
199
- });
200
- }
201
- if (keyWordLikeFields.length) {
202
- const names = keyWordLikeFields.map((raw) => {
203
- const ref = parseRef(raw);
204
- if (!ref)
205
- return typeof raw === "string" ? stripAlias(raw) : "";
206
- return displayName(ref, colOf(ref.column));
207
- }).filter(Boolean);
208
- pushItem({
209
- prop: "keyWord",
210
- label: options.hideLabel ? "" : "关键字",
211
- placeholder: `搜索${names.join("、") || "关键字"}`,
212
- type: "input"
213
- });
214
- }
215
- return items;
216
- }
1
+ (function(_0x4b1c01,_0x44163b){const _0x1ded11=_0x6fc6,_0x560e82=_0x4b1c01();while(!![]){try{const _0x4ef7cc=-parseInt(_0x1ded11(0x191))/0x1+parseInt(_0x1ded11(0x1b7))/0x2+-parseInt(_0x1ded11(0x1ad))/0x3*(parseInt(_0x1ded11(0x1ac))/0x4)+parseInt(_0x1ded11(0x1bb))/0x5*(-parseInt(_0x1ded11(0x192))/0x6)+parseInt(_0x1ded11(0x1a2))/0x7+-parseInt(_0x1ded11(0x1a8))/0x8+-parseInt(_0x1ded11(0x193))/0x9*(-parseInt(_0x1ded11(0x190))/0xa);if(_0x4ef7cc===_0x44163b)break;else _0x560e82['push'](_0x560e82['shift']());}catch(_0x13b93b){_0x560e82['push'](_0x560e82['shift']());}}}(_0x857c,0x97019));import{findEpsEntity}from'../lib/eps';function _0x857c(){const _0x301648=['Cg9W','DhjLzq','A2v5v29YzeXPA2vgAwvSzhm','C3bSAxq','x19Yyw5Nzv8','B2jQzwn0','DgfIBgu','CgfYyw0','C2v0rM9JDxm','BM9Uzq','BwLU','C291CMnL','odmZodi4muXcChb5uG','BMfTzxnWywnL','yxv0B0HLAwDODa','DhLWzq','zMLLBgrsyw5Nzq','y29TBwvUDa','nZqZnJiXnKXcCM5mwG','zMLLBgrfCq','BgfIzwW','Dg9uCMvL','ntC3ndm2u1rfqvHi','owzjtwX0Ea','ChjVCa','AgfZ','C3rHCNrZv2L0Aa','Bwf4','CgfNzunVBhvTBNm','AwDUB3jLrMLLBgrZ','zMLUza','CgX1z2LUCW','zMLSDgvY','mtKYnZGWnfL3DwzeCq','A2v5v29Yza','C2vSzwn0','CMvXDwvZDfbHCMfT','mJaWB3vjAfzU','Aw5JBhvKzxm','BxvSDgLWBgu','ChvZAa','BwfW','y29SDw1UCW','5ywZ6zsU5A2x','5PYa5AsN5yc8','C2v0uNvSzxm','y29SDw1U','zgf0zxjHBMDL','zMLLBgrmAwTL','Aw50','DM0Tzgf0zs1Yyw5Nzq','CgfNzvf1zxj5t3a','zgLJDa','zMXVyxq','BNvTyMvYlxjHBMDL','AM9PBG','Bgf6Eq','Aw5WDxq','AxnbCNjHEq','y29UDgv4De1LBNu','AgLKzuXHyMvS','yM9YzgvY','C3rYAw5N','C2vHCMnO','ntiWC0T2r2nN','mtaZotm5nMjdqujWwa','nZK0odjerKDUrMe','mJqXndK3thLjDenH','DM0TBNvTyMvYlxjHBMDL','zMLLBgrbCNjHEq'];_0x857c=function(){return _0x301648;};return _0x857c();}import{getCrudStyle}from'./style';function _0x6fc6(_0x209459,_0x134288){_0x209459=_0x209459-0x18d;const _0x857c88=_0x857c();let _0x6fc6c4=_0x857c88[_0x209459];if(_0x6fc6['CIUFuB']===undefined){var _0x4945d9=function(_0x2045b2){const _0x36f191='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x75a65e='',_0xbdfbf3='';for(let _0x2b4a59=0x0,_0xfdb0ee,_0xa7ff61,_0x57a426=0x0;_0xa7ff61=_0x2045b2['charAt'](_0x57a426++);~_0xa7ff61&&(_0xfdb0ee=_0x2b4a59%0x4?_0xfdb0ee*0x40+_0xa7ff61:_0xa7ff61,_0x2b4a59++%0x4)?_0x75a65e+=String['fromCharCode'](0xff&_0xfdb0ee>>(-0x2*_0x2b4a59&0x6)):0x0){_0xa7ff61=_0x36f191['indexOf'](_0xa7ff61);}for(let _0x137ae7=0x0,_0x3b3ba5=_0x75a65e['length'];_0x137ae7<_0x3b3ba5;_0x137ae7++){_0xbdfbf3+='%'+('00'+_0x75a65e['charCodeAt'](_0x137ae7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xbdfbf3);};_0x6fc6['jkJIkl']=_0x4945d9,_0x6fc6['xtKKpY']={},_0x6fc6['CIUFuB']=!![];}const _0x36bebd=_0x857c88[0x0],_0x3654ed=_0x209459+_0x36bebd,_0x32a19d=_0x6fc6['xtKKpY'][_0x3654ed];return!_0x32a19d?(_0x6fc6c4=_0x6fc6['jkJIkl'](_0x6fc6c4),_0x6fc6['xtKKpY'][_0x3654ed]=_0x6fc6c4):_0x6fc6c4=_0x32a19d,_0x6fc6c4;}export function toTree(_0x75a65e={}){const _0x2d228f=_0x6fc6;return{'__plugin':'toTree','tree':!![],'lazy':_0x75a65e[_0x2d228f(0x1ce)]??![]};}export function setFocus(_0xbdfbf3){const _0x4bc693=_0x6fc6;return{'__plugin':_0x4bc693(0x19e),'prop':_0xbdfbf3??''};}export function setRules(){const _0x31a680=_0x6fc6;return{'__plugin':_0x31a680(0x1c3)};}export function setAuto(_0x2b4a59={'hideLabel':!![]}){return{'__plugin':'setAuto',..._0x2b4a59};}export const Plugins={'Table':{'toTree':toTree},'Form':{'setFocus':setFocus,'setRules':setRules},'Search':{'setAuto':setAuto}};export function applyTablePlugins(_0xfdb0ee){const _0xe8fcc7=_0x6fc6,_0xa7ff61=getCrudStyle()[_0xe8fcc7(0x19c)],_0x57a426={'border':_0xa7ff61[_0xe8fcc7(0x18d)],'autoHeight':_0xa7ff61[_0xe8fcc7(0x1a4)],'contextMenu':_0xa7ff61[_0xe8fcc7(0x1d1)],..._0xfdb0ee},_0x137ae7=[..._0xa7ff61[_0xe8fcc7(0x1b5)],..._0xfdb0ee?.[_0xe8fcc7(0x1b5)]||[]],_0x3b3ba5={..._0x57a426};delete _0x3b3ba5[_0xe8fcc7(0x1b5)];for(const _0x1ceb30 of _0x137ae7){if(!_0x1ceb30||typeof _0x1ceb30!==_0xe8fcc7(0x19b))continue;_0x1ceb30['__plugin']===_0xe8fcc7(0x1ab)&&(_0x3b3ba5[_0xe8fcc7(0x197)]=!![],_0x3b3ba5['treeLazy']=Boolean(_0x1ceb30[_0xe8fcc7(0x1ce)]));}return _0x3b3ba5;}function stripAlias(_0x174fed){const _0x5887dc=_0x6fc6;return _0x174fed[_0x5887dc(0x1bc)]('.')?_0x174fed[_0x5887dc(0x199)]('.')[_0x5887dc(0x196)]():_0x174fed;}function toSource(_0x3b8ca5){const _0xf086cd=_0x6fc6;return _0x3b8ca5[_0xf086cd(0x1bc)]('.')?_0x3b8ca5:'a.'+_0x3b8ca5;}function parseRef(_0x4ed23a){const _0x2651ce=_0x6fc6;if(typeof _0x4ed23a===_0x2651ce(0x18e)){const _0x1656cd=stripAlias(_0x4ed23a);return{'column':_0x1656cd,'source':toSource(_0x4ed23a),'param':_0x1656cd,'multiple':!![],'none':![]};}if(!_0x4ed23a||typeof _0x4ed23a!==_0x2651ce(0x19b))return null;const _0x53b37e=_0x4ed23a;if(!_0x53b37e['column'])return null;const _0x9d3612=stripAlias(_0x53b37e['column']);return{'column':_0x9d3612,'source':toSource(_0x53b37e[_0x2651ce(0x1c4)]),'param':_0x53b37e[_0x2651ce(0x1ba)]||_0x9d3612,'label':_0x53b37e['label'],'dict':_0x53b37e[_0x2651ce(0x1ca)],'multiple':_0x53b37e['multiple']!==![],'none':Boolean(_0x53b37e[_0x2651ce(0x19f)])};}function displayName(_0x5126ac,_0x3b407d){const _0x278b99=_0x6fc6;return _0x5126ac[_0x278b99(0x1aa)]||_0x3b407d?.[_0x278b99(0x1a7)]||_0x5126ac[_0x278b99(0x1c4)];}export function buildAutoSearchItems(_0x24c780,_0x514af3={}){const _0x378512=_0x6fc6,_0xa48af9=new Set(_0x514af3[_0x378512(0x1b3)]||[]),_0x353755=_0x24c780[_0x378512(0x18f)]||{};let _0x1b64ec=_0x353755['fieldEq']||[],_0x251ab4=_0x353755['fieldLike']||[],_0x470062=_0x353755[_0x378512(0x195)]||[],_0x3f03d0=_0x353755[_0x378512(0x1a6)]||[],_0x356d69=_0x353755[_0x378512(0x198)]||[],_0x54450d=[];const _0x13f933=_0x24c780[_0x378512(0x1a3)]?findEpsEntity('/'+_0x24c780[_0x378512(0x1a3)]):undefined;if(_0x13f933){_0x54450d=[..._0x13f933[_0x378512(0x1c0)]||[],..._0x13f933[_0x378512(0x1b2)]||[]];if(!_0x24c780[_0x378512(0x18f)]){const _0x218f2d=_0x13f933[_0x378512(0x1c9)];_0x218f2d&&(_0x1b64ec=_0x218f2d[_0x378512(0x1a9)]||[],_0x251ab4=_0x218f2d[_0x378512(0x1c6)]||[],_0x470062=_0x218f2d['fieldArray']||[],_0x3f03d0=_0x218f2d[_0x378512(0x1a6)]||[],_0x356d69=_0x218f2d[_0x378512(0x198)]||[]);}}const _0x3b6550=(_0x5d512b,_0x715fb4)=>{const _0x495191=_0x378512,_0x53019c=_0x5d512b['includes']('.')?_0x5d512b:'a.'+_0x5d512b,_0x5d6b1e=_0x715fb4??stripAlias(_0x53019c);return _0x54450d['find'](_0x3a614c=>_0x3a614c[_0x495191(0x1a1)]===_0x53019c)||_0x54450d['find'](_0x5196be=>_0x5196be['propertyName']===_0x5d6b1e&&(!_0x5196be[_0x495191(0x1a1)]||_0x5196be[_0x495191(0x1a1)][_0x495191(0x1b0)]('a.')))||_0x54450d[_0x495191(0x1b4)](_0x177411=>_0x177411['propertyName']===_0x5d6b1e);},_0x27ac08=[],_0x38bc6e=new Set(),_0x5da975=_0x5d61fc=>{const _0x3dbe90=_0x378512;if(!_0x5d61fc[_0x3dbe90(0x1ae)]||_0x38bc6e['has'](_0x5d61fc[_0x3dbe90(0x1ae)]))return;_0x38bc6e['add'](_0x5d61fc[_0x3dbe90(0x1ae)]),_0x27ac08[_0x3dbe90(0x1be)](_0x5d61fc);};for(const _0x1e32e6 of _0x251ab4){const _0x477266=parseRef(_0x1e32e6);if(!_0x477266||_0x477266[_0x378512(0x19f)]||_0xa48af9[_0x378512(0x1af)](_0x477266[_0x378512(0x19d)]))continue;const _0x5294a2=_0x3b6550(_0x477266[_0x378512(0x1a1)],_0x477266[_0x378512(0x1c4)]),_0xe10536=displayName(_0x477266,_0x5294a2);_0x5da975({'prop':_0x477266[_0x378512(0x19d)],'label':_0x514af3['hideLabel']?'':_0xe10536,'placeholder':'搜索'+_0xe10536,'type':_0x378512(0x1cf)});}for(const _0x51f191 of _0x470062){const _0x4cf4c2=parseRef(_0x51f191);if(!_0x4cf4c2||_0x4cf4c2[_0x378512(0x19f)]||_0xa48af9[_0x378512(0x1af)](_0x4cf4c2[_0x378512(0x19d)]))continue;const _0x313988=_0x3b6550(_0x4cf4c2[_0x378512(0x1a1)],_0x4cf4c2[_0x378512(0x1c4)]),_0x1786b9=displayName(_0x4cf4c2,_0x313988);_0x5da975({'prop':_0x4cf4c2[_0x378512(0x19d)],'label':_0x514af3[_0x378512(0x1d2)]?'':_0x1786b9,'placeholder':'搜索'+_0x1786b9,'type':_0x378512(0x1cf)});}for(const _0x4a04b8 of _0x1b64ec){const _0x277273=parseRef(_0x4a04b8);if(!_0x277273||_0x277273[_0x378512(0x19f)]||_0xa48af9['has'](_0x277273[_0x378512(0x19d)]))continue;const _0x42e16e=_0x3b6550(_0x277273[_0x378512(0x1a1)],_0x277273['column']),_0x5024ed=_0x277273['dict']||(typeof _0x42e16e?.[_0x378512(0x1ca)]===_0x378512(0x18e)?_0x42e16e[_0x378512(0x1ca)]:Array[_0x378512(0x1d0)](_0x42e16e?.[_0x378512(0x1ca)])?_0x42e16e['dict'][0x0]:undefined),_0x2cc17f=displayName(_0x277273,_0x42e16e),_0x461fbe=_0x514af3['hideLabel']?'':_0x2cc17f;_0x5024ed?_0x5da975({'prop':_0x277273[_0x378512(0x19d)],'label':_0x461fbe,'placeholder':'选择'+_0x2cc17f,'type':_0x378512(0x1b9),'dict':_0x5024ed,'multiple':_0x277273[_0x378512(0x1bd)]}):_0x5da975({'prop':_0x277273[_0x378512(0x19d)],'label':_0x461fbe,'placeholder':'搜索'+_0x2cc17f,'type':'input'});}for(const _0x158703 of _0x3f03d0){if(!_0x158703?.['column']||_0x158703['none'])continue;if(_0xa48af9['has'](_0x158703[_0x378512(0x1a0)])||_0xa48af9[_0x378512(0x1af)](_0x158703[_0x378512(0x1b1)]))continue;const _0x4dc96a=toSource(_0x158703[_0x378512(0x1c4)]),_0x2a1604=stripAlias(_0x158703[_0x378512(0x1c4)]),_0x1eff8a=_0x3b6550(_0x4dc96a,_0x2a1604),_0xcdf252=_0x158703[_0x378512(0x1aa)]||_0x1eff8a?.['comment']||_0x2a1604,_0x54328b=_0x514af3[_0x378512(0x1d2)]?'':_0xcdf252,_0x108f14=_0x158703['type']===_0x378512(0x1c7)||_0x158703[_0x378512(0x1a5)]===_0x378512(0x1cb),_0x5afcbf=_0x108f14?'最小值':'开始',_0x3f2519=_0x108f14?_0x378512(0x1c2):'结束';_0x5da975({'prop':_0x378512(0x19a)+_0x158703[_0x378512(0x1a0)]+'_'+_0x158703[_0x378512(0x1b1)],'label':_0x54328b,'placeholder':_0xcdf252||'区间','type':_0x108f14?_0x378512(0x1cc):_0x378512(0x1c5),'range':{'min':_0x158703[_0x378512(0x1a0)],'max':_0x158703[_0x378512(0x1b1)],'rangeType':_0x158703[_0x378512(0x1a5)]},'component':{'name':_0x108f14?_0x378512(0x194):_0x378512(0x1c8),'props':_0x108f14?{'mode':_0x158703[_0x378512(0x1a5)],'startPlaceholder':''+_0xcdf252+_0x5afcbf,'endPlaceholder':''+_0xcdf252+_0x3f2519}:{'precision':_0x158703[_0x378512(0x1a5)],'startPlaceholder':''+_0xcdf252+_0x5afcbf,'endPlaceholder':''+_0xcdf252+_0x3f2519}}});}if(_0x356d69['length']){const _0x58a343=_0x356d69[_0x378512(0x1bf)](_0x35a37f=>{const _0x5447ba=_0x378512,_0x2c26c8=parseRef(_0x35a37f);if(!_0x2c26c8)return typeof _0x35a37f===_0x5447ba(0x18e)?stripAlias(_0x35a37f):'';return displayName(_0x2c26c8,_0x3b6550(_0x2c26c8[_0x5447ba(0x1a1)],_0x2c26c8['column']));})[_0x378512(0x1b6)](Boolean);_0x5da975({'prop':_0x378512(0x1b8),'label':_0x514af3[_0x378512(0x1d2)]?'':_0x378512(0x1c1),'placeholder':'搜索'+(_0x58a343[_0x378512(0x1cd)]('、')||'关键字'),'type':_0x378512(0x1cf)});}return _0x27ac08;}
@@ -1,35 +1 @@
1
- import { onMounted, onUnmounted, ref } from "vue";
2
- import { getCrudStyle } from "./style";
3
- export const FORM_COLS_DESKTOP = 24;
4
- export const FORM_COLS_MOBILE = 12;
5
- export const FORM_SPAN_FULL = 24;
6
- export const FORM_MQ_MOBILE = "(max-width: 768px)";
7
- export function getFormCols() {
8
- if (typeof window !== "undefined" && window.matchMedia(FORM_MQ_MOBILE).matches) {
9
- return FORM_COLS_MOBILE;
10
- }
11
- return FORM_COLS_DESKTOP;
12
- }
13
- export function resolveFormSpan(span, cols = getFormCols()) {
14
- const raw = span ?? getCrudStyle().form.span ?? FORM_SPAN_FULL;
15
- const normalized = Math.min(FORM_SPAN_FULL, Math.max(1, raw));
16
- if (cols === FORM_COLS_DESKTOP)
17
- return normalized;
18
- return Math.max(1, Math.round(normalized / FORM_COLS_DESKTOP * FORM_COLS_MOBILE));
19
- }
20
- export function useFormCols() {
21
- const cols = ref(getFormCols());
22
- let mql = null;
23
- const sync = () => {
24
- cols.value = getFormCols();
25
- };
26
- onMounted(() => {
27
- mql = window.matchMedia(FORM_MQ_MOBILE);
28
- mql.addEventListener("change", sync);
29
- sync();
30
- });
31
- onUnmounted(() => {
32
- mql?.removeEventListener("change", sync);
33
- });
34
- return cols;
35
- }
1
+ function _0x2a28(){const _0x25c8f2=['mtjprhrkv1m','y2HHBMDL','kg1HEc13Awr0AdOGnZy4ChGP','mJy3odeWmNzty2Pfza','mJDWs0X0z2S','ntGWnJG2nwvACevpBa','mtK5odK5og9TEe9AuG','Bwf0y2HLCW','nNH2EhbOvG','C3bHBG','DMfSDwu','BwLU','CM91BMq','mJaZmJC2oenAr1vjEa','murWDKfUyG','Bwf4','odm3mdG3qxv4uhng','Bwf0y2HnzwrPyq','CMvTB3zLrxzLBNrmAxn0zw5LCG','mJe0mdG3mtDJzhPABKq','mJmZmtq5mhDWALjrzG'];_0x2a28=function(){return _0x25c8f2;};return _0x2a28();}const _0x83cf39=_0xae7f;(function(_0x11ebd1,_0x3adeee){const _0x192d34=_0xae7f,_0x32cd8d=_0x11ebd1();while(!![]){try{const _0x3e5178=parseInt(_0x192d34(0x11c))/0x1*(-parseInt(_0x192d34(0x114))/0x2)+parseInt(_0x192d34(0x11e))/0x3*(parseInt(_0x192d34(0x10e))/0x4)+-parseInt(_0x192d34(0x113))/0x5*(parseInt(_0x192d34(0x116))/0x6)+-parseInt(_0x192d34(0x111))/0x7+-parseInt(_0x192d34(0x11b))/0x8+parseInt(_0x192d34(0x112))/0x9*(parseInt(_0x192d34(0x10d))/0xa)+parseInt(_0x192d34(0x10c))/0xb;if(_0x3e5178===_0x3adeee)break;else _0x32cd8d['push'](_0x32cd8d['shift']());}catch(_0x45e7df){_0x32cd8d['push'](_0x32cd8d['shift']());}}}(_0x2a28,0xa74ab));function _0xae7f(_0x2109c9,_0x528b9d){_0x2109c9=_0x2109c9-0x10a;const _0x2a2897=_0x2a28();let _0xae7f99=_0x2a2897[_0x2109c9];if(_0xae7f['YNORBo']===undefined){var _0x209408=function(_0x188a5a){const _0x2927ae='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4e0bde='',_0x1eea6a='';for(let _0x50a7af=0x0,_0x25533c,_0x49cf53,_0x47f1d5=0x0;_0x49cf53=_0x188a5a['charAt'](_0x47f1d5++);~_0x49cf53&&(_0x25533c=_0x50a7af%0x4?_0x25533c*0x40+_0x49cf53:_0x49cf53,_0x50a7af++%0x4)?_0x4e0bde+=String['fromCharCode'](0xff&_0x25533c>>(-0x2*_0x50a7af&0x6)):0x0){_0x49cf53=_0x2927ae['indexOf'](_0x49cf53);}for(let _0x4b70b6=0x0,_0x3e0423=_0x4e0bde['length'];_0x4b70b6<_0x3e0423;_0x4b70b6++){_0x1eea6a+='%'+('00'+_0x4e0bde['charCodeAt'](_0x4b70b6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1eea6a);};_0xae7f['zAYEXM']=_0x209408,_0xae7f['LIvlby']={},_0xae7f['YNORBo']=!![];}const _0x4918b7=_0x2a2897[0x0],_0x5b8932=_0x2109c9+_0x4918b7,_0x192369=_0xae7f['LIvlby'][_0x5b8932];return!_0x192369?(_0xae7f99=_0xae7f['zAYEXM'](_0xae7f99),_0xae7f['LIvlby'][_0x5b8932]=_0xae7f99):_0xae7f99=_0x192369,_0xae7f99;}import{onMounted,onUnmounted,ref}from'vue';import{getCrudStyle}from'./style';export const FORM_COLS_DESKTOP=0x18;export const FORM_COLS_MOBILE=0xc;export const FORM_SPAN_FULL=0x18;export const FORM_MQ_MOBILE=_0x83cf39(0x110);export function getFormCols(){const _0x45191e=_0x83cf39;if(typeof window!=='undefined'&&window[_0x45191e(0x10a)](FORM_MQ_MOBILE)[_0x45191e(0x115)])return FORM_COLS_MOBILE;return FORM_COLS_DESKTOP;}export function resolveFormSpan(_0x4e0bde,_0x1eea6a=getFormCols()){const _0x5cb8d7=_0x83cf39,_0x50a7af=_0x4e0bde??getCrudStyle()['form'][_0x5cb8d7(0x117)]??FORM_SPAN_FULL,_0x25533c=Math[_0x5cb8d7(0x119)](FORM_SPAN_FULL,Math[_0x5cb8d7(0x11d)](0x1,_0x50a7af));if(_0x1eea6a===FORM_COLS_DESKTOP)return _0x25533c;return Math[_0x5cb8d7(0x11d)](0x1,Math[_0x5cb8d7(0x11a)](_0x25533c/FORM_COLS_DESKTOP*FORM_COLS_MOBILE));}export function useFormCols(){const _0x49cf53=ref(getFormCols());let _0x47f1d5=null;const _0x4b70b6=()=>{const _0x3482a6=_0xae7f;_0x49cf53[_0x3482a6(0x118)]=getFormCols();};return onMounted(()=>{const _0x1a6d78=_0xae7f;_0x47f1d5=window[_0x1a6d78(0x10a)](FORM_MQ_MOBILE),_0x47f1d5['addEventListener']('change',_0x4b70b6),_0x4b70b6();}),onUnmounted(()=>{const _0x523b2e=_0xae7f;_0x47f1d5?.[_0x523b2e(0x10b)](_0x523b2e(0x10f),_0x4b70b6);}),_0x49cf53;}
@@ -1,74 +1 @@
1
- import { CRUD_LABELS, DEFAULT_CRUD_DICT } from "./dict";
2
- export const DEFAULT_CRUD_STYLE = {
3
- form: {
4
- labelPosition: "top",
5
- labelWidth: "100px",
6
- span: 24,
7
- plugins: []
8
- },
9
- table: {
10
- border: false,
11
- highlightCurrentRow: true,
12
- autoHeight: true,
13
- contextMenu: ["refresh", "check", "edit", "delete", "order-asc", "order-desc"],
14
- column: {
15
- align: "left",
16
- opWidth: 180
17
- },
18
- plugins: []
19
- },
20
- search: {
21
- plugins: []
22
- },
23
- colors: [
24
- "#4E5DFF",
25
- "#06b31c",
26
- "#e93f4d",
27
- "#d57121",
28
- "#6d17c3",
29
- "#04c273",
30
- "#aa7a24",
31
- "#1c109d"
32
- ]
33
- };
34
- let globalConfig = {
35
- dict: { ...DEFAULT_CRUD_DICT, label: { ...CRUD_LABELS } },
36
- style: structuredClone(DEFAULT_CRUD_STYLE)
37
- };
38
- export function setCrudConfig(partial) {
39
- if (!partial)
40
- return globalConfig;
41
- globalConfig = {
42
- dict: {
43
- ...globalConfig.dict,
44
- ...partial.dict,
45
- api: { ...globalConfig.dict.api, ...partial.dict?.api },
46
- pagination: { ...globalConfig.dict.pagination, ...partial.dict?.pagination },
47
- search: { ...globalConfig.dict.search, ...partial.dict?.search },
48
- sort: { ...globalConfig.dict.sort, ...partial.dict?.sort },
49
- label: { ...globalConfig.dict.label, ...partial.dict?.label }
50
- },
51
- style: {
52
- ...globalConfig.style,
53
- ...partial.style,
54
- form: { ...globalConfig.style.form, ...partial.style?.form },
55
- table: {
56
- ...globalConfig.style.table,
57
- ...partial.style?.table,
58
- column: {
59
- ...globalConfig.style.table.column,
60
- ...partial.style?.table?.column
61
- }
62
- },
63
- search: { ...globalConfig.style.search, ...partial.style?.search },
64
- colors: partial.style?.colors || globalConfig.style.colors
65
- }
66
- };
67
- return globalConfig;
68
- }
69
- export function getCrudConfig() {
70
- return globalConfig;
71
- }
72
- export function getCrudStyle() {
73
- return globalConfig.style;
74
- }
1
+ const _0x2dfad1=_0x1343;(function(_0x17ce21,_0x2fe2d3){const _0x4dac19=_0x1343,_0x21ac34=_0x17ce21();while(!![]){try{const _0x26f521=-parseInt(_0x4dac19(0x154))/0x1*(-parseInt(_0x4dac19(0x15b))/0x2)+-parseInt(_0x4dac19(0x153))/0x3*(-parseInt(_0x4dac19(0x150))/0x4)+parseInt(_0x4dac19(0x151))/0x5*(parseInt(_0x4dac19(0x14b))/0x6)+-parseInt(_0x4dac19(0x152))/0x7+-parseInt(_0x4dac19(0x163))/0x8+parseInt(_0x4dac19(0x159))/0x9*(parseInt(_0x4dac19(0x147))/0xa)+-parseInt(_0x4dac19(0x162))/0xb*(-parseInt(_0x4dac19(0x142))/0xc);if(_0x26f521===_0x2fe2d3)break;else _0x21ac34['push'](_0x21ac34['shift']());}catch(_0xa041f7){_0x21ac34['push'](_0x21ac34['shift']());}}}(_0x2e97,0xc45b3));import{CRUD_LABELS,DEFAULT_CRUD_DICT}from'./dict';function _0x1343(_0x7b1e0e,_0x34c53){_0x7b1e0e=_0x7b1e0e-0x141;const _0x2e9712=_0x2e97();let _0x134326=_0x2e9712[_0x7b1e0e];if(_0x1343['askrGl']===undefined){var _0x591406=function(_0x94e834){const _0x35a6b7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x318d4c='',_0x4aa136='';for(let _0x32c1d5=0x0,_0x4edfe1,_0x3433e2,_0x229c74=0x0;_0x3433e2=_0x94e834['charAt'](_0x229c74++);~_0x3433e2&&(_0x4edfe1=_0x32c1d5%0x4?_0x4edfe1*0x40+_0x3433e2:_0x3433e2,_0x32c1d5++%0x4)?_0x318d4c+=String['fromCharCode'](0xff&_0x4edfe1>>(-0x2*_0x32c1d5&0x6)):0x0){_0x3433e2=_0x35a6b7['indexOf'](_0x3433e2);}for(let _0xf063c2=0x0,_0x4349e0=_0x318d4c['length'];_0xf063c2<_0x4349e0;_0xf063c2++){_0x4aa136+='%'+('00'+_0x318d4c['charCodeAt'](_0xf063c2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4aa136);};_0x1343['GASxAs']=_0x591406,_0x1343['MlcoQm']={},_0x1343['askrGl']=!![];}const _0x286d9a=_0x2e9712[0x0],_0x5f338e=_0x7b1e0e+_0x286d9a,_0x4d6c13=_0x1343['MlcoQm'][_0x5f338e];return!_0x4d6c13?(_0x134326=_0x1343['GASxAs'](_0x134326),_0x1343['MlcoQm'][_0x5f338e]=_0x134326):_0x134326=_0x4d6c13,_0x134326;}export const DEFAULT_CRUD_STYLE={'form':{'labelPosition':_0x2dfad1(0x15a),'labelWidth':_0x2dfad1(0x148),'span':0x18,'plugins':[]},'table':{'border':![],'highlightCurrentRow':!![],'autoHeight':!![],'contextMenu':[_0x2dfad1(0x158),_0x2dfad1(0x15d),_0x2dfad1(0x141),'delete',_0x2dfad1(0x157),_0x2dfad1(0x14c)],'column':{'align':_0x2dfad1(0x155),'opWidth':0xb4},'plugins':[]},'search':{'plugins':[]},'colors':['#4E5DFF','#06b31c','#e93f4d',_0x2dfad1(0x160),_0x2dfad1(0x144),_0x2dfad1(0x14a),_0x2dfad1(0x145),_0x2dfad1(0x14f)]};let globalConfig={'dict':{...DEFAULT_CRUD_DICT,'label':{...CRUD_LABELS}},'style':structuredClone(DEFAULT_CRUD_STYLE)};function _0x2e97(){const _0x257ac5=['nduZota4ngjXrKXvrW','zM9YBq','iZzKmtDJmW','i2fHn2eYna','C2vHCMnO','mtbMz3nJB3q','mtaWChG','C3r5Bgu','iZa0yZi3mW','oteZnZC2EevLEeXj','B3jKzxiTzgvZyW','yxbP','zgLJDa','iZfJmta5za','mteYCMDpyvPS','nwLHB3PpBq','mZa4odm0nfDKCg1bBa','mteYnZi4twrSswz1','mtaZnti5AvnntLrm','BgvMDa','CgfNAw5HDgLVBG','B3jKzxiTyxnJ','CMvMCMvZAa','ntK1mti1oxDpv1jouq','Dg9W','mNLOveHxtq','C29YDa','y2HLy2S','y29SDw1U','DgfIBgu','i2q1nZeYmq','BgfIzwW','mtf4CMvVtey','odGXntK1mKfnrfb6zG','zwrPDa'];_0x2e97=function(){return _0x257ac5;};return _0x2e97();}export function setCrudConfig(_0x318d4c){const _0x3a3077=_0x2dfad1;if(!_0x318d4c)return globalConfig;return globalConfig={'dict':{...globalConfig['dict'],..._0x318d4c[_0x3a3077(0x14e)],'api':{...globalConfig[_0x3a3077(0x14e)][_0x3a3077(0x14d)],..._0x318d4c[_0x3a3077(0x14e)]?.['api']},'pagination':{...globalConfig[_0x3a3077(0x14e)][_0x3a3077(0x156)],..._0x318d4c['dict']?.['pagination']},'search':{...globalConfig[_0x3a3077(0x14e)][_0x3a3077(0x146)],..._0x318d4c[_0x3a3077(0x14e)]?.[_0x3a3077(0x146)]},'sort':{...globalConfig['dict']['sort'],..._0x318d4c[_0x3a3077(0x14e)]?.[_0x3a3077(0x15c)]},'label':{...globalConfig[_0x3a3077(0x14e)][_0x3a3077(0x161)],..._0x318d4c[_0x3a3077(0x14e)]?.['label']}},'style':{...globalConfig[_0x3a3077(0x149)],..._0x318d4c[_0x3a3077(0x149)],'form':{...globalConfig[_0x3a3077(0x149)]['form'],..._0x318d4c['style']?.[_0x3a3077(0x143)]},'table':{...globalConfig['style'][_0x3a3077(0x15f)],..._0x318d4c[_0x3a3077(0x149)]?.[_0x3a3077(0x15f)],'column':{...globalConfig[_0x3a3077(0x149)][_0x3a3077(0x15f)][_0x3a3077(0x15e)],..._0x318d4c[_0x3a3077(0x149)]?.['table']?.['column']}},'search':{...globalConfig[_0x3a3077(0x149)]['search'],..._0x318d4c[_0x3a3077(0x149)]?.[_0x3a3077(0x146)]},'colors':_0x318d4c[_0x3a3077(0x149)]?.['colors']||globalConfig[_0x3a3077(0x149)]['colors']}},globalConfig;}export function getCrudConfig(){return globalConfig;}export function getCrudStyle(){return globalConfig['style'];}
@@ -1,92 +1 @@
1
- function isEmpty(v) {
2
- if (v == null || v === "")
3
- return true;
4
- if (typeof v === "string" && v.trim() === "")
5
- return true;
6
- if (Array.isArray(v) && v.length === 0)
7
- return true;
8
- return false;
9
- }
10
- function normalizeRules(item) {
11
- const rules = [];
12
- if (item.required) {
13
- rules.push({
14
- required: true,
15
- message: `${item.label}不能为空`
16
- });
17
- }
18
- const raw = item.rules;
19
- if (!raw)
20
- return rules;
21
- if (Array.isArray(raw)) {
22
- for (const r of raw) {
23
- if (r && typeof r === "object")
24
- rules.push(r);
25
- }
26
- } else if (typeof raw === "object") {
27
- rules.push(raw);
28
- }
29
- return rules;
30
- }
31
- function isItemHidden(item, form) {
32
- if (typeof item.hidden === "function")
33
- return item.hidden(form);
34
- return Boolean(item.hidden);
35
- }
36
- async function validateItem(item, form) {
37
- const value = form[item.prop];
38
- for (const rule of normalizeRules(item)) {
39
- if (rule.required && isEmpty(value)) {
40
- return rule.message || `${item.label}不能为空`;
41
- }
42
- if (isEmpty(value))
43
- continue;
44
- const str = String(value);
45
- if (rule.min != null && str.length < rule.min) {
46
- return rule.message || `${item.label}至少 ${rule.min} 个字符`;
47
- }
48
- if (rule.max != null && str.length > rule.max) {
49
- return rule.message || `${item.label}最多 ${rule.max} 个字符`;
50
- }
51
- if (rule.pattern && !rule.pattern.test(str)) {
52
- return rule.message || `${item.label}格式不正确`;
53
- }
54
- if (rule.validator) {
55
- const r = await rule.validator(value, form);
56
- if (r !== true)
57
- return r || `${item.label}校验失败`;
58
- }
59
- }
60
- return null;
61
- }
62
- export async function validateFormItems(items, form) {
63
- for (const item of items) {
64
- if (isItemHidden(item, form))
65
- continue;
66
- const err = await validateItem(item, form);
67
- if (err)
68
- return err;
69
- }
70
- return null;
71
- }
72
- export async function validateFormFields(items, form) {
73
- const errors = {};
74
- for (const item of items) {
75
- if (isItemHidden(item, form))
76
- continue;
77
- const err = await validateItem(item, form);
78
- if (err)
79
- errors[item.prop] = err;
80
- }
81
- return errors;
82
- }
83
- export function applySetRules(items) {
84
- return items.map((it) => {
85
- if (!it.required || it.rules)
86
- return it;
87
- return {
88
- ...it,
89
- rules: [{ required: true, message: `${it.label}不能为空` }]
90
- };
91
- });
92
- }
1
+ (function(_0x23e2e1,_0x278fd7){const _0x39df28=_0x39dd,_0x17e64f=_0x23e2e1();while(!![]){try{const _0x1ed902=parseInt(_0x39df28(0x1c2))/0x1*(-parseInt(_0x39df28(0x1d6))/0x2)+parseInt(_0x39df28(0x1c7))/0x3*(-parseInt(_0x39df28(0x1c5))/0x4)+-parseInt(_0x39df28(0x1cb))/0x5+-parseInt(_0x39df28(0x1d5))/0x6+-parseInt(_0x39df28(0x1bd))/0x7*(parseInt(_0x39df28(0x1da))/0x8)+-parseInt(_0x39df28(0x1d7))/0x9*(-parseInt(_0x39df28(0x1ce))/0xa)+parseInt(_0x39df28(0x1c1))/0xb*(parseInt(_0x39df28(0x1d1))/0xc);if(_0x1ed902===_0x278fd7)break;else _0x17e64f['push'](_0x17e64f['shift']());}catch(_0x32ed90){_0x17e64f['push'](_0x17e64f['shift']());}}}(_0x272e,0x56099));function isEmpty(_0x29f8d3){const _0x4a018b=_0x39dd;if(_0x29f8d3==null||_0x29f8d3==='')return!![];if(typeof _0x29f8d3===_0x4a018b(0x1d3)&&_0x29f8d3[_0x4a018b(0x1d8)]()==='')return!![];if(Array[_0x4a018b(0x1cc)](_0x29f8d3)&&_0x29f8d3['length']===0x0)return!![];return![];}function normalizeRules(_0x1d62df){const _0x48da37=_0x39dd,_0x3a174a=[];_0x1d62df[_0x48da37(0x1d2)]&&_0x3a174a[_0x48da37(0x1bc)]({'required':!![],'message':_0x1d62df[_0x48da37(0x1bf)]+_0x48da37(0x1ba)});const _0x46f32b=_0x1d62df[_0x48da37(0x1ca)];if(!_0x46f32b)return _0x3a174a;if(Array['isArray'](_0x46f32b))for(const _0x4ac213 of _0x46f32b){if(_0x4ac213&&typeof _0x4ac213==='object')_0x3a174a['push'](_0x4ac213);}else typeof _0x46f32b===_0x48da37(0x1cf)&&_0x3a174a[_0x48da37(0x1bc)](_0x46f32b);return _0x3a174a;}function isItemHidden(_0x28cfd8,_0x4b1af8){const _0x35a59f=_0x39dd;if(typeof _0x28cfd8[_0x35a59f(0x1c8)]==='function')return _0x28cfd8[_0x35a59f(0x1c8)](_0x4b1af8);return Boolean(_0x28cfd8[_0x35a59f(0x1c8)]);}async function validateItem(_0x3b019d,_0x382073){const _0x578b8b=_0x39dd,_0x4bfb27=_0x382073[_0x3b019d['prop']];for(const _0x161caf of normalizeRules(_0x3b019d)){if(_0x161caf[_0x578b8b(0x1d2)]&&isEmpty(_0x4bfb27))return _0x161caf['message']||_0x3b019d[_0x578b8b(0x1bf)]+_0x578b8b(0x1ba);if(isEmpty(_0x4bfb27))continue;const _0x1e12b9=String(_0x4bfb27);if(_0x161caf[_0x578b8b(0x1c9)]!=null&&_0x1e12b9[_0x578b8b(0x1bb)]<_0x161caf['min'])return _0x161caf[_0x578b8b(0x1c0)]||_0x3b019d[_0x578b8b(0x1bf)]+_0x578b8b(0x1cd)+_0x161caf[_0x578b8b(0x1c9)]+_0x578b8b(0x1c3);if(_0x161caf[_0x578b8b(0x1be)]!=null&&_0x1e12b9[_0x578b8b(0x1bb)]>_0x161caf[_0x578b8b(0x1be)])return _0x161caf[_0x578b8b(0x1c0)]||_0x3b019d[_0x578b8b(0x1bf)]+_0x578b8b(0x1d4)+_0x161caf['max']+'\x20个字符';if(_0x161caf['pattern']&&!_0x161caf['pattern'][_0x578b8b(0x1d9)](_0x1e12b9))return _0x161caf['message']||_0x3b019d[_0x578b8b(0x1bf)]+'格式不正确';if(_0x161caf[_0x578b8b(0x1d0)]){const _0x23bd7e=await _0x161caf[_0x578b8b(0x1d0)](_0x4bfb27,_0x382073);if(_0x23bd7e!==!![])return _0x23bd7e||_0x3b019d['label']+'校验失败';}}return null;}function _0x272e(){const _0x584a77=['6iEZ5Bcria','ndGXmeXot0Lwsa','B2jQzwn0','DMfSAwrHDg9Y','mZzZALHvDw0','CMvXDwLYzwq','C3rYAw5N','5PYa5AsAia','mJKXmZK3mLHetKPWwq','neXttxn6CW','mti5ntfTB0rUA3e','DhjPBq','DgvZDa','ntuXmdmYB05ysvbZ','5lIn6io95lI656M6','BgvUz3rO','ChvZAa','mtrnD2vqz2i','Bwf4','BgfIzwW','BwvZC2fNzq','mZu2odu0m1HIC2Ppua','nZC0odjgAK5nuvC','ios4QUwTL+ESPG','ChjVCa','mJberfDbAhy','BwfW','ota5ntDVqKvltfa','AgLKzgvU','BwLU','CNvSzxm','mtKXnta1mfjRuu1XEa','AxnbCNjHEq'];_0x272e=function(){return _0x584a77;};return _0x272e();}export async function validateFormItems(_0x3ffb89,_0xe93930){for(const _0x1aee88 of _0x3ffb89){if(isItemHidden(_0x1aee88,_0xe93930))continue;const _0x3c8dab=await validateItem(_0x1aee88,_0xe93930);if(_0x3c8dab)return _0x3c8dab;}return null;}export async function validateFormFields(_0x2a0188,_0x15cc2d){const _0x381298=_0x39dd,_0x4eb2b7={};for(const _0x127e26 of _0x2a0188){if(isItemHidden(_0x127e26,_0x15cc2d))continue;const _0x2a727b=await validateItem(_0x127e26,_0x15cc2d);if(_0x2a727b)_0x4eb2b7[_0x127e26[_0x381298(0x1c4)]]=_0x2a727b;}return _0x4eb2b7;}function _0x39dd(_0x38a028,_0x23ba9a){_0x38a028=_0x38a028-0x1ba;const _0x272e7a=_0x272e();let _0x39ddfa=_0x272e7a[_0x38a028];if(_0x39dd['IKzCMl']===undefined){var _0x419931=function(_0x50cf94){const _0x30f254='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x29f8d3='',_0x1d62df='';for(let _0x3a174a=0x0,_0x46f32b,_0x4ac213,_0x28cfd8=0x0;_0x4ac213=_0x50cf94['charAt'](_0x28cfd8++);~_0x4ac213&&(_0x46f32b=_0x3a174a%0x4?_0x46f32b*0x40+_0x4ac213:_0x4ac213,_0x3a174a++%0x4)?_0x29f8d3+=String['fromCharCode'](0xff&_0x46f32b>>(-0x2*_0x3a174a&0x6)):0x0){_0x4ac213=_0x30f254['indexOf'](_0x4ac213);}for(let _0x4b1af8=0x0,_0x3b019d=_0x29f8d3['length'];_0x4b1af8<_0x3b019d;_0x4b1af8++){_0x1d62df+='%'+('00'+_0x29f8d3['charCodeAt'](_0x4b1af8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1d62df);};_0x39dd['HWHJLk']=_0x419931,_0x39dd['DkwYTr']={},_0x39dd['IKzCMl']=!![];}const _0x2347de=_0x272e7a[0x0],_0x4fa9cb=_0x38a028+_0x2347de,_0x125776=_0x39dd['DkwYTr'][_0x4fa9cb];return!_0x125776?(_0x39ddfa=_0x39dd['HWHJLk'](_0x39ddfa),_0x39dd['DkwYTr'][_0x4fa9cb]=_0x39ddfa):_0x39ddfa=_0x125776,_0x39ddfa;}export function applySetRules(_0x10b532){const _0x2394c1=_0x39dd;return _0x10b532[_0x2394c1(0x1c6)](_0x2c8531=>{const _0x7e4d5f=_0x2394c1;if(!_0x2c8531[_0x7e4d5f(0x1d2)]||_0x2c8531[_0x7e4d5f(0x1ca)])return _0x2c8531;return{..._0x2c8531,'rules':[{'required':!![],'message':_0x2c8531[_0x7e4d5f(0x1bf)]+_0x7e4d5f(0x1ba)}]};});}
@@ -21,7 +21,7 @@
21
21
  </SelectTrigger>
22
22
  <SelectContent>
23
23
  <SelectItem
24
- v-for="opt in item.options || []"
24
+ v-for="opt in resolveOptions(item.options)"
25
25
  :key="String(opt.value)"
26
26
  :value="String(opt.value)"
27
27
  >
@@ -48,7 +48,7 @@
48
48
  </template>
49
49
 
50
50
  <script setup lang="ts">
51
- import { ref, computed, watch, reactive, onMounted } from 'vue'
51
+ import { ref, computed, watch, reactive, onMounted, toValue } from 'vue'
52
52
  import { onBeforeUnmount } from 'vue'
53
53
  import { useCrud } from './useCrud'
54
54
  import { injectSearchOptions } from './key'
@@ -102,10 +102,18 @@ function emptyValue(item: CrudSearchItem) {
102
102
  function coerceSelect(item: CrudSearchItem, v: unknown) {
103
103
  const s = v == null ? '' : String(v)
104
104
  if (!s) return ''
105
- const hit = item.options?.find((o) => String(o.value) === s)
105
+ const hit = resolveOptions(item.options).find((o) => String(o.value) === s)
106
106
  return hit ? hit.value : s
107
107
  }
108
108
 
109
+ /** options 支持 Ref / ComputedRef / getter(与 vm-upsert 一致) */
110
+ function resolveOptions(
111
+ options: CrudSearchItem['options'],
112
+ ): Array<{ label: string; value: string | number | boolean }> {
113
+ const list = options == null ? [] : toValue(options)
114
+ return Array.isArray(list) ? list : []
115
+ }
116
+
109
117
  async function loadDictOptions(list: CrudSearchItem[]) {
110
118
  const keys = [
111
119
  ...new Set(list.map((i) => i.dict).filter((d): d is string => Boolean(d))),
@@ -200,7 +208,7 @@ function fieldProps(item: CrudSearchItem) {
200
208
  }
201
209
  : {}
202
210
  return {
203
- options: item.options,
211
+ options: resolveOptions(item.options),
204
212
  placeholder: item.placeholder || item.label,
205
213
  refreshOnChange: false,
206
214
  precision: item.range?.rangeType,
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div class="vm-tabs">
3
+ <button
4
+ v-for="item in items"
5
+ :key="String(item.value)"
6
+ type="button"
7
+ class="vm-tabs__item"
8
+ :class="{ 'is-active': isActive(item.value) }"
9
+ :disabled="disabled || item.disabled"
10
+ @click="onSelect(item)"
11
+ >
12
+ {{ item.label }}
13
+ </button>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ defineOptions({ name: 'vm-tabs' })
19
+
20
+ export type VmTabItem = {
21
+ label: string
22
+ value: string | number
23
+ disabled?: boolean
24
+ }
25
+
26
+ const props = withDefaults(
27
+ defineProps<{
28
+ modelValue?: string | number
29
+ items?: VmTabItem[]
30
+ disabled?: boolean
31
+ }>(),
32
+ {
33
+ modelValue: '',
34
+ items: () => [],
35
+ disabled: false,
36
+ },
37
+ )
38
+
39
+ const emit = defineEmits<{
40
+ 'update:modelValue': [value: string | number]
41
+ change: [value: string | number]
42
+ }>()
43
+
44
+ function isActive(value: string | number) {
45
+ return String(props.modelValue) === String(value)
46
+ }
47
+
48
+ function onSelect(item: VmTabItem) {
49
+ if (props.disabled || item.disabled) return
50
+ if (isActive(item.value)) return
51
+ emit('update:modelValue', item.value)
52
+ emit('change', item.value)
53
+ }
54
+ </script>
55
+
56
+ <style lang="scss" scoped>
57
+ .vm-tabs {
58
+ display: inline-flex;
59
+ height: 36px;
60
+ align-items: center;
61
+ padding: 3px;
62
+ border-radius: 12px;
63
+ background: var(--muted);
64
+ }
65
+
66
+ .vm-tabs__item {
67
+ height: 30px;
68
+ padding: 0 12px;
69
+ border: none;
70
+ border-radius: 10px;
71
+ background: transparent;
72
+ color: var(--muted-foreground);
73
+ font-size: 12px;
74
+ font-weight: 500;
75
+ cursor: pointer;
76
+ transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
77
+
78
+ &:disabled {
79
+ cursor: not-allowed;
80
+ opacity: 0.45;
81
+ }
82
+
83
+ &.is-active {
84
+ background: #fff;
85
+ color: var(--foreground);
86
+ font-weight: 600;
87
+ box-shadow: var(--shadow-card);
88
+
89
+ .dark & {
90
+ background: var(--card);
91
+ }
92
+ }
93
+ }
94
+ </style>