@mlightcad/ui-components 0.0.10 → 0.0.11
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.
- package/README.md +9 -11
- package/package.json +1 -1
- package/src/components/{MlToolbar.vue → MlToolBar.vue} +6 -5
- package/src/index.ts +4 -4
package/README.md
CHANGED
|
@@ -115,7 +115,7 @@ interface Props {
|
|
|
115
115
|
}
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
Buttons in toolbar are described by the following data.
|
|
118
|
+
Buttons in toolbar are described by the following data. Property `icon` can be icon provided by Element Plus or icon imported through `vite-svg-loader`.
|
|
119
119
|
|
|
120
120
|
```javascript
|
|
121
121
|
/**
|
|
@@ -123,9 +123,9 @@ Buttons in toolbar are described by the following data.
|
|
|
123
123
|
*/
|
|
124
124
|
export interface MlButtonData {
|
|
125
125
|
/**
|
|
126
|
-
* Icon represented by one
|
|
126
|
+
* Icon represented by one vue component
|
|
127
127
|
*/
|
|
128
|
-
icon:
|
|
128
|
+
icon: Component
|
|
129
129
|
/**
|
|
130
130
|
* Text shown below icon
|
|
131
131
|
*/
|
|
@@ -141,32 +141,30 @@ export interface MlButtonData {
|
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
Usage of this component is as follows.
|
|
144
|
+
Usage of this component is as follows.
|
|
145
145
|
|
|
146
146
|
```javascript
|
|
147
147
|
<script setup lang="ts">
|
|
148
148
|
import '@mlightcad/ui-components/dist/style.css'
|
|
149
149
|
import { MlButtonData, MlToolbar } from '@mlightcad/ui-components'
|
|
150
150
|
import { reactive } from 'vue'
|
|
151
|
-
|
|
152
|
-
const svg =
|
|
153
|
-
'<svg data-v-d0da8fdb="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"></path></svg>'
|
|
151
|
+
import { Delete, Edit, Search } from '@element-plus/icons-vue'
|
|
154
152
|
|
|
155
153
|
const data = reactive<MlButtonData[]>([
|
|
156
154
|
{
|
|
157
|
-
icon:
|
|
155
|
+
icon: Edit,
|
|
158
156
|
text: 'Edit',
|
|
159
157
|
command: 'edit',
|
|
160
158
|
description: 'This is description for edit button'
|
|
161
159
|
},
|
|
162
160
|
{
|
|
163
|
-
icon:
|
|
161
|
+
icon: Delete,
|
|
164
162
|
text: 'Delete',
|
|
165
163
|
command: 'delete',
|
|
166
164
|
description: 'This is description for delete button'
|
|
167
165
|
},
|
|
168
166
|
{
|
|
169
|
-
icon:
|
|
167
|
+
icon: Search,
|
|
170
168
|
text: 'Search',
|
|
171
169
|
command: 'search',
|
|
172
170
|
description: 'This is description for search button'
|
|
@@ -180,7 +178,7 @@ const handleCommand = (command: string) => {
|
|
|
180
178
|
|
|
181
179
|
<template>
|
|
182
180
|
<div>
|
|
183
|
-
<ml-toolbar :items="
|
|
181
|
+
<ml-toolbar :items="data" layout="vertical" @click="handleCommand"/>
|
|
184
182
|
</div>
|
|
185
183
|
</template>
|
|
186
184
|
|
package/package.json
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
@click="handleCommand(item.command)"
|
|
14
14
|
>
|
|
15
15
|
<div>
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
<el-icon :size="buttonIconSize">
|
|
17
|
+
<component :is="item.icon" />
|
|
18
|
+
</el-icon>
|
|
18
19
|
<div v-if="isShowButtonText" class="ml-toolbar-button-text">
|
|
19
20
|
{{ item.text }}
|
|
20
21
|
</div>
|
|
@@ -25,16 +26,16 @@
|
|
|
25
26
|
</template>
|
|
26
27
|
|
|
27
28
|
<script setup lang="ts">
|
|
28
|
-
import { computed } from 'vue'
|
|
29
|
+
import { Component, computed } from 'vue'
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Data to descibe button appearance
|
|
32
33
|
*/
|
|
33
34
|
export interface MlButtonData {
|
|
34
35
|
/**
|
|
35
|
-
* Icon represented by one
|
|
36
|
+
* Icon represented by one vue component
|
|
36
37
|
*/
|
|
37
|
-
icon:
|
|
38
|
+
icon: Component
|
|
38
39
|
/**
|
|
39
40
|
* Text shown below icon
|
|
40
41
|
*/
|
package/src/index.ts
CHANGED
|
@@ -2,18 +2,18 @@ import MlCollapse from './components/MlCollapse.vue'
|
|
|
2
2
|
import MlDropdown from './components/MlDropdown.vue'
|
|
3
3
|
import MlLanguage from './components/MlLanguage.vue'
|
|
4
4
|
import MlStatusBar from './components/MlStatusBar.vue'
|
|
5
|
-
import
|
|
5
|
+
import MlToolBar from './components/MlToolBar.vue'
|
|
6
6
|
import MlToolPalette from './components/MlToolPalette.vue'
|
|
7
7
|
export {
|
|
8
8
|
MlCollapse,
|
|
9
9
|
MlDropdown,
|
|
10
10
|
MlLanguage,
|
|
11
11
|
MlStatusBar,
|
|
12
|
-
|
|
12
|
+
MlToolBar,
|
|
13
13
|
MlToolPalette
|
|
14
14
|
}
|
|
15
15
|
export type { MlDropdownMenuItem } from './components/MlDropdown.vue'
|
|
16
|
-
export type { MlButtonData } from './components/
|
|
16
|
+
export type { MlButtonData } from './components/MlToolBar.vue'
|
|
17
17
|
|
|
18
18
|
// Optionally, export them as a plugin for Vue
|
|
19
19
|
export default {
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
app.component('MlDropdown', MlDropdown)
|
|
24
24
|
app.component('MlLanguage', MlLanguage)
|
|
25
25
|
app.component('MlStatusBar', MlStatusBar)
|
|
26
|
-
app.component('MlToolbar',
|
|
26
|
+
app.component('MlToolbar', MlToolBar)
|
|
27
27
|
app.component('MlToolPalette', MlToolPalette)
|
|
28
28
|
}
|
|
29
29
|
}
|