@jari-ace/element-plus-component 0.1.0 → 0.1.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.
- package/README.md +18 -18
- package/dist/components/tip/index.d.ts +1 -35
- package/dist/components/tip/index.d.ts.map +1 -1
- package/dist/components/upload/index.d.ts +1 -1
- package/dist/components/upload/index.d.ts.map +1 -1
- package/dist/hooks/useBridage.d.ts +3 -3
- package/dist/hooks/useBridage.d.ts.map +1 -1
- package/dist/hooks/useBridage.js +29 -22
- package/dist/hooks/useBridage.js.map +1 -1
- package/dist/hooks/useUserRefQuery.d.ts +2 -2
- package/lib/index.css +1 -1
- package/lib/index.js +32 -28
- package/lib/index.umd.cjs +2 -2
- package/package.json +61 -61
- package/packages/components/autoComplete/JaAutoComplete.vue +47 -47
- package/packages/components/autoComplete/index.ts +5 -5
- package/packages/components/avatar/JaAvatar.vue +126 -126
- package/packages/components/avatar/avatarToken.ts +11 -11
- package/packages/components/avatar/defaultImg.ts +14 -14
- package/packages/components/avatar/index.ts +7 -7
- package/packages/components/button/JaButton.vue +51 -51
- package/packages/components/button/index.ts +4 -4
- package/packages/components/channelPicker/index.ts +7 -7
- package/packages/components/channelPicker/src/ChannelPicker.vue +43 -43
- package/packages/components/channelPicker/src/JaChannelPicker.vue +42 -42
- package/packages/components/checkbox/JaCheckbox.vue +73 -73
- package/packages/components/checkbox/index.ts +4 -4
- package/packages/components/checkboxGroup/JaCheckboxGroup.vue +45 -45
- package/packages/components/checkboxGroup/index.ts +4 -4
- package/packages/components/customGroupTree/index.ts +10 -10
- package/packages/components/customGroupTree/src/customGroupTree.vue +91 -91
- package/packages/components/datePicker/JaDatePicker.vue +52 -52
- package/packages/components/datePicker/index.ts +4 -4
- package/packages/components/departmentPicker/index.ts +4 -4
- package/packages/components/departmentPicker/src/DepartmentPicker.vue +107 -107
- package/packages/components/departmentPicker/src/consts.ts +2 -2
- package/packages/components/departmentTree/index.ts +10 -10
- package/packages/components/departmentTree/src/departmentTree.vue +135 -135
- package/packages/components/dropdownButton/JaDropdownButton.vue +59 -59
- package/packages/components/dropdownButton/index.ts +4 -4
- package/packages/components/enumList/EnumListInput.vue +107 -107
- package/packages/components/enumList/JaEnumList.vue +39 -39
- package/packages/components/enumList/index.ts +7 -7
- package/packages/components/form/JaForm.vue +126 -126
- package/packages/components/form/index.ts +5 -5
- package/packages/components/form/types.ts +4 -4
- package/packages/components/formItem/JaFormItem.vue +68 -68
- package/packages/components/formItem/index.ts +4 -4
- package/packages/components/index.ts +33 -33
- package/packages/components/input/JaInput.vue +143 -143
- package/packages/components/input/index.ts +4 -4
- package/packages/components/inputI18n/I18nBundleEditor.vue +76 -76
- package/packages/components/inputI18n/InputI18n.vue +142 -142
- package/packages/components/inputI18n/JaInputI18n.vue +50 -50
- package/packages/components/inputI18n/index.ts +8 -8
- package/packages/components/inputNumber/JaInputNumber.vue +98 -98
- package/packages/components/inputNumber/index.ts +4 -4
- package/packages/components/mapItemList/JaMapItemList.vue +35 -35
- package/packages/components/mapItemList/MapItemListInput.vue +191 -191
- package/packages/components/mapItemList/index.ts +7 -7
- package/packages/components/numberList/JaNumberList.vue +36 -36
- package/packages/components/numberList/NumberListInput.vue +111 -111
- package/packages/components/numberList/index.ts +7 -7
- package/packages/components/properyPicker/JaPropertyPicker.vue +38 -38
- package/packages/components/properyPicker/PropertyPicker.vue +314 -314
- package/packages/components/properyPicker/index.ts +7 -7
- package/packages/components/radioGroup/JaRadioGroup.vue +50 -50
- package/packages/components/radioGroup/index.ts +4 -4
- package/packages/components/rolePicker/RoleEditor.vue +129 -129
- package/packages/components/rolePicker/RolePicker.vue +44 -44
- package/packages/components/rolePicker/RolePickerRaw.vue +56 -56
- package/packages/components/rolePicker/baseRolePicker.vue +86 -86
- package/packages/components/rolePicker/index.ts +10 -10
- package/packages/components/scrollbar/Scrollbar.vue +89 -89
- package/packages/components/scrollbar/index.ts +5 -5
- package/packages/components/scrollbar/utils.ts +17 -17
- package/packages/components/select/JaSelect.vue +48 -48
- package/packages/components/select/index.ts +4 -4
- package/packages/components/stringList/JaStringList.vue +36 -36
- package/packages/components/stringList/StringListInput.vue +96 -96
- package/packages/components/stringList/index.ts +7 -7
- package/packages/components/switch/JaSwitch.vue +50 -50
- package/packages/components/switch/index.ts +4 -4
- package/packages/components/timePicker/JaTimePicker.vue +52 -52
- package/packages/components/timePicker/index.ts +5 -5
- package/packages/components/tip/index.ts +4 -4
- package/packages/components/tip/src/AceTip.vue +43 -43
- package/packages/components/upload/index.ts +6 -6
- package/packages/components/upload/src/Upload.vue +25 -25
- package/packages/components/upload/src/type.ts +3 -3
- package/packages/components/userGroupPicker/index.ts +4 -4
- package/packages/components/userGroupPicker/src/UserGroupPicker.vue +94 -94
- package/packages/components/userGroupTree/index.ts +10 -10
- package/packages/components/userGroupTree/src/userGroupTree.vue +149 -149
- package/packages/components/userPicker/index.ts +10 -10
- package/packages/components/userPicker/src/CustomGroupManager.vue +189 -189
- package/packages/components/userPicker/src/JaUserList.vue +283 -283
- package/packages/components/userPicker/src/JaUserPicker.vue +37 -37
- package/packages/components/userPicker/src/UserPicker.vue +366 -366
- package/packages/components/userSelectDialog/index.ts +6 -6
- package/packages/components/userSelectDialog/src/userSelectDialog.vue +447 -447
- package/packages/components/userTag/UserInfoTag.vue +397 -397
- package/packages/components/userTag/index.ts +6 -6
- package/packages/components/userTag/sharedAxios.ts +8 -8
- package/packages/directives/auth/index.ts +41 -41
- package/packages/directives/autofocus/index.ts +29 -29
- package/packages/directives/index.ts +10 -10
- package/packages/directives/shortcut/index.ts +192 -192
- package/packages/hooks/useAppInstances.ts +34 -34
- package/packages/hooks/useBackendValidations.ts +55 -55
- package/packages/hooks/useBridage.ts +157 -148
- package/packages/hooks/useDateTimeShortCuts.ts +65 -65
- package/packages/hooks/useTreeData.ts +45 -45
- package/packages/hooks/useUserRefQuery.ts +222 -222
- package/packages/index.ts +21 -21
- package/packages/list.json +7 -7
- package/packages/types/custom.d.ts +13 -13
- package/packages/types/window.d.ts +16 -16
- package/packages/utils/install.ts +43 -43
- package/packages/utils/objectUtils.ts +31 -31
- package/theme-style/fonts/iconfont.json +5196 -5196
- package/theme-style/index.scss +10 -10
- package/theme-style/styles/element-plus-var.scss +1419 -1419
- package/theme-style/styles/iconfont.css +2979 -2979
- package/theme-style/styles/theme-var.scss +72 -72
- package/theme-style/styles/transition.scss +122 -122
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
import {ref, watch} from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
type BooleanResultExpression,
|
|
4
|
-
createAxiosWithoutCache,
|
|
5
|
-
type IAceAxios,
|
|
6
|
-
QUser,
|
|
7
|
-
type SortDescriptor,
|
|
8
|
-
useLoading,
|
|
9
|
-
type UserReference,
|
|
10
|
-
useUserApi,
|
|
11
|
-
useUserQueryBuilder
|
|
12
|
-
} from "@jari-ace/app-bolts";
|
|
13
|
-
import type {TreeNodeType} from "./useTreeData";
|
|
14
|
-
import {ALL_DEPARTMENT, NO_DEPARTMENT} from "../components/departmentPicker/src/consts";
|
|
15
|
-
import debounce from "lodash-es/debounce";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 用户查询hook,当查询参数变化时,会自动查询,订阅结果即可
|
|
19
|
-
* @param queryPrerequisites 执行查询的前提条件,只有此方法返回true时,查询才会执行
|
|
20
|
-
* @param customFilter 自定义查询过滤条件,可以通过这个回调方法,通过程序方式添加自定义的过滤条件
|
|
21
|
-
* @param onQueryResultReturned 查询成功时的回调方法,接收Page<UserReference>类型参数
|
|
22
|
-
* @param scroll 是否滚动模式,滚动模式下,翻页后新页数据会追加到queryState.users集合中,而不是直接赋予queryState.users
|
|
23
|
-
* @param axios 自定义axios实例
|
|
24
|
-
* @param notPaged 不分页
|
|
25
|
-
*/
|
|
26
|
-
export function useUserRefQuery(
|
|
27
|
-
queryPrerequisites?: () => boolean,
|
|
28
|
-
customFilter?: (qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
29
|
-
onQueryResultReturned?: (result?: UserReference[], paramsChanged?: boolean) => void,
|
|
30
|
-
scroll?: boolean,
|
|
31
|
-
axios?: IAceAxios,
|
|
32
|
-
notPaged?: boolean) {
|
|
33
|
-
const queryParams = ref<{
|
|
34
|
-
/**
|
|
35
|
-
* 用户域Id查询参数
|
|
36
|
-
*/
|
|
37
|
-
realmId?: string,
|
|
38
|
-
/**
|
|
39
|
-
* 部门查询参数
|
|
40
|
-
*/
|
|
41
|
-
currentDept?: TreeNodeType,
|
|
42
|
-
/**
|
|
43
|
-
* 用户姓名、用户名或用户拼音过滤参数
|
|
44
|
-
*/
|
|
45
|
-
name?: string,
|
|
46
|
-
/**
|
|
47
|
-
* 排序描述符
|
|
48
|
-
*/
|
|
49
|
-
currentSort?: SortDescriptor,
|
|
50
|
-
/**
|
|
51
|
-
* 用户组查询参数
|
|
52
|
-
*/
|
|
53
|
-
currentGroup?: TreeNodeType,
|
|
54
|
-
/**
|
|
55
|
-
* 自定义组查询参数
|
|
56
|
-
*/
|
|
57
|
-
currentCustomGroup?: TreeNodeType
|
|
58
|
-
}>({})
|
|
59
|
-
|
|
60
|
-
const pageParams = ref<{
|
|
61
|
-
/**
|
|
62
|
-
* 当前页码
|
|
63
|
-
*/
|
|
64
|
-
currentPage: number,
|
|
65
|
-
/**
|
|
66
|
-
* 页内数据行数
|
|
67
|
-
*/
|
|
68
|
-
pageSize: number
|
|
69
|
-
}>({
|
|
70
|
-
currentPage: 1,
|
|
71
|
-
pageSize: 50
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const queryResult = ref<{
|
|
75
|
-
/**
|
|
76
|
-
* 总数据量
|
|
77
|
-
*/
|
|
78
|
-
total: number,
|
|
79
|
-
/**
|
|
80
|
-
* 查询结果集
|
|
81
|
-
*/
|
|
82
|
-
users: UserReference[]
|
|
83
|
-
}>({
|
|
84
|
-
total: 0,
|
|
85
|
-
users: []
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
if (!axios) axios = createAxiosWithoutCache();
|
|
89
|
-
const userApi = useUserApi(axios);
|
|
90
|
-
const loading = useLoading(axios);
|
|
91
|
-
const queryParamChanged = ref<boolean>(false)
|
|
92
|
-
|
|
93
|
-
function doQuery() {
|
|
94
|
-
queryUsers().then(r => {
|
|
95
|
-
if (onQueryResultReturned) {
|
|
96
|
-
onQueryResultReturned(r, queryParamChanged.value);
|
|
97
|
-
}
|
|
98
|
-
queryParamChanged.value = false;
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const debounceDoQuery = debounce(doQuery, 300)
|
|
103
|
-
|
|
104
|
-
function queryOnParamsChanged() {
|
|
105
|
-
queryResult.value.total = 0;
|
|
106
|
-
queryResult.value.users = [];
|
|
107
|
-
if (pageParams.value.currentPage !== 1) {
|
|
108
|
-
pageParams.value.currentPage = 1;
|
|
109
|
-
} else {
|
|
110
|
-
debounceDoQuery();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
watch(queryParams, () => {
|
|
115
|
-
queryParamChanged.value = true;
|
|
116
|
-
queryOnParamsChanged();
|
|
117
|
-
}, {
|
|
118
|
-
deep: true
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
watch(() => pageParams.value.pageSize, () => {
|
|
122
|
-
queryParamChanged.value = true;
|
|
123
|
-
queryOnParamsChanged();
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
watch(() => pageParams.value.currentPage, () => {
|
|
127
|
-
queryUsers().then(r => {
|
|
128
|
-
if (onQueryResultReturned) {
|
|
129
|
-
onQueryResultReturned(r, queryParamChanged.value);
|
|
130
|
-
}
|
|
131
|
-
queryParamChanged.value = false;
|
|
132
|
-
});
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
function queryUsers() {
|
|
136
|
-
if (queryPrerequisites && !queryPrerequisites()) {
|
|
137
|
-
return Promise.resolve(undefined);
|
|
138
|
-
}
|
|
139
|
-
if (!queryParams.value.realmId) {
|
|
140
|
-
return Promise.resolve([] as UserReference[]);
|
|
141
|
-
}
|
|
142
|
-
const builder = useUserQueryBuilder();
|
|
143
|
-
const qUser = builder.getQEntity();
|
|
144
|
-
builder.and(qUser.realm.id.eq(queryParams.value.realmId)).and(qUser.recycled.eq(false));
|
|
145
|
-
const currentDept = queryParams.value.currentDept;
|
|
146
|
-
if (currentDept) {
|
|
147
|
-
// 1=1 and user.department.id = currentDepartmentId
|
|
148
|
-
if (currentDept.id == NO_DEPARTMENT) {
|
|
149
|
-
builder.and(qUser.department.isNull())
|
|
150
|
-
} else if (currentDept.id !== ALL_DEPARTMENT) {
|
|
151
|
-
builder.and(qUser.department.sortPath.startWith(currentDept.sortPath));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const currentGroup = queryParams.value.currentGroup;
|
|
155
|
-
if (currentGroup) {
|
|
156
|
-
builder.and(qUser.userGroups.any().group.sortPath.startWith(currentGroup.sortPath));
|
|
157
|
-
}
|
|
158
|
-
const currentCustomGroup = queryParams.value.currentCustomGroup;
|
|
159
|
-
if (currentCustomGroup) {
|
|
160
|
-
builder.and(qUser.customGroups.any().customGroup.sortPath
|
|
161
|
-
.startWith(currentCustomGroup.sortPath));
|
|
162
|
-
}
|
|
163
|
-
const name = queryParams.value.name;
|
|
164
|
-
if (name) {
|
|
165
|
-
// and (user.username like %nameQuery% or user.fullName like %nameQuery% or user.pinYinName like %nameQuery%
|
|
166
|
-
const queryText = "%" + name.split('').join('%') + "%"
|
|
167
|
-
builder.and(qUser.username.like(queryText)
|
|
168
|
-
.or(qUser.fullName.like(queryText))
|
|
169
|
-
.or(qUser.pinYinName.like(queryText))
|
|
170
|
-
.or(qUser.mobile.like(queryText)))
|
|
171
|
-
}
|
|
172
|
-
if (customFilter) {
|
|
173
|
-
builder.and(customFilter(qUser));
|
|
174
|
-
}
|
|
175
|
-
const currentSort = queryParams.value.currentSort;
|
|
176
|
-
if (currentSort) {
|
|
177
|
-
builder.orderBy(currentSort)
|
|
178
|
-
}
|
|
179
|
-
const filter = builder.build();
|
|
180
|
-
if (notPaged) {
|
|
181
|
-
return userApi.queryUserRefs(filter).then(res => {
|
|
182
|
-
queryResult.value.users = res;
|
|
183
|
-
return res;
|
|
184
|
-
})
|
|
185
|
-
} else {
|
|
186
|
-
const currentPage = pageParams.value.currentPage - 1;
|
|
187
|
-
return userApi.queryUserRefsPaged(filter, currentPage, pageParams.value.pageSize)
|
|
188
|
-
.then(res => {
|
|
189
|
-
if (scroll && currentPage > 0) {
|
|
190
|
-
queryResult.value.users.push(...res.content);
|
|
191
|
-
} else {
|
|
192
|
-
queryResult.value.users = res.content;
|
|
193
|
-
}
|
|
194
|
-
queryResult.value.total = res.totalElements;
|
|
195
|
-
return res.content;
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return {
|
|
201
|
-
/**
|
|
202
|
-
* 查询的参数
|
|
203
|
-
*/
|
|
204
|
-
queryParams,
|
|
205
|
-
/**
|
|
206
|
-
* 分页参数
|
|
207
|
-
*/
|
|
208
|
-
pageParams,
|
|
209
|
-
/**
|
|
210
|
-
* 查询结果
|
|
211
|
-
*/
|
|
212
|
-
queryResult,
|
|
213
|
-
/**
|
|
214
|
-
* 查询方法
|
|
215
|
-
*/
|
|
216
|
-
queryUsers,
|
|
217
|
-
/**
|
|
218
|
-
* loading状态
|
|
219
|
-
*/
|
|
220
|
-
loading
|
|
221
|
-
}
|
|
222
|
-
}
|
|
1
|
+
import {ref, watch} from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
type BooleanResultExpression,
|
|
4
|
+
createAxiosWithoutCache,
|
|
5
|
+
type IAceAxios,
|
|
6
|
+
QUser,
|
|
7
|
+
type SortDescriptor,
|
|
8
|
+
useLoading,
|
|
9
|
+
type UserReference,
|
|
10
|
+
useUserApi,
|
|
11
|
+
useUserQueryBuilder
|
|
12
|
+
} from "@jari-ace/app-bolts";
|
|
13
|
+
import type {TreeNodeType} from "./useTreeData";
|
|
14
|
+
import {ALL_DEPARTMENT, NO_DEPARTMENT} from "../components/departmentPicker/src/consts";
|
|
15
|
+
import debounce from "lodash-es/debounce";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 用户查询hook,当查询参数变化时,会自动查询,订阅结果即可
|
|
19
|
+
* @param queryPrerequisites 执行查询的前提条件,只有此方法返回true时,查询才会执行
|
|
20
|
+
* @param customFilter 自定义查询过滤条件,可以通过这个回调方法,通过程序方式添加自定义的过滤条件
|
|
21
|
+
* @param onQueryResultReturned 查询成功时的回调方法,接收Page<UserReference>类型参数
|
|
22
|
+
* @param scroll 是否滚动模式,滚动模式下,翻页后新页数据会追加到queryState.users集合中,而不是直接赋予queryState.users
|
|
23
|
+
* @param axios 自定义axios实例
|
|
24
|
+
* @param notPaged 不分页
|
|
25
|
+
*/
|
|
26
|
+
export function useUserRefQuery(
|
|
27
|
+
queryPrerequisites?: () => boolean,
|
|
28
|
+
customFilter?: (qUser: InstanceType<typeof QUser>) => BooleanResultExpression,
|
|
29
|
+
onQueryResultReturned?: (result?: UserReference[], paramsChanged?: boolean) => void,
|
|
30
|
+
scroll?: boolean,
|
|
31
|
+
axios?: IAceAxios,
|
|
32
|
+
notPaged?: boolean) {
|
|
33
|
+
const queryParams = ref<{
|
|
34
|
+
/**
|
|
35
|
+
* 用户域Id查询参数
|
|
36
|
+
*/
|
|
37
|
+
realmId?: string,
|
|
38
|
+
/**
|
|
39
|
+
* 部门查询参数
|
|
40
|
+
*/
|
|
41
|
+
currentDept?: TreeNodeType,
|
|
42
|
+
/**
|
|
43
|
+
* 用户姓名、用户名或用户拼音过滤参数
|
|
44
|
+
*/
|
|
45
|
+
name?: string,
|
|
46
|
+
/**
|
|
47
|
+
* 排序描述符
|
|
48
|
+
*/
|
|
49
|
+
currentSort?: SortDescriptor,
|
|
50
|
+
/**
|
|
51
|
+
* 用户组查询参数
|
|
52
|
+
*/
|
|
53
|
+
currentGroup?: TreeNodeType,
|
|
54
|
+
/**
|
|
55
|
+
* 自定义组查询参数
|
|
56
|
+
*/
|
|
57
|
+
currentCustomGroup?: TreeNodeType
|
|
58
|
+
}>({})
|
|
59
|
+
|
|
60
|
+
const pageParams = ref<{
|
|
61
|
+
/**
|
|
62
|
+
* 当前页码
|
|
63
|
+
*/
|
|
64
|
+
currentPage: number,
|
|
65
|
+
/**
|
|
66
|
+
* 页内数据行数
|
|
67
|
+
*/
|
|
68
|
+
pageSize: number
|
|
69
|
+
}>({
|
|
70
|
+
currentPage: 1,
|
|
71
|
+
pageSize: 50
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const queryResult = ref<{
|
|
75
|
+
/**
|
|
76
|
+
* 总数据量
|
|
77
|
+
*/
|
|
78
|
+
total: number,
|
|
79
|
+
/**
|
|
80
|
+
* 查询结果集
|
|
81
|
+
*/
|
|
82
|
+
users: UserReference[]
|
|
83
|
+
}>({
|
|
84
|
+
total: 0,
|
|
85
|
+
users: []
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
if (!axios) axios = createAxiosWithoutCache();
|
|
89
|
+
const userApi = useUserApi(axios);
|
|
90
|
+
const loading = useLoading(axios);
|
|
91
|
+
const queryParamChanged = ref<boolean>(false)
|
|
92
|
+
|
|
93
|
+
function doQuery() {
|
|
94
|
+
queryUsers().then(r => {
|
|
95
|
+
if (onQueryResultReturned) {
|
|
96
|
+
onQueryResultReturned(r, queryParamChanged.value);
|
|
97
|
+
}
|
|
98
|
+
queryParamChanged.value = false;
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const debounceDoQuery = debounce(doQuery, 300)
|
|
103
|
+
|
|
104
|
+
function queryOnParamsChanged() {
|
|
105
|
+
queryResult.value.total = 0;
|
|
106
|
+
queryResult.value.users = [];
|
|
107
|
+
if (pageParams.value.currentPage !== 1) {
|
|
108
|
+
pageParams.value.currentPage = 1;
|
|
109
|
+
} else {
|
|
110
|
+
debounceDoQuery();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
watch(queryParams, () => {
|
|
115
|
+
queryParamChanged.value = true;
|
|
116
|
+
queryOnParamsChanged();
|
|
117
|
+
}, {
|
|
118
|
+
deep: true
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
watch(() => pageParams.value.pageSize, () => {
|
|
122
|
+
queryParamChanged.value = true;
|
|
123
|
+
queryOnParamsChanged();
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
watch(() => pageParams.value.currentPage, () => {
|
|
127
|
+
queryUsers().then(r => {
|
|
128
|
+
if (onQueryResultReturned) {
|
|
129
|
+
onQueryResultReturned(r, queryParamChanged.value);
|
|
130
|
+
}
|
|
131
|
+
queryParamChanged.value = false;
|
|
132
|
+
});
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
function queryUsers() {
|
|
136
|
+
if (queryPrerequisites && !queryPrerequisites()) {
|
|
137
|
+
return Promise.resolve(undefined);
|
|
138
|
+
}
|
|
139
|
+
if (!queryParams.value.realmId) {
|
|
140
|
+
return Promise.resolve([] as UserReference[]);
|
|
141
|
+
}
|
|
142
|
+
const builder = useUserQueryBuilder();
|
|
143
|
+
const qUser = builder.getQEntity();
|
|
144
|
+
builder.and(qUser.realm.id.eq(queryParams.value.realmId)).and(qUser.recycled.eq(false));
|
|
145
|
+
const currentDept = queryParams.value.currentDept;
|
|
146
|
+
if (currentDept) {
|
|
147
|
+
// 1=1 and user.department.id = currentDepartmentId
|
|
148
|
+
if (currentDept.id == NO_DEPARTMENT) {
|
|
149
|
+
builder.and(qUser.department.isNull())
|
|
150
|
+
} else if (currentDept.id !== ALL_DEPARTMENT) {
|
|
151
|
+
builder.and(qUser.department.sortPath.startWith(currentDept.sortPath));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const currentGroup = queryParams.value.currentGroup;
|
|
155
|
+
if (currentGroup) {
|
|
156
|
+
builder.and(qUser.userGroups.any().group.sortPath.startWith(currentGroup.sortPath));
|
|
157
|
+
}
|
|
158
|
+
const currentCustomGroup = queryParams.value.currentCustomGroup;
|
|
159
|
+
if (currentCustomGroup) {
|
|
160
|
+
builder.and(qUser.customGroups.any().customGroup.sortPath
|
|
161
|
+
.startWith(currentCustomGroup.sortPath));
|
|
162
|
+
}
|
|
163
|
+
const name = queryParams.value.name;
|
|
164
|
+
if (name) {
|
|
165
|
+
// and (user.username like %nameQuery% or user.fullName like %nameQuery% or user.pinYinName like %nameQuery%
|
|
166
|
+
const queryText = "%" + name.split('').join('%') + "%"
|
|
167
|
+
builder.and(qUser.username.like(queryText)
|
|
168
|
+
.or(qUser.fullName.like(queryText))
|
|
169
|
+
.or(qUser.pinYinName.like(queryText))
|
|
170
|
+
.or(qUser.mobile.like(queryText)))
|
|
171
|
+
}
|
|
172
|
+
if (customFilter) {
|
|
173
|
+
builder.and(customFilter(qUser));
|
|
174
|
+
}
|
|
175
|
+
const currentSort = queryParams.value.currentSort;
|
|
176
|
+
if (currentSort) {
|
|
177
|
+
builder.orderBy(currentSort)
|
|
178
|
+
}
|
|
179
|
+
const filter = builder.build();
|
|
180
|
+
if (notPaged) {
|
|
181
|
+
return userApi.queryUserRefs(filter).then(res => {
|
|
182
|
+
queryResult.value.users = res;
|
|
183
|
+
return res;
|
|
184
|
+
})
|
|
185
|
+
} else {
|
|
186
|
+
const currentPage = pageParams.value.currentPage - 1;
|
|
187
|
+
return userApi.queryUserRefsPaged(filter, currentPage, pageParams.value.pageSize)
|
|
188
|
+
.then(res => {
|
|
189
|
+
if (scroll && currentPage > 0) {
|
|
190
|
+
queryResult.value.users.push(...res.content);
|
|
191
|
+
} else {
|
|
192
|
+
queryResult.value.users = res.content;
|
|
193
|
+
}
|
|
194
|
+
queryResult.value.total = res.totalElements;
|
|
195
|
+
return res.content;
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
/**
|
|
202
|
+
* 查询的参数
|
|
203
|
+
*/
|
|
204
|
+
queryParams,
|
|
205
|
+
/**
|
|
206
|
+
* 分页参数
|
|
207
|
+
*/
|
|
208
|
+
pageParams,
|
|
209
|
+
/**
|
|
210
|
+
* 查询结果
|
|
211
|
+
*/
|
|
212
|
+
queryResult,
|
|
213
|
+
/**
|
|
214
|
+
* 查询方法
|
|
215
|
+
*/
|
|
216
|
+
queryUsers,
|
|
217
|
+
/**
|
|
218
|
+
* loading状态
|
|
219
|
+
*/
|
|
220
|
+
loading
|
|
221
|
+
}
|
|
222
|
+
}
|
package/packages/index.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {type App, type Plugin} from "vue";
|
|
2
|
-
import * as components from "./components";
|
|
3
|
-
import {installDirectives} from "./directives";
|
|
4
|
-
|
|
5
|
-
export * from "./components";
|
|
6
|
-
export const AceVueUI: Plugin = {
|
|
7
|
-
install(app: App<Element>) {
|
|
8
|
-
for (const [key, comp] of Object.entries(components)) {
|
|
9
|
-
app.component(key, comp);
|
|
10
|
-
}
|
|
11
|
-
installDirectives(app)
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export * from "./hooks/useBackendValidations"
|
|
16
|
-
export * from "./hooks/useTreeData"
|
|
17
|
-
export * from "./hooks/useAppInstances"
|
|
18
|
-
export * from "./directives"
|
|
19
|
-
export * from "./hooks/useDateTimeShortCuts"
|
|
20
|
-
export * from "./components/scrollbar/utils"
|
|
21
|
-
export * from "./hooks/useBridage"
|
|
1
|
+
import {type App, type Plugin} from "vue";
|
|
2
|
+
import * as components from "./components";
|
|
3
|
+
import {installDirectives} from "./directives";
|
|
4
|
+
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export const AceVueUI: Plugin = {
|
|
7
|
+
install(app: App<Element>) {
|
|
8
|
+
for (const [key, comp] of Object.entries(components)) {
|
|
9
|
+
app.component(key, comp);
|
|
10
|
+
}
|
|
11
|
+
installDirectives(app)
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export * from "./hooks/useBackendValidations"
|
|
16
|
+
export * from "./hooks/useTreeData"
|
|
17
|
+
export * from "./hooks/useAppInstances"
|
|
18
|
+
export * from "./directives"
|
|
19
|
+
export * from "./hooks/useDateTimeShortCuts"
|
|
20
|
+
export * from "./components/scrollbar/utils"
|
|
21
|
+
export * from "./hooks/useBridage"
|
package/packages/list.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"compName": "DemoComponent",
|
|
4
|
-
"compZhName": "示例",
|
|
5
|
-
"compDesc": "这是一个示例组件",
|
|
6
|
-
"compClassName": "button"
|
|
7
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"compName": "DemoComponent",
|
|
4
|
+
"compZhName": "示例",
|
|
5
|
+
"compDesc": "这是一个示例组件",
|
|
6
|
+
"compClassName": "button"
|
|
7
|
+
}
|
|
8
8
|
]
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
type ShortcutHandlerType = (event: KeyboardEvent) => void;
|
|
2
|
-
|
|
3
|
-
interface ShortcutHandlerStackItem {
|
|
4
|
-
keys: string;
|
|
5
|
-
el: HTMLElement;
|
|
6
|
-
handler: ShortcutHandlerType;
|
|
7
|
-
prev?: ShortcutHandlerStackItem
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface HTMLElement {
|
|
11
|
-
__vueShortcutHandler__?: ShortcutHandlerStackItem;
|
|
12
|
-
__visibilityObserver__?: IntersectionObserver;
|
|
13
|
-
}
|
|
1
|
+
type ShortcutHandlerType = (event: KeyboardEvent) => void;
|
|
2
|
+
|
|
3
|
+
interface ShortcutHandlerStackItem {
|
|
4
|
+
keys: string;
|
|
5
|
+
el: HTMLElement;
|
|
6
|
+
handler: ShortcutHandlerType;
|
|
7
|
+
prev?: ShortcutHandlerStackItem
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HTMLElement {
|
|
11
|
+
__vueShortcutHandler__?: ShortcutHandlerStackItem;
|
|
12
|
+
__visibilityObserver__?: IntersectionObserver;
|
|
13
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {type GlobalData, Jari, type MicroAppContext} from "@jari-ace/app-bolts";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
appContext?: MicroAppContext;
|
|
7
|
-
microApp?: {
|
|
8
|
-
getGlobalData: () => GlobalData;
|
|
9
|
-
addGlobalDataListener: (data: (data: MicroAppContext) => void) => void;
|
|
10
|
-
addDataListener:any
|
|
11
|
-
} & any,
|
|
12
|
-
__MICRO_APP_ENVIRONMENT__: boolean,
|
|
13
|
-
rawWindow: Window,
|
|
14
|
-
appDescriptor: Jari.Ace.ApplicationDescriptor;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import {type GlobalData, Jari, type MicroAppContext} from "@jari-ace/app-bolts";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
appContext?: MicroAppContext;
|
|
7
|
+
microApp?: {
|
|
8
|
+
getGlobalData: () => GlobalData;
|
|
9
|
+
addGlobalDataListener: (data: (data: MicroAppContext) => void) => void;
|
|
10
|
+
addDataListener:any
|
|
11
|
+
} & any,
|
|
12
|
+
__MICRO_APP_ENVIRONMENT__: boolean,
|
|
13
|
+
rawWindow: Window,
|
|
14
|
+
appDescriptor: Jari.Ace.ApplicationDescriptor;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type {App, AppContext, Plugin, Directive} from "vue";
|
|
2
|
-
|
|
3
|
-
export type SFCWithInstall<T> = T & Plugin;
|
|
4
|
-
|
|
5
|
-
export type SFCInstallWithContext<T> = SFCWithInstall<T> & {
|
|
6
|
-
_context: AppContext | null;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const withInstall = <T, E extends Record<string, any>>(main: T, extra?: E) => {
|
|
10
|
-
(main as SFCWithInstall<T>).install = (app: App<Element>): void => {
|
|
11
|
-
for (const comp of [main, ...Object.values(extra ?? {})]) {
|
|
12
|
-
app.component(comp.name, comp);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
if (extra) {
|
|
16
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
17
|
-
(main as any)[key] = comp;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return main as SFCWithInstall<T> & E;
|
|
21
|
-
};
|
|
22
|
-
export const withInstallFunction = <T>(fn: T, name: string) => {
|
|
23
|
-
(fn as SFCWithInstall<T>).install = (app: App<Element>) => {
|
|
24
|
-
(fn as SFCInstallWithContext<T>)._context = app._context;
|
|
25
|
-
app.config.globalProperties[name] = fn;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return fn as SFCInstallWithContext<T>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const withInstallDirective = <T extends Directive>(directive: T, name: string) => {
|
|
32
|
-
(directive as SFCWithInstall<T>).install = (app: App<Element>): void => {
|
|
33
|
-
app.directive(name, directive);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return directive as SFCWithInstall<T>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const withNoopInstall = <T>(component: T) => {
|
|
40
|
-
;(component as SFCWithInstall<T>).install = (): void => {
|
|
41
|
-
}
|
|
42
|
-
return component as SFCWithInstall<T>
|
|
43
|
-
}
|
|
1
|
+
import type {App, AppContext, Plugin, Directive} from "vue";
|
|
2
|
+
|
|
3
|
+
export type SFCWithInstall<T> = T & Plugin;
|
|
4
|
+
|
|
5
|
+
export type SFCInstallWithContext<T> = SFCWithInstall<T> & {
|
|
6
|
+
_context: AppContext | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const withInstall = <T, E extends Record<string, any>>(main: T, extra?: E) => {
|
|
10
|
+
(main as SFCWithInstall<T>).install = (app: App<Element>): void => {
|
|
11
|
+
for (const comp of [main, ...Object.values(extra ?? {})]) {
|
|
12
|
+
app.component(comp.name, comp);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
if (extra) {
|
|
16
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
17
|
+
(main as any)[key] = comp;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return main as SFCWithInstall<T> & E;
|
|
21
|
+
};
|
|
22
|
+
export const withInstallFunction = <T>(fn: T, name: string) => {
|
|
23
|
+
(fn as SFCWithInstall<T>).install = (app: App<Element>) => {
|
|
24
|
+
(fn as SFCInstallWithContext<T>)._context = app._context;
|
|
25
|
+
app.config.globalProperties[name] = fn;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return fn as SFCInstallWithContext<T>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const withInstallDirective = <T extends Directive>(directive: T, name: string) => {
|
|
32
|
+
(directive as SFCWithInstall<T>).install = (app: App<Element>): void => {
|
|
33
|
+
app.directive(name, directive);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return directive as SFCWithInstall<T>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const withNoopInstall = <T>(component: T) => {
|
|
40
|
+
;(component as SFCWithInstall<T>).install = (): void => {
|
|
41
|
+
}
|
|
42
|
+
return component as SFCWithInstall<T>
|
|
43
|
+
}
|