From 1d2072346bd46ed9183c0bf1d42fb44aa9fa4572 Mon Sep 17 00:00:00 2001 From: Devarsh Bhatt Date: Fri, 26 Apr 2024 00:06:17 +0530 Subject: [PATCH 1/3] [aform, atable] added file attach component --- aform/package.json | 3 +- aform/src/components/form/AFileAttach.vue | 31 +++++++++++++++++++++ aform/src/histoire.setup.ts | 3 ++ aform/src/index.ts | 4 ++- aform/stories/assets/basic_form_schema.json | 5 ++++ atable/src/histoire.setup.ts | 3 +- atable/stories/list.story.vue | 5 ++++ common/config/rush/pnpm-lock.yaml | 3 ++ 8 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 aform/src/components/form/AFileAttach.vue diff --git a/aform/package.json b/aform/package.json index e3f114af..2ae8e63a 100644 --- a/aform/package.json +++ b/aform/package.json @@ -46,7 +46,8 @@ "@stonecrop/themes": "workspace:*", "@stonecrop/utilities": "workspace:*", "uuid": "^9.0.0", - "vue": "^3.4.23" + "vue": "^3.4.23", + "@vueuse/core": "^9.13.0" }, "devDependencies": { "@histoire/plugin-vue": "^0.17.17", diff --git a/aform/src/components/form/AFileAttach.vue b/aform/src/components/form/AFileAttach.vue new file mode 100644 index 00000000..df10fa3e --- /dev/null +++ b/aform/src/components/form/AFileAttach.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/aform/src/histoire.setup.ts b/aform/src/histoire.setup.ts index d8875bed..6c9997b4 100644 --- a/aform/src/histoire.setup.ts +++ b/aform/src/histoire.setup.ts @@ -5,6 +5,8 @@ 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 { ATable, ATableHeader, ATableModal } from '@stonecrop/atable' import '@stonecrop/atable/styles' @@ -19,4 +21,5 @@ export const setupVue3 = defineSetupVue3(({ app }) => { app.component('ATableHeader', ATableHeader) app.component('ATableModal', ATableModal) app.component('ATextInput', ATextInput) + app.component('AFileAttach', AFileAttach) }) diff --git a/aform/src/index.ts b/aform/src/index.ts index 74554cb5..25931e77 100644 --- a/aform/src/index.ts +++ b/aform/src/index.ts @@ -8,6 +8,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 { ACurrency } from '@/components/form/ACurrency.vue' // import { AQuantity } from '@/components/form/AQuantity.vue' @@ -20,8 +21,9 @@ 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) } -export { ACheckbox, AComboBox, ADate, ADropdown, AFieldset, AForm, ANumericInput, ATextInput, install } +export { ACheckbox, AComboBox, ADate, ADropdown, AFieldset, AForm, ANumericInput, ATextInput, AFileAttach, install } diff --git a/aform/stories/assets/basic_form_schema.json b/aform/stories/assets/basic_form_schema.json index fd09981e..8df0fc2e 100644 --- a/aform/stories/assets/basic_form_schema.json +++ b/aform/stories/assets/basic_form_schema.json @@ -37,5 +37,10 @@ "component": "ATextInput", "label": "Phone", "mask": "(locale) => { if (locale === 'en-US') { return '(###) ###-####' } else if (locale === 'en-IN') { return '####-######'} }" + }, + { + "fieldname": "attach_file", + "component": "AFileAttach", + "label": "Attach Files" } ] diff --git a/atable/src/histoire.setup.ts b/atable/src/histoire.setup.ts index d5a19b6e..6c86c499 100644 --- a/atable/src/histoire.setup.ts +++ b/atable/src/histoire.setup.ts @@ -7,7 +7,7 @@ import ATable from '@/components/ATable.vue' import ATableHeader from '@/components/ATableHeader.vue' import ATableModal from '@/components/ATableModal.vue' -import { ADate, AForm, ANumericInput, ATextInput } from '@stonecrop/aform' +import { ADate, AForm, ANumericInput, ATextInput, AFileAttach } from '@stonecrop/aform' export const setupVue3 = defineSetupVue3(({ app }) => { // TODO: (typing) add typing for ADate @@ -21,4 +21,5 @@ export const setupVue3 = defineSetupVue3(({ app }) => { app.component('ATableHeader', ATableHeader) app.component('ATableModal', ATableModal) app.component('ATextInput', ATextInput) + app.component('AFileAttach', AFileAttach) }) diff --git a/atable/stories/list.story.vue b/atable/stories/list.story.vue index b43f894c..abfd176e 100644 --- a/atable/stories/list.story.vue +++ b/atable/stories/list.story.vue @@ -156,6 +156,11 @@ const basic_form_schema = ref([ component: 'ATextInput', label: 'Phone', }, + { + fieldname: "attach_file", + component: "AFileAttach", + label: "Attach Files" + } ]) const http_logs = ref({ diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index adf22c96..4c7a22ae 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -16,6 +16,9 @@ importers: '@stonecrop/utilities': specifier: workspace:* version: link:../utilities + '@vueuse/core': + specifier: ^9.13.0 + version: 9.13.0(vue@3.4.23) uuid: specifier: ^9.0.0 version: 9.0.1 From 034c851a20091cd2395a13af35250653edce5fc8 Mon Sep 17 00:00:00 2001 From: Devarsh Bhatt Date: Fri, 26 Apr 2024 12:23:25 +0530 Subject: [PATCH 2/3] [aform, atable] added changelog --- .../@stonecrop/aform/file-attach_2024-04-25-18-48.json | 10 ++++++++++ .../atable/file-attach_2024-04-25-18-48.json | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 common/changes/@stonecrop/aform/file-attach_2024-04-25-18-48.json create mode 100644 common/changes/@stonecrop/atable/file-attach_2024-04-25-18-48.json diff --git a/common/changes/@stonecrop/aform/file-attach_2024-04-25-18-48.json b/common/changes/@stonecrop/aform/file-attach_2024-04-25-18-48.json new file mode 100644 index 00000000..b76b9a30 --- /dev/null +++ b/common/changes/@stonecrop/aform/file-attach_2024-04-25-18-48.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@stonecrop/aform", + "comment": "added attach file component", + "type": "none" + } + ], + "packageName": "@stonecrop/aform" +} \ No newline at end of file diff --git a/common/changes/@stonecrop/atable/file-attach_2024-04-25-18-48.json b/common/changes/@stonecrop/atable/file-attach_2024-04-25-18-48.json new file mode 100644 index 00000000..db1a5c1c --- /dev/null +++ b/common/changes/@stonecrop/atable/file-attach_2024-04-25-18-48.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@stonecrop/atable", + "comment": "reused attach file component from aform", + "type": "none" + } + ], + "packageName": "@stonecrop/atable" +} \ No newline at end of file From a76e43af59c421c43453d12934e99ca46bf63037 Mon Sep 17 00:00:00 2001 From: Devarsh Bhatt Date: Mon, 6 May 2024 14:54:43 +0530 Subject: [PATCH 3/3] [aForm, atable] upgrade vueuse for file attach --- aform/package.json | 2 +- aform/src/components/form/AFileAttach.vue | 47 ++++++++++--------- .../aform/file-attach_2024-05-06-09-15.json | 10 ++++ .../atable/file-attach_2024-05-06-09-15.json | 10 ++++ common/config/rush/pnpm-lock.yaml | 4 +- 5 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 common/changes/@stonecrop/aform/file-attach_2024-05-06-09-15.json create mode 100644 common/changes/@stonecrop/atable/file-attach_2024-05-06-09-15.json diff --git a/aform/package.json b/aform/package.json index 2ae8e63a..5321ee45 100644 --- a/aform/package.json +++ b/aform/package.json @@ -47,7 +47,7 @@ "@stonecrop/utilities": "workspace:*", "uuid": "^9.0.0", "vue": "^3.4.23", - "@vueuse/core": "^9.13.0" + "@vueuse/core": "^10.9.0" }, "devDependencies": { "@histoire/plugin-vue": "^0.17.17", diff --git a/aform/src/components/form/AFileAttach.vue b/aform/src/components/form/AFileAttach.vue index df10fa3e..c5dce0a3 100644 --- a/aform/src/components/form/AFileAttach.vue +++ b/aform/src/components/form/AFileAttach.vue @@ -1,31 +1,36 @@ \ No newline at end of file +const { files, open, reset, onChange } = useFileDialog() + +onChange(files => { + return files +}) + diff --git a/common/changes/@stonecrop/aform/file-attach_2024-05-06-09-15.json b/common/changes/@stonecrop/aform/file-attach_2024-05-06-09-15.json new file mode 100644 index 00000000..537d5196 --- /dev/null +++ b/common/changes/@stonecrop/aform/file-attach_2024-05-06-09-15.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@stonecrop/aform", + "comment": "upgraded vueuse package", + "type": "none" + } + ], + "packageName": "@stonecrop/aform" +} \ No newline at end of file diff --git a/common/changes/@stonecrop/atable/file-attach_2024-05-06-09-15.json b/common/changes/@stonecrop/atable/file-attach_2024-05-06-09-15.json new file mode 100644 index 00000000..eda24b52 --- /dev/null +++ b/common/changes/@stonecrop/atable/file-attach_2024-05-06-09-15.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@stonecrop/atable", + "comment": "upgraded vueuse package", + "type": "none" + } + ], + "packageName": "@stonecrop/atable" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4c7a22ae..d275229e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -17,8 +17,8 @@ importers: specifier: workspace:* version: link:../utilities '@vueuse/core': - specifier: ^9.13.0 - version: 9.13.0(vue@3.4.23) + specifier: ^10.9.0 + version: 10.9.0(vue@3.4.23) uuid: specifier: ^9.0.0 version: 9.0.1