vue-editify 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/examples/App.vue +62 -61
  3. package/examples/main.ts +4 -4
  4. package/lib/components/button/button.vue.d.ts +11 -11
  5. package/lib/components/checkbox/checkbox.vue.d.ts +8 -8
  6. package/lib/components/colors/colors.vue.d.ts +4 -4
  7. package/lib/components/icon/icon.vue.d.ts +1 -1
  8. package/lib/components/insertImage/insertImage.vue.d.ts +9 -9
  9. package/lib/components/insertLink/insertLink.vue.d.ts +2 -2
  10. package/lib/components/insertTable/insertTable.vue.d.ts +2 -2
  11. package/lib/components/insertVideo/insertVideo.vue.d.ts +9 -9
  12. package/lib/components/layer/layer.vue.d.ts +9 -9
  13. package/lib/components/menu/menu.vue.d.ts +4 -4
  14. package/lib/components/toolbar/toolbar.vue.d.ts +9 -9
  15. package/lib/components/tooltip/tooltip.vue.d.ts +1 -1
  16. package/lib/components/triangle/triangle.vue.d.ts +4 -4
  17. package/lib/editify/editify.vue.d.ts +68 -68
  18. package/lib/editify.es.js +17 -17
  19. package/lib/editify.umd.js +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/style.css +1 -1
  22. package/package.json +45 -45
  23. package/src/components/button/button.less +145 -145
  24. package/src/components/button/button.vue +197 -197
  25. package/src/components/button/props.ts +95 -95
  26. package/src/components/checkbox/checkbox.less +84 -84
  27. package/src/components/checkbox/checkbox.vue +68 -68
  28. package/src/components/checkbox/props.ts +49 -49
  29. package/src/components/colors/colors.less +75 -75
  30. package/src/components/colors/colors.vue +36 -36
  31. package/src/components/colors/props.ts +29 -29
  32. package/src/components/icon/icon.less +14 -14
  33. package/src/components/icon/icon.vue +12 -12
  34. package/src/components/icon/props.ts +11 -11
  35. package/src/components/insertImage/insertImage.less +135 -135
  36. package/src/components/insertImage/insertImage.vue +146 -146
  37. package/src/components/insertImage/props.ts +43 -43
  38. package/src/components/insertLink/insertLink.less +64 -64
  39. package/src/components/insertLink/insertLink.vue +58 -58
  40. package/src/components/insertLink/props.ts +16 -16
  41. package/src/components/insertTable/insertTable.less +54 -54
  42. package/src/components/insertTable/insertTable.vue +85 -85
  43. package/src/components/insertTable/props.ts +27 -27
  44. package/src/components/insertVideo/insertVideo.less +135 -135
  45. package/src/components/insertVideo/insertVideo.vue +146 -146
  46. package/src/components/insertVideo/props.ts +43 -43
  47. package/src/components/layer/layer.less +49 -49
  48. package/src/components/layer/layer.vue +598 -598
  49. package/src/components/layer/props.ts +71 -71
  50. package/src/components/menu/menu.less +63 -63
  51. package/src/components/menu/menu.vue +1569 -1569
  52. package/src/components/menu/props.ts +17 -17
  53. package/src/components/toolbar/props.ts +35 -35
  54. package/src/components/toolbar/toolbar.less +89 -89
  55. package/src/components/toolbar/toolbar.vue +1101 -1101
  56. package/src/components/tooltip/props.ts +21 -21
  57. package/src/components/tooltip/tooltip.less +23 -23
  58. package/src/components/tooltip/tooltip.vue +37 -37
  59. package/src/components/triangle/props.ts +26 -26
  60. package/src/components/triangle/triangle.less +79 -79
  61. package/src/components/triangle/triangle.vue +65 -65
  62. package/src/core/function.ts +1144 -1144
  63. package/src/core/rule.ts +259 -259
  64. package/src/core/tool.ts +1137 -1137
  65. package/src/css/base.less +30 -30
  66. package/src/css/hljs.less +54 -54
  67. package/src/editify/editify.less +404 -403
  68. package/src/editify/editify.vue +803 -803
  69. package/src/editify/props.ts +156 -156
  70. package/src/hljs/index.ts +197 -197
  71. package/src/icon/iconfont.css +219 -219
  72. package/src/index.ts +32 -32
  73. package/src/locale/en_US.ts +88 -88
  74. package/src/locale/index.ts +12 -12
  75. package/src/locale/zh_CN.ts +88 -88
  76. package/tsconfig.json +27 -27
  77. package/tsconfig.node.json +11 -11
  78. package/vite-env.d.ts +1 -1
  79. package/vite.config.ts +42 -42
