From b78acd4eb7cecdfacdae0957cb9daa0520603448 Mon Sep 17 00:00:00 2001 From: smithoo Date: Thu, 21 Nov 2024 13:42:25 +0900 Subject: [PATCH] fix(SSR): apply lazy ID & browser check for SSR render (#290) --- .../vs-checkbox-set/VsCheckboxSet.vue | 5 +---- .../vlossom/src/components/vs-footer/types.ts | 1 + .../vlossom/src/components/vs-header/types.ts | 1 + .../src/components/vs-radio-set/VsRadioSet.vue | 5 +---- .../vlossom/src/components/vs-table/VsTable.vue | 1 - .../src/components/vs-table/VsTableBody.vue | 1 - packages/vlossom/src/composables/index.ts | 1 + .../vlossom/src/composables/input-composable.ts | 5 ++--- .../src/composables/input-form-composable.ts | 10 ++++++++-- .../src/composables/lazy-id-composable.ts | 17 +++++++++++++++++ .../nodes/vs-checkbox-node/VsCheckboxNode.vue | 5 ++--- .../src/nodes/vs-focus-trap/VsFocusTrap.vue | 2 +- .../src/nodes/vs-radio-node/VsRadioNode.vue | 5 ++--- packages/vlossom/src/styles/variables.scss | 1 + packages/vlossom/src/utils/dom.ts | 3 +++ packages/vlossom/src/vlossom-framework.ts | 17 +++++++++++++---- 16 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 packages/vlossom/src/composables/lazy-id-composable.ts diff --git a/packages/vlossom/src/components/vs-checkbox-set/VsCheckboxSet.vue b/packages/vlossom/src/components/vs-checkbox-set/VsCheckboxSet.vue index ae1127d5c..54846969e 100644 --- a/packages/vlossom/src/components/vs-checkbox-set/VsCheckboxSet.vue +++ b/packages/vlossom/src/components/vs-checkbox-set/VsCheckboxSet.vue @@ -27,7 +27,7 @@ :checked="isChecked(option)" :dense="dense" :disabled="computedDisabled" - :id="`${computedId}-${optionIds[index]}`" + :id="`${computedId}-${index}`" :label="getOptionLabel(option)" :name="name" :readonly="computedReadonly" @@ -231,12 +231,9 @@ export default defineComponent({ checkboxRefs.value[0]?.blur(); } - const optionIds = computed(() => options.value.map(() => utils.string.createID())); - return { computedId, checkboxRefs, - optionIds, classObj, computedColorScheme, computedState, diff --git a/packages/vlossom/src/components/vs-footer/types.ts b/packages/vlossom/src/components/vs-footer/types.ts index cfa54155c..cf0f6b5d5 100644 --- a/packages/vlossom/src/components/vs-footer/types.ts +++ b/packages/vlossom/src/components/vs-footer/types.ts @@ -5,4 +5,5 @@ export interface VsFooterStyleSet { height?: string; padding?: string; width?: string; + zIndex?: string; } diff --git a/packages/vlossom/src/components/vs-header/types.ts b/packages/vlossom/src/components/vs-header/types.ts index a0d0cb077..86a32a725 100644 --- a/packages/vlossom/src/components/vs-header/types.ts +++ b/packages/vlossom/src/components/vs-header/types.ts @@ -5,4 +5,5 @@ export interface VsHeaderStyleSet { height?: string; padding?: string; width?: string; + zIndex?: string; } diff --git a/packages/vlossom/src/components/vs-radio-set/VsRadioSet.vue b/packages/vlossom/src/components/vs-radio-set/VsRadioSet.vue index 9efd24439..dcd267ed3 100644 --- a/packages/vlossom/src/components/vs-radio-set/VsRadioSet.vue +++ b/packages/vlossom/src/components/vs-radio-set/VsRadioSet.vue @@ -27,7 +27,7 @@ :checked="isChecked(option)" :dense="dense" :disabled="computedDisabled" - :id="`${computedId}-${optionIds[index]}`" + :id="`${computedId}-${index}`" :label="getOptionLabel(option)" :name="name" :readonly="computedReadonly" @@ -188,12 +188,9 @@ export default defineComponent({ radioRefs.value[0]?.blur(); } - const optionIds = computed(() => options.value.map(() => utils.string.createID())); - return { computedId, radioRefs, - optionIds, classObj, computedColorScheme, computedState, diff --git a/packages/vlossom/src/components/vs-table/VsTable.vue b/packages/vlossom/src/components/vs-table/VsTable.vue index 0cd6d5f8b..96367b0c2 100644 --- a/packages/vlossom/src/components/vs-table/VsTable.vue +++ b/packages/vlossom/src/components/vs-table/VsTable.vue @@ -25,7 +25,6 @@