@mptw/skylens-ui 1.5.23 → 1.5.24

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/app/app.vue CHANGED
@@ -1,11 +1,16 @@
1
1
  <template lang="pug">
2
2
  div
3
- SLPopupMenuButton(:buttons='buttons')
3
+ SLSelect(
4
+ v-model='selected',
5
+ :options='options'
6
+ )
4
7
  </template>
5
8
 
6
9
  <script setup lang="ts">
7
- const buttons = [
8
- { name: "複製", event: "copy" },
9
- { name: "下載 Excel", event: "download" },
10
+ const selected = ref("");
11
+
12
+ const options = [
13
+ { label: "A", icon: "web", value: "a" },
14
+ { label: "B", icon: "map-marker", value: "b" },
10
15
  ];
11
16
  </script>
@@ -10,6 +10,7 @@
10
10
  @click='onClickedToggle',
11
11
  ref='toggleButton'
12
12
  )
13
+ SLIcon.button-icon(v-if='buttonIcon', :icon='buttonIcon')
13
14
  span.button-title {{ buttonTitle }}
14
15
  SLIcon(icon='caret-down')
15
16
  .invalid-feedback
@@ -36,6 +37,7 @@
36
37
  )
37
38
  SLIcon.icon-square(v-if='multiple', icon='square')
38
39
  SLIcon.icon-check-square(v-if='multiple', icon='check-square')
40
+ SLIcon.option-icon(v-if='option.icon', :icon='option.icon')
39
41
  span {{ option.label }}
40
42
  </template>
41
43
 
@@ -195,6 +197,11 @@ export default defineComponent({
195
197
 
196
198
  return selectedOption;
197
199
  });
200
+ const buttonIcon = computed(() => {
201
+ if (multiple.value) return "";
202
+
203
+ return selectedOption.value?.icon || "";
204
+ });
198
205
  const buttonTitle = computed(() => {
199
206
  if (multiple.value) {
200
207
  return placeholder.value;
@@ -440,6 +447,7 @@ export default defineComponent({
440
447
  customSelectClass,
441
448
  selectOptions,
442
449
  selectedOption,
450
+ buttonIcon,
443
451
  buttonTitle,
444
452
  isSearch,
445
453
  isSelected,
@@ -460,10 +468,12 @@ export default defineComponent({
460
468
  .custom-select {
461
469
  @apply relative;
462
470
 
463
- &.disabled .form-control label, &.readonly .form-control label {
471
+ &.disabled .form-control label,
472
+ &.readonly .form-control label {
464
473
  @apply border-primary-600 bg-primary-100 text-pgray-4 cursor-default;
465
474
 
466
- .icon, .icon {
475
+ .icon,
476
+ .icon {
467
477
  @apply text-pgray-4;
468
478
  }
469
479
  }
@@ -509,6 +519,10 @@ export default defineComponent({
509
519
  .icon {
510
520
  @apply grow-0 shrink-0 text-xs text-pgray-2;
511
521
  }
522
+
523
+ .icon.button-icon {
524
+ @apply text-base;
525
+ }
512
526
  }
513
527
  }
514
528
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mptw/skylens-ui",
3
3
  "type": "module",
4
- "version": "1.5.23",
4
+ "version": "1.5.24",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",