diff --git a/aform/CHANGELOG.json b/aform/CHANGELOG.json index cc5ec553..eba829b3 100644 --- a/aform/CHANGELOG.json +++ b/aform/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@stonecrop/aform", "entries": [ + { + "version": "0.3.8", + "tag": "@stonecrop/aform_v0.3.8", + "date": "Thu, 09 Jan 2025 11:21:58 GMT", + "comments": { + "patch": [ + { + "comment": "add strict null checks to improve logic" + } + ] + } + }, { "version": "0.3.7", "tag": "@stonecrop/aform_v0.3.7", diff --git a/aform/CHANGELOG.md b/aform/CHANGELOG.md index 508bb6b9..75c452cb 100644 --- a/aform/CHANGELOG.md +++ b/aform/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @stonecrop/aform -This log was last generated on Fri, 03 Jan 2025 06:27:07 GMT and should not be manually modified. +This log was last generated on Thu, 09 Jan 2025 11:21:58 GMT and should not be manually modified. + +## 0.3.8 +Thu, 09 Jan 2025 11:21:58 GMT + +### Patches + +- add strict null checks to improve logic ## 0.3.7 Fri, 03 Jan 2025 06:27:07 GMT diff --git a/aform/package.json b/aform/package.json index 3c526fc0..9b6e9bc1 100644 --- a/aform/package.json +++ b/aform/package.json @@ -1,6 +1,6 @@ { "name": "@stonecrop/aform", - "version": "0.3.7", + "version": "0.3.8", "license": "MIT", "type": "module", "author": { diff --git a/aform/src/directives/mask.ts b/aform/src/directives/mask.ts index 008d7067..d335ec0f 100644 --- a/aform/src/directives/mask.ts +++ b/aform/src/directives/mask.ts @@ -43,12 +43,12 @@ function getMask(binding: DirectiveBinding) { if (maskFn) { // TODO: (state) replace with state management; // pass the entire form/table data to the function - const locale = binding.instance['locale'] + const locale = binding.instance?.['locale'] mask = maskFn(locale) } } else { // TODO: (state) handle using state management - const schema = binding.instance['schema'] as FormSchema + const schema = binding.instance?.['schema'] as FormSchema const fieldType: string | undefined = schema?.fieldtype?.toLowerCase() if (fieldType && NAMED_MASKS[fieldType]) { mask = NAMED_MASKS[fieldType] @@ -127,7 +127,7 @@ export function useStringMask(el: HTMLInputElement, binding: DirectiveBinding { const $prevMonthBtn = wrapper.find('#previous-month-btn') await $prevMonthBtn.trigger('click') - expect(wrapper.vm.currentMonth).toBe(new Date().getMonth() - 1) + + const currentMonth = new Date().getMonth() + if (currentMonth === 0) { + expect(wrapper.vm.currentMonth).toBe(11) + } else { + expect(wrapper.vm.currentMonth).toBe(currentMonth - 1) + } }) it('select previous year', async () => { diff --git a/atable/CHANGELOG.json b/atable/CHANGELOG.json index ddd34603..e1a76556 100644 --- a/atable/CHANGELOG.json +++ b/atable/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@stonecrop/atable", "entries": [ + { + "version": "0.3.8", + "tag": "@stonecrop/atable_v0.3.8", + "date": "Thu, 09 Jan 2025 11:21:58 GMT", + "comments": { + "patch": [ + { + "comment": "add strict null checks to improve logic" + } + ] + } + }, { "version": "0.3.7", "tag": "@stonecrop/atable_v0.3.7", diff --git a/atable/CHANGELOG.md b/atable/CHANGELOG.md index 850f07f0..ca11f914 100644 --- a/atable/CHANGELOG.md +++ b/atable/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @stonecrop/atable -This log was last generated on Fri, 03 Jan 2025 06:27:07 GMT and should not be manually modified. +This log was last generated on Thu, 09 Jan 2025 11:21:58 GMT and should not be manually modified. + +## 0.3.8 +Thu, 09 Jan 2025 11:21:58 GMT + +### Patches + +- add strict null checks to improve logic ## 0.3.7 Fri, 03 Jan 2025 06:27:07 GMT diff --git a/atable/package.json b/atable/package.json index 6ef5e96f..5ae7a008 100644 --- a/atable/package.json +++ b/atable/package.json @@ -1,6 +1,6 @@ { "name": "@stonecrop/atable", - "version": "0.3.7", + "version": "0.3.8", "license": "MIT", "type": "module", "author": { diff --git a/atable/src/components/ACell.vue b/atable/src/components/ACell.vue index bfb984ad..44ead2d2 100644 --- a/atable/src/components/ACell.vue +++ b/atable/src/components/ACell.vue @@ -90,9 +90,9 @@ const showModal = () => { state.modal.visible = true state.modal.colIndex = colIndex state.modal.rowIndex = rowIndex - state.modal.parent = cellRef.value - state.modal.top = cellRef.value.offsetTop + cellRef.value.offsetHeight - state.modal.left = cellRef.value.offsetLeft + state.modal.parent = cellRef.value! + state.modal.top = cellRef.value!.offsetTop + cellRef.value!.offsetHeight + state.modal.left = cellRef.value!.offsetLeft state.modal.width = width.value state.modal.height = height.value @@ -146,7 +146,7 @@ if (addNavigation) { const onFocus = () => { if (cellRef.value) { - currentData.value = cellRef.value.textContent + currentData.value = cellRef.value.textContent! } } @@ -156,14 +156,14 @@ const updateCellData = (payload: Event) => { return } - emit('cellInput', colIndex, rowIndex, target.textContent, currentData.value) - currentData.value = target.textContent + emit('cellInput', colIndex, rowIndex, target.textContent!, currentData.value) + currentData.value = target.textContent! // only apply changes if the cell value has changed after being mounted if (column.format) { cellModified.value = target.textContent !== store.getFormattedValue(colIndex, rowIndex, originalData) // TODO: need to setup reverse format function? - store.setCellText(colIndex, rowIndex, target.textContent) + store.setCellText(colIndex, rowIndex, target.textContent!) } else { cellModified.value = target.textContent !== originalData store.setCellData(colIndex, rowIndex, target.textContent) diff --git a/atable/src/components/ARow.vue b/atable/src/components/ARow.vue index f3c3e954..b9007dea 100644 --- a/atable/src/components/ARow.vue +++ b/atable/src/components/ARow.vue @@ -26,7 +26,7 @@