frappe-ui 0.0.99 → 0.0.101

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.0.99",
3
+ "version": "0.0.101",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -10,8 +10,8 @@
10
10
  v-if="loading"
11
11
  class="h-3 w-3"
12
12
  :class="{
13
- 'mr-2 -ml-1': !icon,
14
- 'm-0.5': icon,
13
+ 'mr-2 -ml-1': !isIconButton,
14
+ 'm-0.5': isIconButton,
15
15
  'text-white': appearance == 'primary',
16
16
  'text-gray-600': appearance == 'secondary',
17
17
  'text-red-200': appearance == 'danger',
@@ -19,27 +19,39 @@
19
19
  'text-yellow-200': appearance == 'warning',
20
20
  }"
21
21
  />
22
- <FeatherIcon
23
- v-else-if="iconLeft"
24
- :name="iconLeft"
25
- class="mr-1.5 h-4 w-4"
26
- aria-hidden="true"
27
- />
22
+ <template v-else-if="iconLeft || $slots['icon-left']">
23
+ <FeatherIcon
24
+ v-if="iconLeft"
25
+ :name="iconLeft"
26
+ class="mr-1.5 h-4 w-4"
27
+ aria-hidden="true"
28
+ />
29
+ <slot name="icon-left" v-else-if="$slots['icon-left']" />
30
+ </template>
28
31
  <template v-if="loading && loadingText">{{ loadingText }}</template>
29
- <template v-else-if="icon && !loading">
30
- <FeatherIcon :name="icon" class="h-4 w-4" :aria-label="label" />
32
+ <template v-else-if="isIconButton && !loading">
33
+ <FeatherIcon
34
+ v-if="icon"
35
+ :name="icon"
36
+ class="h-4 w-4"
37
+ :aria-label="label"
38
+ />
39
+ <slot name="icon" v-else-if="$slots.icon" />
31
40
  </template>
32
- <span v-else :class="icon ? 'sr-only' : ''">
41
+ <span v-else :class="isIconButton ? 'sr-only' : ''">
33
42
  <slot>
34
43
  {{ label }}
35
44
  </slot>
36
45
  </span>
37
- <FeatherIcon
38
- v-if="iconRight"
39
- :name="iconRight"
40
- class="ml-2 h-4 w-4"
41
- aria-hidden="true"
42
- />
46
+ <template v-if="iconRight || $slots['icon-right']">
47
+ <FeatherIcon
48
+ v-if="iconRight"
49
+ :name="iconRight"
50
+ class="ml-2 h-4 w-4"
51
+ aria-hidden="true"
52
+ />
53
+ <slot name="icon-right" v-else-if="$slots['icon-right']" />
54
+ </template>
43
55
  </button>
44
56
  </template>
45
57
  <script>
@@ -129,7 +141,7 @@ export default {
129
141
  }
130
142
  return [
131
143
  'inline-flex items-center justify-center text-base leading-5 rounded-md border transition-colors focus:outline-none',
132
- this.icon ? 'p-1.5' : 'px-3 py-1',
144
+ this.isIconButton ? 'p-1.5' : 'px-3 py-1',
133
145
  this.isDisabled
134
146
  ? 'opacity-50 cursor-not-allowed pointer-events-none'
135
147
  : '',
@@ -140,7 +152,10 @@ export default {
140
152
  return this.disabled || this.loading
141
153
  },
142
154
  ariaLabel() {
143
- return this.icon ? this.label : null
155
+ return this.isIconButton ? this.label : null
156
+ },
157
+ isIconButton() {
158
+ return this.icon || this.$slots.icon
144
159
  },
145
160
  },
146
161
  methods: {
@@ -45,11 +45,16 @@
45
45
  @click="item.onClick"
46
46
  >
47
47
  <FeatherIcon
48
- v-if="item.icon"
48
+ v-if="item.icon && typeof item.icon === 'string'"
49
49
  :name="item.icon"
50
50
  class="mr-2 h-4 w-4 flex-shrink-0 text-gray-500"
51
51
  aria-hidden="true"
52
52
  />
53
+ <component
54
+ class="mr-2 h-4 w-4 flex-shrink-0 text-gray-500"
55
+ v-else-if="item.icon"
56
+ :is="item.icon"
57
+ />
53
58
  <span class="whitespace-nowrap">
54
59
  {{ item.label }}
55
60
  </span>
@@ -28,6 +28,7 @@ export function createListResource(options, vm) {
28
28
  orderBy: options.orderBy,
29
29
  start: options.start || 0,
30
30
  pageLength: options.pageLength || 20,
31
+ groupBy: options.groupBy,
31
32
  parent: options.parent,
32
33
  debug: options.debug || 0,
33
34
  originalData: null,
@@ -48,6 +49,7 @@ export function createListResource(options, vm) {
48
49
  limit: out.pageLength,
49
50
  limit_start: out.start,
50
51
  limit_page_length: out.pageLength,
52
+ group_by: out.groupBy,
51
53
  parent: out.parent,
52
54
  debug: out.debug,
53
55
  }
@@ -183,6 +185,7 @@ export function createListResource(options, vm) {
183
185
  out.orderBy = updatedOptions.orderBy
184
186
  out.start = updatedOptions.start
185
187
  out.pageLength = updatedOptions.pageLength
188
+ out.groupBy = updatedOptions.groupBy
186
189
  out.parent = updatedOptions.parent
187
190
  out.debug = updatedOptions.debug
188
191
  }