@mlightcad/ui-components 0.0.9 → 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.
Files changed (33) hide show
  1. package/README.md +10 -14
  2. package/dist/ui-components.es.js +197 -172
  3. package/dist/ui-components.umd.js +2 -2
  4. package/lib/index.d.ts +2 -1
  5. package/lib/index.js +3 -1
  6. package/package.json +1 -1
  7. package/src/components/MlCollapse.vue +2 -2
  8. package/src/components/MlStatusBar.vue +43 -0
  9. package/src/components/{MlToolbar.vue → MlToolBar.vue} +6 -5
  10. package/src/components/MlToolPalette.vue +8 -9
  11. package/src/{composable → composables}/useBoundingRect.ts +20 -6
  12. package/src/{composable → composables}/useDrag.ts +13 -20
  13. package/src/{composable → composables}/useDragEx.ts +5 -1
  14. package/src/{composable → composables}/useInitialRect.ts +3 -3
  15. package/src/{composable → composables}/useLastPosAndSize.ts +1 -1
  16. package/src/{composable → composables}/useLeftPosAndWidth.ts +5 -5
  17. package/src/{composable → composables}/useResize.ts +3 -3
  18. package/src/index.ts +13 -4
  19. package/lib/MlDropdown.vue.d.ts +0 -59
  20. package/lib/MlDropdown.vue.js +0 -106
  21. package/lib/MlLanguage.vue.d.ts +0 -29
  22. package/lib/MlLanguage.vue.js +0 -67
  23. package/lib/MlToolPalette.vue.d.ts +0 -2
  24. package/lib/MlToolPalette.vue.js +0 -149
  25. package/lib/MlToolbar.vue.d.ts +0 -74
  26. package/lib/MlToolbar.vue.js +0 -129
  27. /package/src/{composable → composables}/types.ts +0 -0
  28. /package/src/{composable → composables}/useAutoOpen.ts +0 -0
  29. /package/src/{composable → composables}/useTransition.ts +0 -0
  30. /package/src/{composable → composables}/useWindowSize.ts +0 -0
  31. /package/src/{svg → svgs}/arrow-left.svg +0 -0
  32. /package/src/{svg → svgs}/arrow-right.svg +0 -0
  33. /package/src/{svg → svgs}/svg.d.ts +0 -0
package/README.md CHANGED
@@ -49,9 +49,7 @@ interface Props {
49
49
  }
50
50
  ```
51
51
 
52
- Four `offsetXXX` properties are used to set the minimum distance from the side of the tool palette to the side of the window. It is quite useful if you want the tool palette is shown within area. For example, one web page has one title bar at the top of window, one status bar at the bottom of window, and one canvas area between the title bar and the status bar. The height of the title bar is 60px and the height of the status bar is 20px. Then you can set `topOffset` to 60 and `bottomOffset` to 20 to let the tool palette are shown and moved within canvas area only.
53
-
54
- It is quite easy to use it.
52
+ Four `offsetXXX` properties are used to set the minimum distance from the side of the tool palette to the side of the window. It is quite useful if you want the tool palette is shown within certain area. For example, one web page has one title bar at the top of window, one status bar at the bottom of window, and one canvas area between the title bar and the status bar. The height of the title bar is 60px and the height of the status bar is 20px. Then you can set `topOffset` to 60 and `bottomOffset` to 20 to let the tool palette are shown and moved within canvas area only.
55
53
 
56
54
  ```javascript
57
55
  <script lang="ts" setup>
@@ -117,7 +115,7 @@ interface Props {
117
115
  }
118
116
  ```
119
117
 
120
- 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`.
121
119
 
122
120
  ```javascript
123
121
  /**
@@ -125,9 +123,9 @@ Buttons in toolbar are described by the following data.
125
123
  */
126
124
  export interface MlButtonData {
127
125
  /**
128
- * Icon represented by one SVG string
126
+ * Icon represented by one vue component
129
127
  */
130
- icon: string
128
+ icon: Component
131
129
  /**
132
130
  * Text shown below icon
133
131
  */
@@ -143,32 +141,30 @@ export interface MlButtonData {
143
141
  }
144
142
  ```
145
143
 
146
- Usage of this component is as follows. To simplify example code, we use the same SVG icon for all button in toolbar.
144
+ Usage of this component is as follows.
147
145
 
148
146
  ```javascript
149
147
  <script setup lang="ts">
150
148
  import '@mlightcad/ui-components/dist/style.css'
151
149
  import { MlButtonData, MlToolbar } from '@mlightcad/ui-components'
152
150
  import { reactive } from 'vue'
153
-
154
- const svg =
155
- '<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'
156
152
 
157
153
  const data = reactive<MlButtonData[]>([
158
154
  {
159
- icon: svg,
155
+ icon: Edit,
160
156
  text: 'Edit',
161
157
  command: 'edit',
162
158
  description: 'This is description for edit button'
163
159
  },
164
160
  {
165
- icon: svg,
161
+ icon: Delete,
166
162
  text: 'Delete',
167
163
  command: 'delete',
168
164
  description: 'This is description for delete button'
169
165
  },
170
166
  {
171
- icon: svg,
167
+ icon: Search,
172
168
  text: 'Search',
173
169
  command: 'search',
174
170
  description: 'This is description for search button'
@@ -182,7 +178,7 @@ const handleCommand = (command: string) => {
182
178
 
183
179
  <template>
184
180
  <div>
185
- <ml-toolbar :items="data1" layout="vertical" @click="handleCommand"/>
181
+ <ml-toolbar :items="data" layout="vertical" @click="handleCommand"/>
186
182
  </div>
187
183
  </template>
188
184