vome-core 0.0.92 → 0.0.94

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.
@@ -1,278 +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 toSource(column) {
60
- const expr = column.trim().replace(/\s+as\s+[a-zA-Z_]\w*$/i, "").trim();
61
- return expr.includes(".") ? expr : `a.${expr}`;
62
- }
63
- function parseRef(ref) {
64
- const AS_RE = /^(.+?)\s+as\s+([a-zA-Z_]\w*)$/i;
65
- const splitAs = (input) => {
66
- const raw = input.trim();
67
- const m = raw.match(AS_RE);
68
- if (m)
69
- return { expr: m[1].trim(), asName: m[2] };
70
- return { expr: raw, asName: undefined };
71
- };
72
- if (typeof ref === "string") {
73
- const { expr, asName } = splitAs(ref);
74
- const source = toSource(expr);
75
- const column = stripAlias(source);
76
- return {
77
- column,
78
- source,
79
- param: asName ?? column,
80
- multiple: true,
81
- none: false
82
- };
83
- }
84
- if (!ref || typeof ref !== "object")
85
- return null;
86
- const o = ref;
87
- if (!o.column)
88
- return null;
89
- const { expr, asName } = splitAs(o.column);
90
- const source = toSource(expr);
91
- const column = stripAlias(source);
92
- return {
93
- column,
94
- source,
95
- param: asName ?? column,
96
- label: o.label,
97
- dict: o.dict,
98
- multiple: o.multiple !== false,
99
- none: Boolean(o.none)
100
- };
101
- }
102
- function displayName(ref, meta) {
103
- return ref.label || meta?.comment || ref.column;
104
- }
105
- function fieldKeyOf(ref, meta) {
106
- const table = meta?.table?.trim();
107
- const prop = (meta?.propertyName || ref.column || "").trim();
108
- if (!table || !prop)
109
- return;
110
- return `${table}.${prop}`;
111
- }
112
- export function buildAutoSearchItems(service, options = {}) {
113
- const ignore = new Set(options.ignoreFields || []);
114
- const search = service.search || {};
115
- let fieldEq = search.fieldEq || [];
116
- let fieldLike = search.fieldLike || [];
117
- let fieldArray = search.fieldArray || [];
118
- let fieldRange = search.fieldRange || [];
119
- let keyWordLikeFields = search.keyWordLikeFields || [];
120
- let cols = [];
121
- const entity = service.namespace ? findEpsEntity(`/${service.namespace}`) : undefined;
122
- if (entity) {
123
- cols = [
124
- ...entity.columns || [],
125
- ...entity.pageColumns || []
126
- ];
127
- if (!service.search) {
128
- const op = entity.pageQueryOp;
129
- if (op) {
130
- fieldEq = op.fieldEq || [];
131
- fieldLike = op.fieldLike || [];
132
- fieldArray = op.fieldArray || [];
133
- fieldRange = op.fieldRange || [];
134
- keyWordLikeFields = op.keyWordLikeFields || [];
135
- }
136
- }
137
- }
138
- const colOf = (sourceOrName, short) => {
139
- const source = sourceOrName.includes(".") ? sourceOrName : `a.${sourceOrName}`;
140
- const leaf = short ?? stripAlias(source);
141
- return cols.find((c) => c.source === source) || cols.find((c) => c.propertyName === leaf && (!c.source || c.source.startsWith("a."))) || cols.find((c) => c.propertyName === leaf);
142
- };
143
- const items = [];
144
- const usedProps = new Set;
145
- const pushItem = (item) => {
146
- if (!item.prop || usedProps.has(item.prop))
147
- return;
148
- usedProps.add(item.prop);
149
- items.push(item);
150
- };
151
- for (const raw of fieldLike) {
152
- const ref = parseRef(raw);
153
- if (!ref || ref.none || ignore.has(ref.param))
154
- continue;
155
- const meta = colOf(ref.source, ref.column);
156
- const name = displayName(ref, meta);
157
- const fieldKey = fieldKeyOf(ref, meta);
158
- pushItem({
159
- prop: ref.param,
160
- label: options.hideLabel ? "" : name,
161
- nameFallback: name,
162
- fieldKey,
163
- phMode: "search",
164
- placeholder: `搜索${name}`,
165
- type: "input"
166
- });
167
- }
168
- for (const raw of fieldArray) {
169
- const ref = parseRef(raw);
170
- if (!ref || ref.none || ignore.has(ref.param))
171
- continue;
172
- const meta = colOf(ref.source, ref.column);
173
- const name = displayName(ref, meta);
174
- const fieldKey = fieldKeyOf(ref, meta);
175
- pushItem({
176
- prop: ref.param,
177
- label: options.hideLabel ? "" : name,
178
- nameFallback: name,
179
- fieldKey,
180
- phMode: "search",
181
- placeholder: `搜索${name}`,
182
- type: "input"
183
- });
184
- }
185
- for (const raw of fieldEq) {
186
- const ref = parseRef(raw);
187
- if (!ref || ref.none || ignore.has(ref.param))
188
- continue;
189
- const meta = colOf(ref.source, ref.column);
190
- const dictKey = ref.dict || (typeof meta?.dict === "string" ? meta.dict : Array.isArray(meta?.dict) ? meta.dict[0] : undefined);
191
- const name = displayName(ref, meta);
192
- const fieldKey = fieldKeyOf(ref, meta);
193
- const label = options.hideLabel ? "" : name;
194
- if (dictKey) {
195
- pushItem({
196
- prop: ref.param,
197
- label,
198
- nameFallback: name,
199
- fieldKey,
200
- phMode: "select",
201
- placeholder: `选择${name}`,
202
- type: "select",
203
- dict: dictKey,
204
- multiple: ref.multiple
205
- });
206
- } else {
207
- pushItem({
208
- prop: ref.param,
209
- label,
210
- nameFallback: name,
211
- fieldKey,
212
- phMode: "search",
213
- placeholder: `搜索${name}`,
214
- type: "input"
215
- });
216
- }
217
- }
218
- for (const r of fieldRange) {
219
- if (!r?.column || r.none)
220
- continue;
221
- if (ignore.has(r.min) || ignore.has(r.max))
222
- continue;
223
- const source = toSource(r.column);
224
- const col = stripAlias(r.column);
225
- const meta = colOf(source, col);
226
- const name = r.label || meta?.comment || col;
227
- const fieldKey = fieldKeyOf({ column: col }, meta);
228
- const label = options.hideLabel ? "" : name;
229
- const isNum = r.type === "int" || r.type === "float";
230
- const startHint = isNum ? "最小值" : "开始";
231
- const endHint = isNum ? "最大值" : "结束";
232
- pushItem({
233
- prop: `__range_${r.min}_${r.max}`,
234
- label,
235
- nameFallback: name,
236
- fieldKey,
237
- phMode: "range",
238
- placeholder: name || "区间",
239
- type: isNum ? "number-range" : "daterange",
240
- range: { min: r.min, max: r.max, rangeType: r.type },
241
- component: {
242
- name: isNum ? "vm-number-range" : "vm-date-range",
243
- props: isNum ? {
244
- mode: r.type,
245
- startPlaceholder: `${name}${startHint}`,
246
- endPlaceholder: `${name}${endHint}`
247
- } : {
248
- precision: r.type,
249
- startPlaceholder: `${name}${startHint}`,
250
- endPlaceholder: `${name}${endHint}`
251
- }
252
- }
253
- });
254
- }
255
- if (keyWordLikeFields.length) {
256
- const parts = [];
257
- const names = keyWordLikeFields.map((raw) => {
258
- const ref = parseRef(raw);
259
- if (!ref)
260
- return typeof raw === "string" ? stripAlias(raw) : "";
261
- const meta = colOf(ref.source, ref.column);
262
- const fk = fieldKeyOf(ref, meta);
263
- if (fk)
264
- parts.push(fk);
265
- return displayName(ref, meta);
266
- }).filter(Boolean);
267
- pushItem({
268
- prop: "keyWord",
269
- label: options.hideLabel ? "" : "关键字",
270
- nameFallback: names.join("、") || "关键字",
271
- phMode: "keyword",
272
- keywordParts: parts,
273
- placeholder: `搜索${names.join("、") || "关键字"}`,
274
- type: "input"
275
- });
276
- }
277
- return items;
278
- }
1
+ (function(_0x1a6f53,_0x582d8d){const _0x401fd4=_0x3e09,_0x391de6=_0x1a6f53();while(!![]){try{const _0x5907b7=-parseInt(_0x401fd4(0x1ee))/0x1*(-parseInt(_0x401fd4(0x21b))/0x2)+parseInt(_0x401fd4(0x200))/0x3+parseInt(_0x401fd4(0x224))/0x4*(-parseInt(_0x401fd4(0x1f2))/0x5)+parseInt(_0x401fd4(0x221))/0x6*(parseInt(_0x401fd4(0x21f))/0x7)+-parseInt(_0x401fd4(0x231))/0x8+parseInt(_0x401fd4(0x216))/0x9+-parseInt(_0x401fd4(0x228))/0xa;if(_0x5907b7===_0x582d8d)break;else _0x391de6['push'](_0x391de6['shift']());}catch(_0x712492){_0x391de6['push'](_0x391de6['shift']());}}}(_0xac93,0xd80f9));import{findEpsEntity}from'../lib/eps';function _0x3e09(_0x2ec933,_0x1565a3){_0x2ec933=_0x2ec933-0x1eb;const _0xac9345=_0xac93();let _0x3e0961=_0xac9345[_0x2ec933];if(_0x3e09['AAMwXh']===undefined){var _0x3b7d28=function(_0x23ef8a){const _0x1a76f8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x519d09='',_0xc066a1='';for(let _0x736288=0x0,_0xd3a95e,_0x266d3e,_0x221139=0x0;_0x266d3e=_0x23ef8a['charAt'](_0x221139++);~_0x266d3e&&(_0xd3a95e=_0x736288%0x4?_0xd3a95e*0x40+_0x266d3e:_0x266d3e,_0x736288++%0x4)?_0x519d09+=String['fromCharCode'](0xff&_0xd3a95e>>(-0x2*_0x736288&0x6)):0x0){_0x266d3e=_0x1a76f8['indexOf'](_0x266d3e);}for(let _0x39ea1f=0x0,_0x12fe68=_0x519d09['length'];_0x39ea1f<_0x12fe68;_0x39ea1f++){_0xc066a1+='%'+('00'+_0x519d09['charCodeAt'](_0x39ea1f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xc066a1);};_0x3e09['nzpWsf']=_0x3b7d28,_0x3e09['YeQKPg']={},_0x3e09['AAMwXh']=!![];}const _0x399509=_0xac9345[0x0],_0x5148cc=_0x2ec933+_0x399509,_0x278fc9=_0x3e09['YeQKPg'][_0x5148cc];return!_0x278fc9?(_0x3e0961=_0x3e09['nzpWsf'](_0x3e0961),_0x3e09['YeQKPg'][_0x5148cc]=_0x3e0961):_0x3e0961=_0x278fc9,_0x3e0961;}import{getCrudStyle}from'./style';export function toTree(_0x519d09={}){const _0x15b331=_0x3e09;return{'__plugin':'toTree','tree':!![],'lazy':_0x519d09[_0x15b331(0x1fb)]??![]};}export function setFocus(_0xc066a1){return{'__plugin':'setFocus','prop':_0xc066a1??''};}function _0xac93(){const _0x1ba3a0=['5PYa5Bcp5yc8','zgLJDa','DgfIBgu','DhjLzuXHENK','Bwf0y2G','Bwf4','mxrAvxLpBW','zMLLBgrfCq','yxv0B0HLAwDODa','DhLWzq','nJm2mta1AgzrrNnO','yM9YzgvY','zMLLBgrbCNjHEq','ywrK','CMvWBgfJzq','C2v0uNvSzxm','C291CMnL','B2jQzwn0','zMLSDgvY','Bgf6Eq','C3bSAxq','zMLLBgrmAwTL','x19WBhvNAw4','CgfNzunVBhvTBNm','mJu0ndiWn1LeueDJtG','CgfNzvf1zxj5t3a','zMXVyxq','y29UDgv4De1LBNu','y29SDw1U','Aw50','AgLKzuXHyMvS','AM9PBG','Dg9uCMvL','DhjLzq','BM9Uzq','C2vSzwn0','5ywZ6zsU5A2x','CMfUz2u','Aw5JBhvKzxm','A2v5v29YzeXPA2vgAwvSzhm','A2v5D29Yza','ChjVCa','BgfIzwW','BNvTyMvYlxjHBMDL','AgfZ','5PYa5AsN5yc8','mtmWmtGWnJHvBeH6zgS','BMfTzxnWywnL','BwLU','zMLLBgrsyw5Nzq','CgfYyw0','mJi4mJuYmgnIvgLtEa','DhjPBq','C3rYAw5N','C2vHCMnO','nJaZneXoALjQwa','BwfW','mtiZmtHTr3zOu2O','BgvUz3rO','CgX1z2LUCW','mZzOCxbxBKy','Aw5WDxq','y29TBwvUDa','DM0Tzgf0zs1Yyw5Nzq','mtCWntKXndbKzNj5qvi','ChvZAa','C2v0qxv0BW','ChjVCgvYDhLoyw1L','BxvSDgLWBgu','zMLUza','C3rHCNrZv2L0Aa','AwDUB3jLrMLLBgrZ','Cg9W','mte3nty2mZjjufDqtMi'];_0xac93=function(){return _0x1ba3a0;};return _0xac93();}export function setRules(){const _0x1b2de2=_0x3e09;return{'__plugin':_0x1b2de2(0x1f7)};}export function setAuto(_0x736288={'hideLabel':!![]}){const _0x66c277=_0x3e09;return{'__plugin':_0x66c277(0x22a),..._0x736288};}export const Plugins={'Table':{'toTree':toTree},'Form':{'setFocus':setFocus,'setRules':setRules},'Search':{'setAuto':setAuto}};export function applyTablePlugins(_0xd3a95e){const _0x325472=_0x3e09,_0x266d3e=getCrudStyle()['table'],_0x221139={'border':_0x266d3e[_0x325472(0x1f3)],'autoHeight':_0x266d3e[_0x325472(0x1f0)],'contextMenu':_0x266d3e[_0x325472(0x203)],..._0xd3a95e},_0x39ea1f=[..._0x266d3e[_0x325472(0x223)],..._0xd3a95e?.[_0x325472(0x223)]||[]],_0x12fe68={..._0x221139};delete _0x12fe68['plugins'];for(const _0x34fe01 of _0x39ea1f){if(!_0x34fe01||typeof _0x34fe01!==_0x325472(0x1f9))continue;_0x34fe01[_0x325472(0x1fe)]===_0x325472(0x208)&&(_0x12fe68[_0x325472(0x209)]=!![],_0x12fe68[_0x325472(0x1eb)]=Boolean(_0x34fe01[_0x325472(0x1fb)]));}return _0x12fe68;}function stripAlias(_0x92e9c4){const _0x4e36de=_0x3e09;return _0x92e9c4[_0x4e36de(0x20e)]('.')?_0x92e9c4[_0x4e36de(0x1fc)]('.')[_0x4e36de(0x230)]():_0x92e9c4;}function toSource(_0x352b3a){const _0x483034=_0x3e09,_0x379800=_0x352b3a[_0x483034(0x21c)]()[_0x483034(0x1f6)](/\s+as\s+[a-zA-Z_]\w*$/i,'')[_0x483034(0x21c)]();return _0x379800['includes']('.')?_0x379800:'a.'+_0x379800;}function parseRef(_0x43c3d6){const _0x371054=_0x3e09,_0x528509=/^(.+?)\s+as\s+([a-zA-Z_]\w*)$/i,_0x20bad5=_0x20375c=>{const _0x4155e3=_0x3e09,_0x1d55fd=_0x20375c['trim'](),_0x2354f1=_0x1d55fd[_0x4155e3(0x1ec)](_0x528509);if(_0x2354f1)return{'expr':_0x2354f1[0x1]['trim'](),'asName':_0x2354f1[0x2]};return{'expr':_0x1d55fd,'asName':undefined};};if(typeof _0x43c3d6==='string'){const {expr:_0x174fef,asName:_0x5301e6}=_0x20bad5(_0x43c3d6),_0x505d01=toSource(_0x174fef),_0x336422=stripAlias(_0x505d01);return{'column':_0x336422,'source':_0x505d01,'param':_0x5301e6??_0x336422,'multiple':!![],'none':![]};}if(!_0x43c3d6||typeof _0x43c3d6!=='object')return null;const _0x525b87=_0x43c3d6;if(!_0x525b87[_0x371054(0x204)])return null;const {expr:_0x583e40,asName:_0x556586}=_0x20bad5(_0x525b87[_0x371054(0x204)]),_0xe85ef3=toSource(_0x583e40),_0x30091b=stripAlias(_0xe85ef3);return{'column':_0x30091b,'source':_0xe85ef3,'param':_0x556586??_0x30091b,'label':_0x525b87['label'],'dict':_0x525b87[_0x371054(0x233)],'multiple':_0x525b87[_0x371054(0x22c)]!==![],'none':Boolean(_0x525b87[_0x371054(0x20a)])};}function displayName(_0x1eb80b,_0x3ca057){const _0x290daa=_0x3e09;return _0x1eb80b[_0x290daa(0x212)]||_0x3ca057?.[_0x290daa(0x226)]||_0x1eb80b[_0x290daa(0x204)];}function fieldKeyOf(_0x2a0223,_0x5027b0){const _0x3806c0=_0x3e09,_0x3c7579=_0x5027b0?.[_0x3806c0(0x234)]?.[_0x3806c0(0x21c)](),_0x12bfb4=(_0x5027b0?.['propertyName']||_0x2a0223[_0x3806c0(0x204)]||'')[_0x3806c0(0x21c)]();if(!_0x3c7579||!_0x12bfb4)return;return _0x3c7579+'.'+_0x12bfb4;}export function buildAutoSearchItems(_0x124c45,_0x314d1b={}){const _0x86a0e5=_0x3e09,_0x4546e2=new Set(_0x314d1b[_0x86a0e5(0x22f)]||[]),_0xf03ac=_0x124c45[_0x86a0e5(0x21e)]||{};let _0xf47cbf=_0xf03ac[_0x86a0e5(0x1ef)]||[],_0x2efa82=_0xf03ac[_0x86a0e5(0x1fd)]||[],_0x274c25=_0xf03ac[_0x86a0e5(0x1f4)]||[],_0x495d80=_0xf03ac[_0x86a0e5(0x219)]||[],_0x21f90d=_0xf03ac[_0x86a0e5(0x20f)]||[],_0x5e2331=[];const _0x2812c9=_0x124c45[_0x86a0e5(0x217)]?findEpsEntity('/'+_0x124c45['namespace']):undefined;if(_0x2812c9){_0x5e2331=[..._0x2812c9['columns']||[],..._0x2812c9[_0x86a0e5(0x1ff)]||[]];if(!_0x124c45[_0x86a0e5(0x21e)]){const _0x36f4f6=_0x2812c9[_0x86a0e5(0x201)];_0x36f4f6&&(_0xf47cbf=_0x36f4f6['fieldEq']||[],_0x2efa82=_0x36f4f6['fieldLike']||[],_0x274c25=_0x36f4f6[_0x86a0e5(0x1f4)]||[],_0x495d80=_0x36f4f6[_0x86a0e5(0x219)]||[],_0x21f90d=_0x36f4f6['keyWordLikeFields']||[]);}}const _0x28ec43=(_0x4e2781,_0x46802f)=>{const _0x3a513e=_0x86a0e5,_0x3813ea=_0x4e2781[_0x3a513e(0x20e)]('.')?_0x4e2781:'a.'+_0x4e2781,_0x2d6a7a=_0x46802f??stripAlias(_0x3813ea);return _0x5e2331[_0x3a513e(0x22d)](_0x452ea7=>_0x452ea7[_0x3a513e(0x1f8)]===_0x3813ea)||_0x5e2331[_0x3a513e(0x22d)](_0x26973e=>_0x26973e[_0x3a513e(0x22b)]===_0x2d6a7a&&(!_0x26973e[_0x3a513e(0x1f8)]||_0x26973e['source'][_0x3a513e(0x22e)]('a.')))||_0x5e2331[_0x3a513e(0x22d)](_0x18526c=>_0x18526c['propertyName']===_0x2d6a7a);},_0x1eb450=[],_0x47115e=new Set(),_0xcd2760=_0x53d72e=>{const _0x2ec114=_0x86a0e5;if(!_0x53d72e['prop']||_0x47115e['has'](_0x53d72e['prop']))return;_0x47115e[_0x2ec114(0x1f5)](_0x53d72e[_0x2ec114(0x211)]),_0x1eb450[_0x2ec114(0x229)](_0x53d72e);};for(const _0x3eabbd of _0x2efa82){const _0x410aa5=parseRef(_0x3eabbd);if(!_0x410aa5||_0x410aa5[_0x86a0e5(0x20a)]||_0x4546e2['has'](_0x410aa5[_0x86a0e5(0x21a)]))continue;const _0x341906=_0x28ec43(_0x410aa5['source'],_0x410aa5[_0x86a0e5(0x204)]),_0x414a41=displayName(_0x410aa5,_0x341906),_0x24038e=fieldKeyOf(_0x410aa5,_0x341906);_0xcd2760({'prop':_0x410aa5[_0x86a0e5(0x21a)],'label':_0x314d1b[_0x86a0e5(0x206)]?'':_0x414a41,'nameFallback':_0x414a41,'fieldKey':_0x24038e,'phMode':_0x86a0e5(0x21e),'placeholder':'搜索'+_0x414a41,'type':_0x86a0e5(0x225)});}for(const _0x2ca245 of _0x274c25){const _0x505878=parseRef(_0x2ca245);if(!_0x505878||_0x505878[_0x86a0e5(0x20a)]||_0x4546e2[_0x86a0e5(0x214)](_0x505878[_0x86a0e5(0x21a)]))continue;const _0x5439a7=_0x28ec43(_0x505878['source'],_0x505878['column']),_0x3a582f=displayName(_0x505878,_0x5439a7),_0x2651da=fieldKeyOf(_0x505878,_0x5439a7);_0xcd2760({'prop':_0x505878['param'],'label':_0x314d1b[_0x86a0e5(0x206)]?'':_0x3a582f,'nameFallback':_0x3a582f,'fieldKey':_0x2651da,'phMode':_0x86a0e5(0x21e),'placeholder':'搜索'+_0x3a582f,'type':_0x86a0e5(0x225)});}for(const _0x4ea258 of _0xf47cbf){const _0x4b5029=parseRef(_0x4ea258);if(!_0x4b5029||_0x4b5029[_0x86a0e5(0x20a)]||_0x4546e2[_0x86a0e5(0x214)](_0x4b5029[_0x86a0e5(0x21a)]))continue;const _0x19f25a=_0x28ec43(_0x4b5029['source'],_0x4b5029[_0x86a0e5(0x204)]),_0x4900b4=_0x4b5029[_0x86a0e5(0x233)]||(typeof _0x19f25a?.[_0x86a0e5(0x233)]===_0x86a0e5(0x21d)?_0x19f25a[_0x86a0e5(0x233)]:Array['isArray'](_0x19f25a?.[_0x86a0e5(0x233)])?_0x19f25a[_0x86a0e5(0x233)][0x0]:undefined),_0x493b9f=displayName(_0x4b5029,_0x19f25a),_0x1c1cd2=fieldKeyOf(_0x4b5029,_0x19f25a),_0x47d68a=_0x314d1b[_0x86a0e5(0x206)]?'':_0x493b9f;_0x4900b4?_0xcd2760({'prop':_0x4b5029[_0x86a0e5(0x21a)],'label':_0x47d68a,'nameFallback':_0x493b9f,'fieldKey':_0x1c1cd2,'phMode':_0x86a0e5(0x20b),'placeholder':'选择'+_0x493b9f,'type':'select','dict':_0x4900b4,'multiple':_0x4b5029['multiple']}):_0xcd2760({'prop':_0x4b5029[_0x86a0e5(0x21a)],'label':_0x47d68a,'nameFallback':_0x493b9f,'fieldKey':_0x1c1cd2,'phMode':'search','placeholder':'搜索'+_0x493b9f,'type':_0x86a0e5(0x225)});}for(const _0x4c4d62 of _0x495d80){if(!_0x4c4d62?.['column']||_0x4c4d62[_0x86a0e5(0x20a)])continue;if(_0x4546e2[_0x86a0e5(0x214)](_0x4c4d62[_0x86a0e5(0x218)])||_0x4546e2['has'](_0x4c4d62[_0x86a0e5(0x1ed)]))continue;const _0x4051b7=toSource(_0x4c4d62[_0x86a0e5(0x204)]),_0x14f624=stripAlias(_0x4c4d62[_0x86a0e5(0x204)]),_0x79993=_0x28ec43(_0x4051b7,_0x14f624),_0x4ea5fd=_0x4c4d62['label']||_0x79993?.[_0x86a0e5(0x226)]||_0x14f624,_0xb55ba5=fieldKeyOf({'column':_0x14f624},_0x79993),_0x53e50d=_0x314d1b['hideLabel']?'':_0x4ea5fd,_0x59c931=_0x4c4d62['type']===_0x86a0e5(0x205)||_0x4c4d62[_0x86a0e5(0x1f1)]===_0x86a0e5(0x202),_0x2c5db2=_0x59c931?_0x86a0e5(0x232):'开始',_0x54ef62=_0x59c931?_0x86a0e5(0x215):'结束';_0xcd2760({'prop':'__range_'+_0x4c4d62[_0x86a0e5(0x218)]+'_'+_0x4c4d62[_0x86a0e5(0x1ed)],'label':_0x53e50d,'nameFallback':_0x4ea5fd,'fieldKey':_0xb55ba5,'phMode':_0x86a0e5(0x20d),'placeholder':_0x4ea5fd||'区间','type':_0x59c931?_0x86a0e5(0x213):'daterange','range':{'min':_0x4c4d62[_0x86a0e5(0x218)],'max':_0x4c4d62[_0x86a0e5(0x1ed)],'rangeType':_0x4c4d62[_0x86a0e5(0x1f1)]},'component':{'name':_0x59c931?'vm-number-range':_0x86a0e5(0x227),'props':_0x59c931?{'mode':_0x4c4d62[_0x86a0e5(0x1f1)],'startPlaceholder':''+_0x4ea5fd+_0x2c5db2,'endPlaceholder':''+_0x4ea5fd+_0x54ef62}:{'precision':_0x4c4d62[_0x86a0e5(0x1f1)],'startPlaceholder':''+_0x4ea5fd+_0x2c5db2,'endPlaceholder':''+_0x4ea5fd+_0x54ef62}}});}if(_0x21f90d[_0x86a0e5(0x222)]){const _0x119e11=[],_0x33ffea=_0x21f90d[_0x86a0e5(0x220)](_0x37fec7=>{const _0x33a41c=_0x86a0e5,_0x28e910=parseRef(_0x37fec7);if(!_0x28e910)return typeof _0x37fec7==='string'?stripAlias(_0x37fec7):'';const _0x1596ba=_0x28ec43(_0x28e910['source'],_0x28e910[_0x33a41c(0x204)]),_0x3b040d=fieldKeyOf(_0x28e910,_0x1596ba);if(_0x3b040d)_0x119e11['push'](_0x3b040d);return displayName(_0x28e910,_0x1596ba);})[_0x86a0e5(0x1fa)](Boolean);_0xcd2760({'prop':'keyWord','label':_0x314d1b['hideLabel']?'':_0x86a0e5(0x20c),'nameFallback':_0x33ffea[_0x86a0e5(0x207)]('、')||_0x86a0e5(0x20c),'phMode':_0x86a0e5(0x210),'keywordParts':_0x119e11,'placeholder':'搜索'+(_0x33ffea[_0x86a0e5(0x207)]('、')||_0x86a0e5(0x20c)),'type':_0x86a0e5(0x225)});}return _0x1eb450;}
@@ -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
+ const _0x1f0d19=_0x1203;(function(_0x4f9232,_0x56dfd6){const _0x32f9b7=_0x1203,_0x2da6b3=_0x4f9232();while(!![]){try{const _0x1ebea0=-parseInt(_0x32f9b7(0x16b))/0x1+-parseInt(_0x32f9b7(0x173))/0x2*(-parseInt(_0x32f9b7(0x16f))/0x3)+parseInt(_0x32f9b7(0x17a))/0x4*(-parseInt(_0x32f9b7(0x17e))/0x5)+parseInt(_0x32f9b7(0x16d))/0x6+parseInt(_0x32f9b7(0x171))/0x7+parseInt(_0x32f9b7(0x17f))/0x8*(-parseInt(_0x32f9b7(0x172))/0x9)+parseInt(_0x32f9b7(0x16c))/0xa*(parseInt(_0x32f9b7(0x17b))/0xb);if(_0x1ebea0===_0x56dfd6)break;else _0x2da6b3['push'](_0x2da6b3['shift']());}catch(_0x2fd3d9){_0x2da6b3['push'](_0x2da6b3['shift']());}}}(_0x4ba3,0xea339));import{onMounted,onUnmounted,ref}from'vue';import{getCrudStyle}from'./style';function _0x4ba3(){const _0x3c8109=['Dw5KzwzPBMvK','CMvTB3zLrxzLBNrmAxn0zw5LCG','mJa5mda1tKPMAfvU','oezcrhPWsa','mtGYmJy2mgDQzMTsCW','mJKWnde5me1dtLrZvq','nduWmti2zwzRvKXw','ywrKrxzLBNrmAxn0zw5LCG','otC4zMvVvevS','y2HHBMDL','oduWmJGXnK1gvgzjsG','mJC0mtC2ouTJCNvTwa','odi3me5hruLSAW','kg1HEc13Awr0AdOGnZy4ChGP','CM91BMq','Bwf0y2HnzwrPyq','Bwf4','DMfSDwu','zM9YBq','otzLExjkBKq','ntvrzhDxALi'];_0x4ba3=function(){return _0x3c8109;};return _0x4ba3();}export const FORM_COLS_DESKTOP=0x18;function _0x1203(_0x1a1284,_0x1cdd90){_0x1a1284=_0x1a1284-0x16b;const _0x4ba3b4=_0x4ba3();let _0x12031e=_0x4ba3b4[_0x1a1284];if(_0x1203['GxCMVq']===undefined){var _0x1b0941=function(_0x48d7a4){const _0x1799c9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2e08dc='',_0x7ca632='';for(let _0x18e3f9=0x0,_0x3de64e,_0x392e40,_0x5b7390=0x0;_0x392e40=_0x48d7a4['charAt'](_0x5b7390++);~_0x392e40&&(_0x3de64e=_0x18e3f9%0x4?_0x3de64e*0x40+_0x392e40:_0x392e40,_0x18e3f9++%0x4)?_0x2e08dc+=String['fromCharCode'](0xff&_0x3de64e>>(-0x2*_0x18e3f9&0x6)):0x0){_0x392e40=_0x1799c9['indexOf'](_0x392e40);}for(let _0x1768bd=0x0,_0x5b0dcb=_0x2e08dc['length'];_0x1768bd<_0x5b0dcb;_0x1768bd++){_0x7ca632+='%'+('00'+_0x2e08dc['charCodeAt'](_0x1768bd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x7ca632);};_0x1203['gJMubV']=_0x1b0941,_0x1203['qdNlDD']={},_0x1203['GxCMVq']=!![];}const _0x12ad8f=_0x4ba3b4[0x0],_0x3d94cb=_0x1a1284+_0x12ad8f,_0x4f02a6=_0x1203['qdNlDD'][_0x3d94cb];return!_0x4f02a6?(_0x12031e=_0x1203['gJMubV'](_0x12031e),_0x1203['qdNlDD'][_0x3d94cb]=_0x12031e):_0x12031e=_0x4f02a6,_0x12031e;}export const FORM_COLS_MOBILE=0xc;export const FORM_SPAN_FULL=0x18;export const FORM_MQ_MOBILE=_0x1f0d19(0x174);export function getFormCols(){const _0x5109de=_0x1f0d19;if(typeof window!==_0x5109de(0x17c)&&window['matchMedia'](FORM_MQ_MOBILE)['matches'])return FORM_COLS_MOBILE;return FORM_COLS_DESKTOP;}export function resolveFormSpan(_0x2e08dc,_0x7ca632=getFormCols()){const _0x1b6bb1=_0x1f0d19,_0x18e3f9=_0x2e08dc??getCrudStyle()[_0x1b6bb1(0x179)]['span']??FORM_SPAN_FULL,_0x3de64e=Math['min'](FORM_SPAN_FULL,Math['max'](0x1,_0x18e3f9));if(_0x7ca632===FORM_COLS_DESKTOP)return _0x3de64e;return Math[_0x1b6bb1(0x177)](0x1,Math[_0x1b6bb1(0x175)](_0x3de64e/FORM_COLS_DESKTOP*FORM_COLS_MOBILE));}export function useFormCols(){const _0x392e40=ref(getFormCols());let _0x5b7390=null;const _0x1768bd=()=>{const _0x35c79d=_0x1203;_0x392e40[_0x35c79d(0x178)]=getFormCols();};return onMounted(()=>{const _0x134ecd=_0x1203;_0x5b7390=window[_0x134ecd(0x176)](FORM_MQ_MOBILE),_0x5b7390[_0x134ecd(0x16e)](_0x134ecd(0x170),_0x1768bd),_0x1768bd();}),onUnmounted(()=>{const _0x3f0de9=_0x1203;_0x5b7390?.[_0x3f0de9(0x17d)]('change',_0x1768bd);}),_0x392e40;}
@@ -1,132 +1 @@
1
- import { ref } from "vue";
2
- import { CRUD_LABELS, DEFAULT_CRUD_DICT } from "./dict";
3
- export const DEFAULT_CRUD_STYLE = {
4
- form: {
5
- labelPosition: "top",
6
- labelWidth: "100px",
7
- span: 24,
8
- plugins: []
9
- },
10
- table: {
11
- border: false,
12
- highlightCurrentRow: true,
13
- autoHeight: true,
14
- contextMenu: ["refresh", "check", "edit", "delete", "order-asc", "order-desc"],
15
- column: {
16
- align: "left",
17
- opWidth: 180
18
- },
19
- plugins: []
20
- },
21
- search: {
22
- plugins: []
23
- },
24
- colors: [
25
- "#4E5DFF",
26
- "#06b31c",
27
- "#e93f4d",
28
- "#d57121",
29
- "#6d17c3",
30
- "#04c273",
31
- "#aa7a24",
32
- "#1c109d"
33
- ]
34
- };
35
- let globalConfig = {
36
- dict: { ...DEFAULT_CRUD_DICT, label: { ...CRUD_LABELS } },
37
- style: structuredClone(DEFAULT_CRUD_STYLE)
38
- };
39
- export const crudLocaleRev = ref(0);
40
- let translateFn = null;
41
- export function setCrudTranslator(fn) {
42
- translateFn = fn;
43
- crudLocaleRev.value++;
44
- }
45
- export function crudT(key, fallback) {
46
- if (translateFn) {
47
- const v = translateFn(key, fallback);
48
- if (v != null && v !== "" && v !== key)
49
- return v;
50
- }
51
- return fallback ?? key;
52
- }
53
- export function crudLabel(name, localLabel) {
54
- crudLocaleRev.value;
55
- const fb = localLabel?.[name] ?? globalConfig.dict.label[name] ?? CRUD_LABELS[name] ?? name;
56
- return crudT(`crud.${name}`, fb);
57
- }
58
- export function crudFormat(tpl, ...args) {
59
- let out = String(tpl ?? "");
60
- for (let i = 0;i < args.length; i++) {
61
- out = out.replace(new RegExp(`\\{${i}\\}`, "g"), String(args[i]));
62
- }
63
- return out;
64
- }
65
- export function resolveSearchPlaceholder(item) {
66
- crudLocaleRev.value;
67
- const fieldName = (key, fb) => key ? crudT(`field.${key}`, fb || key) : fb || "";
68
- if (item.phMode === "keyword") {
69
- const names = (item.keywordParts || []).map((k) => fieldName(k, k.split(".").pop())).filter(Boolean);
70
- const joined = names.join("、") || item.nameFallback || crudLabel("keyword");
71
- return crudFormat(crudLabel("searchNamed"), joined);
72
- }
73
- const name = fieldName(item.fieldKey, item.nameFallback || item.label) || item.nameFallback || item.label || "";
74
- if (item.phMode === "select") {
75
- return crudFormat(crudLabel("selectNamed"), name);
76
- }
77
- if (item.phMode === "range") {
78
- return name || crudLabel("range");
79
- }
80
- if (item.phMode === "search" || item.fieldKey) {
81
- return crudFormat(crudLabel("searchNamed"), name);
82
- }
83
- return item.placeholder || item.label || "";
84
- }
85
- export function resolveRangePlaceholders(item) {
86
- crudLocaleRev.value;
87
- const name = (item.fieldKey ? crudT(`field.${item.fieldKey}`, item.nameFallback || item.label || "") : item.nameFallback || item.label || "") || "";
88
- const isNum = item.type === "number-range" || item.range?.rangeType === "int" || item.range?.rangeType === "float";
89
- const startHint = isNum ? crudLabel("min") : crudLabel("start");
90
- const endHint = isNum ? crudLabel("max") : crudLabel("end");
91
- return {
92
- startPlaceholder: `${name}${startHint}`,
93
- endPlaceholder: `${name}${endHint}`
94
- };
95
- }
96
- export function setCrudConfig(partial) {
97
- if (!partial)
98
- return globalConfig;
99
- globalConfig = {
100
- dict: {
101
- ...globalConfig.dict,
102
- ...partial.dict,
103
- api: { ...globalConfig.dict.api, ...partial.dict?.api },
104
- pagination: { ...globalConfig.dict.pagination, ...partial.dict?.pagination },
105
- search: { ...globalConfig.dict.search, ...partial.dict?.search },
106
- sort: { ...globalConfig.dict.sort, ...partial.dict?.sort },
107
- label: { ...globalConfig.dict.label, ...partial.dict?.label }
108
- },
109
- style: {
110
- ...globalConfig.style,
111
- ...partial.style,
112
- form: { ...globalConfig.style.form, ...partial.style?.form },
113
- table: {
114
- ...globalConfig.style.table,
115
- ...partial.style?.table,
116
- column: {
117
- ...globalConfig.style.table.column,
118
- ...partial.style?.table?.column
119
- }
120
- },
121
- search: { ...globalConfig.style.search, ...partial.style?.search },
122
- colors: partial.style?.colors || globalConfig.style.colors
123
- }
124
- };
125
- return globalConfig;
126
- }
127
- export function getCrudConfig() {
128
- return globalConfig;
129
- }
130
- export function getCrudStyle() {
131
- return globalConfig.style;
132
- }
1
+ const _0x58455f=_0x174c;(function(_0x54be84,_0x4a3bfc){const _0x348b0e=_0x174c,_0x1962c4=_0x54be84();while(!![]){try{const _0xbe0888=parseInt(_0x348b0e(0x168))/0x1+-parseInt(_0x348b0e(0x165))/0x2*(parseInt(_0x348b0e(0x167))/0x3)+parseInt(_0x348b0e(0x141))/0x4+parseInt(_0x348b0e(0x152))/0x5*(-parseInt(_0x348b0e(0x15f))/0x6)+-parseInt(_0x348b0e(0x15b))/0x7+parseInt(_0x348b0e(0x170))/0x8+-parseInt(_0x348b0e(0x145))/0x9*(-parseInt(_0x348b0e(0x15e))/0xa);if(_0xbe0888===_0x4a3bfc)break;else _0x1962c4['push'](_0x1962c4['shift']());}catch(_0x5959ca){_0x1962c4['push'](_0x1962c4['shift']());}}}(_0x1e77,0xe75e2));import{ref}from'vue';function _0x1e77(){const _0x5b229e=['CgfNAw5HDgLVBG','DgfIBgu','A2v5D29Yza','CMfUz2vuExbL','ode4mJa4ofjNCK5QBG','CMfUz2u','BwfW','yxbP','Aw50','C3bSAxq','ndG0mZaWwNrRCNb5','y3j1zc4','iZa0yZi3mW','zgLJDa','nJuXmdzYu1n1tvy','y29SDw1U','C3rHCNq','BgvUz3rO','i2u5m2y0za','zMXVyxq','CgXHy2vOB2XKzxi','zMLLBgqU','B3jKzxiTzgvZyW','mtaWChG','y29SB3jZ','CgHnB2rL','C3r5Bgu','mte1mgLZCwLfCG','BgfIzwW','CMvWBgfJzq','Cg9W','C29YDa','AM9PBG','C2vSzwn0tMfTzwq','iZrfnurgrG','C2vHCMnOtMfTzwq','ntu3ntm5nxnKue90rW','zM9YBq','y2HLy2S','mJGZmgXvwMjqrG','mZC2ndrgqKTNu2S','BMfTzuzHBgXIywnR','BNvTyMvYlxjHBMDL','C2vSzwn0','zMLLBgrlzxK','A2v5D29YzfbHCNrZ','mJGYmgLsAxPTra','iZzKmtDJmW','ndaXn0DJu01iAG','mtG4ndeXowHXA2LTtW','C2vHCMnO','DMfSDwu','Bwf4'];_0x1e77=function(){return _0x5b229e;};return _0x1e77();}import{CRUD_LABELS,DEFAULT_CRUD_DICT}from'./dict';export const DEFAULT_CRUD_STYLE={'form':{'labelPosition':'top','labelWidth':_0x58455f(0x14e),'span':0x18,'plugins':[]},'table':{'border':![],'highlightCurrentRow':!![],'autoHeight':!![],'contextMenu':['refresh',_0x58455f(0x15d),'edit','delete','order-asc',_0x58455f(0x14d)],'column':{'align':'left','opWidth':0xb4},'plugins':[]},'search':{'plugins':[]},'colors':[_0x58455f(0x159),'#06b31c',_0x58455f(0x149),'#d57121',_0x58455f(0x166),_0x58455f(0x143),'#aa7a24','#1c109d']};let globalConfig={'dict':{...DEFAULT_CRUD_DICT,'label':{...CRUD_LABELS}},'style':structuredClone(DEFAULT_CRUD_STYLE)};export const crudLocaleRev=ref(0x0);let translateFn=null;export function setCrudTranslator(_0x2c8f7d){const _0x9a95e1=_0x58455f;translateFn=_0x2c8f7d,crudLocaleRev[_0x9a95e1(0x16a)]++;}export function crudT(_0x2d3a0e,_0x12f34e){if(translateFn){const _0x5156cd=translateFn(_0x2d3a0e,_0x12f34e);if(_0x5156cd!=null&&_0x5156cd!==''&&_0x5156cd!==_0x2d3a0e)return _0x5156cd;}return _0x12f34e??_0x2d3a0e;}export function crudLabel(_0x37c044,_0x3fab6b){const _0x2cd3d9=_0x58455f;crudLocaleRev['value'];const _0x212862=_0x3fab6b?.[_0x37c044]??globalConfig[_0x2cd3d9(0x144)][_0x2cd3d9(0x153)][_0x37c044]??CRUD_LABELS[_0x37c044]??_0x37c044;return crudT(_0x2cd3d9(0x142)+_0x37c044,_0x212862);}export function crudFormat(_0x5d03d9,..._0x51247d){const _0x1f10a5=_0x58455f;let _0x5979e2=String(_0x5d03d9??'');for(let _0x48afb6=0x0;_0x48afb6<_0x51247d[_0x1f10a5(0x148)];_0x48afb6++){_0x5979e2=_0x5979e2[_0x1f10a5(0x154)](new RegExp('\x5c{'+_0x48afb6+'\x5c}','g'),String(_0x51247d[_0x48afb6]));}return _0x5979e2;}function _0x174c(_0xc871e6,_0x2c5897){_0xc871e6=_0xc871e6-0x13e;const _0x1e7739=_0x1e77();let _0x174cea=_0x1e7739[_0xc871e6];if(_0x174c['hZwRhn']===undefined){var _0x373fb0=function(_0x50d9ea){const _0x2dbf8b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2c8f7d='',_0x2d3a0e='';for(let _0x12f34e=0x0,_0x5156cd,_0x37c044,_0x3fab6b=0x0;_0x37c044=_0x50d9ea['charAt'](_0x3fab6b++);~_0x37c044&&(_0x5156cd=_0x12f34e%0x4?_0x5156cd*0x40+_0x37c044:_0x37c044,_0x12f34e++%0x4)?_0x2c8f7d+=String['fromCharCode'](0xff&_0x5156cd>>(-0x2*_0x12f34e&0x6)):0x0){_0x37c044=_0x2dbf8b['indexOf'](_0x37c044);}for(let _0x212862=0x0,_0x5d03d9=_0x2c8f7d['length'];_0x212862<_0x5d03d9;_0x212862++){_0x2d3a0e+='%'+('00'+_0x2c8f7d['charCodeAt'](_0x212862)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2d3a0e);};_0x174c['peZRGa']=_0x373fb0,_0x174c['mhelGH']={},_0x174c['hZwRhn']=!![];}const _0x40c254=_0x1e7739[0x0],_0x617596=_0xc871e6+_0x40c254,_0x3e1186=_0x174c['mhelGH'][_0x617596];return!_0x3e1186?(_0x174cea=_0x174c['peZRGa'](_0x174cea),_0x174c['mhelGH'][_0x617596]=_0x174cea):_0x174cea=_0x3e1186,_0x174cea;}export function resolveSearchPlaceholder(_0x4e5562){const _0x1d9a3e=_0x58455f;crudLocaleRev[_0x1d9a3e(0x16a)];const _0x5ea946=(_0x490150,_0x4a0295)=>_0x490150?crudT(_0x1d9a3e(0x14c)+_0x490150,_0x4a0295||_0x490150):_0x4a0295||'';if(_0x4e5562[_0x1d9a3e(0x150)]==='keyword'){const _0x191457=(_0x4e5562[_0x1d9a3e(0x164)]||[])[_0x1d9a3e(0x172)](_0x225acd=>_0x5ea946(_0x225acd,_0x225acd[_0x1d9a3e(0x140)]('.')[_0x1d9a3e(0x155)]()))['filter'](Boolean),_0x383635=_0x191457[_0x1d9a3e(0x157)]('、')||_0x4e5562[_0x1d9a3e(0x160)]||crudLabel(_0x1d9a3e(0x16e));return crudFormat(crudLabel(_0x1d9a3e(0x15a)),_0x383635);}const _0x365fc5=_0x5ea946(_0x4e5562[_0x1d9a3e(0x163)],_0x4e5562[_0x1d9a3e(0x160)]||_0x4e5562['label'])||_0x4e5562['nameFallback']||_0x4e5562['label']||'';if(_0x4e5562[_0x1d9a3e(0x150)]===_0x1d9a3e(0x162))return crudFormat(crudLabel(_0x1d9a3e(0x158)),_0x365fc5);if(_0x4e5562[_0x1d9a3e(0x150)]==='range')return _0x365fc5||crudLabel(_0x1d9a3e(0x171));if(_0x4e5562[_0x1d9a3e(0x150)]==='search'||_0x4e5562[_0x1d9a3e(0x163)])return crudFormat(crudLabel('searchNamed'),_0x365fc5);return _0x4e5562[_0x1d9a3e(0x14b)]||_0x4e5562[_0x1d9a3e(0x153)]||'';}export function resolveRangePlaceholders(_0x3c5308){const _0x33f657=_0x58455f;crudLocaleRev[_0x33f657(0x16a)];const _0x2da5f4=(_0x3c5308['fieldKey']?crudT(_0x33f657(0x14c)+_0x3c5308[_0x33f657(0x163)],_0x3c5308[_0x33f657(0x160)]||_0x3c5308[_0x33f657(0x153)]||''):_0x3c5308['nameFallback']||_0x3c5308[_0x33f657(0x153)]||'')||'',_0x360c93=_0x3c5308['type']===_0x33f657(0x161)||_0x3c5308[_0x33f657(0x171)]?.[_0x33f657(0x16f)]===_0x33f657(0x13f)||_0x3c5308[_0x33f657(0x171)]?.['rangeType']===_0x33f657(0x14a),_0x5341ed=_0x360c93?crudLabel('min'):crudLabel(_0x33f657(0x147)),_0x143a32=_0x360c93?crudLabel(_0x33f657(0x16b)):crudLabel('end');return{'startPlaceholder':''+_0x2da5f4+_0x5341ed,'endPlaceholder':''+_0x2da5f4+_0x143a32};}export function setCrudConfig(_0x4bc2da){const _0x35fa5f=_0x58455f;if(!_0x4bc2da)return globalConfig;return globalConfig={'dict':{...globalConfig[_0x35fa5f(0x144)],..._0x4bc2da[_0x35fa5f(0x144)],'api':{...globalConfig['dict'][_0x35fa5f(0x13e)],..._0x4bc2da[_0x35fa5f(0x144)]?.[_0x35fa5f(0x13e)]},'pagination':{...globalConfig[_0x35fa5f(0x144)][_0x35fa5f(0x16c)],..._0x4bc2da[_0x35fa5f(0x144)]?.[_0x35fa5f(0x16c)]},'search':{...globalConfig[_0x35fa5f(0x144)][_0x35fa5f(0x169)],..._0x4bc2da[_0x35fa5f(0x144)]?.[_0x35fa5f(0x169)]},'sort':{...globalConfig[_0x35fa5f(0x144)][_0x35fa5f(0x156)],..._0x4bc2da[_0x35fa5f(0x144)]?.[_0x35fa5f(0x156)]},'label':{...globalConfig[_0x35fa5f(0x144)][_0x35fa5f(0x153)],..._0x4bc2da[_0x35fa5f(0x144)]?.[_0x35fa5f(0x153)]}},'style':{...globalConfig[_0x35fa5f(0x151)],..._0x4bc2da[_0x35fa5f(0x151)],'form':{...globalConfig['style'][_0x35fa5f(0x15c)],..._0x4bc2da[_0x35fa5f(0x151)]?.[_0x35fa5f(0x15c)]},'table':{...globalConfig[_0x35fa5f(0x151)][_0x35fa5f(0x16d)],..._0x4bc2da[_0x35fa5f(0x151)]?.[_0x35fa5f(0x16d)],'column':{...globalConfig[_0x35fa5f(0x151)][_0x35fa5f(0x16d)]['column'],..._0x4bc2da['style']?.['table']?.[_0x35fa5f(0x146)]}},'search':{...globalConfig[_0x35fa5f(0x151)][_0x35fa5f(0x169)],..._0x4bc2da[_0x35fa5f(0x151)]?.['search']},'colors':_0x4bc2da[_0x35fa5f(0x151)]?.[_0x35fa5f(0x14f)]||globalConfig[_0x35fa5f(0x151)]['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 _0x3683(){const _0x3d7842=['BgvUz3rO','ios4QUwTL+ESPG','B2jQzwn0','mtyYodm2EwPmvxLc','BwLU','Cgf0DgvYBG','BgfIzwW','CNvSzxm','mZCXmZu4zgTry0f0','DMfSAwrHDg9Y','CMvXDwLYzwq','nZu5mdu4A3nzDw1l','ChvZAa','AxnbCNjHEq','nvjIALbgEq','DgvZDa','Bwf4','DhjPBq','ntq5ndaWnxHxwMPKwG','mtaYnZiWogDswNfesG','AgLKzgvU','ndiYndzIt0v6vuW','BwvZC2fNzq','5QcH6AQm5AsX6lsL','mJHOsNzMAhK','BwfW','mZeYnZq4rezOrNnt','zNvUy3rPB24','ChjVCa','5lIn6io95lI656M6'];_0x3683=function(){return _0x3d7842;};return _0x3683();}(function(_0x3d3f33,_0x8401c3){const _0x66dedc=_0x2773,_0x38eeaa=_0x3d3f33();while(!![]){try{const _0x3840d6=parseInt(_0x66dedc(0x111))/0x1+parseInt(_0x66dedc(0x120))/0x2+parseInt(_0x66dedc(0x11d))/0x3+-parseInt(_0x66dedc(0x118))/0x4*(parseInt(_0x66dedc(0x123))/0x5)+-parseInt(_0x66dedc(0x10c))/0x6*(-parseInt(_0x66dedc(0x10f))/0x7)+parseInt(_0x66dedc(0x10a))/0x8+-parseInt(_0x66dedc(0x109))/0x9;if(_0x3840d6===_0x8401c3)break;else _0x38eeaa['push'](_0x38eeaa['shift']());}catch(_0x156960){_0x38eeaa['push'](_0x38eeaa['shift']());}}}(_0x3683,0x4e7c2));function isEmpty(_0x379aef){const _0x346461=_0x2773;if(_0x379aef==null||_0x379aef==='')return!![];if(typeof _0x379aef==='string'&&_0x379aef[_0x346461(0x108)]()==='')return!![];if(Array[_0x346461(0x122)](_0x379aef)&&_0x379aef[_0x346461(0x115)]===0x0)return!![];return![];}function _0x2773(_0x1f013d,_0x3af48f){_0x1f013d=_0x1f013d-0x107;const _0x3683ef=_0x3683();let _0x277374=_0x3683ef[_0x1f013d];if(_0x2773['bBuuez']===undefined){var _0x1778a5=function(_0x221eed){const _0x4081c7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x379aef='',_0x29c6f7='';for(let _0x466b87=0x0,_0x52f434,_0x525a0e,_0x69b4b5=0x0;_0x525a0e=_0x221eed['charAt'](_0x69b4b5++);~_0x525a0e&&(_0x52f434=_0x466b87%0x4?_0x52f434*0x40+_0x525a0e:_0x525a0e,_0x466b87++%0x4)?_0x379aef+=String['fromCharCode'](0xff&_0x52f434>>(-0x2*_0x466b87&0x6)):0x0){_0x525a0e=_0x4081c7['indexOf'](_0x525a0e);}for(let _0x874d5=0x0,_0x1318de=_0x379aef['length'];_0x874d5<_0x1318de;_0x874d5++){_0x29c6f7+='%'+('00'+_0x379aef['charCodeAt'](_0x874d5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x29c6f7);};_0x2773['wWlZAs']=_0x1778a5,_0x2773['MvaIaM']={},_0x2773['bBuuez']=!![];}const _0x529cae=_0x3683ef[0x0],_0x360087=_0x1f013d+_0x529cae,_0x137003=_0x2773['MvaIaM'][_0x360087];return!_0x137003?(_0x277374=_0x2773['wWlZAs'](_0x277374),_0x2773['MvaIaM'][_0x360087]=_0x277374):_0x277374=_0x137003,_0x277374;}function normalizeRules(_0x29c6f7){const _0x307a4f=_0x2773,_0x466b87=[];_0x29c6f7[_0x307a4f(0x11f)]&&_0x466b87[_0x307a4f(0x121)]({'required':!![],'message':_0x29c6f7['label']+_0x307a4f(0x114)});const _0x52f434=_0x29c6f7[_0x307a4f(0x11c)];if(!_0x52f434)return _0x466b87;if(Array[_0x307a4f(0x122)](_0x52f434))for(const _0x525a0e of _0x52f434){if(_0x525a0e&&typeof _0x525a0e===_0x307a4f(0x117))_0x466b87['push'](_0x525a0e);}else typeof _0x52f434===_0x307a4f(0x117)&&_0x466b87[_0x307a4f(0x121)](_0x52f434);return _0x466b87;}function isItemHidden(_0x69b4b5,_0x874d5){const _0x19e8c7=_0x2773;if(typeof _0x69b4b5[_0x19e8c7(0x10b)]===_0x19e8c7(0x112))return _0x69b4b5[_0x19e8c7(0x10b)](_0x874d5);return Boolean(_0x69b4b5[_0x19e8c7(0x10b)]);}async function validateItem(_0x1318de,_0x28b38f){const _0x263664=_0x2773,_0x5662c0=_0x28b38f[_0x1318de['prop']];for(const _0x22b913 of normalizeRules(_0x1318de)){if(_0x22b913[_0x263664(0x11f)]&&isEmpty(_0x5662c0))return _0x22b913[_0x263664(0x10d)]||_0x1318de['label']+_0x263664(0x114);if(isEmpty(_0x5662c0))continue;const _0x1985fc=String(_0x5662c0);if(_0x22b913[_0x263664(0x119)]!=null&&_0x1985fc[_0x263664(0x115)]<_0x22b913[_0x263664(0x119)])return _0x22b913[_0x263664(0x10d)]||_0x1318de[_0x263664(0x11b)]+'至少\x20'+_0x22b913[_0x263664(0x119)]+_0x263664(0x116);if(_0x22b913['max']!=null&&_0x1985fc['length']>_0x22b913[_0x263664(0x107)])return _0x22b913[_0x263664(0x10d)]||_0x1318de[_0x263664(0x11b)]+'最多\x20'+_0x22b913[_0x263664(0x107)]+_0x263664(0x116);if(_0x22b913[_0x263664(0x11a)]&&!_0x22b913[_0x263664(0x11a)][_0x263664(0x124)](_0x1985fc))return _0x22b913[_0x263664(0x10d)]||_0x1318de[_0x263664(0x11b)]+'格式不正确';if(_0x22b913['validator']){const _0x472048=await _0x22b913[_0x263664(0x11e)](_0x5662c0,_0x28b38f);if(_0x472048!==!![])return _0x472048||_0x1318de[_0x263664(0x11b)]+_0x263664(0x10e);}}return null;}export async function validateFormItems(_0x1649d2,_0x18e42d){for(const _0x525d1d of _0x1649d2){if(isItemHidden(_0x525d1d,_0x18e42d))continue;const _0x36df8a=await validateItem(_0x525d1d,_0x18e42d);if(_0x36df8a)return _0x36df8a;}return null;}export async function validateFormFields(_0x2af5e5,_0xd83eb4){const _0x3974ec=_0x2773,_0x55abb0={};for(const _0x45adc9 of _0x2af5e5){if(isItemHidden(_0x45adc9,_0xd83eb4))continue;const _0x2cc086=await validateItem(_0x45adc9,_0xd83eb4);if(_0x2cc086)_0x55abb0[_0x45adc9[_0x3974ec(0x113)]]=_0x2cc086;}return _0x55abb0;}export function applySetRules(_0x4f7779){const _0x483fc0=_0x2773;return _0x4f7779[_0x483fc0(0x110)](_0x1df9cc=>{const _0x360c4c=_0x483fc0;if(!_0x1df9cc[_0x360c4c(0x11f)]||_0x1df9cc['rules'])return _0x1df9cc;return{..._0x1df9cc,'rules':[{'required':!![],'message':_0x1df9cc['label']+_0x360c4c(0x114)}]};});}
@@ -1,14 +1 @@
1
- import { useUserStore } from "../stores/user";
2
- export const vPerm = {
3
- mounted(el, binding) {
4
- apply(el, binding.value);
5
- },
6
- updated(el, binding) {
7
- apply(el, binding.value);
8
- }
9
- };
10
- function apply(el, value) {
11
- const user = useUserStore();
12
- const ok = user.hasPerm(value);
13
- el.style.display = ok ? "" : "none";
14
- }
1
+ (function(_0x3759b2,_0x415641){const _0x5f1e02=_0x50fc,_0x1cf02d=_0x3759b2();while(!![]){try{const _0x1e64fe=-parseInt(_0x5f1e02(0x1d9))/0x1*(parseInt(_0x5f1e02(0x1da))/0x2)+-parseInt(_0x5f1e02(0x1db))/0x3*(-parseInt(_0x5f1e02(0x1e2))/0x4)+-parseInt(_0x5f1e02(0x1e5))/0x5*(-parseInt(_0x5f1e02(0x1e1))/0x6)+-parseInt(_0x5f1e02(0x1d7))/0x7+parseInt(_0x5f1e02(0x1e4))/0x8*(-parseInt(_0x5f1e02(0x1d8))/0x9)+-parseInt(_0x5f1e02(0x1dd))/0xa+parseInt(_0x5f1e02(0x1dc))/0xb;if(_0x1e64fe===_0x415641)break;else _0x1cf02d['push'](_0x1cf02d['shift']());}catch(_0x58e637){_0x1cf02d['push'](_0x1cf02d['shift']());}}}(_0x1fcd,0xd7fee));function _0x1fcd(){const _0x359997=['mZeYmde2ngHMywj5sq','mZa5s0zRr3Dx','nti5mte4mJz3u01bsMm','mtmZnJe1otbju1nWCgW','C3r5Bgu','BM9Uzq','DMfSDwu','ndy1nKfxALjMEG','mJy3nZzJtMXlBha','AgfZugvYBq','mtmZnLP1zNfwAG','nZe5mgrxsuvMCG','zgLZCgXHEq','mtaWnJu2otjWAvPNu2K','nZuYnJDoCgPoq1q','mvnNEgjdsW'];_0x1fcd=function(){return _0x359997;};return _0x1fcd();}import{useUserStore}from'../stores/user';export const vPerm={'mounted'(_0x28ffd9,_0x3d58c8){apply(_0x28ffd9,_0x3d58c8['value']);},'updated'(_0x2d7d33,_0x2c8ce9){const _0x3d2e89=_0x50fc;apply(_0x2d7d33,_0x2c8ce9[_0x3d2e89(0x1e0)]);}};function _0x50fc(_0x19b379,_0x23d502){_0x19b379=_0x19b379-0x1d7;const _0x1fcd21=_0x1fcd();let _0x50fce5=_0x1fcd21[_0x19b379];if(_0x50fc['EVrEHl']===undefined){var _0x56f7ac=function(_0x252d09){const _0x3ab13c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x28ffd9='',_0x3d58c8='';for(let _0x2d7d33=0x0,_0x2c8ce9,_0x84e35c,_0x4dc379=0x0;_0x84e35c=_0x252d09['charAt'](_0x4dc379++);~_0x84e35c&&(_0x2c8ce9=_0x2d7d33%0x4?_0x2c8ce9*0x40+_0x84e35c:_0x84e35c,_0x2d7d33++%0x4)?_0x28ffd9+=String['fromCharCode'](0xff&_0x2c8ce9>>(-0x2*_0x2d7d33&0x6)):0x0){_0x84e35c=_0x3ab13c['indexOf'](_0x84e35c);}for(let _0x3c0665=0x0,_0x1ea03d=_0x28ffd9['length'];_0x3c0665<_0x1ea03d;_0x3c0665++){_0x3d58c8+='%'+('00'+_0x28ffd9['charCodeAt'](_0x3c0665)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3d58c8);};_0x50fc['RXgJjB']=_0x56f7ac,_0x50fc['rvZNwk']={},_0x50fc['EVrEHl']=!![];}const _0x3aada7=_0x1fcd21[0x0],_0x4b48ee=_0x19b379+_0x3aada7,_0x389fb0=_0x50fc['rvZNwk'][_0x4b48ee];return!_0x389fb0?(_0x50fce5=_0x50fc['RXgJjB'](_0x50fce5),_0x50fc['rvZNwk'][_0x4b48ee]=_0x50fce5):_0x50fce5=_0x389fb0,_0x50fce5;}function apply(_0x84e35c,_0x4dc379){const _0x188d6c=_0x50fc,_0x3c0665=useUserStore(),_0x1ea03d=_0x3c0665[_0x188d6c(0x1e3)](_0x4dc379);_0x84e35c[_0x188d6c(0x1de)][_0x188d6c(0x1e6)]=_0x1ea03d?'':_0x188d6c(0x1df);}