@jetlinks-web/components 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AMap/Map.js +124 -0
- package/es/AMap/index.js +2 -0
- package/es/AMap/util.js +56 -0
- package/es/BadgeStatus/Badge.js +54 -0
- package/es/BadgeStatus/color.js +21 -0
- package/es/BadgeStatus/index.js +3 -0
- package/es/CardSelect/CardSelect.js +123 -0
- package/es/CardSelect/index.js +2 -0
- package/es/CheckButton/CheckButton.js +121 -0
- package/es/CheckButton/index.js +2 -0
- package/es/ConfigProvider/context.js +12 -0
- package/es/ConfigProvider/index.js +31 -0
- package/es/Echarts/Echarts.js +47 -0
- package/es/Echarts/index.js +2 -0
- package/es/Ellipsis/Ellipsis.js +189 -0
- package/es/Ellipsis/index.js +2 -0
- package/es/Empty/Empty.js +56 -0
- package/es/Empty/image.js +2 -0
- package/es/Empty/index.js +2 -0
- package/es/FullPage/FullPage.js +31 -0
- package/es/FullPage/index.js +2 -0
- package/es/Icon/icon.js +42 -0
- package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
- package/es/MonacoEditor/Monaco.js +238 -0
- package/es/MonacoEditor/index.js +2 -0
- package/es/PermissionButton/index.js +117 -0
- package/es/ProLayout/Basic/BasicLayout.js +259 -0
- package/es/ProLayout/Basic/Header.js +97 -0
- package/es/ProLayout/PageContainer/index.js +324 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +285 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +278 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +163 -0
- package/es/ProLayout/defaultSettings.js +66 -0
- package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
- package/{src → es}/ProLayout/style/default.less +4 -4
- package/es/ProLayout/style/index.js +1 -0
- package/es/ProLayout/typings.js +1 -0
- package/es/ProLayout/util.js +61 -0
- package/es/ProTable/index.js +411 -0
- package/es/ProTable/proTableTypes.js +11 -0
- package/es/ProTable/style/index.css +65 -0
- package/es/ProTable/style/index.js +1 -0
- package/es/Scrollbar/Bar.js +114 -0
- package/es/Scrollbar/Scrollbar.js +212 -0
- package/es/Scrollbar/Thumb.js +189 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/thumbProps.js +10 -0
- package/es/Scrollbar/util.js +30 -0
- package/es/Search/Advanced/History.js +183 -0
- package/es/Search/Advanced/SaveHistory.js +153 -0
- package/es/Search/Advanced/index.js +520 -0
- package/es/Search/Item.js +497 -0
- package/es/Search/Search.js +249 -0
- package/es/Search/hooks/index.js +1 -0
- package/es/Search/hooks/useSearchItems.js +40 -0
- package/es/Search/index.js +4 -0
- package/es/Search/setting.js +91 -0
- package/es/Search/style/Item.less +33 -0
- package/es/Search/style/Search.less +179 -0
- package/es/Search/style/index.js +2 -0
- package/es/Search/typing.js +1 -0
- package/es/Search/util.js +234 -0
- package/es/ValueItem/ValueItem.js +233 -0
- package/es/ValueItem/index.js +2 -0
- package/es/ValueItem/util.js +16 -0
- package/es/index.js +24 -0
- package/es/style/index.js +3 -0
- package/es/style/variable.css +0 -0
- package/{src → es}/style/variable.less +0 -2
- package/es/style.js +3 -0
- package/lib/AMap/Map.js +124 -0
- package/lib/AMap/index.js +9 -0
- package/lib/AMap/util.js +62 -0
- package/lib/BadgeStatus/Badge.js +54 -0
- package/lib/BadgeStatus/color.js +27 -0
- package/lib/BadgeStatus/index.js +22 -0
- package/lib/CardSelect/CardSelect.js +123 -0
- package/lib/CardSelect/index.js +9 -0
- package/lib/CheckButton/CheckButton.js +121 -0
- package/lib/CheckButton/index.js +9 -0
- package/lib/ConfigProvider/context.js +19 -0
- package/lib/ConfigProvider/index.js +37 -0
- package/lib/Echarts/Echarts.js +47 -0
- package/lib/Echarts/index.js +9 -0
- package/lib/Ellipsis/Ellipsis.js +189 -0
- package/lib/Ellipsis/index.js +9 -0
- package/lib/Empty/Empty.js +56 -0
- package/lib/Empty/image.js +8 -0
- package/lib/Empty/index.js +9 -0
- package/lib/FullPage/FullPage.js +31 -0
- package/lib/FullPage/index.js +9 -0
- package/lib/Icon/icon.js +52 -0
- package/lib/Icon/index.js +9 -0
- package/lib/MonacoEditor/Monaco.js +238 -0
- package/lib/MonacoEditor/index.js +9 -0
- package/lib/PermissionButton/index.js +124 -0
- package/lib/ProLayout/Basic/BasicLayout.js +268 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +103 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +327 -0
- package/lib/ProLayout/PageContainer/index.less +103 -0
- package/lib/ProLayout/PageContainer/typings.js +5 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +290 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +287 -0
- package/lib/ProLayout/SiderMenu/index.js +20 -0
- package/lib/ProLayout/SiderMenu/index.less +212 -0
- package/lib/ProLayout/SiderMenu/typings.js +5 -0
- package/lib/ProLayout/TopHeader/index.js +168 -0
- package/lib/ProLayout/TopHeader/index.less +174 -0
- package/lib/ProLayout/defaultSettings.js +72 -0
- package/lib/ProLayout/index.js +16 -0
- package/lib/ProLayout/style/default.less +4 -0
- package/lib/ProLayout/style/index.js +3 -0
- package/lib/ProLayout/style/style.less +7 -0
- package/lib/ProLayout/typings.js +5 -0
- package/lib/ProLayout/util.js +72 -0
- package/lib/ProTable/index.js +417 -0
- package/lib/ProTable/proTableTypes.js +17 -0
- package/lib/ProTable/style/index.css +65 -0
- package/lib/ProTable/style/index.js +3 -0
- package/lib/ProTable/style/index.less +92 -0
- package/lib/Scrollbar/Bar.js +114 -0
- package/lib/Scrollbar/Scrollbar.js +212 -0
- package/lib/Scrollbar/Thumb.js +189 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -0
- package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
- package/lib/Scrollbar/thumbProps.js +16 -0
- package/lib/Scrollbar/util.js +37 -0
- package/lib/Search/Advanced/History.js +183 -0
- package/lib/Search/Advanced/SaveHistory.js +153 -0
- package/lib/Search/Advanced/index.js +520 -0
- package/lib/Search/Item.js +497 -0
- package/lib/Search/Search.js +249 -0
- package/lib/Search/hooks/index.js +16 -0
- package/lib/Search/hooks/useSearchItems.js +47 -0
- package/lib/Search/index.js +16 -0
- package/lib/Search/setting.js +97 -0
- package/lib/Search/style/Item.less +33 -0
- package/lib/Search/style/Search.less +179 -0
- package/lib/Search/style/index.js +4 -0
- package/lib/Search/typing.js +5 -0
- package/lib/Search/util.js +241 -0
- package/lib/ValueItem/ValueItem.js +233 -0
- package/lib/ValueItem/index.js +9 -0
- package/lib/ValueItem/util.js +22 -0
- package/lib/index.js +158 -0
- package/lib/style/components.less +1 -0
- package/lib/style/index.js +4 -0
- package/lib/style/variable.css +0 -0
- package/lib/style/variable.less +2 -0
- package/lib/style.js +5 -0
- package/package.json +122 -13
- package/index.ts +0 -64
- package/src/AMap/Map.vue +0 -110
- package/src/AMap/index.ts +0 -1
- package/src/AMap/util.ts +0 -56
- package/src/BadgeStatus/Badge.vue +0 -41
- package/src/BadgeStatus/color.ts +0 -25
- package/src/BadgeStatus/index.ts +0 -4
- package/src/CardSelect/CardSelect.vue +0 -136
- package/src/CardSelect/index.ts +0 -3
- package/src/CheckButton/CheckButton.vue +0 -146
- package/src/CheckButton/index.md +0 -27
- package/src/CheckButton/index.ts +0 -3
- package/src/ConfigProvider/context.ts +0 -17
- package/src/ConfigProvider/index.tsx +0 -42
- package/src/Echarts/Echarts.vue +0 -43
- package/src/Echarts/index.ts +0 -3
- package/src/Ellipsis/Ellipsis.vue +0 -182
- package/src/Ellipsis/index.ts +0 -3
- package/src/Empty/Empty.vue +0 -43
- package/src/Empty/image.ts +0 -3
- package/src/Empty/index.ts +0 -2
- package/src/FullPage/FullPage.vue +0 -30
- package/src/FullPage/index.ts +0 -3
- package/src/Icon/icon.tsx +0 -40
- package/src/MonacoEditor/Monaco.vue +0 -242
- package/src/MonacoEditor/index.md +0 -26
- package/src/MonacoEditor/index.ts +0 -2
- package/src/PermissionButton/index.tsx +0 -110
- package/src/ProLayout/Basic/BasicLayout.tsx +0 -392
- package/src/ProLayout/Basic/Header.tsx +0 -115
- package/src/ProLayout/PageContainer/index.tsx +0 -441
- package/src/ProLayout/PageContainer/typings.ts +0 -56
- package/src/ProLayout/RouteContext.ts +0 -87
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
- package/src/ProLayout/SiderMenu/index.ts +0 -2
- package/src/ProLayout/SiderMenu/typings.ts +0 -49
- package/src/ProLayout/TopHeader/index.tsx +0 -210
- package/src/ProLayout/defaultSettings.ts +0 -106
- package/src/ProLayout/style/index.ts +0 -1
- package/src/ProLayout/typings.ts +0 -87
- package/src/ProLayout/util.ts +0 -64
- package/src/ProTable/index.md +0 -53
- package/src/ProTable/index.tsx +0 -551
- package/src/ProTable/proTableTypes.ts +0 -70
- package/src/ProTable/style/index.ts +0 -1
- package/src/Scrollbar/Bar.vue +0 -75
- package/src/Scrollbar/Scrollbar.vue +0 -260
- package/src/Scrollbar/Thumb.vue +0 -163
- package/src/Scrollbar/constants.ts +0 -10
- package/src/Scrollbar/index.ts +0 -4
- package/src/Scrollbar/thumb.ts +0 -16
- package/src/Scrollbar/util.ts +0 -38
- package/src/Search/Advanced/History.vue +0 -140
- package/src/Search/Advanced/SaveHistory.vue +0 -108
- package/src/Search/Advanced/index.vue +0 -435
- package/src/Search/Item.vue +0 -525
- package/src/Search/Search.vue +0 -398
- package/src/Search/hooks/index.ts +0 -1
- package/src/Search/hooks/useSearchItems.ts +0 -68
- package/src/Search/index.md +0 -57
- package/src/Search/index.ts +0 -5
- package/src/Search/setting.ts +0 -55
- package/src/Search/typing.ts +0 -76
- package/src/Search/util.ts +0 -263
- package/src/ValueItem/ValueItem.vue +0 -192
- package/src/ValueItem/index.ts +0 -3
- package/src/ValueItem/util.ts +0 -16
- package/src/style/index.ts +0 -3
- /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
- /package/{src → es}/ProLayout/Basic/Header.less +0 -0
- /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
- /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
- /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
- /package/{src → es}/ProLayout/style/style.less +0 -0
- /package/{src → es}/ProTable/style/index.less +0 -0
package/src/Search/util.ts
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import { cloneDeep, isArray, isFunction, isString } from 'lodash-es';
|
|
2
|
-
import type { SearchItemData } from './typing';
|
|
3
|
-
import { termType } from './setting';
|
|
4
|
-
import { SearchProps } from './typing';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 处理like,nlike特殊值
|
|
8
|
-
* @param v
|
|
9
|
-
*/
|
|
10
|
-
export const handleLikeValue = (v: string) => {
|
|
11
|
-
if (isString(v)) {
|
|
12
|
-
return v.split('').reduce((pre: string, next: string) => {
|
|
13
|
-
let _next = next;
|
|
14
|
-
if (next === '\\') {
|
|
15
|
-
_next = '\\\\';
|
|
16
|
-
} else if (next === '%') {
|
|
17
|
-
_next = '\\%';
|
|
18
|
-
}
|
|
19
|
-
return pre + _next;
|
|
20
|
-
}, '');
|
|
21
|
-
}
|
|
22
|
-
return v;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const handleItemValue = (item, columnOptionMap) => {
|
|
26
|
-
const _item = columnOptionMap.get(item.column);
|
|
27
|
-
|
|
28
|
-
if (!_item) return item;
|
|
29
|
-
if (_item.rename) {
|
|
30
|
-
item.column = _item.rename;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (_item.handleValue && isFunction(_item.handleValue)) {
|
|
34
|
-
item.value = _item.handleValue(item.value, item);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (['like', 'nlike'].includes(item.termType) && !!item.value) {
|
|
38
|
-
item.value = `%${handleLikeValue(item.value)}%`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return item;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const isEmpty = (v) => {
|
|
45
|
-
return (
|
|
46
|
-
v === undefined ||
|
|
47
|
-
v === null ||
|
|
48
|
-
v === '' ||
|
|
49
|
-
(isArray(v) && v.length === 0)
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleArrayToTerms = (terms: any[], columnOptionMap) => {
|
|
54
|
-
return terms
|
|
55
|
-
.map((item) => {
|
|
56
|
-
if (item.terms) {
|
|
57
|
-
const filterTerms = item.terms.filter((filterItem) => {
|
|
58
|
-
return (
|
|
59
|
-
filterItem &&
|
|
60
|
-
!isEmpty(filterItem.value) &&
|
|
61
|
-
filterItem.termType !== undefined &&
|
|
62
|
-
filterItem.column !== undefined
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
item.terms = filterTerms.map((result) =>
|
|
66
|
-
handleItemValue(result, columnOptionMap),
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return item;
|
|
70
|
-
})
|
|
71
|
-
.filter((item) => item.terms?.length);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 处理为外部使用
|
|
76
|
-
* @terms {Array} 表单数据
|
|
77
|
-
* @columnOptionMap {Map} column的Map对象
|
|
78
|
-
*/
|
|
79
|
-
export const termsParamsFormat = (
|
|
80
|
-
terms,
|
|
81
|
-
columnOptionMap,
|
|
82
|
-
type: string = 'adv',
|
|
83
|
-
searchType: string = 'terms',
|
|
84
|
-
) => {
|
|
85
|
-
// 过滤掉terms中value无效的item
|
|
86
|
-
const cloneParams = cloneDeep(terms);
|
|
87
|
-
if (searchType === 'terms') {
|
|
88
|
-
return type === 'adv'
|
|
89
|
-
? { terms: handleArrayToTerms(cloneParams.terms, columnOptionMap) }
|
|
90
|
-
: cloneParams
|
|
91
|
-
.filter(
|
|
92
|
-
(item) =>
|
|
93
|
-
item &&
|
|
94
|
-
!isEmpty(item.value) &&
|
|
95
|
-
item.column !== undefined,
|
|
96
|
-
)
|
|
97
|
-
.map((item) => handleItemValue(item, columnOptionMap));
|
|
98
|
-
} else if (searchType == 'object') {
|
|
99
|
-
const result = {};
|
|
100
|
-
cloneParams
|
|
101
|
-
.filter(
|
|
102
|
-
(item) => item && item.value !== undefined && item.value !== '',
|
|
103
|
-
)
|
|
104
|
-
.forEach((item) => {
|
|
105
|
-
Object.assign(result, { [item.column]: item.value });
|
|
106
|
-
});
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* TreeSelect过滤
|
|
113
|
-
* @param value 过滤值
|
|
114
|
-
* @param treeNode
|
|
115
|
-
* @param key
|
|
116
|
-
*/
|
|
117
|
-
export const filterTreeSelectNode = (
|
|
118
|
-
value: string,
|
|
119
|
-
treeNode: any,
|
|
120
|
-
key: string = 'name',
|
|
121
|
-
): boolean => {
|
|
122
|
-
return treeNode[key]?.includes(value);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Select过滤
|
|
127
|
-
* @param value 过滤值
|
|
128
|
-
* @param option
|
|
129
|
-
* @param key
|
|
130
|
-
*/
|
|
131
|
-
export const filterSelectNode = (
|
|
132
|
-
value: string,
|
|
133
|
-
option: any,
|
|
134
|
-
key: string = 'label',
|
|
135
|
-
): boolean => {
|
|
136
|
-
return option[key]?.includes(value);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export const handleQData = (terms: any): any => {
|
|
140
|
-
// 排序, null 往后放
|
|
141
|
-
terms.terms.forEach((a) => {
|
|
142
|
-
for (let i = 0; i < a.terms.length; i++) {
|
|
143
|
-
for (let j = 0; j < a.terms.length - i - 1; j++) {
|
|
144
|
-
if (!a.terms[j] && a.terms[j + 1]) {
|
|
145
|
-
const temp = a.terms[j];
|
|
146
|
-
a.terms[j] = a.terms[j + 1];
|
|
147
|
-
a.terms[j + 1] = temp;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
return terms;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const hasExpand = (terms): boolean => {
|
|
157
|
-
let itemCount = 0;
|
|
158
|
-
terms.forEach((a) => {
|
|
159
|
-
a.terms.forEach((b) => {
|
|
160
|
-
if (b) {
|
|
161
|
-
itemCount += 1;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
return itemCount >= 2;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const compatibleOldTerms = (q: string) => {
|
|
169
|
-
const _terms = [
|
|
170
|
-
{ terms: [null, null, null] },
|
|
171
|
-
{ terms: [null, null, null], type: 'and' },
|
|
172
|
-
];
|
|
173
|
-
|
|
174
|
-
try {
|
|
175
|
-
const terms = JSON.parse(q || '{}');
|
|
176
|
-
terms.terms?.forEach((a, aIndex) => {
|
|
177
|
-
a?.terms?.forEach((b, bIndex) => {
|
|
178
|
-
_terms[aIndex].terms[bIndex] = b;
|
|
179
|
-
});
|
|
180
|
-
if (a.type) {
|
|
181
|
-
_terms[aIndex].type = a.type;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return { terms: _terms };
|
|
185
|
-
} catch (e) {
|
|
186
|
-
return { terms: _terms };
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export const handleParamsToString = (
|
|
191
|
-
terms: SearchItemData[] = [],
|
|
192
|
-
type: string = 'and',
|
|
193
|
-
) => {
|
|
194
|
-
const _terms = [
|
|
195
|
-
{ terms: [null, null, null] },
|
|
196
|
-
{ terms: [null, null, null], type: type },
|
|
197
|
-
];
|
|
198
|
-
let termsIndex = 0;
|
|
199
|
-
let termsStar = 0;
|
|
200
|
-
terms.forEach((item, index) => {
|
|
201
|
-
if (index > 2) {
|
|
202
|
-
termsIndex = 1;
|
|
203
|
-
termsStar = 4;
|
|
204
|
-
}
|
|
205
|
-
_terms[termsIndex].terms[index - termsStar] = item;
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
return JSON.stringify({ terms: _terms });
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export const getTermTypeFn = (type?: SearchProps['type'], column?: string) => {
|
|
212
|
-
// if (column?.includes('id') && type === 'string') {
|
|
213
|
-
// // 默认id为 eq
|
|
214
|
-
// return 'eq';
|
|
215
|
-
// }
|
|
216
|
-
|
|
217
|
-
switch (type) {
|
|
218
|
-
case 'select':
|
|
219
|
-
case 'treeSelect':
|
|
220
|
-
case 'number':
|
|
221
|
-
return 'eq';
|
|
222
|
-
case 'date':
|
|
223
|
-
case 'time':
|
|
224
|
-
return 'gt';
|
|
225
|
-
case 'timeRange':
|
|
226
|
-
case 'rangePicker':
|
|
227
|
-
return 'btw';
|
|
228
|
-
default:
|
|
229
|
-
return 'like';
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export const getTermTypes = (types: string[]) => {
|
|
234
|
-
return termType.filter((item) => types.includes(item.value));
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
export const getTermOptions = (type?: SearchProps['type'], column?: string) => {
|
|
238
|
-
let keys: string[] = [];
|
|
239
|
-
switch (type) {
|
|
240
|
-
case 'select':
|
|
241
|
-
case 'treeSelect':
|
|
242
|
-
keys = ['not', 'eq', 'in', 'nin'];
|
|
243
|
-
break;
|
|
244
|
-
case 'time':
|
|
245
|
-
case 'date':
|
|
246
|
-
keys = ['gt', 'lt', 'gte', 'lte'];
|
|
247
|
-
break;
|
|
248
|
-
case 'timeRange':
|
|
249
|
-
case 'rangePicker':
|
|
250
|
-
keys = ['btw', 'nbtw'];
|
|
251
|
-
break;
|
|
252
|
-
case 'number':
|
|
253
|
-
keys = ['eq', 'not', 'gt', 'lt', 'gte', 'lte'];
|
|
254
|
-
break;
|
|
255
|
-
default:
|
|
256
|
-
keys = ['like', 'nlike'];
|
|
257
|
-
// column?.includes('id') && type === 'string'
|
|
258
|
-
// ? ['eq']
|
|
259
|
-
// : ['like', 'nlike'];
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
return keys.length ? getTermTypes(keys) : termType;
|
|
263
|
-
};
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
<!-- 参数类型输入组件 -->
|
|
2
|
-
<template>
|
|
3
|
-
<div class="value-item-warp">
|
|
4
|
-
<Select
|
|
5
|
-
v-if="typeMap.get(itemType) === 'select'"
|
|
6
|
-
v-model:value="myValue"
|
|
7
|
-
allowClear
|
|
8
|
-
v-bind="props"
|
|
9
|
-
@change="(_, options) => onChange(options)"
|
|
10
|
-
/>
|
|
11
|
-
<DatePicker
|
|
12
|
-
v-else-if="typeMap.get(itemType) === 'date'"
|
|
13
|
-
v-model:value="myValue"
|
|
14
|
-
:valueFormat="valueFormat || 'YYYY-MM-DD HH:mm:ss'"
|
|
15
|
-
allowClear
|
|
16
|
-
showTime
|
|
17
|
-
v-bind="props"
|
|
18
|
-
@change="onChange"
|
|
19
|
-
/>
|
|
20
|
-
<TimePicker
|
|
21
|
-
v-else-if="typeMap.get(itemType) === 'time'"
|
|
22
|
-
v-model:value="myValue"
|
|
23
|
-
:valueFormat="valueFormat || 'HH:mm:ss'"
|
|
24
|
-
allowClear
|
|
25
|
-
v-bind="props"
|
|
26
|
-
@change="onChange"
|
|
27
|
-
/>
|
|
28
|
-
<InputNumber
|
|
29
|
-
v-else-if="typeMap.get(itemType) === 'inputNumber'"
|
|
30
|
-
v-model:value="myValue"
|
|
31
|
-
allowClear
|
|
32
|
-
v-bind="props"
|
|
33
|
-
@change="onChange"
|
|
34
|
-
/>
|
|
35
|
-
<Input
|
|
36
|
-
v-else-if="typeMap.get(itemType) === 'object'"
|
|
37
|
-
v-model:value="myValue"
|
|
38
|
-
allowClear
|
|
39
|
-
v-bind="props"
|
|
40
|
-
@change="onChange"
|
|
41
|
-
>
|
|
42
|
-
<template #addonAfter>
|
|
43
|
-
<AIcon type="FormOutlined" @click="modalVisible = true" />
|
|
44
|
-
</template>
|
|
45
|
-
</Input>
|
|
46
|
-
<Input
|
|
47
|
-
v-else-if="typeMap.get(itemType) === 'file'"
|
|
48
|
-
v-model:value="myValue"
|
|
49
|
-
allowClear
|
|
50
|
-
placeholder="请输入链接"
|
|
51
|
-
v-bind="props"
|
|
52
|
-
@change="onChange"
|
|
53
|
-
>
|
|
54
|
-
<template #addonAfter>
|
|
55
|
-
<Upload
|
|
56
|
-
:action="action"
|
|
57
|
-
:headers="headers"
|
|
58
|
-
:showUploadList="false"
|
|
59
|
-
name="file"
|
|
60
|
-
@change="handleFileChange"
|
|
61
|
-
>
|
|
62
|
-
<AIcon type="UploadOutlined" />
|
|
63
|
-
</Upload>
|
|
64
|
-
</template>
|
|
65
|
-
</Input>
|
|
66
|
-
<InputPassword
|
|
67
|
-
v-else-if="typeMap.get(itemType) === 'password'"
|
|
68
|
-
v-model:value="myValue"
|
|
69
|
-
allowClear
|
|
70
|
-
type="password"
|
|
71
|
-
v-bind="props"
|
|
72
|
-
@change="onChange"
|
|
73
|
-
/>
|
|
74
|
-
<Input
|
|
75
|
-
v-else
|
|
76
|
-
v-model:value="myValue"
|
|
77
|
-
allowClear
|
|
78
|
-
type="text"
|
|
79
|
-
v-bind="props"
|
|
80
|
-
@change="onChange"
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
|
-
<!-- 代码编辑器弹窗 -->
|
|
84
|
-
<Modal
|
|
85
|
-
v-model:visible="modalVisible"
|
|
86
|
-
:zIndex="1100"
|
|
87
|
-
cancel-text="取消"
|
|
88
|
-
ok-text="确认"
|
|
89
|
-
title="编辑"
|
|
90
|
-
width="700px"
|
|
91
|
-
@cancel="modalVisible = false"
|
|
92
|
-
@ok="handleItemModalSubmit"
|
|
93
|
-
>
|
|
94
|
-
<div style="width: 100%; height: 300px">
|
|
95
|
-
<MonacoEditor v-model:modelValue="objectValue" />
|
|
96
|
-
</div>
|
|
97
|
-
</Modal>
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
100
|
-
|
|
101
|
-
<script lang="ts" setup>
|
|
102
|
-
import { CSSProperties, PropType, ref, watch } from 'vue'
|
|
103
|
-
import { componentsType } from './util'
|
|
104
|
-
import { MonacoEditor } from '../../'
|
|
105
|
-
import {
|
|
106
|
-
Select,
|
|
107
|
-
DatePicker,
|
|
108
|
-
TimePicker,
|
|
109
|
-
Input,
|
|
110
|
-
InputNumber,
|
|
111
|
-
InputPassword,
|
|
112
|
-
Upload,
|
|
113
|
-
Modal,
|
|
114
|
-
} from 'ant-design-vue'
|
|
115
|
-
|
|
116
|
-
type Emits = {
|
|
117
|
-
(e: 'update:modelValue', data: string | number | boolean): void
|
|
118
|
-
(e: 'change', data: any, item?: any): void
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
interface ItemProps {
|
|
122
|
-
style?: CSSProperties
|
|
123
|
-
class?: string
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const emit = defineEmits<Emits>()
|
|
127
|
-
|
|
128
|
-
const props = defineProps({
|
|
129
|
-
// 组件双向绑定的值
|
|
130
|
-
modelValue: {
|
|
131
|
-
type: [Number, String],
|
|
132
|
-
default: '',
|
|
133
|
-
},
|
|
134
|
-
// 组件类型
|
|
135
|
-
itemType: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: () => 'string',
|
|
138
|
-
},
|
|
139
|
-
// 多选框
|
|
140
|
-
mode: {
|
|
141
|
-
type: String as PropType<'multiple' | 'tags' | 'combobox' | ''>,
|
|
142
|
-
default: '',
|
|
143
|
-
},
|
|
144
|
-
placeholder: String,
|
|
145
|
-
options: Array, // 下拉选择框下拉数据
|
|
146
|
-
style: Object as PropType<ItemProps['style']>,
|
|
147
|
-
class: String,
|
|
148
|
-
valueFormat: String,
|
|
149
|
-
action: [String, Promise],
|
|
150
|
-
headers: Object,
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
const typeMap = new Map(Object.entries(componentsType))
|
|
154
|
-
|
|
155
|
-
const myValue = ref<any>(undefined)
|
|
156
|
-
const modalVisible = ref<boolean>(false)
|
|
157
|
-
const objectValue = ref<string>('')
|
|
158
|
-
|
|
159
|
-
const handleItemModalSubmit = () => {
|
|
160
|
-
myValue.value = objectValue.value.replace(/[\r\n]\s*/g, '')
|
|
161
|
-
modalVisible.value = false
|
|
162
|
-
emit('update:modelValue', objectValue.value)
|
|
163
|
-
emit('change', objectValue.value)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const onChange = (e) => {
|
|
167
|
-
emit('update:modelValue', myValue.value)
|
|
168
|
-
emit('change', e)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const handleFileChange = (info: any) => {
|
|
172
|
-
if (info.file.status === 'done') {
|
|
173
|
-
const url = info.file.response?.result
|
|
174
|
-
myValue.value = url
|
|
175
|
-
emit('update:modelValue', url)
|
|
176
|
-
emit('change', url)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
watch(
|
|
181
|
-
() => props.modelValue,
|
|
182
|
-
() => {
|
|
183
|
-
myValue.value = props.modelValue
|
|
184
|
-
if (props.itemType === 'object') {
|
|
185
|
-
objectValue.value = props.modelValue as string
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{ immediate: true },
|
|
189
|
-
)
|
|
190
|
-
</script>
|
|
191
|
-
|
|
192
|
-
<style lang="less" scoped></style>
|
package/src/ValueItem/index.ts
DELETED
package/src/ValueItem/util.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const componentsType = {
|
|
2
|
-
int: 'inputNumber',
|
|
3
|
-
long: 'inputNumber',
|
|
4
|
-
float: 'inputNumber',
|
|
5
|
-
double: 'inputNumber',
|
|
6
|
-
string: 'input',
|
|
7
|
-
array: 'input',
|
|
8
|
-
password: 'password',
|
|
9
|
-
enum: 'select',
|
|
10
|
-
boolean: 'select',
|
|
11
|
-
date: 'date',
|
|
12
|
-
time: 'time',
|
|
13
|
-
object: 'object',
|
|
14
|
-
geoPoint: 'geoPoint',
|
|
15
|
-
file: 'file',
|
|
16
|
-
}
|
package/src/style/index.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|