diff --git a/src/editor/check-box-list/checkbox-list-editor.controller.ts b/src/editor/check-box-list/checkbox-list-editor.controller.ts index 73db271bfa1038a7950cff214f7f7441828f772d..7c30ab6dc62ffba1459d80f34d3bbebeaa9f81dd 100644 --- a/src/editor/check-box-list/checkbox-list-editor.controller.ts +++ b/src/editor/check-box-list/checkbox-list-editor.controller.ts @@ -16,11 +16,23 @@ export class CheckBoxListEditorController extends CodeListEditorController { super.onInit(); if (this.model.appCodeListId) { const app = await ibiz.hub.getApp(this.context.srfappid); this.codeList = app.codeList.getCodeList(this.model.appCodeListId); } + const { editorParams } = this.model; + if (editorParams?.rowNumber) { + this.rowNumber = Number(editorParams.rowNumber); + } } } diff --git a/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.scss b/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.scss index 65a278720995f2b1c49984d7e8d26a3412f69fcd..abd449f6f3a9189e84190e1b883d1b16338fc49d 100644 --- a/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.scss +++ b/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.scss @@ -1,4 +1,8 @@ +$checkbox-list: ( + group-row-number: 0, +); @include b('checkbox-list') { + @include set-component-css-var(checkbox-list, $checkbox-list); @include e('text') { font-size: getCssVar('form-item', 'font-size'); color: getCssVar('form-item', 'text-color'); @@ -9,6 +13,11 @@ line-height: getCssVar(editor, default, line-height); color: getCssVar(form-item, readonly-color); } + + @include e(row-number){ + display: grid; + grid-template-columns: repeat(getCssVar(checkbox-list, group-row-number), 1fr); + } } diff --git a/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.tsx b/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.tsx index a39c2de93ade0c38ad831f8ac0235c0b41456236..9ec12842ad41aea65a93a645e013ed8e2814c848 100644 --- a/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.tsx +++ b/src/editor/check-box-list/ibiz-checkbox-list/ibiz-checkbox-list.tsx @@ -215,6 +215,11 @@ export const IBizCheckboxList = defineComponent({ this.readonly ? this.ns.m('readonly') : '', this.ns.is('show-default', this.showFormDefaultContent), ]} + style={ + this.controller.rowNumber + ? `--ibiz-checkbox-list-group-row-number:${this.controller.rowNumber}` + : '' + } > {this.readonly ? ( this.valueText @@ -222,6 +227,7 @@ export const IBizCheckboxList = defineComponent({ {this.items.map((item, index: number) => ( diff --git a/src/editor/radio-button-list/ibiz-radio/ibiz-radio.scss b/src/editor/radio-button-list/ibiz-radio/ibiz-radio.scss index d4a18e0cdab3ac464aedb38eab5f2bd35c47e50d..be4c942fc1b1db5f51ca0ed6f328c38c1ff0a40c 100644 --- a/src/editor/radio-button-list/ibiz-radio/ibiz-radio.scss +++ b/src/editor/radio-button-list/ibiz-radio/ibiz-radio.scss @@ -1,5 +1,9 @@ +$radio: ( + group-row-number: 0, +); /* stylelint-disable no-descending-specificity */ @include b(radio) { + @include set-component-css-var(radio, $radio); @include e(text) { font-size: getCssVar(form-item, font-size); color: getCssVar(form-item, text-color); @@ -51,6 +55,11 @@ } } } + + @include e(row-number){ + display: grid; + grid-template-columns: repeat(getCssVar(radio, group-row-number), 1fr); + } } diff --git a/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx b/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx index d5f2dadbe323fa970bf804ba9d078c627b53558b..766592c7add433e6f51bd61b669733af246c00b6 100644 --- a/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx +++ b/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx @@ -125,13 +125,21 @@ export const IBizRadio = defineComponent({ this.readonly ? this.ns.m('readonly') : '', this.ns.is('show-default', this.showFormDefaultContent), ]} + style={ + this.controller.rowNumber + ? `--ibiz-radio-group-row-number:${this.controller.rowNumber}` + : '' + } ref='editorRef' > {this.readonly ? ( this.valueText ) : ( {} +export class RadioButtonListEditorController extends CodeListEditorController { + /** + * 单选一行展示几个 + * @author fangZhiHao + * @date 2024-07-17 10:07:40 + * @type {(number | undefined)} + */ + rowNumber: number | undefined = undefined; + + protected async onInit(): Promise { + super.onInit(); + const { editorParams } = this.model; + if (editorParams?.rowNumber) { + this.rowNumber = Number(editorParams.rowNumber); + } + } +}