br-dionysus 0.7.21 → 0.8.0

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 (53) hide show
  1. package/README.md +62 -0
  2. package/dist/br-dionysus.es.js +1125 -1050
  3. package/dist/br-dionysus.umd.js +3 -3
  4. package/dist/index.css +1 -1
  5. package/dist/packages/MInline/index.d.ts +1 -1
  6. package/dist/packages/MInputNumber/index.d.ts +1 -1
  7. package/dist/packages/MSelect/index.d.ts +5 -0
  8. package/dist/packages/MSelect/src/MOption.vue.d.ts +9 -0
  9. package/dist/packages/MSelect/src/MSelect.vue.d.ts +45 -0
  10. package/dist/packages/MSelect/src/token.d.ts +7 -0
  11. package/dist/packages/MSelectTable/index.d.ts +1 -1
  12. package/dist/packages/MTable/index.d.ts +1 -1
  13. package/dist/packages/MTableColumn/index.d.ts +1 -1
  14. package/dist/packages/MTableColumnSet/index.d.ts +1 -1
  15. package/dist/packages/SkinConfig/index.d.ts +1 -1
  16. package/dist/packages/TabPage/index.d.ts +1 -1
  17. package/dist/packages/index.d.ts +1 -0
  18. package/docs/assets/index-DYbJp-wp.js +2 -2
  19. package/package.json +1 -1
  20. package/packages/Hook/useRemainingSpace/useRemainingSpace.ts +1 -1
  21. package/packages/MInline/index.ts +1 -1
  22. package/packages/MInputNumber/index.ts +1 -1
  23. package/packages/MSelect/docs/README.md +20 -0
  24. package/packages/MSelect/docs/demo.vue +36 -0
  25. package/packages/MSelect/index.ts +12 -0
  26. package/packages/MSelect/src/MOption.vue +41 -0
  27. package/packages/MSelect/src/MSelect.vue +75 -0
  28. package/packages/MSelect/src/token.ts +8 -0
  29. package/packages/MSelectTable/index.ts +1 -1
  30. package/packages/MTable/index.ts +1 -1
  31. package/packages/MTableColumn/index.ts +1 -1
  32. package/packages/MTableColumnSet/index.ts +1 -1
  33. package/packages/SkinConfig/index.ts +1 -1
  34. package/packages/TabPage/index.ts +1 -1
  35. package/packages/index.ts +3 -2
  36. package/packages/list.json +6 -0
  37. package/src/router.ts +6 -1
  38. package/dist/packages/MInline/src/{index.vue.d.ts → Minline.vue.d.ts} +0 -0
  39. package/dist/packages/MInputNumber/src/{index.vue.d.ts → MInputNumber.vue.d.ts} +0 -0
  40. package/dist/packages/MSelectTable/src/{index.vue.d.ts → MSelectTable.vue.d.ts} +1 -1
  41. /package/dist/packages/MTable/src/{index.vue.d.ts → MTable.vue.d.ts} +0 -0
  42. /package/dist/packages/MTableColumn/src/{index.vue.d.ts → MTableColumn.vue.d.ts} +0 -0
  43. /package/dist/packages/MTableColumnSet/src/{index.vue.d.ts → MTableColumnSet.vue.d.ts} +0 -0
  44. /package/dist/packages/SkinConfig/src/{index.vue.d.ts → SkinConfig.vue.d.ts} +0 -0
  45. /package/dist/packages/TabPage/src/{index.vue.d.ts → TabPage.vue.d.ts} +0 -0
  46. /package/packages/MInline/src/{index.vue → Minline.vue} +0 -0
  47. /package/packages/MInputNumber/src/{index.vue → MInputNumber.vue} +0 -0
  48. /package/packages/MSelectTable/src/{index.vue → MSelectTable.vue} +0 -0
  49. /package/packages/MTable/src/{index.vue → MTable.vue} +0 -0
  50. /package/packages/MTableColumn/src/{index.vue → MTableColumn.vue} +0 -0
  51. /package/packages/MTableColumnSet/src/{index.vue → MTableColumnSet.vue} +0 -0
  52. /package/packages/SkinConfig/src/{index.vue → SkinConfig.vue} +0 -0
  53. /package/packages/TabPage/src/{index.vue → TabPage.vue} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "br-dionysus",
