diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0b011065..b34b465e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: registry-url: https://npm.pkg.github.com/ - name: Install Rush - run: node common/scripts/install-run-rush.js install + run: node common/scripts/install-run-rush.js install && node common/scripts/install-run-rush.js build - name: Run Tests working-directory: ./aform @@ -86,7 +86,7 @@ jobs: registry-url: https://npm.pkg.github.com/ - name: Install Rush - run: node common/scripts/install-run-rush.js install + run: node common/scripts/install-run-rush.js install && node common/scripts/install-run-rush.js build - name: Run Tests working-directory: ./atable diff --git a/aform/src/components/form/ADate.vue b/aform/src/components/form/ADate.vue index c045b50a..b40d1ceb 100644 --- a/aform/src/components/form/ADate.vue +++ b/aform/src/components/form/ADate.vue @@ -1,277 +1,94 @@ diff --git a/aform/src/components/form/ADatePicker.vue b/aform/src/components/form/ADatePicker.vue new file mode 100644 index 00000000..ba1a91fd --- /dev/null +++ b/aform/src/components/form/ADatePicker.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/aform/src/histoire.setup.ts b/aform/src/histoire.setup.ts index d8875bed..f39f7e75 100644 --- a/aform/src/histoire.setup.ts +++ b/aform/src/histoire.setup.ts @@ -1,6 +1,8 @@ import { defineSetupVue3 } from '@histoire/plugin-vue' import ACheckbox from '@/components/form/ACheckbox.vue' +import ADate from '@/components/form/ADate.vue' +import ADatePicker from '@/components/form/ADatePicker.vue' import AFieldset from '@/components/form/AFieldset.vue' import AForm from '@/components/AForm.vue' import ANumericInput from '@/components/form/ANumericInput.vue' @@ -12,6 +14,8 @@ import '@stonecrop/atable/styles' export const setupVue3 = defineSetupVue3(({ app }) => { // TODO: (typing) add typing for ATable components app.component('ACheckbox', ACheckbox) + app.component('ADate', ADate) + app.component('ADatePicker', ADatePicker) app.component('AFieldset', AFieldset) app.component('AForm', AForm) app.component('ANumericInput', ANumericInput) diff --git a/aform/src/index.ts b/aform/src/index.ts index 74554cb5..0afeea9c 100644 --- a/aform/src/index.ts +++ b/aform/src/index.ts @@ -4,6 +4,7 @@ import ACheckbox from '@/components/form/ACheckbox.vue' import AComboBox from '@/components/form/AComboBox.vue' import ADate from '@/components/form/ADate.vue' import ADropdown from '@/components/form/ADropdown.vue' +import ADatePicker from '@/components/form/ADatePicker.vue' import AFieldset from '@/components/form/AFieldset.vue' import AForm from '@/components/AForm.vue' import ANumericInput from '@/components/form/ANumericInput.vue' @@ -16,6 +17,7 @@ function install(app: App /* options */) { app.component('ACombobox', AComboBox) app.component('ADate', ADate) app.component('ADropdown', ADropdown) + app.component('ADatePicker', ADatePicker) app.component('AFieldset', AFieldset) app.component('AForm', AForm) app.component('ANumericInput', ANumericInput) @@ -24,4 +26,4 @@ function install(app: App /* options */) { // app.component('AQuantity', AQuantity) } -export { ACheckbox, AComboBox, ADate, ADropdown, AFieldset, AForm, ANumericInput, ATextInput, install } +export { ACheckbox, AComboBox, ADate, ADropdown, ADatePicker, AFieldset, AForm, ANumericInput, ATextInput, install } diff --git a/aform/src/theme/adate.css b/aform/src/theme/adate.css new file mode 100644 index 00000000..6734f5d8 --- /dev/null +++ b/aform/src/theme/adate.css @@ -0,0 +1,49 @@ +.adatepicker { + font-size: var(--table-font-size); + display: inline-table; + color: var(--cell-text-color); + outline: none; + border-collapse: collapse; + /* width: calc(100% - 4px); */ +} + +.adatepicker tr { + height: 1.15rem; + height: 1.15rem; + text-align: center; + vertical-align: middle; +} + +.adatepicker td { + border: 2px solid transparent; + outline: 2px solid transparent; + min-width: 3ch; + max-width: 3ch; +} + +.adatepicker td:focus, +.adatepicker td:focus-within { + outline: 1px dashed black; + box-shadow: none; + overflow: hidden; + min-height: 1.15em; + max-height: 1.15em; + overflow: hidden; +} +.adatepicker .selectedDate { + outline: 1px solid black; + background: var(--gray-20); + font-weight: bolder; +} + +.adatepicker .todaysDate { + font-weight: bolder; + text-decoration: underline; + color: black; +} +.days-header > td { + font-weight: bold; +} +.prev-date { + color: var(--gray-20); +} diff --git a/aform/stories/assets/basic_table_schema.json b/aform/stories/assets/basic_table_schema.json index 9e2c7e71..bf38d8a5 100644 --- a/aform/stories/assets/basic_table_schema.json +++ b/aform/stories/assets/basic_table_schema.json @@ -44,6 +44,7 @@ "name": "report_date", "fieldname": "report_date", "fieldtype": "component", + "modalComponent": "ADatePicker", "align": "center", "edit": true, "width": "25ch", diff --git a/aform/stories/assets/fieldset_table_schema.json b/aform/stories/assets/fieldset_table_schema.json index ba970425..78b3e1f5 100644 --- a/aform/stories/assets/fieldset_table_schema.json +++ b/aform/stories/assets/fieldset_table_schema.json @@ -49,6 +49,7 @@ "name": "report_date", "fieldname": "report_date", "fieldtype": "component", + "modalComponent": "ADatePicker", "align": "center", "edit": true, "width": "25ch", diff --git a/aform/stories/date.story.vue b/aform/stories/date.story.vue new file mode 100644 index 00000000..8ac3753d --- /dev/null +++ b/aform/stories/date.story.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/aform/stories/dropdown.story.vue b/aform/stories/dropdown.story.vue index edb5269c..48f7ddb9 100644 --- a/aform/stories/dropdown.story.vue +++ b/aform/stories/dropdown.story.vue @@ -1,5 +1,5 @@