qtsk-vue3 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,130 +1,35 @@
1
- /* import McLink from './components/link'
2
- import McBreadcrumb from './components/breadcrumb'
3
- import McButton from './components/button'
4
- import McCheckbox from './components/checkbox'
5
- import McCheckboxGroup from './components/checkbox-group'
6
- import McRadio from './components/radio'
7
- import McRadioGroup from './components/radio-group'
8
- import McProgress from './components/progress'
9
- import McInput from './components/input'
10
- import McSlide from './components/slide'
11
- import McSwitch from './components/switch'
12
- import McTab from './components/tab'
13
- import McTextarea from './components/textarea'
14
- import McTree from './components/tree'
15
- import McCity from './components/city'
16
- import McCityPicker from './components/city-picker'
17
- import McAddress from './components/address'
18
- import McFuzzySearch from './components/fuzzy-search'
19
- import McTip from './components/tip'
20
- import McPopup from './components/popup'
21
- import McTable from './components/table'
22
- import McTableColumn from './components/table-column'
23
- import McPagination from './components/pagination'
24
- import McForm from './components/form'
25
- import McFormItem from './components/form-item'
26
- import McSelect from './components/select'
27
- import McSelectOption from './components/select-option'
28
- import McDatePicker from './components/date-picker'
29
- import McMonthPicker from './components/month-picker'
30
- import McDropdown from './components/dropdown'
31
- import McImport from './components/import'
32
- // import McNotification from './components/notification'
33
- import McCollapse from './components/collapse'
34
- import McCollapseItem from './components/collapse-item'
35
- import McCollapseTransition from './components/collapse-transition'
36
- import McUpload from './components/upload'
37
- import McDepartmentTree from './components/department-tree'
38
- import McDepartmentPicker from './components/department-picker'
39
- import McPermissionTree from './components/permission-tree'
40
- import McLabel from './components/label'
41
- import McJobFuncPicker from './components/job-func'
42
- import McAmountRange from './components/amount-range'
43
-
44
- // 新版table控件 支持除jsx外的调用方式
45
- import {McTableV2,McTableV2Column} from './components/tableV2'
46
-
47
- export default [
48
- McLink,
49
- McBreadcrumb,
50
- McButton,
51
- McCheckbox,
52
- McCheckboxGroup,
53
- McRadio,
54
- McRadioGroup,
55
- McProgress,
56
- McInput,
57
- McSlide,
58
- McSwitch,
59
- McTab,
60
- McTextarea,
61
- McTree,
62
- McCity,
63
- McCityPicker,
64
- McAddress,
65
- McFuzzySearch,
66
- McTip,
67
- McPopup,
68
- McTable,
69
- McTableColumn,
70
- McPagination,
71
- McForm,
72
- McFormItem,
73
- McSelect,
74
- McSelectOption,
75
- McDatePicker,
76
- McMonthPicker,
77
- McDropdown,
78
- McImport,
79
- // McNotification,
80
- McCollapse,
81
- McCollapseItem,
82
- McCollapseTransition,
83
- McUpload,
84
- McDepartmentTree,
85
- McDepartmentPicker,
86
- McPermissionTree,
87
- McLabel,
88
- McJobFuncPicker,
89
-
90
- // new version table package
91
- McTableV2,
92
- McTableV2Column,
93
-
94
- McAmountRange,
95
- ]
96
- */
97
-
98
- import QTButton from './components/QTButton/index.vue'
99
- import QTContainer from './components/QTContainer/index.vue'
100
- import QTMenu from './components/QTMenu/index.vue'
101
- import QTIcons from './components/QTIcons/index.vue'
102
- import QTInput from './components/QTInput/index.vue'
103
- import QTSelect from './components/QTSelect/index.vue'
104
- import QTTable from './components/QTTable/index.vue'
105
- import QTSwitch from './components/QTSwitch/index.vue'
106
- import QTPagination from './components/QTPagination/index.vue'
107
- import QTDatePicker from './components/QTDatePicker/index.vue'
108
- import QTTree from './components/QTTree/index.vue'
109
- import QTDialog from './components/QTDialog/index.vue'
110
- import QTForm from './components/QTForm/index.vue'
111
- import QTFormItem from './components/QTFormItem/index.vue'
1
+ import CommonButton from './components/Button/index.vue'
2
+ import Container from './components/Container/index.vue'
3
+ import Menu from './components/Menu/index.vue'
4
+ import Icons from './components/Icons/index.vue'
5
+ import Input from './components/Input/index.vue'
6
+ import Select from './components/Select/index.vue'
7
+ import Table from './components/Table/index.vue'
8
+ import Switch from './components/Switch/index.vue'
9
+ import Pagination from './components/Pagination/index.vue'
10
+ import DatePicker from './components/DatePicker/index.vue'
11
+ import Tree from './components/Tree/index.vue'
12
+ import Dialog from './components/Dialog/index.vue'
13
+ import Form from './components/Form/index.vue'
14
+ import FormItem from './components/FormItem/index.vue'
15
+ import Empty from './components/Empty/index.vue'
112
16
 