3
- "version": "0.7.21",
3
+ "version": "0.8.0",
4
4
  "scripts": {
5
5
  "dev": "vite --config ./build/base.config.ts",
6
6
  "build:doc": "vue-tsc --noEmit && vite build --config ./build/doc.config.ts && node script/copyDir.js",
@@ -116,7 +116,7 @@ const useRemainingSpace = (boxClassName: string, className: string = '', redunda
116
116
  }
117
117
 
118
118
  // 节流
119
- const throttle = (func: Function, limit: number = 1000) => {
119
+ const throttle = (func: Function, limit: number = 100) => {
120
120
  let inThrottle: boolean = false
121
121
  return (...args: any) => {
122
122
  if (!inThrottle) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MInline from './src/index.vue'
2
+ import MInline from './src/Minline.vue'
3
3
 
4
4
  export const MInlinePlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MInputNumber from './src/index.vue'
2
+ import MInputNumber from './src/MInputNumber.vue'
3
3
 
4
4
  export const MInputNumberPlugin: Plugin = {
5
5
  install(app: App) {
@@ -0,0 +1,20 @@
1
+ <script setup>
2
+ import demo from './demo.vue'
3
+ </script>
4
+
5
+ 下拉选择器组件
6
+ =================
7
+
8
+ ### 1) 基础用法
9
+
10
+ <Preview comp-name="MSelect" demo-name="demo">
11
+ <demo />
12
+ </Preview>
13
+
14
+ ### 2) Attributes
15
+
16
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
17
+ |-------------------------------|:---------------------------------------------------------:|:------:|:---:|:---------:|
18
+ | value / v-model | 绑定值 | number | - | '' |
19
+ | checkbox-mode | 设置数值输入框允许的最小值 | number | - | -Infinity |
20
+ | 其他属性同element-plus的el-select组件 | https://element-plus.gitee.io/zh-CN/component/select.html | - | - | - |
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div class="g-demo-m-select-box">
3
+ <m-select
4
+ v-model="test"
5
+ checkbox-mode
6
+ multiple
7
+ >
8
+ <m-option
9
+ v-for="item in options"
10
+ :key="item.value"
11
+ :label="item.label"
12
+ :value="item.value"
13
+ ></m-option>
14
+ </m-select>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { ref } from 'vue'
20
+
21
+ const test = ref<string>('')
22
+
23
+ const options: Option[] = [{
24
+ label: '这是选项一',
25
+ value: 'a'
26
+ }, {
27
+ label: '这是选项二',
28
+ value: 'b'
29
+ }]
30
+ </script>
31
+
32
+ <style scoped>
33
+ .g-demo-m-select-box {
34
+ max-width: 1000px;
35
+ }
36
+ </style>
@@ -0,0 +1,12 @@
1
+ import { App, Plugin } from 'vue'
2
+ import MSelect from './src/MSelect.vue'
3
+ import MOption from './src/MOption.vue'
4
+
5
+ export const MSelectPlugin: Plugin = {
6
+ install(app: App) {
7
+ app.component('m-select', MSelect)
8
+ app.component('m-option', MOption)
9
+ }
10
+ }
11
+
12
+ export { MSelect, MOption }
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <el-option v-bind="attrs">
3
+ <div
4
+ class="u-group"
5
+ v-if="selectData?.checkboxMode"
6
+ >
7
+ <el-checkbox
8
+ class="u-checkbox"
9
+ v-model="checkboxValue"
10
+ />
11
+ <slot>
12
+ <span>{{ attrs.label }}</span>
13
+ </slot>
14
+ </div>
15
+ </el-option>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import { inject, useAttrs, computed } from 'vue'
20
+ import { selectKey } from 'packages/MSelect/src/token'
21
+
22
+ const attrs = useAttrs()
23
+
24
+ const selectData = inject(selectKey)
25
+ const checkboxValue = computed(() => {
26
+ if (selectData?.multiple && Array.isArray(selectData?.modelValue?.value)) return selectData?.modelValue?.value?.includes(attrs.value as string | number)
27
+ return selectData?.modelValue.value === attrs.value
28
+ })
29
+ </script>
30
+
31
+ <style scoped lang="scss">
32
+ .u-group {
33
+ display: flex;
34
+ align-items: center;
35
+
36
+ .u-checkbox {
37
+ padding-right: 4px;
38
+ pointer-events: none;
39
+ }
40
+ }
41
+ </style>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <el-select
3
+ v-bind="attrs"
4
+ :multiple="props.multiple"
5
+ >
6
+ <!--<template #header>-->
7
+ <!-- <el-checkbox-->
8
+ <!-- v-model="checkAll"-->
9
+ <!-- :indeterminate="indeterminate"-->
10
+ <!-- @change="handleCheckAll"-->
11
+ <!-- >-->
12
+ <!-- 全选-->
13
+ <!-- </el-checkbox>-->
14
+ <!--</template>-->
15
+ <slot></slot>
16
+ <template v-for="(slot, name) in $slots" v-slot:[name]="slotData">
17
+ <slot :name="name" v-bind="slotData"></slot>
18
+ </template>
19
+ </el-select>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import { provide, useAttrs, ref, watch } from 'vue'
24
+ import { selectKey } from 'packages/MSelect/src/token'
25
+
26
+ const props = withDefaults(defineProps<{
27
+ /** 是否为checkbox模式 */
28
+ checkboxMode?: boolean,
29
+ /** 多选 */
30
+ multiple?: boolean
31
+ // /** 是否显示全选 */
32
+ // showAll?: boolean
33
+ }>(), {
34
+ checkboxMode: false,
35
+ multiple: false
36
+ // showAll: false
37
+ })
38
+
39
+ const attrs = useAttrs()
40
+
41
+ const modelValue = ref<string | number>(attrs.modelValue as string | number)
42
+ watch(
43
+ () => attrs.modelValue,
44
+ () => {
45
+ modelValue.value = attrs.modelValue as string | number
46
+ }
47
+ )
48
+
49
+ // const emit = defineEmits<{
50
+ // 'update:modelValue': [data: any]
51
+ // }>()
52
+
53
+ // const checkAll = ref(false)
54
+ // const indeterminate = ref(false)
55
+ // const handleCheckAll = (val: boolean) => {
56
+ // indeterminate.value = false
57
+ // if (val) {
58
+ // emit('update:modelValue', [])
59
+ // } else {
60
+ // emit('update:modelValue', [])
61
+ // }
62
+ // }
63
+
64
+ provide(selectKey, {
65
+ checkboxMode: props.checkboxMode,
66
+ modelValue,
67
+ multiple: props.multiple as boolean
68
+ })
69
+ </script>
70
+
71
+ <style lang="scss" scoped>
72
+ </style>
73
+
74
+ <style lang="scss">
75
+ </style>
@@ -0,0 +1,8 @@
1
+ import { InjectionKey } from 'vue'
2
+ import type { Ref } from 'vue'
3
+
4
+ export const selectKey: InjectionKey<{
5
+ checkboxMode: boolean,
6
+ modelValue: Ref<string | number | Array<string | number>>,
7
+ multiple: boolean
8
+ }> = Symbol('selectKey')
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MSelectTable from './src/index.vue'
2
+ import MSelectTable from './src/MSelectTable.vue'
3
3
 
4
4
  export const MSelectTablePlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MTable from './src/index.vue'
2
+ import MTable from './src/MTable.vue'
3
3
 
4
4
  export const MTablePlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MTableColumn from './src/index.vue'
2
+ import MTableColumn from './src/MTableColumn.vue'
3
3
 
4
4
  export const MTableColumnPlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import MTableColumnSet from './src/index.vue'
2
+ import MTableColumnSet from './src/MTableColumnSet.vue'
3
3
 
4
4
  export const MTableColumnSetPlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue'
2
- import SkinConfig from './src/index.vue'
2
+ import SkinConfig from './src/SkinConfig.vue'
3
3
 
4
4
  export const SkinConfigPlugin: Plugin = {
5
5
  install(app: App) {
@@ -1,5 +1,5 @@
1
1
  import { App, Plugin } from 'vue';
2
- import TabPage from './src/index.vue';
2
+ import TabPage from './src/TabPage.vue';
3
3
 
4
4
  export const TabPagePlugin: Plugin = {
5
5
  install(app: App) {
package/packages/index.ts CHANGED
@@ -1,5 +1,3 @@
1
- /* eslint-disable */
2
-
3
1
  import { App, Plugin } from 'vue'
4
2
 
5
3
  import { ButtonPlugin } from './Button'
@@ -12,6 +10,7 @@ import { MSelectTablePlugin } from 'packages/MSelectTable'
12
10
  import { MTablePlugin } from 'packages/MTable'
13
11
  import { MTableColumnPlugin } from 'packages/MTableColumn'
14
12
  import { MTableColumnSetPlugin } from 'packages/MTableColumnSet'
13
+ import { MSelectPlugin } from 'packages/MSelect'
15
14
  import hook from 'packages/Hook'
16
15
  import useTableConfig from 'packages/Hook/useTableConfig/useTableConfig'
17
16
  import useRemainingSpace from 'packages/Hook/useRemainingSpace/useRemainingSpace'
@@ -28,6 +27,7 @@ const BrPlugin: Plugin = {
28
27
  MTablePlugin.install?.(app)
29
28
  MTableColumnPlugin.install?.(app)
30
29
  MTableColumnSetPlugin.install?.(app)
30
+ MSelectPlugin.install?.(app)
31
31
  }
32
32
  }
33
33
 
@@ -43,6 +43,7 @@ export * from './MSelectTable'
43
43
  export * from './MTable'
44
44
  export * from './MTableColumn'
45
45
  export * from './MTableColumnSet'
46
+ export * from './MSelect'
46
47
 
47
48
  export { hook }
48
49
  export { useTableConfig }
@@ -58,5 +58,11 @@
58
58
  "compZhName": "表格头设置组件",
59
59
  "compDesc": "这是一个表格头设置组件",
60
60
  "compClassName": "m-table-column-set"
61
+ },
62
+ {
63
+ "compName": "MSelect",
64
+ "compZhName": "下拉选择器组件",
65
+ "compDesc": "这是一个下拉选择器组件",
66
+ "compClassName": "m-select"
61
67
  }
62
68
  ]
package/src/router.ts CHANGED
@@ -46,11 +46,16 @@ const routes = [{
46
46
  name: 'MTableColumn',
47
47
  path: '/components/MTableColumn',
48
48
  component: () => import('packages/MTableColumn/docs/README.md')
49
- },{
49
+ }, {
50
50
  title: '表格头设置组件',
51
51
  name: 'MTableColumnSet',
52
52
  path: '/components/MTableColumnSet',
53
53
  component: () => import('packages/MTableColumnSet/docs/README.md')
54
+ }, {
55
+ title: '下拉选择器组件',
56
+ name: 'MSelect',
57
+ path: '/components/MSelect',
58
+ component: () => import('packages/MSelect/docs/README.md')
54
59
  }]
55
60
 
56
61
  const routerConfig = {
@@ -70,8 +70,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
70
70
  clearable: boolean;
71
71
  placeholder: string;
72
72
  disabled: boolean;
73
- total: number | null;
74
73
  options: Option[];
74
+ total: number | null;
75
75
  remoteMethod: Function;
76
76
  tableTitle: any[];
77
77
  focusShow: boolean;
File without changes
File without changes
File without changes