From 9f53208ae80ea6cc4667a03aed1f23726ef5ad47 Mon Sep 17 00:00:00 2001 From: hisoka0728 <1399952343@qq.com> Date: Wed, 17 Jul 2024 20:11:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=95=E9=80=89=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A1=86=E5=A4=9A=E9=80=89=E5=88=97=E8=A1=A8=E6=A1=86=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=BC=96=E8=BE=91=E5=99=A8=E5=8F=82=E6=95=B0rowNumber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkbox-list-editor.controller.ts | 12 ++++++++++++ .../ibiz-checkbox-list/ibiz-checkbox-list.scss | 9 +++++++++ .../ibiz-checkbox-list/ibiz-checkbox-list.tsx | 6 ++++++ .../ibiz-radio/ibiz-radio.scss | 9 +++++++++ .../ibiz-radio/ibiz-radio.tsx | 10 +++++++++- .../radio-button-list.controller.ts | 18 +++++++++++++++++- 6 files changed, 62 insertions(+), 2 deletions(-) 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 73db271bf..7c30ab6dc 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 65a278720..abd449f6f 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 a39c2de93..9ec12842a 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 d4a18e0cd..be4c942fc 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 d5f2dadbe..766592c7a 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); + } + } +} -- Gitee