@stonecrop/aform 0.9.2 → 0.10.0
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/dist/aform.d.ts +11 -15
- package/dist/aform.js +1462 -1377
- package/dist/aform.js.map +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/src/types/index.d.ts +10 -15
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/AForm.vue +30 -28
- package/src/components/form/ACheckbox.vue +18 -12
- package/src/components/form/AComboBox.vue +4 -1
- package/src/components/form/ADate.vue +17 -17
- package/src/components/form/ADatePicker.vue +9 -1
- package/src/components/form/ADropdown.vue +16 -7
- package/src/components/form/AFieldset.vue +5 -2
- package/src/components/form/AFileAttach.vue +31 -16
- package/src/components/form/ANumericInput.vue +16 -10
- package/src/components/form/ATextInput.vue +17 -11
- package/src/types/index.ts +11 -17
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="aform_form-element">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
<template v-if="mode === 'display'">
|
|
4
|
+
<span class="aform_display-value">{{ inputNumber ?? '' }}</span>
|
|
5
|
+
<label class="aform_field-label">{{ label }}</label>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else>
|
|
8
|
+
<input
|
|
9
|
+
:id="uuid"
|
|
10
|
+
v-model="inputNumber"
|
|
11
|
+
class="aform_input-field"
|
|
12
|
+
type="number"
|
|
13
|
+
:disabled="mode === 'read'"
|
|
14
|
+
:required="required" />
|
|
15
|
+
<label class="aform_field-label" :for="uuid">{{ label }}</label>
|
|
16
|
+
<p v-show="validation.errorMessage" class="aform_error" v-html="validation.errorMessage"></p>
|
|
17
|
+
</template>
|
|
12
18
|
</div>
|
|
13
19
|
</template>
|
|
14
20
|
|
|
15
21
|
<script setup lang="ts">
|
|
16
22
|
import { ComponentProps } from '../../types'
|
|
17
23
|
|
|
18
|
-
const { label, required,
|
|
24
|
+
const { label, required, mode, uuid, validation = { errorMessage: ' ' } } = defineProps<ComponentProps>()
|
|
19
25
|
const inputNumber = defineModel<number>()
|
|
20
26
|
</script>
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="aform_form-element">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
<template v-if="mode === 'display'">
|
|
4
|
+
<span class="aform_display-value">{{ inputText ?? '' }}</span>
|
|
5
|
+
<label class="aform_field-label">{{ label }}</label>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else>
|
|
8
|
+
<input
|
|
9
|
+
:id="uuid"
|
|
10
|
+
v-model="inputText"
|
|
11
|
+
v-mask="mask"
|
|
12
|
+
class="aform_input-field"
|
|
13
|
+
:disabled="mode === 'read'"
|
|
14
|
+
:maxlength="mask ? (maskFilled ? mask.length : undefined) : undefined"
|
|
15
|
+
:required="required" />
|
|
16
|
+
<label class="aform_field-label" :for="uuid">{{ label }} </label>
|
|
17
|
+
<p v-show="validation.errorMessage" class="aform_error" v-html="validation.errorMessage"></p>
|
|
18
|
+
</template>
|
|
13
19
|
</div>
|
|
14
20
|
</template>
|
|
15
21
|
|
|
@@ -19,7 +25,7 @@ import { /* inject, */ ref } from 'vue'
|
|
|
19
25
|
import { useStringMask as vMask } from '../../directives/mask'
|
|
20
26
|
import { ComponentProps } from '../../types'
|
|
21
27
|
|
|
22
|
-
const { label, mask, required,
|
|
28
|
+
const { label, mask, required, mode, uuid, validation = { errorMessage: ' ' } } = defineProps<ComponentProps>()
|
|
23
29
|
|
|
24
30
|
// TODO: setup maskFilled as a computed property
|
|
25
31
|
const maskFilled = ref(true)
|
package/src/types/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { TableColumn, TableConfig, TableRow } from '@stonecrop/atable'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The rendering mode for AForm components
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type FormMode = 'edit' | 'read' | 'display'
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* Defined props for AForm components
|
|
5
11
|
* @public
|
|
@@ -30,10 +36,10 @@ export type ComponentProps = {
|
|
|
30
36
|
required?: boolean
|
|
31
37
|
|
|
32
38
|
/**
|
|
33
|
-
*
|
|
39
|
+
* The rendering mode for the component
|
|
34
40
|
* @public
|
|
35
41
|
*/
|
|
36
|
-
|
|
42
|
+
mode?: FormMode
|
|
37
43
|
|
|
38
44
|
/**
|
|
39
45
|
* Set a unique identifier for elements inside the component
|
|
@@ -79,10 +85,10 @@ export type BaseSchema = {
|
|
|
79
85
|
component?: string
|
|
80
86
|
|
|
81
87
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @
|
|
88
|
+
* Per-field rendering mode override; takes precedence over the AForm-level `mode` prop
|
|
89
|
+
* @public
|
|
84
90
|
*/
|
|
85
|
-
|
|
91
|
+
mode?: FormMode
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -232,12 +238,6 @@ export type DoctypeSchema = BaseSchema & {
|
|
|
232
238
|
* @public
|
|
233
239
|
*/
|
|
234
240
|
schema?: SchemaTypes[]
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Indicate whether the nested form is read-only
|
|
238
|
-
* @public
|
|
239
|
-
*/
|
|
240
|
-
readOnly?: boolean
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
/**
|
|
@@ -291,12 +291,6 @@ export type TableDoctypeSchema = BaseSchema & {
|
|
|
291
291
|
* @public
|
|
292
292
|
*/
|
|
293
293
|
rows?: TableRow[]
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Indicate whether the table is read-only
|
|
297
|
-
* @public
|
|
298
|
-
*/
|
|
299
|
-
readOnly?: boolean
|
|
300
294
|
}
|
|
301
295
|
|
|
302
296
|
/**
|