frappe-ui 0.0.97 → 0.0.99

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.97",
3
+ "version": "0.0.99",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -4,17 +4,17 @@
4
4
  <template #target="{ open: openPopover }">
5
5
  <div class="w-full">
6
6
  <ComboboxButton
7
- class="flex w-full items-center justify-between rounded-md bg-gray-100 py-1.5 pl-3 pr-2"
7
+ class="flex w-full items-center justify-between rounded-md bg-gray-100 py-1 pl-3 pr-2"
8
8
  :class="{ 'rounded-b-none': isComboboxOpen }"
9
9
  @click="() => openPopover()"
10
10
  >
11
11
  <span
12
- class="overflow-hidden text-ellipsis text-base"
12
+ class="overflow-hidden text-ellipsis text-base leading-5"
13
13
  v-if="selectedValue"
14
14
  >
15
15
  {{ displayValue(selectedValue) }}
16
16
  </span>
17
- <span class="text-base text-gray-500" v-else>
17
+ <span class="text-base leading-5 text-gray-500" v-else>
18
18
  {{ placeholder || '' }}
19
19
  </span>
20
20
  <FeatherIcon
@@ -98,7 +98,6 @@ export function createDocumentResource(options, vm) {
98
98
  },
99
99
  vm
100
100
  ),
101
- update,
102
101
  reload,
103
102
  setDoc,
104
103
  })
@@ -119,7 +118,7 @@ export function createDocumentResource(options, vm) {
119
118
  dt: out.doctype,
120
119
  dn: out.name,
121
120
  method: method,
122
- args: JSON.stringify(values),
121
+ args: values,
123
122
  }
124
123
  },
125
124
  onSuccess(data) {
@@ -144,12 +143,6 @@ export function createDocumentResource(options, vm) {
144
143
  )
145
144
  }
146
145
 
147
- function update(updatedOptions) {
148
- out.doctype = updatedOptions.doctype
149
- out.name = updatedOptions.name
150
- out.get.fetch()
151
- }
152
-
153
146
  function reload() {
154
147
  return out.get.fetch()
155
148
  }
@@ -23,25 +23,30 @@ let createMixin = (mixinOptions) => ({
23
23
  return null
24
24
  }
25
25
  },
26
- (updatedOptions, oldVal) => {
27
- if (!updatedOptions) {
26
+ (options, oldOptions) => {
27
+ if (!options) {
28
28
  return
29
29
  }
30
30
 
31
31
  let changed =
32
- !oldVal ||
33
- JSON.stringify(updatedOptions) !== JSON.stringify(oldVal)
32
+ !oldOptions ||
33
+ JSON.stringify(options) !== JSON.stringify(oldOptions)
34
34
 
35
35
  if (!changed) return
36
36
 
37
- let resource = this._resources[key]
38
- if (!resource) {
39
- resource = createResourceForOptions(updatedOptions, this)
37
+ if (options.type === 'document') {
38
+ let resource = createDocumentResource(options, this)
40
39
  this._resources[key] = resource
41
40
  } else {
42
- resource.update(updatedOptions)
43
- if (resource.auto) {
44
- resource.reload()
41
+ let resource = this._resources[key]
42
+ if (!resource) {
43
+ resource = createResourceForOptions(options, this)
44
+ this._resources[key] = resource
45
+ } else {
46
+ resource.update(options)
47
+ if (resource.auto) {
48
+ resource.reload()
49
+ }
45
50
  }
46
51
  }
47
52
  },