@@ -1,197 +1,197 @@
1
- <template>
2
- <div class="editify-button">
3
- <div class="editify-button-wrap" :class="{ 'right-border': rightBorder, 'left-border': leftBorder }">
4
- <Tooltip :content="title" :disabled="!tooltip">
5
- <div ref="btnRef" :style="btnStyle" class="editify-button-el" :class="{ disabled: disabled, active: active }" @mouseenter="status = 'hover'" @mouseleave="status = null" @mousedown="status = 'down'" @mouseup="status = 'hover'" @click="handleClick">
6
- <div v-if="type == 'default' || type == 'select'" class="editify-button-slot">
7
- <slot></slot>
8
- </div>
9
- <div v-else-if="type == 'display'">{{ displayLabel }}</div>
10
- <Icon v-if="type == 'select' || type == 'display'" value="caret-down" class="editify-button-caret" :class="{ rotate: show }"></Icon>
11
- </div>
12
- </Tooltip>
13
- <Layer ref="layerRef" v-model="show" :node="btnRef" border fade placement="bottom-start" :z-index="12" animation="translate" @show="emits('layerShow')" @shown="emits('layerShown')" @hidden="emits('layerHidden')">
14
- <div class="editify-button-layer" :style="{ width: (type == 'select' ? parseSelectConfig.width : parseDisplayConfig.width) + 'px', maxHeight: (type == 'select' ? parseSelectConfig.maxHeight : parseDisplayConfig.maxHeight) + 'px', overflow: hideScroll ? 'visible' : '' }">
15
- <slot v-if="$slots.layer" name="layer" :options="cmpOptions"></slot>
16
- <div v-else class="editify-button-options">
17
- <div @click="select(item)" class="editify-button-option" :class="{ active: type == 'display' ? item.value == parseDisplayConfig.value : false }" :style="item.style || ''" v-for="item in cmpOptions">
18
- <slot v-if="$slots.option" name="option" :item="item"></slot>
19
- <div class="editify-button-option-flex" v-else>
20
- <Icon v-if="item.icon" :value="item.icon"></Icon>
21
- <span>{{ item.label }}</span>
22
- </div>
23
- </div>
24
- </div>
25
- </div>
26
- </Layer>
27
- </div>
28
- </div>
29
- </template>
30
- <script setup lang="ts">
31
- import Tooltip from '../tooltip/tooltip.vue'
32
- import Layer from '../layer/layer.vue'
33
- import Icon from '../icon/icon.vue'
34
- import { common as DapCommon, color as DapColor } from 'dap-util'
35
- import { ButtonDisplayConfigType, ButtonOptionsItemType, ButtonProps, ButtonSelectConfigType } from './props'
36
- import { computed, ref } from 'vue'
37
- import { ObjectType } from '../../core/tool'
38
-
39
- defineOptions({
40
- name: 'Button'
41
- })
42
- const props = defineProps(ButtonProps)
43
- const emits = defineEmits(['operate', 'layerShow', 'layerShown', 'layerHidden'])
44
-
45
- //是否显示浮层
46
- const show = ref<boolean>(false)
47
- //按钮状态,hover表示悬浮,down表示按下
48
- const status = ref<'hover' | 'down' | null>(null)
49
- const btnRef = ref<HTMLElement | null>(null)
50
- const layerRef = ref<InstanceType<typeof Layer> | null>(null)
51
-
52
- //处理后的select配置
53
- const parseSelectConfig = computed<ButtonSelectConfigType>(() => {
54
- let options: ButtonOptionsItemType[] = []
55
- let width: number | '' = ''
56
- let maxHeight: number | '' = ''
57
- if (DapCommon.isObject(props.selectConfig)) {
58
- if (Array.isArray(props.selectConfig.options)) {
59
- options = props.selectConfig.options.map(item => {
60
- if (DapCommon.isObject(item)) {
61
- return {
62
- label: (<ButtonOptionsItemType>item).label,
63
- value: (<ButtonOptionsItemType>item).value,
64
- icon: (<ButtonOptionsItemType>item).icon,
65
- style: (<ButtonOptionsItemType>item).style
66
- }
67
- }
68
- return {
69
- label: <string | number>item,
70
- value: <string | number>item
71
- }
72
- })
73
- }
74
- if (typeof props.selectConfig.width == 'number') {
75
- width = props.selectConfig.width
76
- }
77
- if (typeof props.selectConfig.maxHeight == 'number') {
78
- maxHeight = props.selectConfig.maxHeight
79
- }
80
- }
81
- return {
82
- options,
83
- width,
84
- maxHeight
85
- }
86
- })
87
- //处理后的display配置
88
- const parseDisplayConfig = computed<ButtonDisplayConfigType>(() => {
89
- let options: ButtonOptionsItemType[] = []
90
- let width: number | '' = ''
91
- let maxHeight: number | '' = ''
92
- let value: string | number = ''
93
- if (DapCommon.isObject(props.displayConfig)) {
94
- if (typeof props.displayConfig.value == 'string' || typeof props.displayConfig.value == 'number') {
95
- value = props.displayConfig.value
96
- }
97
- if (Array.isArray(props.displayConfig.options)) {
98
- options = props.displayConfig.options.map(item => {
99
- if (DapCommon.isObject(item)) {
100
- return {
101
- label: (<ButtonOptionsItemType>item).label,
102
- value: (<ButtonOptionsItemType>item).value,
103
- icon: (<ButtonOptionsItemType>item).icon,
104
- style: (<ButtonOptionsItemType>item).style
105
- }
106
- }
107
- return {
108
- label: <string | number>item,
109
- value: <string | number>item
110
- }
111
- })
112
- let optItem = options.find(item => {
113
- return item.value == value
114
- })
115
- if (!optItem && options[0]) {
116
- value = options[0].value!
117
- }
118
- }
119
- if (typeof props.displayConfig.width == 'number') {
120
- width = props.displayConfig.width
121
- }
122
- if (typeof props.displayConfig.maxHeight == 'number') {
123
- maxHeight = props.displayConfig.maxHeight
124
- }
125
- }
126
- return {
127
- options,
128
- width,
129
- maxHeight,
130
- value
131
- }
132
- })
133
- //渲染的浮层列表数据
134
- const cmpOptions = computed<ButtonOptionsItemType[]>(() => {
135
- return props.type == 'select' ? <ButtonOptionsItemType[]>parseSelectConfig.value.options : <ButtonOptionsItemType[]>parseDisplayConfig.value.options
136
- })
137
- //显示在页面的value值对应的label
138
- const displayLabel = computed<string | number>(() => {
139
- const val = (<ButtonOptionsItemType[]>parseDisplayConfig.value.options).find(item => {
140
- return item.value == parseDisplayConfig.value.value
141
- })
142
- return val ? val.label! : ''
143
- })
144
- //十六进制颜色转换的rgb颜色数组
145
- const parseColor = computed<number[]>(() => {
146
- return DapColor.hex2rgb(props.color)
147
- })
148
- //按钮样式
149
- const btnStyle = computed<ObjectType>(() => {
150
- if (props.disabled) {
151
- return {}
152
- }
153
- if (props.color) {
154
- //激活情况下和鼠标按下状态
155
- if (props.active || status.value == 'down') {
156
- return {
157
- color: props.color,
158
- backgroundColor: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.15)`
159
- }
160
- }
161
- //鼠标悬浮状态
162
- if (status.value == 'hover') {
163
- return {
164
- color: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.9)`,
165
- backgroundColor: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.05)`
166
- }
167
- }
168
- }
169
- return {}
170
- })
171
-
172
- //列表选择
173
- const select = (item: ButtonOptionsItemType) => {
174
- if (props.disabled) {
175
- return
176
- }
177
- emits('operate', props.name, item.value)
178
- show.value = false
179
- }
180
- //按钮点击处理
181
- const handleClick = () => {
182
- if (props.disabled) {
183
- return
184
- }
185
- if (props.type == 'default') {
186
- emits('operate', props.name)
187
- } else {
188
- show.value = !show.value
189
- }
190
- }
191
-
192
- defineExpose({
193
- show,
194
- status
195
- })
196
- </script>
197
- <style scoped src="./button.less"></style>
1
+ <template>
2
+ <div class="editify-button">
3
+ <div class="editify-button-wrap" :class="{ 'right-border': rightBorder, 'left-border': leftBorder }">
4
+ <Tooltip :content="title" :disabled="!tooltip">
5
+ <div ref="btnRef" :style="btnStyle" class="editify-button-el" :class="{ disabled: disabled, active: active }" @mouseenter="status = 'hover'" @mouseleave="status = null" @mousedown="status = 'down'" @mouseup="status = 'hover'" @click="handleClick">
6
+ <div v-if="type == 'default' || type == 'select'" class="editify-button-slot">
7
+ <slot></slot>
8
+ </div>
9
+ <div v-else-if="type == 'display'">{{ displayLabel }}</div>
10
+ <Icon v-if="type == 'select' || type == 'display'" value="caret-down" class="editify-button-caret" :class="{ rotate: show }"></Icon>
11
+ </div>
12
+ </Tooltip>
13
+ <Layer ref="layerRef" v-model="show" :node="btnRef" border fade placement="bottom-start" :z-index="12" animation="translate" @show="emits('layerShow')" @shown="emits('layerShown')" @hidden="emits('layerHidden')">
14
+ <div class="editify-button-layer" :style="{ width: (type == 'select' ? parseSelectConfig.width : parseDisplayConfig.width) + 'px', maxHeight: (type == 'select' ? parseSelectConfig.maxHeight : parseDisplayConfig.maxHeight) + 'px', overflow: hideScroll ? 'visible' : '' }">
15
+ <slot v-if="$slots.layer" name="layer" :options="cmpOptions"></slot>
16
+ <div v-else class="editify-button-options">
17
+ <div @click="select(item)" class="editify-button-option" :class="{ active: type == 'display' ? item.value == parseDisplayConfig.value : false }" :style="item.style || ''" v-for="item in cmpOptions">
18
+ <slot v-if="$slots.option" name="option" :item="item"></slot>
19
+ <div class="editify-button-option-flex" v-else>
20
+ <Icon v-if="item.icon" :value="item.icon"></Icon>
21
+ <span>{{ item.label }}</span>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </Layer>
27
+ </div>
28
+ </div>
29
+ </template>
30
+ <script setup lang="ts">
31
+ import Tooltip from '../tooltip/tooltip.vue'
32
+ import Layer from '../layer/layer.vue'
33
+ import Icon from '../icon/icon.vue'
34
+ import { common as DapCommon, color as DapColor } from 'dap-util'
35
+ import { ButtonDisplayConfigType, ButtonOptionsItemType, ButtonProps, ButtonSelectConfigType } from './props'
36
+ import { computed, ref } from 'vue'
37
+ import { ObjectType } from '../../core/tool'
38
+
39
+ defineOptions({
40
+ name: 'Button'
41
+ })
42
+ const props = defineProps(ButtonProps)
43
+ const emits = defineEmits(['operate', 'layerShow', 'layerShown', 'layerHidden'])
44
+
45
+ //是否显示浮层
46
+ const show = ref<boolean>(false)
47
+ //按钮状态,hover表示悬浮,down表示按下
48
+ const status = ref<'hover' | 'down' | null>(null)
49
+ const btnRef = ref<HTMLElement | null>(null)
50
+ const layerRef = ref<InstanceType<typeof Layer> | null>(null)
51
+
52
+ //处理后的select配置
53
+ const parseSelectConfig = computed<ButtonSelectConfigType>(() => {
54
+ let options: ButtonOptionsItemType[] = []
55
+ let width: number | '' = ''
56
+ let maxHeight: number | '' = ''
57
+ if (DapCommon.isObject(props.selectConfig)) {
58
+ if (Array.isArray(props.selectConfig.options)) {
59
+ options = props.selectConfig.options.map(item => {
60
+ if (DapCommon.isObject(item)) {
61
+ return {
62
+ label: (<ButtonOptionsItemType>item).label,
63
+ value: (<ButtonOptionsItemType>item).value,
64
+ icon: (<ButtonOptionsItemType>item).icon,
65
+ style: (<ButtonOptionsItemType>item).style
66
+ }
67
+ }
68
+ return {
69
+ label: <string | number>item,
70
+ value: <string | number>item
71
+ }
72
+ })
73
+ }
74
+ if (typeof props.selectConfig.width == 'number') {
75
+ width = props.selectConfig.width
76
+ }
77
+ if (typeof props.selectConfig.maxHeight == 'number') {
78
+ maxHeight = props.selectConfig.maxHeight
79
+ }
80
+ }
81
+ return {
82
+ options,
83
+ width,
84
+ maxHeight
85
+ }
86
+ })
87
+ //处理后的display配置
88
+ const parseDisplayConfig = computed<ButtonDisplayConfigType>(() => {
89
+ let options: ButtonOptionsItemType[] = []
90
+ let width: number | '' = ''
91
+ let maxHeight: number | '' = ''
92
+ let value: string | number = ''
93
+ if (DapCommon.isObject(props.displayConfig)) {
94
+ if (typeof props.displayConfig.value == 'string' || typeof props.displayConfig.value == 'number') {
95
+ value = props.displayConfig.value
96
+ }
97
+ if (Array.isArray(props.displayConfig.options)) {
98
+ options = props.displayConfig.options.map(item => {
99
+ if (DapCommon.isObject(item)) {
100
+ return {
101
+ label: (<ButtonOptionsItemType>item).label,
102
+ value: (<ButtonOptionsItemType>item).value,
103
+ icon: (<ButtonOptionsItemType>item).icon,
104
+ style: (<ButtonOptionsItemType>item).style
105
+ }
106
+ }
107
+ return {
108
+ label: <string | number>item,
109
+ value: <string | number>item
110
+ }
111
+ })
112
+ let optItem = options.find(item => {
113
+ return item.value == value
114
+ })
115
+ if (!optItem && options[0]) {
116
+ value = options[0].value!
117
+ }
118
+ }
119
+ if (typeof props.displayConfig.width == 'number') {
120
+ width = props.displayConfig.width
121
+ }
122
+ if (typeof props.displayConfig.maxHeight == 'number') {
123
+ maxHeight = props.displayConfig.maxHeight
124
+ }
125
+ }
126
+ return {
127
+ options,
128
+ width,
129
+ maxHeight,
130
+ value
131
+ }
132
+ })
133
+ //渲染的浮层列表数据
134
+ const cmpOptions = computed<ButtonOptionsItemType[]>(() => {
135
+ return props.type == 'select' ? <ButtonOptionsItemType[]>parseSelectConfig.value.options : <ButtonOptionsItemType[]>parseDisplayConfig.value.options
136
+ })
137
+ //显示在页面的value值对应的label
138
+ const displayLabel = computed<string | number>(() => {
139
+ const val = (<ButtonOptionsItemType[]>parseDisplayConfig.value.options).find(item => {
140
+ return item.value == parseDisplayConfig.value.value
141
+ })
142
+ return val ? val.label! : ''
143
+ })
144
+ //十六进制颜色转换的rgb颜色数组
145
+ const parseColor = computed<number[]>(() => {
146
+ return DapColor.hex2rgb(props.color)
147
+ })
148
+ //按钮样式
149
+ const btnStyle = computed<ObjectType>(() => {
150
+ if (props.disabled) {
151
+ return {}
152
+ }
153
+ if (props.color) {
154
+ //激活情况下和鼠标按下状态
155
+ if (props.active || status.value == 'down') {
156
+ return {
157
+ color: props.color,
158
+ backgroundColor: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.15)`
159
+ }
160
+ }
161
+ //鼠标悬浮状态
162
+ if (status.value == 'hover') {
163
+ return {
164
+ color: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.9)`,
165
+ backgroundColor: `rgba(${parseColor.value[0]},${parseColor.value[1]},${parseColor.value[2]},0.05)`
166
+ }
167
+ }
168
+ }
169
+ return {}
170
+ })
171
+
172
+ //列表选择
173
+ const select = (item: ButtonOptionsItemType) => {
174
+ if (props.disabled) {
175
+ return
176
+ }
177
+ emits('operate', props.name, item.value)
178
+ show.value = false
179
+ }
180
+ //按钮点击处理
181
+ const handleClick = () => {
182
+ if (props.disabled) {
183
+ return
184
+ }
185
+ if (props.type == 'default') {
186
+ emits('operate', props.name)
187
+ } else {
188
+ show.value = !show.value
189
+ }
190
+ }
191
+
192
+ defineExpose({
193
+ show,
194
+ status
195
+ })
196
+ </script>
197
+ <style scoped src="./button.less"></style>
@@ -1,95 +1,95 @@
1
- import { ExtractPublicPropTypes, PropType } from 'vue'
2
- import { ObjectType } from '../../core/tool'
3
-
4
- export type ButtonTypeType = 'default' | 'select' | 'display'
5
-
6
- export type ButtonOptionsItemType = {
7
- label?: string | number
8
- value?: string | number
9
- icon?: string
10
- style?: ObjectType
11
- }
12
-
13
- export type ButtonSelectConfigType = {
14
- options?: (ButtonOptionsItemType | number | string)[]
15
- width?: number | ''
16
- maxHeight?: number | ''
17
- }
18
-
19
- export type ButtonDisplayConfigType = {
20
- options?: (ButtonOptionsItemType | number | string)[]
21
- width?: number | ''
22
- maxHeight?: number | ''
23
- value?: string | number
24
- }
25
-
26
- export const ButtonProps = {
27
- //按钮类型
28
- type: {
29
- type: String as PropType<ButtonTypeType>,
30
- default: 'default',
31
- validator(value: any) {
32
- //default表示默认的点击按钮
33
- //select表示下拉列表的按钮
34
- //display表示显示值的下拉列表按钮
35
- return ['default', 'select', 'display'].includes(value)
36
- }
37
- },
38
- //按钮名称,唯一值
39
- name: {
40
- type: String,
41
- default: ''
42
- },
43
- //按钮提示内容
44
- title: {
45
- type: String,
46
- default: ''
47
- },
48
- //是否显示工具提示
49
- tooltip: {
50
- type: Boolean,
51
- default: false
52
- },
53
- //是否显示右侧边框
54
- rightBorder: {
55
- type: Boolean,
56
- default: false
57
- },
58
- //是否显示左侧边框
59
- leftBorder: {
60
- type: Boolean,
61
- default: false
62
- },
63
- //主题色,用于按钮悬浮颜色变化使用,仅支持十六进制
64
- color: {
65
- type: String,
66
- default: ''
67
- },
68
- //是否禁用
69
- disabled: {
70
- type: Boolean,
71
- default: false
72
- },
73
- //是否激活
74
- active: {
75
- type: Boolean,
76
- default: false
77
- },
78
- //type=select时的配置
79
- selectConfig: {
80
- type: Object as PropType<ButtonSelectConfigType>,
81
- default: null
82
- },
83
- //type=display时的配置
84
- displayConfig: {
85
- type: Object as PropType<ButtonDisplayConfigType>,
86
- default: null
87
- },
88
- //浮层隐藏滚动条
89
- hideScroll: {
90
- type: Boolean,
91
- default: false
92
- }
93
- }
94
-
95
- export type ButtonPropsType = ExtractPublicPropTypes<typeof ButtonProps>
1
+ import { ExtractPublicPropTypes, PropType } from 'vue'
2
+ import { ObjectType } from '../../core/tool'
3
+
4
+ export type ButtonTypeType = 'default' | 'select' | 'display'
5
+
6
+ export type ButtonOptionsItemType = {
7
+ label?: string | number
8
+ value?: string | number
9
+ icon?: string
10
+ style?: ObjectType
11
+ }
12
+
13
+ export type ButtonSelectConfigType = {
14
+ options?: (ButtonOptionsItemType | number | string)[]
15
+ width?: number | ''
16
+ maxHeight?: number | ''
17
+ }
18
+
19
+ export type ButtonDisplayConfigType = {
20
+ options?: (ButtonOptionsItemType | number | string)[]
21
+ width?: number | ''
22
+ maxHeight?: number | ''
23
+ value?: string | number
24
+ }
25
+
26
+ export const ButtonProps = {
27
+ //按钮类型
28
+ type: {
29
+ type: String as PropType<ButtonTypeType>,
30
+ default: 'default',
31
+ validator(value: any) {
32
+ //default表示默认的点击按钮
33
+ //select表示下拉列表的按钮
34
+ //display表示显示值的下拉列表按钮
35
+ return ['default', 'select', 'display'].includes(value)
36
+ }
37
+ },
38
+ //按钮名称,唯一值
39
+ name: {
40
+ type: String,
41
+ default: ''
42
+ },
43
+ //按钮提示内容
44
+ title: {
45
+ type: String,
46
+ default: ''
47
+ },
48
+ //是否显示工具提示
49
+ tooltip: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ //是否显示右侧边框
54
+ rightBorder: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ //是否显示左侧边框
59
+ leftBorder: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ //主题色,用于按钮悬浮颜色变化使用,仅支持十六进制
64
+ color: {
65
+ type: String,
66
+ default: ''
67
+ },
68
+ //是否禁用
69
+ disabled: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+ //是否激活
74
+ active: {
75
+ type: Boolean,
76
+ default: false
77
+ },
78
+ //type=select时的配置
79
+ selectConfig: {
80
+ type: Object as PropType<ButtonSelectConfigType>,
81
+ default: null
82
+ },
83
+ //type=display时的配置
84
+ displayConfig: {
85
+ type: Object as PropType<ButtonDisplayConfigType>,
86
+ default: null
87
+ },
88
+ //浮层隐藏滚动条
89
+ hideScroll: {
90
+ type: Boolean,
91
+ default: false
92
+ }
93
+ }
94
+
95
+ export type ButtonPropsType = ExtractPublicPropTypes<typeof ButtonProps>