113
17
  const components =
114
18
  [
115
- QTButton,
116
- QTContainer,
117
- QTMenu,
118
- QTIcons,
119
- QTInput,
120
- QTSelect,
121
- QTTable,
122
- QTSwitch,
123
- QTPagination,
124
- QTDatePicker,
125
- QTTree,
126
- QTDialog,
127
- QTForm,
128
- QTFormItem
19
+ CommonButton,
20
+ Container,
21
+ Menu,
22
+ Icons,
23
+ Input,
24
+ Select,
25
+ Table,
26
+ Switch,
27
+ Pagination,
28
+ DatePicker,
29
+ Tree,
30
+ Dialog,
31
+ Form,
32
+ FormItem,
33
+ Empty
129
34
  ]
130
35
  export default components
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div :class="[type === 'default' ? 'defaultClass' : 'normalClass']">
3
- <el-button :type="type" :color="color" :link="link">
2
+ <div class="normalClass">
3
+ <el-button :type="type" :color="color" :link="link" :loading="loading">
4
4
  <slot>按钮</slot>
5
5
  </el-button>
6
6
  </div>
@@ -11,35 +11,32 @@ import { ElButton} from 'element-plus'
11
11
  import '../../style/root.css'
12
12
 
13
13
  defineOptions({
14
- name: 'QTButton',
14
+ name: 'CommonButton',
15
15
  })
