frappe-ui 0.1.18 → 0.1.20

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.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  import ListHeader from './ListHeader.vue'
17
17
  import ListRows from './ListRows.vue'
18
18
  import ListSelectBanner from './ListSelectBanner.vue'
19
- import { reactive, computed, provide } from 'vue'
19
+ import { reactive, computed, provide, watch } from 'vue'
20
20
 
21
21
  defineOptions({
22
22
  inheritAttrs: false,
@@ -48,6 +48,12 @@ const props = defineProps({
48
48
 
49
49
  let selections = reactive(new Set())
50
50
 
51
+ const emit = defineEmits(['update:selections'])
52
+
53
+ watch(selections, (value) => {
54
+ emit('update:selections', value)
55
+ })
56
+
51
57
  let _options = computed(() => {
52
58
  function defaultTrue(value) {
53
59
  return value === undefined ? true : value
@@ -157,11 +157,20 @@ export function createDocumentResource(options, vm) {
157
157
  method: methodOptions,
158
158
  }
159
159
  }
160
- let { method, onSuccess, ...otherOptions } = methodOptions
160
+
161
+ let {
162
+ method,
163
+ onSuccess,
164
+ makeParams,
165
+ transform: _transform,
166
+ ...otherOptions
167
+ } = methodOptions
168
+
161
169
  out[methodKey] = createResource(
162
170
  {
163
171
  url: defaultRunDocMethodUrl,
164
172
  makeParams(values) {
173
+ values = makeParams ? makeParams.call(vm, values) : values
165
174
  return {
166
175
  dt: out.doctype,
167
176
  dn: out.name,
@@ -169,6 +178,15 @@ export function createDocumentResource(options, vm) {
169
178
  args: values,
170
179
  }
171
180
  },
181
+ transform(data) {
182
+ if (_transform) {
183
+ let returnValue = _transform.call(vm, data.message)
184
+ if (returnValue != null) {
185
+ return returnValue
186
+ }
187
+ }
188
+ return data.message
189
+ },
172
190
  onSuccess(data) {
173
191
  if (data.docs) {
174
192
  for (let doc of data.docs) {