@drax/crud-vue 2.0.6 → 2.0.7

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
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.0.6",
6
+ "version": "2.0.7",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -50,5 +50,5 @@
50
50
  "vue-tsc": "^3.2.4",
51
51
  "vuetify": "^3.11.8"
52
52
  },
53
- "gitHead": "9ccda70d228007d50fe535b26d719148318086fa"
53
+ "gitHead": "7f2c7c7fa1b3e77276c8ce1ec7e86c008a51a776"
54
54
  }
package/src/EntityCrud.ts CHANGED
@@ -141,7 +141,7 @@ class EntityCrud implements IEntityCrud {
141
141
  throw new Error("Ref not found: " + ref)
142
142
  }
143
143
 
144
- return this.refs[ref]
144
+ return this.refs[ref] as IEntityCrud
145
145
  }
146
146
 
147
147
  get rules(): IEntityCrudRules {
@@ -19,7 +19,7 @@ const {hasPermission} = useAuth()
19
19
 
20
20
  const valueModel = defineModel<any>({type: [String, Number, Boolean, Object, Array], default: false})
21
21
 
22
- const {index, entity, field, disableRules, parentField} = defineProps({
22
+ const {index, entity, field, disableRules, parentField, errorMessages} = defineProps({
23
23
  entity: {type: Object as PropType<IEntityCrud>, required: true},
24
24
  field: {type: Object as PropType<IEntityCrudField | IEntityCrudFilter | undefined>, required: true},
25
25
  prependIcon: {type: String, default: ''},
@@ -35,6 +35,7 @@ const {index, entity, field, disableRules, parentField} = defineProps({
35
35
  preview: {type: Boolean, default: true},
36
36
  previewHeight: {type: String, default: '100px'},
37
37
  parentField: {type: String, default: null, required: false},
38
+ errorMessages: {type: Array as PropType<string[]>, default: null, required: false},
38
39
  index: {type: Number, default: null, required: false},
39
40
  density: {type: String as PropType<'comfortable' | 'compact' | 'default'>, default: 'default'},
40
41
  variant: {
@@ -64,13 +65,17 @@ const rules = computed(() => {
64
65
  return entity.getRule(field.name) as any
65
66
  })
66
67
 
67
- const inputErrors = computed(() => {
68
+ const storeErrorMessages = computed(() => {
68
69
  let sIndex = (index != null && index >= 0) ? `${index}.` : ''
69
70
  let name = parentField ? `${parentField}.${sIndex}${field.name}` : field.name
70
71
  return store.getFieldInputErrors(name).map((error: string) =>te(error) ? t(error) : error)
71
72
  }
72
73
  )
73
74
 
75
+ const inputErrors = computed(() => {
76
+ return errorMessages ?? storeErrorMessages.value
77
+ })
78
+
74
79
  defineEmits(['updateValue'])
75
80
 
76
81
  </script>
@@ -399,7 +399,8 @@ export function useCrud(entity: IEntityCrud) {
399
399
 
400
400
 
401
401
  return {
402
- doPaginate, doExport, onView, onCreate, onEdit, onDelete, onCancel, onSubmit, resetCrudStore,
402
+ doPaginate, doExport, doUpdate, doCreate, doDelete,
403
+ onView, onCreate, onEdit, onDelete, onCancel, onSubmit, resetCrudStore,
403
404
  operation, dialog, form, notify, error, message, formValid,
404
405
  loading, itemsPerPage, page, sortBy, search, totalItems, items,
405
406
  prepareFilters, filters, clearFilters, applyFilters,