Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aform, atable] added file attach component #122

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"dependencies": {
"@stonecrop/themes": "workspace:*",
"@stonecrop/utilities": "workspace:*",
"@vueuse/core": "^10.11.0",
"vue": "^3.4.31"
},
"devDependencies": {
Expand Down
36 changes: 36 additions & 0 deletions aform/src/components/form/AFileAttach.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<button type="button" @click="open()">
{{ props.label }}
</button>
&nbsp;
<button type="button" :disabled="!files" @click="reset()">Reset</button>

<template v-if="files">
<div>
<p>
You have selected: <b>{{ `${files.length} ${files.length === 1 ? 'file' : 'files'}` }}</b>
</p>
<li v-for="file of files" :key="file.name">
{{ file.name }}
</li>
</div>
</template>
</template>

<script setup lang="ts">
import { useFileDialog } from '@vueuse/core'
import { SchemaTypes } from 'types/index'

const props = defineProps<{
schema: SchemaTypes[]
label: string
collapsible?: boolean
data?: any
}>()

const { files, open, reset, onChange } = useFileDialog()

onChange(files => {
return files
})
</script>
5 changes: 4 additions & 1 deletion aform/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import AFieldset from '@/components/form/AFieldset.vue'
import AForm from '@/components/AForm.vue'
import ANumericInput from '@/components/form/ANumericInput.vue'
import ATextInput from '@/components/form/ATextInput.vue'
import AFileAttach from '@/components/form/AFileAttach.vue'
import Login from '@/components/utilities/Login.vue'
export type { BasicSchema, FormSchema, TableSchema, FieldsetSchema, SchemaTypes } from '@/types'
// import { ACurrency } from '@/components/form/ACurrency.vue'
Expand All @@ -29,6 +30,7 @@ function install(app: App /* options */) {
app.component('AForm', AForm)
app.component('ANumericInput', ANumericInput)
app.component('ATextInput', ATextInput)
app.component('AFileAttach', AFileAttach)
// app.component('ACurrency', ACurrency)
// app.component('AQuantity', AQuantity)
}
Expand All @@ -37,9 +39,10 @@ export {
ACheckbox,
AComboBox,
ADate,
ADropdown,
ADatePicker,
ADropdown,
AFieldset,
AFileAttach,
AForm,
ANumericInput,
ATextInput,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-plugin-manifest.schema.json",
"plugins": [
{
"pluginName": "rush-sort-package-json",
"description": "Rush plugin for sort package.json file in the project",
"commandLineJsonFilePath": "command-line.json"
}
]
}
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-plugin-manifest.schema.json",
"plugins": [
{
"pluginName": "rush-sort-package-json",
"description": "Rush plugin for sort package.json file in the project",
"commandLineJsonFilePath": "command-line.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
"commands": [
{
"name": "sort-package-json",
"commandKind": "global",
"summary": "Rush plugin for sort package.json file in the project",
"shellCommand": "node <packageFolder>/lib/index.js",
"safeForSimultaneousRushProcesses": true
}
]
}
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
"commands": [
{
"name": "sort-package-json",
"commandKind": "global",
"summary": "Rush plugin for sort package.json file in the project",
"shellCommand": "node <packageFolder>/lib/index.js",
"safeForSimultaneousRushProcesses": true
}
]
}
10 changes: 10 additions & 0 deletions common/changes/@stonecrop/aform/file-attach_2024-04-25-18-48.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/aform",
"comment": "added attach file component",
"type": "none"
}
],
"packageName": "@stonecrop/aform"
}
10 changes: 10 additions & 0 deletions common/changes/@stonecrop/aform/file-attach_2024-05-06-09-15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/aform",
"comment": "upgraded vueuse package",
"type": "none"
}
],
"packageName": "@stonecrop/aform"
}
10 changes: 10 additions & 0 deletions common/changes/@stonecrop/atable/file-attach_2024-04-25-18-48.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/atable",
"comment": "reused attach file component from aform",
"type": "none"
}
],
"packageName": "@stonecrop/atable"
}
10 changes: 10 additions & 0 deletions common/changes/@stonecrop/atable/file-attach_2024-05-06-09-15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/atable",
"comment": "upgraded vueuse package",
"type": "none"
}
],
"packageName": "@stonecrop/atable"
}
Loading
Loading