jobdone-shared-files 1.0.8 → 1.0.10
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.
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
<div class="nav-item navbar-line-item btn nav-link border-0 dropdown"
|
|
27
27
|
:class="{'active': isActive(navLinkObj.moduleLink)}">
|
|
28
|
+
<!-- NOTE 自己的獨立AP 沒有list,目前因為隕石已被GeneralLink取代 -->
|
|
28
29
|
<a :href="navLinkObj.url + projectId" class="dropdown-link" v-if="navLinkObj?.moduleLink?.selfIsApp">
|
|
29
30
|
<span class="material-icons icon-18 me-2">{{ navLinkObj?.moduleLink?.icon }}</span>
|
|
30
31
|
{{ navLinkObj?.moduleLink?.name }}
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
</ul>
|
|
44
45
|
</div>
|
|
45
46
|
<div class="nav-item navbar-line-item btn nav-link border-0 dropdown"
|
|
46
|
-
:class="{'active': isActive(item.
|
|
47
|
+
:class="{'active': isActive(item.id)}"
|
|
47
48
|
v-for="item in navLinkObj.generalLink">
|
|
48
49
|
<a :href="item.url + '?projectId=' + projectId" class="dropdown-link">
|
|
49
50
|
<span class="material-icons icon-18 me-2">{{item.icon}}</span>
|
|
@@ -167,12 +168,15 @@
|
|
|
167
168
|
|
|
168
169
|
const isActive = (target) => {
|
|
169
170
|
if (target === null) {
|
|
171
|
+
// 專案資訊
|
|
170
172
|
return target === null && !props.activeClientId;
|
|
171
173
|
}
|
|
172
174
|
if (typeof target === 'object') {
|
|
175
|
+
// 功能選單
|
|
173
176
|
return !!props.activeClientId && (target.clientId === props.activeClientId || target.apps.some(x => x.clientId == props.activeClientId))
|
|
174
177
|
}
|
|
175
178
|
if (!!props.activeClientId && target == props.activeClientId) {
|
|
179
|
+
// 功能選單
|
|
176
180
|
return true;
|
|
177
181
|
}
|
|
178
182
|
return false;
|
package/autocompleteSelect.vue
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
<!-- preview input -->
|
|
4
4
|
<button type="button" class='form-control autocomplete-select-component-display-selecting' :disabled="disabled"
|
|
5
5
|
:class="[triggerClass, previewInput]">{{
|
|
6
|
-
|
|
6
|
+
selectedPreviewText
|
|
7
7
|
}}</button>
|
|
8
8
|
<!-- search input -->
|
|
9
9
|
<input class='form-control autocomplete-select-component-keyword-filter-input' :class="[triggerClass, searchInput]"
|
|
10
10
|
type="text" ref="keywordFilterInput" v-model="keyword"
|
|
11
|
-
:placeholder="searchPlaceholder == '' ?
|
|
12
|
-
@keydown.enter="keyboardSelectConfirm()" @keydown.up="keyboardSwitch(-1)"
|
|
13
|
-
@change="keyboardSwitchIndexReset()">
|
|
11
|
+
:placeholder="searchPlaceholder == '' ? selectedPreviewText : searchPlaceholder" maxlength="50"
|
|
12
|
+
@keydown.enter="keyboardSelectConfirm($event)" @keydown.up="keyboardSwitch(-1)"
|
|
13
|
+
@keydown.down="keyboardSwitch(1)" @change="keyboardSwitchIndexReset()">
|
|
14
14
|
<Teleport :to="listPut">
|
|
15
15
|
<div class="autocomplete-select-component-selector-content" :class="{ 'active': active }"
|
|
16
16
|
ref="componentContentList" :style="positionStyle">
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</li>
|
|
29
29
|
<template v-if="active">
|
|
30
|
-
<li v-for="(opt, idx) in filterList" :key="idx" @click.stop="selectConfirm(opt)" :title="opt.name"
|
|
30
|
+
<li v-for="(opt, idx) in filterList" :key="idx" @click.stop="selectConfirm(opt)" :title="opt.name"
|
|
31
|
+
:id="`autocomplete-select-component-opt-item_${idx}`">
|
|
31
32
|
<button class="autocomplete-select-component-opt-item" type="button"
|
|
32
33
|
:class="idx == keyboardSwitchIndex ? 'active' : ''">
|
|
33
34
|
<template v-if="htmlOption">
|
|
@@ -96,12 +97,12 @@ const props = defineProps({
|
|
|
96
97
|
resetValue: {
|
|
97
98
|
default: ''
|
|
98
99
|
},
|
|
99
|
-
disabled:{
|
|
100
|
-
type:Boolean,
|
|
100
|
+
disabled: {
|
|
101
|
+
type: Boolean,
|
|
101
102
|
default: false
|
|
102
103
|
},
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
|
|
105
106
|
previewKey: {
|
|
106
107
|
type: String,
|
|
107
108
|
default: '',
|
|
@@ -122,7 +123,7 @@ const props = defineProps({
|
|
|
122
123
|
type: Boolean,
|
|
123
124
|
default: false
|
|
124
125
|
},
|
|
125
|
-
|
|
126
|
+
|
|
126
127
|
|
|
127
128
|
});
|
|
128
129
|
|
|
@@ -138,7 +139,7 @@ const keywordFilterInput = ref(null)
|
|
|
138
139
|
const active = ref(false)
|
|
139
140
|
const domPosition = ref({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 })
|
|
140
141
|
function activeSelector() {
|
|
141
|
-
if(props.disabled){
|
|
142
|
+
if (props.disabled) {
|
|
142
143
|
return
|
|
143
144
|
}
|
|
144
145
|
active.value = true
|
|
@@ -168,8 +169,6 @@ function leave() {
|
|
|
168
169
|
keywordFilterInput.value.blur()
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
173
172
|
// 確認傳入選單列表內的選項Type,只檢查第一個,請內容統一,不要傳奇怪的東西進來
|
|
174
173
|
const allowOptItemType = ['string', 'number', 'object']
|
|
175
174
|
const optItemType = computed(() => {
|
|
@@ -217,7 +216,7 @@ const filterList = computed(() => {
|
|
|
217
216
|
})
|
|
218
217
|
})
|
|
219
218
|
|
|
220
|
-
// 從選項列表中挖出整個選中的item
|
|
219
|
+
// 從選項列表中挖出整個選中的item,因選中的值(可能是某個key)
|
|
221
220
|
const selectedItem = computed(() => {
|
|
222
221
|
if (!props.selectedData) {
|
|
223
222
|
return
|
|
@@ -227,12 +226,11 @@ const selectedItem = computed(() => {
|
|
|
227
226
|
if (props.bindingKey !== '') {
|
|
228
227
|
return props.opts.find(i => i[props.bindingKey.toString()] == props.selectedData) ?? props.selectedData
|
|
229
228
|
}
|
|
230
|
-
|
|
231
229
|
return props.selectedData
|
|
232
230
|
})
|
|
233
231
|
|
|
234
232
|
|
|
235
|
-
//
|
|
233
|
+
// 整理 選項與選中值 的顯示文字
|
|
236
234
|
function previewAdjust(itemObj) {
|
|
237
235
|
if (props.previewKey !== '') {
|
|
238
236
|
let strAry = props.previewKey.split('+')
|
|
@@ -253,12 +251,22 @@ function previewAdjust(itemObj) {
|
|
|
253
251
|
if (isUndefined) {
|
|
254
252
|
return props.isUndefinedHint
|
|
255
253
|
}
|
|
256
|
-
return finalStr ? finalStr :
|
|
254
|
+
return finalStr ? finalStr : props.placeholder
|
|
257
255
|
}
|
|
258
256
|
return itemObj
|
|
259
257
|
}
|
|
260
258
|
|
|
261
|
-
|
|
259
|
+
// 強制更新selectedPreviewText
|
|
260
|
+
const selectedPreviewTextUpdateCount = ref(0)
|
|
261
|
+
function selectedPreviewTextUpdate() {
|
|
262
|
+
selectedPreviewTextUpdateCount.value++
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// 選中的值的顯示
|
|
266
|
+
const selectedPreviewText = computed(() => {
|
|
267
|
+
|
|
268
|
+
let updateComputed = selectedPreviewTextUpdateCount.value + 1 // 讓外部可以強制更新這個computed,不要刪除
|
|
269
|
+
|
|
262
270
|
if (!selectedItem.value || Object.keys(selectedItem.value).length === 0) {
|
|
263
271
|
return props.placeholder
|
|
264
272
|
}
|
|
@@ -267,6 +275,7 @@ const previewText = computed(() => {
|
|
|
267
275
|
|
|
268
276
|
// 清除選擇內容
|
|
269
277
|
function clearSelected() {
|
|
278
|
+
selectedPreviewTextUpdateCount.value = 0
|
|
270
279
|
emit('select', props.resetValue)
|
|
271
280
|
leave()
|
|
272
281
|
}
|
|
@@ -276,15 +285,20 @@ function selectConfirm(v) {
|
|
|
276
285
|
if (!v) {
|
|
277
286
|
return
|
|
278
287
|
}
|
|
288
|
+
selectedPreviewTextUpdate()
|
|
279
289
|
emit('select', JSON.parse(JSON.stringify(v)))
|
|
280
290
|
leave()
|
|
281
291
|
keyboardSwitchIndexReset()
|
|
282
292
|
}
|
|
283
293
|
|
|
284
294
|
// 鍵盤送出
|
|
285
|
-
function keyboardSelectConfirm() {
|
|
295
|
+
function keyboardSelectConfirm(event) {
|
|
296
|
+
if (event.isComposing) {
|
|
297
|
+
return
|
|
298
|
+
}
|
|
286
299
|
if (filterList.value?.length) {
|
|
287
300
|
selectConfirm(filterList.value[keyboardSwitchIndex.value])
|
|
301
|
+
selectedPreviewTextUpdate()
|
|
288
302
|
}
|
|
289
303
|
}
|
|
290
304
|
|
|
@@ -317,7 +331,7 @@ function keyboardSwitchIndexReset() {
|
|
|
317
331
|
|
|
318
332
|
// 樣式
|
|
319
333
|
const previewInput = computed(() => {
|
|
320
|
-
if (
|
|
334
|
+
if (selectedPreviewText.value == props.placeholder) {
|
|
321
335
|
return 'autocomplete-select-component-value-null'
|
|
322
336
|
}
|
|
323
337
|
return ''
|
|
@@ -328,7 +342,7 @@ const searchInput = computed(() => {
|
|
|
328
342
|
}
|
|
329
343
|
return ''
|
|
330
344
|
})
|
|
331
|
-
function initTrigger() {
|
|
345
|
+
function initTrigger(event) {
|
|
332
346
|
if (componentContentInput.value.contains(event.target) || componentContentList.value.contains(event.target)) {
|
|
333
347
|
activeSelector()
|
|
334
348
|
} else {
|