@jetlinks-web/components 2.0.2 → 2.0.4-1

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 (245) hide show
  1. package/es/AMap/Map.js +125 -0
  2. package/es/AMap/index.js +2 -0
  3. package/es/AMap/util.js +56 -0
  4. package/es/BadgeStatus/Badge.js +54 -0
  5. package/es/BadgeStatus/color.js +21 -0
  6. package/es/BadgeStatus/index.js +3 -0
  7. package/es/CardSelect/CardSelect.js +123 -0
  8. package/es/CardSelect/index.js +2 -0
  9. package/es/CheckButton/CheckButton.js +120 -0
  10. package/es/CheckButton/index.js +2 -0
  11. package/es/CheckButton/style/index.css +37 -0
  12. package/es/CheckButton/style/index.less +40 -0
  13. package/es/ConfigProvider/context.js +12 -0
  14. package/es/ConfigProvider/index.js +31 -0
  15. package/es/Echarts/Echarts.js +47 -0
  16. package/es/Echarts/index.js +2 -0
  17. package/es/Ellipsis/Ellipsis.js +184 -0
  18. package/es/Ellipsis/index.js +2 -0
  19. package/es/Ellipsis/style/index.css +17 -0
  20. package/es/Ellipsis/style/index.less +20 -0
  21. package/es/Empty/Empty.js +56 -0
  22. package/es/Empty/image.js +2 -0
  23. package/es/Empty/index.js +2 -0
  24. package/es/FullPage/FullPage.js +31 -0
  25. package/es/FullPage/index.js +2 -0
  26. package/es/Icon/icon.js +42 -0
  27. package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
  28. package/es/MonacoEditor/Monaco.js +238 -0
  29. package/es/MonacoEditor/index.js +2 -0
  30. package/es/PermissionButton/index.js +117 -0
  31. package/es/ProLayout/Basic/BasicLayout.js +259 -0
  32. package/es/ProLayout/Basic/Header.js +97 -0
  33. package/es/ProLayout/PageContainer/index.js +324 -0
  34. package/es/ProLayout/PageContainer/typings.js +1 -0
  35. package/es/ProLayout/RouteContext.js +22 -0
  36. package/es/ProLayout/SiderMenu/BaseMenu.js +285 -0
  37. package/es/ProLayout/SiderMenu/SiderMenu.js +278 -0
  38. package/es/ProLayout/SiderMenu/index.js +2 -0
  39. package/es/ProLayout/SiderMenu/typings.js +1 -0
  40. package/es/ProLayout/TopHeader/index.js +163 -0
  41. package/es/ProLayout/defaultSettings.js +66 -0
  42. package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
  43. package/{src → es}/ProLayout/style/default.less +1 -1
  44. package/es/ProLayout/style/index.js +1 -0
  45. package/es/ProLayout/typings.js +1 -0
  46. package/es/ProLayout/util.js +61 -0
  47. package/es/ProTable/index.js +411 -0
  48. package/es/ProTable/proTableTypes.js +11 -0
  49. package/es/ProTable/style/index.css +65 -0
  50. package/es/ProTable/style/index.js +1 -0
  51. package/{src → es}/ProTable/style/index.less +92 -92
  52. package/es/Scrollbar/Bar.js +114 -0
  53. package/es/Scrollbar/Scrollbar.js +212 -0
  54. package/es/Scrollbar/Thumb.js +189 -0
  55. package/es/Scrollbar/constants.js +1 -0
  56. package/es/Scrollbar/index.js +2 -0
  57. package/es/Scrollbar/scrollbarProps.js +100 -0
  58. package/es/Scrollbar/thumbProps.js +10 -0
  59. package/es/Scrollbar/util.js +30 -0
  60. package/es/Search/Advanced/History.js +183 -0
  61. package/es/Search/Advanced/SaveHistory.js +153 -0
  62. package/es/Search/Advanced/index.js +520 -0
  63. package/es/Search/Item.js +497 -0
  64. package/es/Search/Search.js +249 -0
  65. package/es/Search/hooks/index.js +1 -0
  66. package/es/Search/hooks/useSearchItems.js +40 -0
  67. package/es/Search/index.js +4 -0
  68. package/es/Search/setting.js +91 -0
  69. package/es/Search/style/Item.less +33 -0
  70. package/es/Search/style/Search.less +179 -0
  71. package/es/Search/style/index.js +2 -0
  72. package/es/Search/typing.js +1 -0
  73. package/es/Search/util.js +234 -0
  74. package/es/ValueItem/ValueItem.js +233 -0
  75. package/es/ValueItem/index.js +2 -0
  76. package/es/ValueItem/util.js +16 -0
  77. package/es/index.js +24 -0
  78. package/es/style/index.js +3 -0
  79. package/es/style/variable.css +0 -0
  80. package/{src → es}/style/variable.less +2 -4
  81. package/es/style.js +5 -0
  82. package/lib/AMap/Map.js +125 -0
  83. package/lib/AMap/index.js +9 -0
  84. package/lib/AMap/util.js +62 -0
  85. package/lib/BadgeStatus/Badge.js +54 -0
  86. package/lib/BadgeStatus/color.js +27 -0
  87. package/lib/BadgeStatus/index.js +22 -0
  88. package/lib/CardSelect/CardSelect.js +123 -0
  89. package/lib/CardSelect/index.js +9 -0
  90. package/lib/CheckButton/CheckButton.js +120 -0
  91. package/lib/CheckButton/index.js +9 -0
  92. package/lib/CheckButton/style/index.css +37 -0
  93. package/lib/CheckButton/style/index.less +40 -0
  94. package/lib/ConfigProvider/context.js +19 -0
  95. package/lib/ConfigProvider/index.js +37 -0
  96. package/lib/Echarts/Echarts.js +47 -0
  97. package/lib/Echarts/index.js +9 -0
  98. package/lib/Ellipsis/Ellipsis.js +184 -0
  99. package/lib/Ellipsis/index.js +9 -0
  100. package/lib/Ellipsis/style/index.css +17 -0
  101. package/lib/Ellipsis/style/index.less +20 -0
  102. package/lib/Empty/Empty.js +56 -0
  103. package/lib/Empty/image.js +8 -0
  104. package/lib/Empty/index.js +9 -0
  105. package/lib/FullPage/FullPage.js +31 -0
  106. package/lib/FullPage/index.js +9 -0
  107. package/lib/Icon/icon.js +52 -0
  108. package/lib/Icon/index.js +9 -0
  109. package/lib/MonacoEditor/Monaco.js +238 -0
  110. package/lib/MonacoEditor/index.js +9 -0
  111. package/lib/PermissionButton/index.js +124 -0
  112. package/lib/ProLayout/Basic/BasicLayout.js +268 -0
  113. package/lib/ProLayout/Basic/BasicLayout.less +66 -0
  114. package/lib/ProLayout/Basic/Header.js +103 -0
  115. package/lib/ProLayout/Basic/Header.less +8 -0
  116. package/lib/ProLayout/PageContainer/index.js +327 -0
  117. package/lib/ProLayout/PageContainer/index.less +103 -0
  118. package/lib/ProLayout/PageContainer/typings.js +5 -0
  119. package/lib/ProLayout/RouteContext.js +28 -0
  120. package/lib/ProLayout/SiderMenu/BaseMenu.js +290 -0
  121. package/lib/ProLayout/SiderMenu/SiderMenu.js +287 -0
  122. package/lib/ProLayout/SiderMenu/index.js +20 -0
  123. package/lib/ProLayout/SiderMenu/index.less +212 -0
  124. package/lib/ProLayout/SiderMenu/typings.js +5 -0
  125. package/lib/ProLayout/TopHeader/index.js +168 -0
  126. package/lib/ProLayout/TopHeader/index.less +174 -0
  127. package/lib/ProLayout/defaultSettings.js +72 -0
  128. package/lib/ProLayout/index.js +16 -0
  129. package/lib/ProLayout/style/default.less +4 -0
  130. package/lib/ProLayout/style/index.js +3 -0
  131. package/lib/ProLayout/style/style.less +7 -0
  132. package/lib/ProLayout/typings.js +5 -0
  133. package/lib/ProLayout/util.js +72 -0
  134. package/lib/ProTable/index.js +417 -0
  135. package/lib/ProTable/proTableTypes.js +17 -0
  136. package/lib/ProTable/style/index.css +65 -0
  137. package/lib/ProTable/style/index.js +3 -0
  138. package/lib/ProTable/style/index.less +92 -0
  139. package/lib/Scrollbar/Bar.js +114 -0
  140. package/lib/Scrollbar/Scrollbar.js +212 -0
  141. package/lib/Scrollbar/Thumb.js +189 -0
  142. package/lib/Scrollbar/constants.js +7 -0
  143. package/lib/Scrollbar/index.js +9 -0
  144. package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
  145. package/lib/Scrollbar/thumbProps.js +16 -0
  146. package/lib/Scrollbar/util.js +37 -0
  147. package/lib/Search/Advanced/History.js +183 -0
  148. package/lib/Search/Advanced/SaveHistory.js +153 -0
  149. package/lib/Search/Advanced/index.js +520 -0
  150. package/lib/Search/Item.js +497 -0
  151. package/lib/Search/Search.js +249 -0
  152. package/lib/Search/hooks/index.js +16 -0
  153. package/lib/Search/hooks/useSearchItems.js +47 -0
  154. package/lib/Search/index.js +16 -0
  155. package/lib/Search/setting.js +97 -0
  156. package/lib/Search/style/Item.less +33 -0
  157. package/lib/Search/style/Search.less +179 -0
  158. package/lib/Search/style/index.js +4 -0
  159. package/lib/Search/typing.js +5 -0
  160. package/lib/Search/util.js +241 -0
  161. package/lib/ValueItem/ValueItem.js +233 -0
  162. package/lib/ValueItem/index.js +9 -0
  163. package/lib/ValueItem/util.js +22 -0
  164. package/lib/index.js +158 -0
  165. package/lib/style/components.less +3 -0
  166. package/lib/style/index.js +4 -0
  167. package/lib/style/variable.css +0 -0
  168. package/lib/style/variable.less +2 -0
  169. package/lib/style.js +7 -0
  170. package/package.json +123 -13
  171. package/index.ts +0 -64
  172. package/src/AMap/Map.vue +0 -110
  173. package/src/AMap/index.ts +0 -1
  174. package/src/AMap/util.ts +0 -56
  175. package/src/BadgeStatus/Badge.vue +0 -41
  176. package/src/BadgeStatus/color.ts +0 -25
  177. package/src/BadgeStatus/index.ts +0 -4
  178. package/src/CardSelect/CardSelect.vue +0 -136
  179. package/src/CardSelect/index.ts +0 -3
  180. package/src/CheckButton/CheckButton.vue +0 -146
  181. package/src/CheckButton/index.md +0 -27
  182. package/src/CheckButton/index.ts +0 -3
  183. package/src/ConfigProvider/context.ts +0 -17
  184. package/src/ConfigProvider/index.tsx +0 -42
  185. package/src/Echarts/Echarts.vue +0 -43
  186. package/src/Echarts/index.ts +0 -3
  187. package/src/Ellipsis/Ellipsis.vue +0 -182
  188. package/src/Ellipsis/index.ts +0 -3
  189. package/src/Empty/Empty.vue +0 -43
  190. package/src/Empty/image.ts +0 -3
  191. package/src/Empty/index.ts +0 -2
  192. package/src/FullPage/FullPage.vue +0 -30
  193. package/src/FullPage/index.ts +0 -3
  194. package/src/Icon/icon.tsx +0 -40
  195. package/src/MonacoEditor/Monaco.vue +0 -242
  196. package/src/MonacoEditor/index.md +0 -26
  197. package/src/MonacoEditor/index.ts +0 -2
  198. package/src/PermissionButton/index.tsx +0 -110
  199. package/src/ProLayout/Basic/BasicLayout.tsx +0 -392
  200. package/src/ProLayout/Basic/Header.tsx +0 -115
  201. package/src/ProLayout/PageContainer/index.tsx +0 -441
  202. package/src/ProLayout/PageContainer/typings.ts +0 -56
  203. package/src/ProLayout/RouteContext.ts +0 -87
  204. package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
  205. package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
  206. package/src/ProLayout/SiderMenu/index.ts +0 -2
  207. package/src/ProLayout/SiderMenu/typings.ts +0 -49
  208. package/src/ProLayout/TopHeader/index.tsx +0 -210
  209. package/src/ProLayout/defaultSettings.ts +0 -106
  210. package/src/ProLayout/style/index.ts +0 -1
  211. package/src/ProLayout/typings.ts +0 -87
  212. package/src/ProLayout/util.ts +0 -64
  213. package/src/ProTable/index.md +0 -53
  214. package/src/ProTable/index.tsx +0 -551
  215. package/src/ProTable/proTableTypes.ts +0 -70
  216. package/src/ProTable/style/index.ts +0 -1
  217. package/src/Scrollbar/Bar.vue +0 -75
  218. package/src/Scrollbar/Scrollbar.vue +0 -260
  219. package/src/Scrollbar/Thumb.vue +0 -163
  220. package/src/Scrollbar/constants.ts +0 -10
  221. package/src/Scrollbar/index.ts +0 -4
  222. package/src/Scrollbar/thumb.ts +0 -16
  223. package/src/Scrollbar/util.ts +0 -38
  224. package/src/Search/Advanced/History.vue +0 -140
  225. package/src/Search/Advanced/SaveHistory.vue +0 -108
  226. package/src/Search/Advanced/index.vue +0 -435
  227. package/src/Search/Item.vue +0 -525
  228. package/src/Search/Search.vue +0 -398
  229. package/src/Search/hooks/index.ts +0 -1
  230. package/src/Search/hooks/useSearchItems.ts +0 -68
  231. package/src/Search/index.md +0 -57
  232. package/src/Search/index.ts +0 -5
  233. package/src/Search/setting.ts +0 -55
  234. package/src/Search/typing.ts +0 -76
  235. package/src/Search/util.ts +0 -263
  236. package/src/ValueItem/ValueItem.vue +0 -192
  237. package/src/ValueItem/index.ts +0 -3
  238. package/src/ValueItem/util.ts +0 -16
  239. package/src/style/index.ts +0 -3
  240. /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
  241. /package/{src → es}/ProLayout/Basic/Header.less +0 -0
  242. /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
  243. /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
  244. /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
  245. /package/{src → es}/ProLayout/style/style.less +0 -0
@@ -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>
@@ -1,3 +0,0 @@
1
- import ValueItem from './ValueItem.vue'
2
-
3
- export default ValueItem
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import '../ProLayout/style'
2
- import '../ProTable/style'
3
- import '../ProLayout/style'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes