@stonecrop/aform 0.2.24 → 0.2.26

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": "@stonecrop/aform",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -17,48 +17,47 @@
17
17
  },
18
18
  "exports": {
19
19
  ".": {
20
- "import": "./dist/aform.js",
20
+ "import": {
21
+ "types": "./dist/aform/src/index.d.ts",
22
+ "default": "./dist/aform.js"
23
+ },
21
24
  "require": "./dist/aform.umd.cjs"
22
25
  },
23
26
  "./styles": "./dist/style.css"
24
27
  },
25
- "main": "dist/aform.js",
26
- "module": "dist/aform.js",
27
- "umd": "dist/aform.umd.cjs",
28
- "types": "src/index",
28
+ "typings": "./dist/aform/src/index.d.ts",
29
29
  "files": [
30
30
  "dist/*",
31
31
  "src/*"
32
32
  ],
33
33
  "dependencies": {
34
- "uuid": "^9.0.0",
35
- "vue": "^3.4.23",
36
- "@stonecrop/themes": "0.2.24",
37
- "@stonecrop/utilities": "0.2.24"
34
+ "vue": "^3.4.31",
35
+ "@stonecrop/utilities": "0.2.26",
36
+ "@stonecrop/themes": "0.2.26"
38
37
  },
39
38
  "devDependencies": {
40
- "@histoire/plugin-vue": "^0.17.17",
41
- "@types/uuid": "^9.0.0",
42
- "@typescript-eslint/eslint-plugin": "^7.6.0",
43
- "@typescript-eslint/parser": "^7.6.0",
44
- "@vitejs/plugin-vue": "^5.0.4",
39
+ "@microsoft/api-documenter": "^7.25.3",
40
+ "@rushstack/heft": "^0.66.18",
41
+ "@typescript-eslint/eslint-plugin": "^7.14.1",
42
+ "@typescript-eslint/parser": "^7.14.1",
43
+ "@vitejs/plugin-vue": "^5.0.5",
45
44
  "@vitest/coverage-istanbul": "^1.6.0",
46
45
  "@vitest/ui": "^1.6.0",
47
46
  "@vue/test-utils": "^2.4.6",
48
- "cypress": "^12.11.0",
47
+ "cypress": "^13.11.0",
49
48
  "eslint-config-prettier": "^8.8.0",
50
49
  "eslint-plugin-vue": "^9.11.1",
51
50
  "eslint": "^8.40.0",
52
- "histoire": "^0.17.17",
53
51
  "jsdom": "^24.0.0",
54
- "typescript": "^5.4.5",
55
- "vite": "^5.2.9",
52
+ "typescript": "^5.5.2",
53
+ "vite": "^5.3.2",
56
54
  "vitest": "^1.6.0",
57
- "vue-router": "^4",
58
- "@stonecrop/atable": "0.2.24"
55
+ "vue-router": "^4.4.0",
56
+ "@stonecrop/atable": "0.2.26",
57
+ "stonecrop-rig": "0.2.22"
59
58
  },
60
59
  "peerDependencies": {
61
- "@stonecrop/atable": "0.2.24"
60
+ "@stonecrop/atable": "0.2.26"
62
61
  },
63
62
  "publishConfig": {
64
63
  "access": "public"
@@ -67,14 +66,12 @@
67
66
  "node": ">=20.11.0"
68
67
  },
69
68
  "scripts": {
70
- "prepublish": "tsc -b && vite build",
71
- "build": "tsc -b && vite build",
69
+ "prepublish": "heft build && vite build && rushx docs",
70
+ "build": "heft build && vite build && rushx docs",
72
71
  "dev": "vite",
72
+ "docs": "api-documenter markdown -i temp -o ../docs/aform",
73
73
  "lint": "eslint . --ext .ts,.vue",
74
74
  "preview": "vite preview",
75
- "story:build": "histoire build",
76
- "story:dev": "histoire dev",
77
- "story:preview": "histoire preview",
78
75
  "test": "vitest",
79
76
  "test:coverage": "vitest run --coverage",
80
77
  "test:ui": "vitest --ui"
@@ -16,7 +16,7 @@
16
16
  <script setup lang="ts">
17
17
  import { ref, computed } from 'vue'
18
18
 
19
- import { SchemaTypes } from 'types'
19
+ import type { SchemaTypes } from '@/types'
20
20
 
21
21
  const props = defineProps<{
22
22
  modelValue: SchemaTypes[]
@@ -55,6 +55,7 @@ const childModels = computed({
55
55
  },
56
56
  set: newValue => {
57
57
  // Find the component in modelValue and update it
58
+ // eslint-disable-next-line vue/no-mutating-props
58
59
  props.modelValue[i].value = newValue
59
60
  emit('update:modelValue', props.modelValue)
60
61
  },
@@ -2,7 +2,13 @@
2
2
  <div class="aform__form-element">
3
3
  <label class="aform__field-label" :for="uuid">{{ label }}</label>
4
4
  <span class="aform__checkbox-container aform__input-field">
5
- <input v-model="checkbox" type="checkbox" :id="uuid" class="aform__checkbox" :readonly="readOnly" :required="required" />
5
+ <input
6
+ v-model="checkbox"
7
+ type="checkbox"
8
+ :id="uuid"
9
+ class="aform__checkbox"
10
+ :readonly="readOnly"
11
+ :required="required" />
6
12
  </span>
7
13
  <p class="error" v-show="validation.errorMessage" v-html="validation.errorMessage"></p>
8
14
  </div>
@@ -80,7 +80,7 @@ const onChange = () => {
80
80
  }
81
81
  }
82
82
 
83
- const handleClickOutside = (event: MouseEvent) => {
83
+ const handleClickOutside = () => {
84
84
  closeResults()
85
85
  arrowCounter.value = 0
86
86
  }
@@ -15,7 +15,7 @@ import { ref } from 'vue'
15
15
 
16
16
  import CollapseButton from '@/components/base/CollapseButton.vue'
17
17
  import AForm from '@/components/AForm.vue'
18
- import { SchemaTypes } from 'types/index'
18
+ import { SchemaTypes } from '@/types'
19
19
 
20
20
  const props = defineProps<{
21
21
  schema: SchemaTypes[]
@@ -1,7 +1,13 @@
1
1
  <template>
2
2
  <div class="aform__form-element">
3
3
  <label class="aform__field-label" :for="uuid">{{ label }}</label>
4
- <input class="aform__input-field" v-model="inputNumber" type="number" :id="uuid" :disabled="readonly" :required="required" />
4
+ <input
5
+ class="aform__input-field"
6
+ v-model="inputNumber"
7
+ type="number"
8
+ :id="uuid"
9
+ :disabled="readonly"
10
+ :required="required" />
5
11
  <p class="error" v-show="validation.errorMessage" v-html="validation.errorMessage"></p>
6
12
  </div>
7
13
  </template>
@@ -14,10 +14,10 @@
14
14
  </template>
15
15
 
16
16
  <script setup lang="ts">
17
- import { inject, ref } from 'vue'
17
+ import { /* inject, */ ref } from 'vue'
18
18
 
19
- import { FormSchema } from 'types'
20
19
  import { useStringMask as vMask } from '@/directives/mask'
20
+ import type { FormSchema } from '@/types'
21
21
 
22
22
  withDefaults(
23
23
  defineProps<{
@@ -1,6 +1,7 @@
1
- import type { FormSchema } from 'types'
2
1
  import type { DirectiveBinding } from 'vue'
3
2
 
3
+ import type { FormSchema } from '@/types'
4
+
4
5
  const NAMED_MASKS = {
5
6
  date: '##/##/####',
6
7
  datetime: '####/##/## ##:##',
package/src/index.ts CHANGED
@@ -9,9 +9,16 @@ import AFieldset from '@/components/form/AFieldset.vue'
9
9
  import AForm from '@/components/AForm.vue'
10
10
  import ANumericInput from '@/components/form/ANumericInput.vue'
11
11
  import ATextInput from '@/components/form/ATextInput.vue'
12
+ import Login from '@/components/utilities/Login.vue'
13
+ export type { BasicSchema, FormSchema, TableSchema, FieldsetSchema, SchemaTypes } from '@/types'
12
14
  // import { ACurrency } from '@/components/form/ACurrency.vue'
13
15
  // import { AQuantity } from '@/components/form/AQuantity.vue'
14
16
 
17
+ /**
18
+ * Install all AForm components
19
+ * @param app - Vue app instance
20
+ * @public
21
+ */
15
22
  function install(app: App /* options */) {
16
23
  app.component('ACheckbox', ACheckbox)
17
24
  app.component('ACombobox', AComboBox)
@@ -26,4 +33,16 @@ function install(app: App /* options */) {
26
33
  // app.component('AQuantity', AQuantity)
27
34
  }
28
35
 
29
- export { ACheckbox, AComboBox, ADate, ADropdown, ADatePicker, AFieldset, AForm, ANumericInput, ATextInput, install }
36
+ export {
37
+ ACheckbox,
38
+ AComboBox,
39
+ ADate,
40
+ ADropdown,
41
+ ADatePicker,
42
+ AFieldset,
43
+ AForm,
44
+ ANumericInput,
45
+ ATextInput,
46
+ Login,
47
+ install,
48
+ }
@@ -1 +1 @@
1
- @import url('@stonecrop/themes/default/default.css');
1
+ @import url('@stonecrop/themes/default/default.css');
@@ -1,48 +1,47 @@
1
1
  /* Styles for all types of fields: Text and Number Inputs, Radios, Checkboxes, etc. */
2
- .form-element{
3
- min-width:40ch;
4
- border:1px solid transparent;
5
- padding:0;
6
- margin:0;
7
- margin-right:.5rem;
8
- margin-bottom:.5rem;
2
+ .form-element {
3
+ min-width: 40ch;
4
+ border: 1px solid transparent;
5
+ padding: 0;
6
+ margin: 0;
7
+ margin-right: 0.5rem;
8
+ margin-bottom: 0.5rem;
9
9
  }
10
- .input-field{
11
- outline: 1px solid transparent;
10
+ .input-field {
11
+ outline: 1px solid transparent;
12
12
  border: 1px solid var(--input-border-color);
13
- padding:.25rem;
13
+ padding: 0.25rem;
14
14
  margin: 0 0 0 0;
15
- border-radius: 0 0 0.25rem .25rem;
16
- box-sizing:border-box;
17
- width:100%;
15
+ border-radius: 0 0 0.25rem 0.25rem;
16
+ box-sizing: border-box;
17
+ width: 100%;
18
18
  }
19
- .field-label{
20
- color: var(--input-label-color);
19
+ .field-label {
20
+ color: var(--input-label-color);
21
21
  display: block;
22
22
  min-height: 1.15rem;
23
- padding: .25rem;
23
+ padding: 0.25rem;
24
24
  margin: 0rem;
25
- z-index: 2;
25
+ z-index: 2;
26
26
  font-size: 1rem;
27
- font-weight:bold;
27
+ font-weight: bold;
28
28
  background: white;
29
- width:100%;
30
- box-sizing:border-box;
31
- background:var(--gray-5);
32
- border:1px solid var(--input-border-color);
33
- border-bottom:none;
34
-
29
+ width: 100%;
30
+ box-sizing: border-box;
31
+ background: var(--gray-5);
32
+ border: 1px solid var(--input-border-color);
33
+ border-bottom: none;
35
34
  }
36
- p.error{
35
+ p.error {
37
36
  display: block;
38
37
  min-height: 1.15rem;
39
38
  padding: 0rem;
40
- padding-left:.5rem;
41
- margin: .5rem 0 .25rem 0rem;
39
+ padding-left: 0.5rem;
40
+ margin: 0.5rem 0 0.25rem 0rem;
42
41
  border: 1px solid transparent;
43
- width: 100%;
42
+ width: 100%;
44
43
  color: var(--brand-danger);
45
- font-size: .8rem;
44
+ font-size: 0.8rem;
46
45
  }
47
46
 
48
47
  .input-field:focus {
@@ -56,14 +55,14 @@ p.error{
56
55
  /** CHECKBOX **/
57
56
  .checkbox {
58
57
  visibility: hidden;
59
- display:none;
58
+ display: none;
60
59
  }
61
60
 
62
61
  .checkbox + .custom-checkbox:before {
63
62
  content: '⬡';
64
63
  font-size: 1.2rem;
65
64
  cursor: pointer;
66
- margin-right:.25rem;
65
+ margin-right: 0.25rem;
67
66
  }
68
67
 
69
68
  .checkbox:checked + .custom-checkbox:before {
@@ -72,14 +71,14 @@ p.error{
72
71
 
73
72
  .custom-checkbox {
74
73
  display: inline-block;
75
- line-height:0;
74
+ line-height: 0;
76
75
  }
77
76
 
78
77
  .checkbox-container {
79
- width:100%;
80
- display:inline-block;
78
+ width: 100%;
79
+ display: inline-block;
81
80
  }
82
81
 
83
82
  .checkbox-container:hover + .field-label {
84
83
  color: var(--input-active-label-color);
85
- }
84
+ }
@@ -1,4 +1,2 @@
1
1
  @import url('@stonecrop/themes/default/default.css');
2
2
  @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');
3
-
4
-
@@ -0,0 +1,31 @@
1
+ import ATable from '@stonecrop/atable'
2
+
3
+ export type BasicSchema = {
4
+ component: string
5
+ fieldname: string
6
+ value: any
7
+ }
8
+
9
+ export type FormSchema = BasicSchema & {
10
+ align: string
11
+ edit: boolean
12
+ fieldtype: string
13
+ label: string
14
+ name: string
15
+ width: string
16
+ mask?: string
17
+ }
18
+
19
+ export type TableSchema = BasicSchema & {
20
+ columns: ATable.TableColumn[]
21
+ config: ATable.TableConfig
22
+ rows: ATable.TableRow[]
23
+ }
24
+
25
+ export type FieldsetSchema = BasicSchema & {
26
+ label: string
27
+ schema: (FormSchema | TableSchema)[]
28
+ collapsible?: boolean
29
+ }
30
+
31
+ export type SchemaTypes = FormSchema | TableSchema | FieldsetSchema
@@ -1,26 +0,0 @@
1
- import { defineSetupVue3 } from '@histoire/plugin-vue'
2
-
3
- import ACheckbox from '@/components/form/ACheckbox.vue'
4
- import ADate from '@/components/form/ADate.vue'
5
- import ADatePicker from '@/components/form/ADatePicker.vue'
6
- import AFieldset from '@/components/form/AFieldset.vue'
7
- import AForm from '@/components/AForm.vue'
8
- import ANumericInput from '@/components/form/ANumericInput.vue'
9
- import ATextInput from '@/components/form/ATextInput.vue'
10
-
11
- import { ATable, ATableHeader, ATableModal } from '@stonecrop/atable'
12
- import '@stonecrop/atable/styles'
13
-
14
- export const setupVue3 = defineSetupVue3(({ app }) => {
15
- // TODO: (typing) add typing for ATable components
16
- app.component('ACheckbox', ACheckbox)
17
- app.component('ADate', ADate)
18
- app.component('ADatePicker', ADatePicker)
19
- app.component('AFieldset', AFieldset)
20
- app.component('AForm', AForm)
21
- app.component('ANumericInput', ANumericInput)
22
- app.component('ATable', ATable)
23
- app.component('ATableHeader', ATableHeader)
24
- app.component('ATableModal', ATableModal)
25
- app.component('ATextInput', ATextInput)
26
- })