frappe-ui 0.0.21 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="flex items-center text-base text-gray-500">
3
- <LoadingIndicator /> {{ text }}
3
+ <LoadingIndicator class="w-3 h-3 mr-2 -ml-1" /> {{ text }}
4
4
  </div>
5
5
  </template>
6
6
  <script>
@@ -23,10 +23,17 @@
23
23
 
24
24
  <Dialog :options="{ title: 'Set Link' }" v-model="setLinkDialog.show">
25
25
  <template #body-content>
26
- <Input type="text" label="URL" v-model="setLinkDialog.url" />
26
+ <Input
27
+ type="text"
28
+ label="URL"
29
+ v-model="setLinkDialog.url"
30
+ @keydown.enter="(e) => setLink(e.target.value)"
31
+ />
27
32
  </template>
28
33
  <template #actions>
29
- <Button appearance="primary" @click="setLink"> Save </Button>
34
+ <Button appearance="primary" @click="setLink(setLinkDialog.url)">
35
+ Save
36
+ </Button>
30
37
  </template>
31
38
  </Dialog>
32
39
  </div>
@@ -54,9 +61,9 @@ export default {
54
61
  button.action(this.editor)
55
62
  }
56
63
  },
57
- setLink() {
64
+ setLink(url) {
58
65
  // empty
59
- if (this.setLinkDialog.url === '') {
66
+ if (url === '') {
60
67
  this.editor.chain().focus().extendMarkRange('link').unsetLink().run()
61
68
  } else {
62
69
  // update link
@@ -64,7 +71,7 @@ export default {
64
71
  .chain()
65
72
  .focus()
66
73
  .extendMarkRange('link')
67
- .setLink({ href: this.setLinkDialog.url })
74
+ .setLink({ href: url })
68
75
  .run()
69
76
  }
70
77
 
@@ -71,6 +71,7 @@ export default {
71
71
  'bubbleMenu',
72
72
  'floatingMenu',
73
73
  'extensions',
74
+ 'starterkitOptions',
74
75
  ],
75
76
  emits: ['change'],
76
77
  expose: ['editor'],
@@ -92,7 +93,7 @@ export default {
92
93
  },
93
94
  mounted() {
94
95
  this.editor = new Editor({
95
- content: this.content || '<p></p>',
96
+ content: this.content || null,
96
97
  editorProps: {
97
98
  attributes: {
98
99
  class: ['prose prose-sm prose-p:my-1', this.editorClass].join(' '),
@@ -100,7 +101,9 @@ export default {
100
101
  },
101
102
  editable: this.editable,
102
103
  extensions: [
103
- StarterKit,
104
+ StarterKit.configure({
105
+ ...this.starterkitOptions,
106
+ }),
104
107
  Image,
105
108
  Link,
106
109
  Placeholder.configure({
@@ -13,10 +13,10 @@
13
13
  class="p-4 bg-white border rounded-lg shadow-md min-w-[15rem] max-w-[40rem]"
14
14
  >
15
15
  <div class="flex items-start">
16
- <div class="grid w-5 h-5 place-items-center">
16
+ <div v-if="icon" class="grid w-5 h-5 mr-3 place-items-center">
17
17
  <FeatherIcon :name="icon" :class="['w-5 h-5', iconClasses]" />
18
18
  </div>
19
- <div class="ml-3">
19
+ <div>
20
20
  <slot>
21
21
  <p class="text-base font-medium text-gray-900">
22
22
  {{ title }}
@@ -165,7 +165,9 @@ export function createDocumentResource(options, vm) {
165
165
  },
166
166
  onSuccess(data) {
167
167
  out.doc = transform(data)
168
+ options.setValue?.onSuccess?.call(vm, data)
168
169
  },
170
+ onError: options.setValue?.onError,
169
171
  }
170
172
 
171
173
  let out = reactive({
@@ -206,7 +208,9 @@ export function createDocumentResource(options, vm) {
206
208
  },
207
209
  onSuccess() {
208
210
  out.doc = null
211
+ options.delete?.onSuccess?.call(vm, data)
209
212
  },
213
+ onError: options.delete?.onError,
210
214
  },
211
215
  vm
212
216
  ),
@@ -300,8 +304,9 @@ function createListResource(options, vm, getResource) {
300
304
  },
301
305
  onSuccess(data) {
302
306
  out.data = transform(data)
303
- options.onSuccess && options.onSuccess.call(vm, out.data)
307
+ options.onSuccess?.call(vm, out.data)
304
308
  },
309
+ onError: options.onError,
305
310
  },
306
311
  vm
307
312
  ),
@@ -316,9 +321,11 @@ function createListResource(options, vm, getResource) {
316
321
  },
317
322
  }
318
323
  },
319
- onSuccess() {
324
+ onSuccess(data) {
320
325
  out.list.fetch()
326
+ options.insert?.onSuccess?.call(vm, data)
321
327
  },
328
+ onError: options.insert?.onError,
322
329
  },
323
330
  vm
324
331
  ),
@@ -333,9 +340,11 @@ function createListResource(options, vm, getResource) {
333
340
  fieldname: values,
334
341
  }
335
342
  },
336
- onSuccess() {
343
+ onSuccess(data) {
337
344
  out.list.fetch()
345
+ options.setValue?.onSuccess?.call(vm, data)
338
346
  },
347
+ onError: options.setValue?.onError,
339
348
  },
340
349
  vm
341
350
  ),
@@ -348,9 +357,11 @@ function createListResource(options, vm, getResource) {
348
357
  name,
349
358
  }
350
359
  },
351
- onSuccess() {
360
+ onSuccess(data) {
352
361
  out.list.fetch()
362
+ options.delete?.onSuccess?.call(vm, data)
353
363
  },
364
+ onError: options.delete?.onError,
354
365
  },
355
366
  vm
356
367
  ),