16
- const props = defineProps({
16
+ defineProps({
17
17
  type:{
18
18
  type: String,
19
19
  default: 'default', //可选数值有, primary/default
20
20
  },
21
21
  color: {
22
22
  type: String,
23
- default: '#4d4398'
23
+ default: ''
24
24
  },
25
25
  link: {
26
26
  type: Boolean,
27
27
  default: false
28
+ },
29
+ loading: {
30
+ type: Boolean,
31
+ default: false
28
32
  }
29
33
  })
30
34
  //根据不同的类型,自定义按钮颜色
31
- const color = props.type === 'primary' ? props.color : ''
35
+ // const color = props.type === 'primary' ? props.color : ''
32
36
  </script>
33
37
 
34
38
  <style lang="less" scoped>
35
39
  .normalClass{
36
40
  margin: 0 10px;
37
41
  }
38
- .defaultClass{
39
- margin: 0 10px;
40
- :deep(.el-button){
41
- color: var(--qt-main-color)!important;
42
- border-color: var(--qt-main-color)!important;
43
- }
44
- }
45
42
  </style>
@@ -25,7 +25,7 @@
25
25
  <script setup>
26
26
  import { ElContainer, ElHeader, ElAside, ElMain } from 'element-plus'
27
27
  defineOptions({
28
- name: 'QTContainer'
28
+ name: 'Container'
29
29
  })
30
30
  </script>
31
31
 
@@ -38,6 +38,7 @@ defineOptions({
38
38
  .el-header{
39
39
  display: flex;
40
40
  align-items: center;
41
+ justify-content: space-between;
41
42
  height: 60px;
42
43
  }
43
44
  .el-aside, .el-main{
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-config-provider :locale="zhCn">
3
- <el-date-picker v-model="modelValue" type="date" :placeholder="placeholder" :format="format" :value-format="format"/>
3
+ <el-date-picker style="width: 100%;" v-model="modelValue" type="date" :placeholder="placeholder" :format="format" :value-format="format"/>
4
4
  </el-config-provider>
5
5
  </template>
6
6
 
@@ -9,7 +9,7 @@ import { ElDatePicker, ElConfigProvider } from 'element-plus'
9
9
  import zhCn from 'element-plus/es/locale/lang/zh-cn'
10
10
 
11
11
  defineOptions({
12
- name: 'QTDatePicker',
12
+ name: 'DatePicker',
13
13
  })
14
14
 
15
15
  const props = defineProps({
@@ -23,7 +23,8 @@ const props = defineProps({
23
23
  },
24
24
  })
25
25
 
26
- const modelValue = defineModel('modelValue', { type: Boolean })
26
+ const modelValue = defineModel('modelValue', { type: String })
27
27
  </script>
28
28
 
29
- <style lang="less" scoped></style>
29
+ <style lang="less" scoped>
30
+ </style>
@@ -18,7 +18,7 @@
18
18
  import { ElDialog, ElButton } from 'element-plus'
19
19
 
20
20
  defineOptions({
21
- name: 'QTDialog',
21
+ name: 'Dialog',
22
22
  })
23
23
 
24
24
  defineProps({
@@ -38,14 +38,14 @@ defineProps({
38
38
  })
39
39
 
40
40
  let modelValue = defineModel('modelValue', {type: Boolean})
41
-
41
+ let emits = defineEmits(['confirm'])
42
42
  // 点击取消
43
43
  const handleCancel = () => {
44
44
  modelValue.value = false
45
45
  }
46
46
  // 点击确认
47
47
  const handleConfirm = () => {
48
- modelValue.value = false
48
+ emits('confirm')
49
49
  }
50
50
  </script>
51
51
 
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <el-empty :description="description" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { ElEmpty} from 'element-plus'
7
+
8
+ defineOptions({
9
+ name: 'Empty',
10
+ })
11
+ defineProps({
12
+ description:{
13
+ type: String,
14
+ default: '敬请期待',
15
+ }
16
+ })
17
+ </script>
18
+
19
+ <style lang="less" scoped>
20
+ </style>
@@ -13,16 +13,17 @@
13
13
  </template>
14
14
 
15
15
  <script setup>
16
+ import { ref } from 'vue'
16
17
  import { ElForm } from 'element-plus'
17
18
 
18
19
  defineOptions({
19
- name: 'QTForm',
20
+ name: 'Form',
20
21
  })
21
22
 
22
23
  defineProps({
23
24
  rules: {
24
- type: Array,
25
- default: () => ([])
25
+ type: Object,
26
+ default: () => ({})
26
27
  },
27
28
  inline: {
28
29
  type: Boolean,
@@ -31,6 +32,17 @@ defineProps({
31
32
  })
32
33
 
33
34
  let formData = defineModel('formData', {type: Object})
35
+ let ruleFormRef = ref(null)
36
+
37
+ const resetForm = () => {
38
+ if (!ruleFormRef.value) return
39
+ ruleFormRef.value.resetFields()
40
+ }
41
+
42
+ defineExpose({
43
+ resetForm,
44
+ ruleFormRef
45
+ })
34
46
 
35
47
  </script>
36
48
 
@@ -8,7 +8,7 @@
8
8
  import { ElFormItem } from 'element-plus'
9
9
 
10
10
  defineOptions({
11
- name: 'QTFormItem',
11
+ name: 'FormItem',
12
12
  })
13
13
 
14
14
  defineProps({
@@ -10,7 +10,7 @@ import { computed } from 'vue'
10
10
  import * as Icons from '@element-plus/icons-vue';
11
11
 
12
12
  defineOptions({
13
- name: 'QTIcons'
13
+ name: 'Icons'
14
14
  })
15
15
  const props = defineProps({
16
16
  type: {
@@ -1,5 +1,14 @@
1
1
  <template>
2
- <ElInput :type="type" :placeholder="placeholder" v-model="inputValue" v-bind="$attrs"/>
2
+ <ElInput :type="type" :placeholder="placeholder" v-model="inputValue" v-bind="$attrs">
3
+ <template #prepend v-if="$slots.prepend">
4
+ <!-- 前缀 -->
5
+ <slot name="prepend" />
6
+ </template>
7
+ <template #append v-if="$slots.append">
8
+ <!-- 后缀 -->
9
+ <slot name="append" />
10
+ </template>
11
+ </ElInput>
3
12
  </template>
4
13
 
5
14
  <script setup>
@@ -7,7 +16,7 @@ import {ElInput} from 'element-plus'
7
16
  import '../../style/root.css'
8
17
 
9
18
  defineOptions({
10
- name: 'QTInput'
19
+ name: 'Input'
11
20
  })
12
21
  defineProps({
13
22
  type: {
@@ -24,6 +33,6 @@ const inputValue = defineModel('modelValue', {default: '',type: [String, Number]
24
33
 
25
34
  <style lang="less" scoped>
26
35
  :deep(.el-textarea__inner:focus), :deep(.el-input__wrapper.is-focus){
27
- box-shadow: 0 0 0 1px var(--qt-main-color) inset;
36
+ box-shadow: 0 0 0 1px var(--main-color) inset;
28
37
  }
29
38
  </style>
@@ -3,15 +3,15 @@
3
3
  <el-menu class="el-menu-vertical-demo" router :collapse="isCollapse" :default-active="activeMenu"
4
4
  @open="handleOpen" @close="handleClose">
5
5
  <el-menu-item :index="menu.path" v-for="(menu, index) in menus" :key="index">
6
- <QTIcons :type="menu.icon"></QTIcons>
6
+ <Icons :type="menu.icon"></Icons>
7
7
  <template #title>
8
8
  <span>{{ menu.name }}</span>
9
9
  </template>
10
10
  </el-menu-item>
11
11
  </el-menu>
12
12
  <div class="menu_btn">
13
- <QTIcons v-if="isCollapse" @click="isCollapse = false" :type="'DArrowRight'"></QTIcons>
14
- <QTIcons v-else @click="isCollapse = true" :type="'DArrowLeft'"></QTIcons>
13
+ <Icons v-if="isCollapse" @click="isCollapse = false" :type="'DArrowRight'"></Icons>
14
+ <Icons v-else @click="isCollapse = true" :type="'DArrowLeft'"></Icons>
15
15
  </div>
16
16
  </div>
17
17
  </template>
@@ -19,10 +19,10 @@
19
19
  <script setup>
20
20
  import { ref } from 'vue'
21
21
  import { ElMenu, ElMenuItem } from 'element-plus'
22
- import QTIcons from '../QTIcons/index.vue'
22
+ import Icons from '../Icons/index.vue'
23
23
 
24
24
  defineOptions({
25
- name: 'QTMenu'
25
+ name: 'Menu'
26
26
  })
27
27
  defineProps({
28
28
  menus: {
@@ -59,8 +59,8 @@ const handleClose = (key, keyPath) => {
59
59
  }
60
60
 
61
61
  .is-active {
62
- color: var(--qt-main-color);
63
- background-color: var(--qt-background-color);
62
+ color: var(--main-color);
63
+ background-color: var(--main-background-color);
64
64
  }
65
65
  }
66
66
 
@@ -1,9 +1,9 @@
1
1
  /**
2
- * QTMessage 消息提示包含四种类型: error(错误), success(成功), warning(警告), info(信息)
2
+ * Message 消息提示包含四种类型: error(错误), success(成功), warning(警告), info(信息)
3
3
  */
4
4
  import { ElMessage, ElMessageBox } from 'element-plus'
5
5
 
6
- export const QTMessage = {
6
+ export const Message = {
7
7
  error: (message) => {
8
8
  ElMessage.error(message)
9
9
  },
@@ -24,4 +24,4 @@ export const QTMessage = {
24
24
  }
25
25
  }
26
26
 
27
- export const QTMessageBox = ElMessageBox
27
+ export const MessageBox = ElMessageBox
@@ -13,7 +13,7 @@ import { ElPagination, ElConfigProvider } from 'element-plus'
13
13
  import zhCn from 'element-plus/es/locale/lang/zh-cn'
14
14
 
15
15
  defineOptions({
16
- name: 'QTPagination',
16
+ name: 'Pagination',
17
17
  })
18
18
  defineProps({
19
19
  total: {
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <el-select v-model="selectValue" :placeholder="placeholder" v-bind="$attrs" :teleported="false">
2
+ <el-select
3
+ v-model="selectValue"
4
+ :placeholder="placeholder"
5
+ v-bind="$attrs"
6
+ :teleported="false"
7
+ clearable
8
+ >
3
9
  <el-option v-for="item in options" :key="item[valueName]" :label="item[keyName]" :value="item[valueName]" />
4
10
  </el-select>
5
11
  </template>
@@ -9,7 +15,7 @@ import { ElSelect, ElOption } from 'element-plus'
9
15
  import '../../style/root.css'
10
16
 
11
17
  defineOptions({
12
- name: 'QTSelect'
18
+ name: 'Select'
13
19
  })
14
20
  defineProps({
15
21
  placeholder: {
@@ -6,7 +6,7 @@
6
6
  import { ElSwitch } from 'element-plus'
7
7
 
8
8
  defineOptions({
9
- name: 'QTSwitch',
9
+ name: 'Switch',
10
10
  })
11
11
 
12
12
  const props = defineProps({
@@ -7,14 +7,15 @@
7
7
  :width="column.width"
8
8
  :fixed="column.fixed"
9
9
  :key="index"
10
+ :show-overflow-tooltip="column.width?true:false"
10
11
  >
11
12
  <template #default="scope">
12
- <div v-if="column.key!=='operations'">
13
+ <template v-if="column.key!=='operations'">
13
14
  {{ scope.row[column.key] }}
14
- </div>
15
- <div v-else>
15
+ </template>
16
+ <template v-else>
16
17
  <slot name="operations" :data="scope.row" :index="scope.$index"/>
17
- </div>
18
+ </template>
18
19
  </template>
19
20
  </el-table-column>
20
21
  <template #empty>
@@ -28,7 +29,7 @@
28
29
  <script setup>
29
30
  import { ElTable, ElTableColumn, ElEmpty } from 'element-plus'
30
31
  defineOptions({
31
- name: 'QTTable',
32
+ name: 'Table',
32
33
  })
33
34
  defineProps({
34
35
  data: {
@@ -1,14 +1,15 @@
1
1
  <template>
2
2
  <el-tree
3
3
  ref="treeRef"
4
- style="max-width: 600px"
4
+ style="max-width: 600px;padding-top: 4px;"
5
5
  :data="data"
6
6
  :props="defaultProps"
7
7
  :show-checkbox="showCheckBox"
8
8
  default-expand-all
9
9
  :node-key="nodeKey"
10
10
  :expand-on-click-node="false"
11
- @node-click="handleNodeClick"
11
+ @node-click="handleNodeClick"
12
+ @check-change="checkChange"
12
13
  />
13
14
  </template>
14
15
 
@@ -17,8 +18,10 @@ import { ref } from 'vue'
17
18
  import { ElTree } from 'element-plus'
18
19
 
19
20
  const treeRef = ref(null)
21
+ const modelValue = defineModel('modelValue', { type: Array })
22
+
20
23
  defineOptions({
21
- name: 'QTTree',
24
+ name: 'Tree',
22
25
  })
23
26
 
24
27
  defineProps({
@@ -50,6 +53,12 @@ const defaultProps = {
50
53
  const getCheckedKeys = () => {
51
54
  console.log(treeRef.value.getCheckedKeys(false))
52
55
  }
56
+
57
+ //当复选框被点击的时候触发, 用于获取所有的选中数据
58
+ const checkChange = () => {
59
+ modelValue.value = treeRef.value.getCheckedKeys(false)
60
+ }
61
+
53
62
  defineExpose({
54
63
  getCheckedKeys
55
64
  })
@@ -1,4 +1,6 @@
1
1
  import Components from './component'
2
+ import { Message, MessageBox } from './components/Message'
3
+
2
4
  const makeInstaller = (components = [], directives = []) => {
3
5
  const apps = []
4
6
  const install = (app, opts) => {
@@ -15,6 +17,6 @@ const makeInstaller = (components = [], directives = []) => {
15
17
 
16
18
  const install = makeInstaller(Components)
17
19
 
18
- export { install, install as default }
20
+ export { Message, MessageBox, install, install as default }
19
21
 
20
- console.info('%c====== Editing in local package ======', 'font-size:16px;color:green;')
22
+ console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
package/package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Components from './component'
2
- import { QTMessage, QTMessageBox } from './components/QTMessage'
2
+ import { Message, MessageBox } from './components/Message'
3
3
 
4
4
  const makeInstaller = (components = [], directives = []) => {
5
5
  const apps = []
@@ -17,6 +17,6 @@ const makeInstaller = (components = [], directives = []) => {
17
17
 
18
18
  const install = makeInstaller(Components)
19
19
 
20
- export { QTMessage, QTMessageBox, install, install as default }
20
+ export { Message, MessageBox, install, install as default }
21
21
 
22
- console.info('%c====== Editing in local package ======', 'font-size:16px;color:green;')
22
+ console.info('%c====== Editing in local package ======', 'font-size:16px;color:pink;')
@@ -1,5 +1,5 @@
1
1
  /* 标准化样式定义 */
2
2
  :root{
3
- --qt-main-color: #4d4398;
4
- --qt-background-color: #e0edff;
5
- }
3
+ --main-color: #4d4398;
4
+ --main-background-color: #e0edff
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qtsk-vue3",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "vue3版组件库",
5
5
  "main": "./package/index.js",
6
6
  "scripts": {