jobdone-shared-files v1.1.5
Vue Components
如果要使用 vue 檔,需要直接引用 node_modules 裡的檔案,例如:
import OOXX from '../../node_modules/jobdone-shared-files/OOXX.vue';
.
01.ProjectManagement/projectNavbar - 專案資訊Navbar(2024.07.30_v2版本為破壞性更新)
可用參數
參數 | 型別 | 說明 | 必要 |
---|---|---|---|
root-domain | String | 底層的 domain,傳入的值有無斜線皆可 | 是 |
arrow-back-link | String | 離開專案的連結,一般來說是底層的 Index,底層的 Index 會再判斷該導回對應模組的首頁 | 是 |
project-info | String , Object | 可接受api url或物件,api 僅支援 Get 請求,結構應為{name: "", caseNo: "", caseNo: "",beginDT:"",endDT:"",approvedWorkingPeriod:0, extendToDT:"",extendDays:""} | 是 |
project-apps | String , Object | 可接受 api url 或物件,api 僅支援 Get 請求,,結構應為{ id: null, name: '', iconName: '', featurePackApps: [], generalLinks: [] } ,去呼叫底層 API 取得專案所屬 Module 的 App 連結 (V2 TOP) | 是 |
active-client-id | String | Navbar active 的對象,請填入 client id,預設 active 的為專案資訊 | 否 |
project-id | String | project id | 是 |
user-id | String | 傳入 user 的帳號 id | 是 |
user-picture | String | 傳入 user 的大頭貼 | 是 |
log-out-link | String | 登出連結 | 是 |
02-1.ModuleInfo/LayoutNav - 模組首頁 Sidebar
LayoutNav
是用於模組首頁的側邊欄 Component,會顯示模組資訊、使用者資訊以及該模組的待辦事項列表 (單單) 的連結。
其中 module-info
可以傳入 API URL 或者直接傳入物件。如果是 API URL,組件將自動發出 GET 請求來獲取資料。
LayoutNav
內已包含 navButton
模組功能總表按鈕/下拉選單。
可用參數
參數 | 型別 | 說明 | 必要 |
---|---|---|---|
root-domain | String | 底層的 domain,傳入的值有無斜線皆可 | 否 |
user-avatar | String | 傳入 user 的大頭貼 | 是 |
user-display-name | String | 傳入 user 的顯示名稱 | 是 |
user-full-name | String | 傳入 user 的全名 | 是 |
org-name | String | 公司名稱,僅在 moduleInfo.isPersonal 為 false 時顯示 | 否 |
module-info | String , Object | 可接受 API URL 或物件,API 僅支援 GET 請求,結構應為 { moduleInfo: { name: "", iconName: "" }, generalLinks: [], isPersonal: true, isPaymentAdmin: false } | 是 |
index-link | String | 模組的首頁,預設為 /Index ,,一般來說是底層的 Index | 否 |
logout-link | String | 登出連結,預設為 /Logout | 否 |
否 |
Slot 說明
LayoutNav
組件提供多個插槽 (slots) 讓開發者自定義內容:
list-content-top
: 放於「我的待辦事項列表 (單單) 」之上的內容。list-content-bottom
: 放於「我的待辦事項列表 (單單) 」之下的內容。bottom-link
: 固定於側邊欄底部的插槽,放在「我的聯絡人」旁的按鈕。可添加其他重要的按鈕,例如「通知」等功能。
02-2.ModuleInfo/navButton - 模組功能總表按鈕/下拉選單
navButton
是用於顯示模組功能總表的按鈕及下拉選單的組件。按下按鈕後,會顯示與模組相關的功能連結,例如待辦事項、公司資訊和個人資料等連結。
其中 module-info
可以傳入 API URL 或者直接傳入物件。如果是 API URL,組件將自動發出 GET 請求來獲取資料,同 LayoutNav
。
可用參數
參數 | 型別 | 說明 | 必要 |
---|---|---|---|
root-domain | String | 底層的 domain,傳入的值有無斜線皆可 | 否 |
module-info | String , Object | 可接受 API URL 或物件,API 僅支援 GET 請求,結構應為 { moduleInfo: { name: "", iconName: "" }, generalLinks: [], isPersonal: true, isPaymentAdmin: false } | 是 |
index-link | String | 模組的首頁,預設為 /Index ,,一般來說是底層的 Index | 否 |
logout-link | String | 登出連結,預設為 /Logout | 否 |
.
03.Paginate - 分頁
範例
<template>
<paginate
container-class="..."
:total-pages="..."
:current-page="..."
@to-page="...">
</paginate>
</template>
<script setup>
import paginate from 'jobdone-shared-files/paginate.vue';
<script>
可用參數
# | 參數 Attribute | 型別 Type | 預設值 Default | 選項 Option | 說明 Description |
---|---|---|---|---|---|
1 | container-class | String | '' | ' ' 'pagination-sm' 'pagination-lg' | 尺寸設定 |
2 | total-pages | Number | 1 | 任意阿拉伯數字 | 總頁數 |
3 | current-page | Number | 1 | 任意阿拉伯數字 | 當前頁碼 |
4 | page-range | Number | 5 | 任意阿拉伯數字 | 最多顯示幾個頁碼 |
可用方法
# | 參數 Attribute | 說明 Description |
---|---|---|
1 | to-page | 點選頁碼執行的動作 |
.
04.TagEditor - 標籤
範例
<template>
<tagEditor
ref="tagEditorComponent"
:auto-complete-option='autoCompleteTagList'
@update-auto-complete-option="getTagListByKeyWord">
</tagEditor>
</template>
<script setup>
import tagEditor from 'jobdone-shared-files/tagEditor.vue';
<!-- autoComplete 功能 -->
const autoCompleteTagList = ref([]);
async function getTagListByKeyWord(keyword) {
autoCompleteTagList.value = await axios.get(...).data;
}
<!-- 取得建立的TAG值 -->
const tagEditorComponent = ref(null);
const tags = ref([])
functio getTag(){
tags.value = tagEditorComponent.value.tagAry
}
<script>
可用參數
# | 參數 Attribute | 型別 Type | 預設值 Default | 選項 Option | 說明 Description |
---|---|---|---|---|---|
1 | placeholder | String | '請在此處輸入標籤文字' | 任意字串 | input的提示文字 |
2 | auto-complete | Boolean | true | true false | 是否啟用AutoComplete,啟用的話必需傳入用於AutoComplete的Array |
3 | auto-complete-option | Array | [] | ['...','...','...'] | 僅接受字串陣列。 |
4 | disabled | Boolean | false | true false | 停用 |
可用方法
# | 參數 Attribute | 說明 Description |
---|---|---|
1 | update-auto-complete-option | 文字輸入時呼叫,value為當前輸入的值,可用於刷新autoCompleteOption。 |
.
05.Tree - 樹狀結構
需另外引入 ../../node_modules/jobdone-shared-files/style/scss/Tree.scss
檔案
範例
<template>
<tree :items="items" :click-item="clickItem" size="sm">
<template v-slot:icon-start>
// 前方箭頭後的 slot 插槽
</template>
<template v-slot:icon="slotProps">
// 後方的 slot 插槽,預設為 radio icon
// 透過 slotProps 取得每一個 item 的資料
{{slotProps.item}}
</template>
</tree>
</template>
<script setup>
import tree from 'jobdone-shared-files/tree.vue';
const items = [
{
id:1,
name:'分類A',
children{
id:11,
title:'分類A'-1,
children:[
...
]
}
},{
id:2,
name:'分類B',
children{
id:12,
title:'分類B-1',
children:[
...
]
}
},
...
]
function clickItem(v){
console.log(v)
}
<script>
可用參數
# | 參數 Attribute | 型別 Type | 預設值 Default | 選項 Option | 說明 Description |
---|---|---|---|---|---|
1 | items | Array | [] | 須包含Id,名稱必須為title,子層的Key必須為children | 尺寸設定 |
2 | size | String | '' | '' 'sm' | 內容陣列 |
4 | bgColor | String | '' | '' 'white' | 用於什麼樣子的背景色上,預設用在灰色背景上。用在白背景上可使用white模式 |
可用方法
Function | 說明 Description |
---|---|
clickItem | 點選項目執行的方法 |
.
06.VueLoadingOverlay - 指定樣式讀取樣式
範例
<template>
<Loading :is-active="isLoading"></Loading>
</template>
<script setup>
import Loading from "jobdone-shared-files/vueLoadingOverlay.vue";
<!-- loading 初始化 "isLoading" => 自定義變數 -->
const isLoading = ref(false);
<!-- 開啟loading -->
function showLodaing(){
isLoading.value = true;
}
<!-- 關閉loading -->
function showLodaing(){
isLoading.value = false;
}
</script>
可用變數:
# | 參數 Attribute | 型別 Type | 預設值 Default | 說明Description |
---|---|---|---|---|
1. | full-page | Boolean | true | 是否填滿整個視窗。為False時,則填滿放置位置的父層 |
其他可用變數(統一樣式不推薦修改):
# | 參數 Attribute | 型別 Type | 預設值 Default | 說明Description |
---|---|---|---|---|
1. | is-active | Boolean | false | 開啟 / 關閉 |
2. | loader | String | bars | 圖案樣式spinner / dots / bars 三種可選 |
3. | colors | String | #fff | 圖案顏色 |
4. | background-color | String | #000 | 遮罩顏色 |
5. | opacity | Number | 0.5 | 遮罩透明度 |
.
07.lightboxWithOverview - 有縮圖的圖片光箱
<lightbox-with-overview
:pictures-data="picturesData"
ref="lightboxWithOverviewRef">
</lightbox-with-overview>
可傳入的值:
參數 | 說明 | 必要 |
---|---|---|
pictures-data | 格式為: [{src: "", title: ""}] | 是 |
preview | 是否要顯示縮圖,可傳入 true or false | 否 |
display-index | 預設 index 為 0 | 否 |
preview-count | preview 的圖片陣列數量,預設為 5,可使用 lightboxWithOverviewRef?.previewPictures 與 lightboxWithOverviewRef?.otherPictureCount | 否 |
.
08.autocompleteSelect - autocomplete下拉選單
範例1:簡易型,String Array 的選單
<template>
<autocomplete-select
:opts="opts"
:selected-data="selected"
@select="(v) => selected = v">
</autocomplete-select>
</template>
<script setup>
import autocompleteSelect from 'jobdone-shared-files/autocompleteSelect.vue';
const selected =''
const opts =['汪汪汪','喵喵喵','啾啾啾']
<script>
範例2:複雜型,Object Array 的選單
<template>
<autocomplete-select
:selected-data="selected"
:opts="members"
:filter-keys="['firstName','lastName','enName']"
preview-key="enName + ' ( ' + lastName + ' ' + firstName + ' ) '"
binding-key="id"
@select="(v) => selected = v.id"
></autocomplete-select>
</template>
<script setup>
import autocompleteSelect from 'jobdone-shared-files/autocompleteSelect.vue';
const selected = '1'
const members =[{
id:'1',
firstName:'美美',
lastName:'陳',
enName:'Amy'
},{
id:'2',
firstName:'大蒙',
lastName:'王',
enName:'Jed'
},{
...
}]
<script>
範例3:自訂選單樣式()
<template>
<autocomplete-select
:selected-data="selected"
:opts="members"
:filter-keys="['firstName','lastName','enName']"
binding-key="id"
@select="(v) => selected = v.id"
:html-option='true'
opt-class='border-bottom'
>
<template #option = "{ optData }">
<div>我全要喵喵喵喵!!</div>
<div>
{{optData.phoneNumber}}
</div>
<div>
{{ `${optData.enName} (${ optData.firstName } ${ optData.lastName })` }}
</div>
</template>
</autocomplete-select>
</template>
<script setup>
import autocompleteSelect from 'jobdone-shared-files/autocompleteSelect.vue';
const selected = '1'
const members =[{
id:'1',
firstName:'美美',
lastName:'陳',
enName:'Amy',
phoneNumber:'0911111111',
},{
id:'2',
firstName:'大蒙',
lastName:'王',
enName:'Jed',
phoneNumber:'092222222',
},{
...
}]
<script>
基本參數
# 參數 Attribute 型別 Type 預設值 Default 說明 Description 1 selected-data
String
Number
Object
none
當前選擇的值(類似平常 vModel
的用法)2 opts
Array
[]
選項列表,只接受 StringArray
NumberArray
ObjectArray
,且請陣列內容格式統一3 opt-class
String
''
選項列表客製化樣式 4 placeholder
String
'請選擇'
未選擇內容時的提示文字 5 search-placeholder
String
''
自定義搜尋框的提示文字。如未設定,有選擇內容時會將選擇的內容當成提示文字,而未選擇時則顯示placeholder(參數2)的值 6 trigger-class
String
''
預覽框與輸入框的樣式CLASS,可用於驗證提示 7 list-put
String
'body'
列表Dom放置位置 8 is-unselected-extend-value
Array
[]
如未設定 null
undefined
0
''
辯視為未選擇內容
清除按鈕參數
# | 參數 Attribute | 型別 Type | 預設值 Default | 選項 Option | 說明 Description |
---|---|---|---|---|---|
7 | clear-btn | Boolean | True | True False | 是否顯示清除按鈕 |
8 | clear-placeholder | String | '清除選擇' | 清除按鈕的文字 | |
9 | reset-value | String Number Object | '' | 清空選擇替換的預設值 |
Object陣列選項清單用參數
# | 參數 Attribute | 型別 Type | 預設值 Default | 選項 Option | 說明 Description |
---|---|---|---|---|---|
10 | preview-key | String | '' | 顯示指定字符連接。請填入符合規定的字串 | 用+號連接keyName和自定義字串,自定義字串請用''包起來(空白同理)。範例enName + ' ( ' + lastName + ' ' + firstName + ' ) ' |
11 | filter-key | Array | ['name'] | 字串陣列 | 傳入需要進行篩選比對的keyName,可多個。 |
12 | binding-key | String | '' | 本參數僅供提傳入供單一且為唯一值得keyName,一般用於ID。 | 如傳入的選項列表為複雜object陣列,但選中的值是某個key。可傳入Key Name以供Component辨並從傳入的陣列中找出該object。如綁定的是整個object,不需使用此參數。 |
13 | is-undefined-hint | String | '⚠️ 未找到符合原選擇的選項,可能相關資料曾發生異動 | 字串 | 傳入binding-key但比對失敗,在opts(參數2)中找不到binding-key內容與selected-data值相符的選項,用於提示的預覽文字 |
14 | html-option | Boolean | false | true false | 是否啟用自訂選項樣式,用法請參考範例3。請注意就算起啟用preview-key還是必須傳入。 |
可用方法
Function | 說明 Description |
---|---|
select | 選到項目要做什麼 |
.
.
.
Directives
01.SelectPlaceholder
<select>
未選擇值時加上Placeholder樣式
null
false
undefined
''
預設會被判斷為Placeholder,如有增減需求請參考option可用變數。
使用範例:
<template>
<select class="form-select"
v-model="selectingValue"
v-select-placeholder="{
value: selectingValue,
placeholderValue: [1,2],
excludeValue: [false],
unselectClass:'is-invalid'
}">
<option :value="null">請選擇一隻貓,這是Placeholder</option>
<option :value="false">雖然是false,但是我任性地說他一個正常的選項</option>
<option :value="1">雖然是1,但是我任性地說他Placeholder選項</option>
<option :value="2">雖然是2,但是我任性地說他Placeholder選項</option>
<option :value="3">Candy</option>
...
</select>
</template>
<script setup>
import { ref } from "vue";
import vSelectPlaceholder from 'jobdone-shared-files/common/directives/selectPlaceholder.js';
const selectingValue = ref(null)
</script>
可用變數
# | 參數 Attribute | 型別 Type | 必填 required | 預設值 Default | 說明Description |
---|---|---|---|---|---|
1 | value | -- | 是 | -- | 當前選擇內容的值 |
2 | placeholderValue | Array | 否 | [] | 除了預設會被判斷為Placeholder的值,如有其他需求可增加。 |
3 | excludeValue | Array | 否 | [] | 如預設會被判斷為Placeholder的值,需被排除判斷,可在此處排除 |
4 | unselectClass | String | 否 | '' | 如在未選擇值時希望有更多特殊樣式,可在此傳入Class。不需要加. |
.
02.textareaAutoHeight
使用範例:
<template>
<textarea v-textarea-auto-height v-model="inputValue"></textarea>
</template>
<script setup>
import { ref } from "vue";
import vTextareaAutoHeight from 'jobdone-shared-files/common/directives/textareaAutoHeight.js';
const inputValue = ref(null)
</script>
SCSS
Layout
Layout 名稱 | 說明 | 在 jobdone-shared-files 內? |
---|---|---|
LayoutBase | 客製化的 Bootstrap (5.3.0) | 是 |
LayoutProject | Project 使用的共用樣式,含開合雙欄樣式 | 是 |
LayoutSinglePage | 單頁版面的樣式,如:登入、錯誤頁、條款等 | 是 |
LayoutTwoColumn | 雙欄可開合樣式 | 是 |
LayoutInnerColumn | 針對 Project 雙欄樣式內的雙欄樣式 | 是 |
LayoutDocs | 針對條文調整的樣式 | 否 |
LayoutOutside | 針對 (底層) Project 外的共用樣式 | 否 |
Common
- Animation:目前只有 Fade In keyframe
- SelectableTable:勾選 tr focus style
- thumbnail-group:方形大頭貼與小大頭貼相疊 style
- filepond:客製化 filepond 樣式
- Tree:Tree Component 樣式
6 months ago
7 months ago
7 months ago
6 months ago
6 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
6 months ago
6 months ago
6 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago