diff --git a/src/editor/autocomplete/autocomplete-editor.controller.ts b/src/editor/autocomplete/autocomplete-editor.controller.ts index 945f9b92ba21e9b94ccc6d474118438c1920243d..7e88cc17dfe17d4701b83f7e506110e25a2786fb 100644 --- a/src/editor/autocomplete/autocomplete-editor.controller.ts +++ b/src/editor/autocomplete/autocomplete-editor.controller.ts @@ -1,7 +1,6 @@ import { IHttpResponse, RuntimeModelError } from '@ibiz-template/core'; -import { EditorController } from '@ibiz-template/runtime'; +import { EditorController, getDeACMode } from '@ibiz-template/runtime'; import { - IAppDataEntity, IAppDEACMode, IAutoComplete, IDEACModeDataItem, @@ -32,11 +31,6 @@ export class AutoCompleteEditorController extends EditorController { super.onInit(); if (this.model.appDataEntityId) { - this.appDataEntity = await ibiz.hub.getAppDataEntity( - this.model.appDataEntityId, - this.context.srfappid, - )!; - if (this.appDataEntity) { - this.keyName = this.appDataEntity.keyAppDEFieldId!; - this.textName = this.appDataEntity.majorAppDEFieldId!; - this.getAcParams(); - this.sort = this.getAcSort(); - } - } - } - - /** - * 获取Ac参数 - */ - public getAcParams() { - if (this.appDataEntity?.codeName) { - this.serviceName = this.appDataEntity.codeName; - } - if (this.model.appDEDataSetId) { - this.interfaceName = this.model.appDEDataSetId; - } - if (this.appDataEntity?.appDEACModes) { - this.deACMode = this.appDataEntity.appDEACModes[0]; - if (this.deACMode.textAppDEFieldId) { - this.textName = this.deACMode.textAppDEFieldId; - } - if (this.deACMode.valueAppDEFieldId) { - this.keyName = this.deACMode.valueAppDEFieldId; + if (this.model.appDEDataSetId) { + this.interfaceName = this.model.appDEDataSetId; } - if (this.deACMode.deacmodeDataItems) { - this.deACMode.deacmodeDataItems.forEach(dataItem => { - if (dataItem.id !== 'value' && dataItem.id !== 'text') { - this.dataItems.push(dataItem); + if (this.model.appDEACModeId) { + this.deACMode = await getDeACMode( + this.model.appDEACModeId, + this.model.appDataEntityId, + this.context.srfappid, + ); + if (this.deACMode) { + // 自填模式相关 + const { minorSortAppDEFieldId, minorSortDir } = this.deACMode; + if (minorSortAppDEFieldId && minorSortDir) { + this.sort = `${minorSortAppDEFieldId.toLowerCase()},${minorSortDir.toLowerCase()}`; } - }); - } - } - } - - /** - * 获取自填模式sort排序 - */ - public getAcSort() { - if (this.deACMode) { - const { minorSortAppDEFieldId, minorSortDir } = this.deACMode; - if (minorSortAppDEFieldId && minorSortDir) { - return `${minorSortAppDEFieldId.toLowerCase()},${minorSortDir.toLowerCase()}`; + if (this.deACMode.textAppDEFieldId) { + this.textName = this.deACMode.textAppDEFieldId; + } + if (this.deACMode.valueAppDEFieldId) { + this.keyName = this.deACMode.valueAppDEFieldId; + } + if (this.deACMode.deacmodeDataItems) { + this.dataItems = []; + this.deACMode.deacmodeDataItems.forEach( + (dataItem: IDEACModeDataItem) => { + if (dataItem.id !== 'value' && dataItem.id !== 'text') { + this.dataItems.push(dataItem); + } + }, + ); + } + } } } - return undefined; } /** @@ -141,10 +112,14 @@ export class AutoCompleteEditorController extends EditorController; } throw new RuntimeModelError(this.model, '请配置实体和实体数据集'); diff --git a/src/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.tsx b/src/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.tsx index e838f048225979bda47c74fc474705161f1edaed..3ebaaa1218f28c2ce60ff553c697ddbe93b1d438 100644 --- a/src/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.tsx +++ b/src/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.tsx @@ -1,4 +1,4 @@ -import { computed, defineComponent, onMounted, Ref, ref, watch } from 'vue'; +import { computed, defineComponent, Ref, ref, watch } from 'vue'; import { getAutoCompleteProps, getEditorEmits, @@ -85,7 +85,7 @@ export const IBizAutoComplete = defineComponent({ // 搜索 const onSearch = async (query: string, cb?: Function) => { - if (c.appDataEntity) { + if (c.model.appDataEntityId) { const trimQuery = query.trim(); const res = await c.getServiceData(trimQuery, props.data); if (res) { @@ -112,22 +112,14 @@ export const IBizAutoComplete = defineComponent({ }; // 聚焦 - const onFocus = (e: IData) => { - const query = isShowAll.value ? '' : e.target.value; - onSearch(query); + const onFocus = () => { + emit('focus'); }; - onMounted(() => { - // 监听autocomplete的activated - watch( - () => autoCompleteRef.value?.activated, - newVal => { - if (typeof newVal === 'boolean') { - emit('operate', newVal); - } - }, - ); - }); + // 失焦 + const onBlur = () => { + emit('blur'); + }; // 输入框focus时是否显示建议 const triggerOnFocus = computed(() => { @@ -175,6 +167,7 @@ export const IBizAutoComplete = defineComponent({ onSearch, onClear, onFocus, + onBlur, onACSelect, items, handleInput, @@ -198,6 +191,8 @@ export const IBizAutoComplete = defineComponent({ disabled={this.disabled || this.readonly} onSelect={this.onACSelect} onInput={this.handleInput} + onFocus={this.onFocus} + onBlur={this.onBlur} > {{ default: ({ item }: { item: IData }) => { diff --git a/src/editor/check-box-list/ibiz-grid-checkbox-list/ibiz-grid-checkbox-list.tsx b/src/editor/check-box-list/ibiz-grid-checkbox-list/ibiz-grid-checkbox-list.tsx deleted file mode 100644 index ac2d3c9575c6ae57290b0158151cf2a26934cb03..0000000000000000000000000000000000000000 --- a/src/editor/check-box-list/ibiz-grid-checkbox-list/ibiz-grid-checkbox-list.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent, h, resolveComponent } from 'vue'; -import { - getGridEditorEmits, - getGridInputProps, - useNamespace, -} from '@ibiz-template/vue3-util'; -import { CheckBoxListEditorController } from '../checkbox-list-editor.controller'; - -export const IBizGridCheckboxList = defineComponent({ - name: 'IBizGridCheckboxList', - props: getGridInputProps(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-checkbox-list'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizCheckboxList'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/check-box-list/index.ts b/src/editor/check-box-list/index.ts index 418a6ccd846ceadaa86d67d1c2e57dd18e34c283..adc5fcf841810cbdf3567a04d0a81fc86682f96f 100644 --- a/src/editor/check-box-list/index.ts +++ b/src/editor/check-box-list/index.ts @@ -1,4 +1,3 @@ export { IBizCheckboxList } from './ibiz-checkbox-list/ibiz-checkbox-list'; -export { IBizGridCheckboxList } from './ibiz-grid-checkbox-list/ibiz-grid-checkbox-list'; export * from './checkbox-list-editor.controller'; export * from './checkbox-list-editor.provider'; diff --git a/src/editor/check-box/ibiz-checkbox/ibiz-checkbox.tsx b/src/editor/check-box/ibiz-checkbox/ibiz-checkbox.tsx index d60d2e85368d2365ae0a8c65ce0d8d98af7e5922..26b27dd8fb9f44a7c36cd19b0f7c444e3b0efdc7 100644 --- a/src/editor/check-box/ibiz-checkbox/ibiz-checkbox.tsx +++ b/src/editor/check-box/ibiz-checkbox/ibiz-checkbox.tsx @@ -2,6 +2,7 @@ import { computed, defineComponent } from 'vue'; import { getCheckboxProps, getEditorEmits, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import { CheckBoxEditorController } from '../check-box-editor.controller'; @@ -47,15 +48,22 @@ export const IBizCheckbox = defineComponent({ }, }); + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, editorModel, currentVal, + editorRef, }; }, render() { return ( -
+
{ - if (c.appDataEntity) { + if (c.model.appDataEntityId) { loading.value = true; try { const trimQuery = query.trim(); @@ -141,7 +141,6 @@ export const IBizMPicker = defineComponent({ // 下拉打开 const onOpenChange = (flag: boolean) => { open.value = flag; - emit('operate', flag); if (open.value) { items.value = []; onSearch(''); @@ -156,6 +155,17 @@ export const IBizMPicker = defineComponent({ }) .join(','); }); + + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, @@ -167,6 +177,8 @@ export const IBizMPicker = defineComponent({ onOpenChange, onSelect, openPickUpView, + onFocus, + onBlur, }; }, render() { @@ -177,6 +189,7 @@ export const IBizMPicker = defineComponent({ this.disabled ? this.ns.m('disabled') : '', this.readonly ? this.ns.m('readonly') : '', ]} + ref='editorRef' > {this.readonly && this.valueText} {!this.readonly && ( @@ -191,6 +204,8 @@ export const IBizMPicker = defineComponent({ onVisibleChange={this.onOpenChange} onChange={this.onSelect} disabled={this.disabled} + onFocus={this.onFocus} + onBlur={this.onBlur} > {this.items.map((item, index) => { return ( @@ -206,7 +221,7 @@ export const IBizMPicker = defineComponent({ {!this.readonly && (
- {this.c.pickupView ? ( + {this.c.model.pickupAppViewId ? ( { - if (c.appDataEntity && loading.value === false) { + if (c.model.appDataEntityId && loading.value === false) { loading.value = true; try { const trimQuery = query.trim(); @@ -120,7 +120,6 @@ export const IBizPickerDropDown = defineComponent({ // 下拉打开 const onOpenChange = (isOpen: boolean) => { - emit('operate', isOpen); if (isOpen) { items.value = []; onSearch(''); @@ -141,6 +140,17 @@ export const IBizPickerDropDown = defineComponent({ } emit('change', null); }; + + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, @@ -151,6 +161,8 @@ export const IBizPickerDropDown = defineComponent({ onClear, onSelect, onSearch, + onFocus, + onBlur, }; }, render() { @@ -176,6 +188,8 @@ export const IBizPickerDropDown = defineComponent({ onChange={this.onSelect} onClear={this.onClear} disabled={this.disabled} + onFocus={this.onFocus} + onBlur={this.onBlur} > {this.items.map((item, index) => { return ( diff --git a/src/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.tsx b/src/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.tsx index 1f08b7c4caac5d1cb65b43698f023e5649eb5e19..5ffd71fa8b73cc62cc31bab29cca63525071af0b 100644 --- a/src/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.tsx +++ b/src/editor/data-picker/ibiz-picker-embed-view/ibiz-picker-embed-view.tsx @@ -1,7 +1,15 @@ -import { defineComponent, ref, resolveComponent, watch, h } from 'vue'; +import { + defineComponent, + ref, + resolveComponent, + watch, + h, + computed, +} from 'vue'; import { getDataPickerProps, getEditorEmits, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-picker-embed-view.scss'; @@ -69,36 +77,52 @@ export const IBizPickerEmbedView = defineComponent({ onViewDataChange(event.data); }; - return { ns, c, context, params, onSelectionChange }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + + const pickupViewModel = computed(() => { + return c.pickupView; + }); + + return { + ns, + c, + context, + params, + onSelectionChange, + editorRef, + pickupViewModel, + }; }, render() { - const viewShell = resolveComponent('ViewShell'); + const viewShell = resolveComponent('IBizViewShell'); return ( -
- {this.c.model.pickupAppViewId ? ( - [ -
- {h(viewShell, { - context: this.context, - params: this.params, - modal: { mode: ViewMode.EMBED }, - modelData: this.c.pickupView, - onSelectionChange: this.onSelectionChange, - })} -
, -
- {this.$props.value ? ( - this.$props.value.split(',').map(item => { - return {item}; ; - }) - ) : ( - {this.c.placeHolder} - )} -
, - ] - ) : ( -
{this.c.placeHolder}
- )} +
+ {this.pickupViewModel + ? [ +
+ {h(viewShell, { + context: this.context, + params: this.params, + modal: { mode: ViewMode.EMBED }, + modelData: this.c.pickupView, + onSelectionChange: this.onSelectionChange, + })} +
, +
+ {this.$props.value ? ( + this.$props.value.split(',').map(item => { + return {item}; ; + }) + ) : ( + {this.c.placeHolder} + )} +
, + ] + : null}
); }, diff --git a/src/editor/data-picker/ibiz-picker-link/ibiz-picker-link.tsx b/src/editor/data-picker/ibiz-picker-link/ibiz-picker-link.tsx index b015134d4ee8e7c7ecc0fe21cffe67b82e190a88..0115f81217c4aca60bdeae3fdf7f97250985984f 100644 --- a/src/editor/data-picker/ibiz-picker-link/ibiz-picker-link.tsx +++ b/src/editor/data-picker/ibiz-picker-link/ibiz-picker-link.tsx @@ -2,6 +2,7 @@ import { defineComponent, ref, Ref, watch } from 'vue'; import { getDataPickerProps, getEditorEmits, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-picker-link.scss'; @@ -47,11 +48,21 @@ export const IBizPickerLink = defineComponent({ handleOpenViewClose(res); } }; - return { ns, openLinkView, curValue }; + + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + + return { ns, openLinkView, curValue, editorRef }; }, render() { return ( -
+ ); diff --git a/src/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.tsx b/src/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.tsx index 6e4f91900208e04dd940a1a629ee194455cbeddb..757dcc63627ce1fc2d17eabf2960540a7f798502 100644 --- a/src/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.tsx +++ b/src/editor/data-picker/ibiz-picker-select-view/ibiz-picker-select-view.tsx @@ -10,6 +10,7 @@ import { import { getDataPickerProps, getEditorEmits, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-picker-select-view.scss'; @@ -256,6 +257,12 @@ export const IBizPickerSelectView = defineComponent({ onViewDataChange(event.data); }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, c, @@ -276,11 +283,12 @@ export const IBizPickerSelectView = defineComponent({ onSelectChange, remoteMethod, onSelectionChange, + editorRef, }; }, render() { return ( -
+
{{ default: () => { @@ -342,17 +350,18 @@ export const IBizPickerSelectView = defineComponent({ ); }, dropdown: () => { - const viewShell = resolveComponent('ViewShell'); + const viewShell = resolveComponent('IBizViewShell'); return ( - {h(viewShell, { - context: this.context, - params: this.params, - modal: { mode: ViewMode.EMBED }, - modelData: this.c.pickupView, - style: { height: '100%', width: this.pickViewWidth }, - onSelectionChange: this.onSelectionChange, - })} + {this.c.pickupView && + h(viewShell, { + context: this.context, + params: this.params, + modal: { mode: ViewMode.EMBED }, + modelData: this.c.pickupView, + style: { height: '100%', width: this.pickViewWidth }, + onSelectionChange: this.onSelectionChange, + })} ); }, diff --git a/src/editor/data-picker/ibiz-picker/ibiz-picker.tsx b/src/editor/data-picker/ibiz-picker/ibiz-picker.tsx index d5a27770b31fc82c2bb92b567167626e9070a485..58d9809f11f5e10d164ea7e12655f30c04603c93 100644 --- a/src/editor/data-picker/ibiz-picker/ibiz-picker.tsx +++ b/src/editor/data-picker/ibiz-picker/ibiz-picker.tsx @@ -97,7 +97,7 @@ export const IBizPicker = defineComponent({ // 搜索 const onSearch = async (query: string, cb?: Function) => { - if (c.appDataEntity) { + if (c.model.appDataEntityId) { const trimQuery = query.trim(); const res = await c.getServiceData(trimQuery, props.data); if (res) { diff --git a/src/editor/data-picker/picker-editor.controller.ts b/src/editor/data-picker/picker-editor.controller.ts index b62d69793b3aede5ccdccf38d44630f9ba321a69..fbd02601783ed741cad2591643d5ea12ca28fedb 100644 --- a/src/editor/data-picker/picker-editor.controller.ts +++ b/src/editor/data-picker/picker-editor.controller.ts @@ -1,7 +1,10 @@ import { IHttpResponse, RuntimeModelError } from '@ibiz-template/core'; -import { EditorController, OpenAppViewCommand } from '@ibiz-template/runtime'; import { - IAppDataEntity, + EditorController, + OpenAppViewCommand, + getDeACMode, +} from '@ibiz-template/runtime'; +import { IAppDEACMode, IAppView, IDEACModeDataItem, @@ -50,11 +53,6 @@ export class PickerEditorController extends EditorController { */ public textName: string = 'srfmajortext'; - /** - * 实体codeName - */ - public serviceName: string = ''; - /** * 数据集codeName */ @@ -75,15 +73,10 @@ export class PickerEditorController extends EditorController { */ public noButton: boolean = false; - /** - * 编辑器实体 - */ - public appDataEntity: IAppDataEntity | null = null; - /** * 实体自填模式模型 */ - public deACMode: IAppDEACMode | null = null; + public deACMode: IAppDEACMode | undefined = undefined; /** * 自填数据项集合(已排除了value和text) @@ -95,17 +88,52 @@ export class PickerEditorController extends EditorController { this.initParams(); this.valueItem = this.model.valueItemName?.toLowerCase() || ''; if (this.model.appDataEntityId) { - this.appDataEntity = await ibiz.hub.getAppDataEntity( - this.model.appDataEntityId, - this.context.srfappid, - )!; - if (this.appDataEntity) { - this.keyName = this.appDataEntity.keyAppDEFieldId!; - this.textName = this.appDataEntity.majorAppDEFieldId!; - this.getAcParams(); - this.sort = this.getAcSort(); + if (this.model.appDEDataSetId) { + this.interfaceName = this.model.appDEDataSetId; + } + if (this.model.appDEACModeId) { + this.deACMode = await getDeACMode( + this.model.appDEACModeId, + this.model.appDataEntityId, + this.context.srfappid, + ); + if (this.deACMode) { + // 自填模式相关 + const { minorSortAppDEFieldId, minorSortDir } = this.deACMode; + if (minorSortAppDEFieldId && minorSortDir) { + this.sort = `${minorSortAppDEFieldId.toLowerCase()},${minorSortDir.toLowerCase()}`; + } + if (this.deACMode.textAppDEFieldId) { + this.textName = this.deACMode.textAppDEFieldId; + } + if (this.deACMode.valueAppDEFieldId) { + this.keyName = this.deACMode.valueAppDEFieldId; + } + if (this.deACMode.deacmodeDataItems) { + this.dataItems = []; + this.deACMode.deacmodeDataItems.forEach( + (dataItem: IDEACModeDataItem) => { + if (dataItem.id !== 'value' && dataItem.id !== 'text') { + this.dataItems.push(dataItem); + } + }, + ); + } + } } } + // 这三种嵌入选择视图的需要预先加载视图模型用于绘制 + const embedViewEditors = [ + 'PICKEREX_DROPDOWNVIEW', + 'PICKEREX_DROPDOWNVIEW_LINK', + 'PICKUPVIEW', + ]; + if ( + this.model.editorType && + embedViewEditors.includes(this.model.editorType) + ) { + this.initPickupViewParams(); + } } /** @@ -144,47 +172,6 @@ export class PickerEditorController extends EditorController { } } - /** - * 获取Ac参数 - */ - public getAcParams() { - if (this.appDataEntity?.codeName) { - this.serviceName = this.appDataEntity.codeName; - } - if (this.model.appDEDataSetId) { - this.interfaceName = this.model.appDEDataSetId; - } - if (this.appDataEntity?.appDEACModes) { - this.deACMode = this.appDataEntity.appDEACModes[0]; - if (this.deACMode.textAppDEFieldId) { - this.textName = this.deACMode.textAppDEFieldId; - } - if (this.deACMode.valueAppDEFieldId) { - this.keyName = this.deACMode.valueAppDEFieldId; - } - if (this.deACMode.deacmodeDataItems) { - this.deACMode.deacmodeDataItems.forEach(dataItem => { - if (dataItem.id !== 'value' && dataItem.id !== 'text') { - this.dataItems.push(dataItem); - } - }); - } - } - } - - /** - * 获取自填模式sort排序 - */ - public getAcSort() { - if (this.deACMode) { - const { minorSortAppDEFieldId, minorSortDir } = this.deACMode; - if (minorSortAppDEFieldId && minorSortDir) { - return `${minorSortAppDEFieldId.toLowerCase()},${minorSortDir.toLowerCase()}`; - } - } - return undefined; - } - /** * 加载实体数据集数据 * @@ -208,10 +195,14 @@ export class PickerEditorController extends EditorController { this.context, tempParams, ); - if (this.serviceName && this.interfaceName) { - const app = ibiz.hub.getApp(this.appDataEntity!.appId); - const deService = await app.deService.getService(this.serviceName); - const res = await deService.exec(this.interfaceName, context, params); + if (this.interfaceName) { + const app = ibiz.hub.getApp(this.context.srfappid); + const res = await app.deService.exec( + this.model.appDataEntityId!, + this.interfaceName, + context, + params, + ); return res as IHttpResponse; } throw new RuntimeModelError(this.model, '请配置实体和实体数据集'); diff --git a/src/editor/date-picker/date-picker-editor.provider.ts b/src/editor/date-picker/date-picker-editor.provider.ts index c03c9eca49dbff7a24ee27c5bda04b3d33387f71..f4645685274268d95c369e352ab703e0e7d6de37 100644 --- a/src/editor/date-picker/date-picker-editor.provider.ts +++ b/src/editor/date-picker/date-picker-editor.provider.ts @@ -18,7 +18,7 @@ import { DatePickerEditorController } from './date-picker-editor.controller'; export class DatePickerEditorProvider implements IEditorProvider { formEditor: string = 'IBizDatePicker'; - gridEditor: string = 'IBizGridDatePicker'; + gridEditor: string = 'IBizDatePicker'; async createController( editorModel: IDatePicker, diff --git a/src/editor/date-picker/ibiz-date-picker/ibiz-date-picker.tsx b/src/editor/date-picker/ibiz-date-picker/ibiz-date-picker.tsx index ff0bc69c805bbd1e2177c1357f4bfd0c430c76cc..a27b4f1a88a11b595959182f209fc63798f43177 100644 --- a/src/editor/date-picker/ibiz-date-picker/ibiz-date-picker.tsx +++ b/src/editor/date-picker/ibiz-date-picker/ibiz-date-picker.tsx @@ -70,9 +70,7 @@ export const IBizDatePicker = defineComponent({ emit('change', date); }; - const onOpenChange = (isOpen: boolean) => { - emit('operate', isOpen); - }; + const onOpenChange = (_isOpen: boolean) => {}; const inputRef = ref(); @@ -85,6 +83,16 @@ export const IBizDatePicker = defineComponent({ }); } + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, @@ -96,6 +104,8 @@ export const IBizDatePicker = defineComponent({ onOpenChange, inputRef, isTimePicker, + onFocus, + onBlur, }; }, render() { @@ -120,6 +130,8 @@ export const IBizDatePicker = defineComponent({ onVisibleChange={this.onOpenChange} onChange={this.handleChange} disabled={this.disabled} + onFocus={this.onFocus} + onBlur={this.onBlur} > ) : ( )}
diff --git a/src/editor/date-picker/ibiz-grid-date-picker/ibiz-grid-date-picker.tsx b/src/editor/date-picker/ibiz-grid-date-picker/ibiz-grid-date-picker.tsx deleted file mode 100644 index 707c356a26e918b14bf46bbcef0a260bbd539e78..0000000000000000000000000000000000000000 --- a/src/editor/date-picker/ibiz-grid-date-picker/ibiz-grid-date-picker.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent, h, resolveComponent } from 'vue'; -import { - getGridDatePickerProps, - getGridEditorEmits, - useNamespace, -} from '@ibiz-template/vue3-util'; -import { DatePickerEditorController } from '../date-picker-editor.controller'; - -export const IBizGridDatePicker = defineComponent({ - name: 'IBizGridDatePicker', - props: getGridDatePickerProps(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-date-picker'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizDatePicker'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/date-picker/index.ts b/src/editor/date-picker/index.ts index c668158358396030539357ad50d9f0d6843e56d2..d22c70857dbb753ba29a1469dd2e571b47b22f04 100644 --- a/src/editor/date-picker/index.ts +++ b/src/editor/date-picker/index.ts @@ -1,4 +1,3 @@ export { IBizDatePicker } from './ibiz-date-picker/ibiz-date-picker'; -export { IBizGridDatePicker } from './ibiz-grid-date-picker/ibiz-grid-date-picker'; export * from './date-picker-editor.controller'; export * from './date-picker-editor.provider'; diff --git a/src/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.tsx b/src/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.tsx index 4f48650ebadd65e7ef5f1f59c5d0ae705925e7ae..02abd419d3e86f2d05b3a024f52bf89aeb387ee9 100644 --- a/src/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.tsx +++ b/src/editor/date-range/ibiz-date-range-picker/ibiz-date-range-picker.tsx @@ -113,6 +113,16 @@ export const IBizDateRangePicker = defineComponent({ }, }); + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, @@ -125,6 +135,8 @@ export const IBizDateRangePicker = defineComponent({ endPlaceHolder, rangeSeparator, unlinkPanels, + onFocus, + onBlur, }; }, render() { @@ -142,6 +154,8 @@ export const IBizDateRangePicker = defineComponent({ start-placeholder={this.startPlaceHolder} end-placeholder={this.endPlaceHolder} unlink-panels={this.unlinkPanels} + onFocus={this.onFocus} + onBlur={this.onBlur} >
); diff --git a/src/editor/dropdown-list/ibiz-grid-dropdown/ibiz-grid-dropdown.tsx b/src/editor/dropdown-list/ibiz-grid-dropdown/ibiz-grid-dropdown.tsx deleted file mode 100644 index eb6b61e2abb7e445a39f887aa29a44ba8540b86b..0000000000000000000000000000000000000000 --- a/src/editor/dropdown-list/ibiz-grid-dropdown/ibiz-grid-dropdown.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent, h, resolveComponent } from 'vue'; -import { - getGridDropdownProps, - getGridEditorEmits, - useNamespace, -} from '@ibiz-template/vue3-util'; -import { DropDownListEditorController } from '../dropdown-list-editor.controller'; - -export const IBizGridDropdown = defineComponent({ - name: 'IBizGridDropdown', - props: getGridDropdownProps(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-dropdown'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizDropdown'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/dropdown-list/index.ts b/src/editor/dropdown-list/index.ts index 9229b9c62cabaf23eac846eff353803ac83de402..6d962698dfd2a3fa3b4cf87a81892cb7583827dd 100644 --- a/src/editor/dropdown-list/index.ts +++ b/src/editor/dropdown-list/index.ts @@ -1,4 +1,3 @@ export { IBizDropdown } from './ibiz-dropdown/ibiz-dropdown'; -export { IBizGridDropdown } from './ibiz-grid-dropdown/ibiz-grid-dropdown'; export * from './dropdown-list-editor.controller'; export * from './dropdown-list-editor.provider'; diff --git a/src/editor/index.ts b/src/editor/index.ts index a9ebb02c3cc350156faa293ac813da63893b40db..5f885397ba186eb8873c8975b53136d6e49487f0 100644 --- a/src/editor/index.ts +++ b/src/editor/index.ts @@ -6,31 +6,13 @@ import { IBizInput, IBizInputNumber, IBizInputIP, - IBizGridInput, - IBizGridInputNumber, TextBoxEditorProvider, } from './text-box'; -import { - IBizDropdown, - IBizGridDropdown, - DropDownListEditorProvider, -} from './dropdown-list'; +import { IBizDropdown, DropDownListEditorProvider } from './dropdown-list'; import { IBizCheckbox, CheckBoxEditorProvider } from './check-box'; -import { - IBizCheckboxList, - IBizGridCheckboxList, - CheckBoxListEditorProvider, -} from './check-box-list'; -import { - IBizRadio, - IBizGridRadio, - RadioButtonListEditorProvider, -} from './radio-button-list'; -import { - IBizDatePicker, - IBizGridDatePicker, - DatePickerEditorProvider, -} from './date-picker'; +import { IBizCheckboxList, CheckBoxListEditorProvider } from './check-box-list'; +import { IBizRadio, RadioButtonListEditorProvider } from './radio-button-list'; +import { IBizDatePicker, DatePickerEditorProvider } from './date-picker'; import { IBizRaw, RawEditorProvider } from './raw'; import { IBizStepper, StepperEditorProvider } from './stepper'; import { IBizRate, RateEditorProvider } from './rate'; @@ -68,17 +50,11 @@ export const IBizEditor = { v.component(IBizInput.name, IBizInput); v.component(IBizInputNumber.name, IBizInputNumber); v.component(IBizInputIP.name, IBizInputIP); - v.component(IBizGridInput.name, IBizGridInput); - v.component(IBizGridInputNumber.name, IBizGridInputNumber); v.component(IBizDropdown.name, IBizDropdown); - v.component(IBizGridDropdown.name, IBizGridDropdown); v.component(IBizCheckbox.name, IBizCheckbox); v.component(IBizCheckboxList.name, IBizCheckboxList); - v.component(IBizGridCheckboxList.name, IBizGridCheckboxList); v.component(IBizRadio.name, IBizRadio); - v.component(IBizGridRadio.name, IBizGridRadio); v.component(IBizDatePicker.name, IBizDatePicker); - v.component(IBizGridDatePicker.name, IBizGridDatePicker); v.component(IBizRaw.name, IBizRaw); v.component(IBizStepper.name, IBizStepper); v.component(IBizRate.name, IBizRate); diff --git a/src/editor/list-box/ibiz-list-box/ibiz-list-box.tsx b/src/editor/list-box/ibiz-list-box/ibiz-list-box.tsx index c8de0ab352df138557df278e3e277a2479e5aa27..edd51544bf021483b3d894e3f15328cdd5695780 100644 --- a/src/editor/list-box/ibiz-list-box/ibiz-list-box.tsx +++ b/src/editor/list-box/ibiz-list-box/ibiz-list-box.tsx @@ -3,6 +3,7 @@ import { getListBoxProps, getEditorEmits, useNamespace, + useFocusAndBlur, } from '@ibiz-template/vue3-util'; import { isNil } from 'ramda'; import './ibiz-list-box.scss'; @@ -45,7 +46,7 @@ export const IBizListBox = defineComponent({ }); } else if (Object.is('LISTBOXPICKUP', editorType)) { const controller = c as ListBoxPickerEditorController; - if (controller.appDataEntity) { + if (controller.model.appDataEntityId) { const res = await controller.getServiceData(props.data); if (res) { items.value = res.data.map(item => ({ @@ -148,17 +149,24 @@ export const IBizListBox = defineComponent({ emit('change', _value); }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, items, selectArray, onSelectArrayChange, multiple, + editorRef, }; }, render() { return ( -
+
{this.multiple ? ( { super.onInit(); if (this.model.editorType === 'LISTBOXPICKUP') { - this.appDataEntity = await ibiz.hub.getAppDataEntity( - this.model.appDataEntityId!, - this.context.srfappid, - ); - if (this.appDataEntity) { - this.keyName = this.appDataEntity.keyAppDEFieldId!; - this.textName = this.appDataEntity.majorAppDEFieldId!; - this.getAcParams(); + if (this.model.appDEDataSetId) { + this.interfaceName = this.model.appDEDataSetId; } } } - /** - * 获取Ac参数 - */ - public getAcParams() { - if (this.appDataEntity?.codeName) { - this.serviceName = this.appDataEntity.codeName; - } - if (this.model.appDEDataSetId) { - this.interfaceName = this.model.appDEDataSetId; - } - } - /** * 加载实体数据集数据 * @@ -76,10 +48,14 @@ export class ListBoxPickerEditorController extends EditorController; } throw new RuntimeModelError(this.model, '请配置实体和实体数据集'); diff --git a/src/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.tsx b/src/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.tsx index 311d2cf61ee7dd8189fc3cab5235731c915daa0a..8a8e5031d94885bc72f4ecb945d984cabae97b4c 100644 --- a/src/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.tsx +++ b/src/editor/number-range/ibiz-number-range-picker/ibiz-number-range-picker.tsx @@ -2,6 +2,7 @@ import { defineComponent, Ref, ref, watch } from 'vue'; import { getEditorEmits, getNumberRangeProps, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-number-range-picker.scss'; @@ -102,6 +103,12 @@ export const IBizNumberRangePicker = defineComponent({ } }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, c, @@ -116,11 +123,12 @@ export const IBizNumberRangePicker = defineComponent({ startPlaceHolder, endPlaceHolder, rangeSeparator, + editorRef, }; }, render() { return ( -
+
(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-radio'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizRadio'), { - ...this.$props, - })} -
- ); - }, -}); 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 e05e059d454add2b67937104e4c2aa1dbe9e42cf..2d6c1fcccd7ca42805872a4ed2b2938350ad64bf 100644 --- a/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx +++ b/src/editor/radio-button-list/ibiz-radio/ibiz-radio.tsx @@ -2,6 +2,7 @@ import { computed, defineComponent, ref, watch } from 'vue'; import { getEditorEmits, getRadioProps, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import './ibiz-radio.scss'; @@ -41,12 +42,19 @@ export const IBizRadio = defineComponent({ return items.value.find(item => item.value === props.value)?.text || ''; }); + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, editorModel, items, valueText, onSelectValueChange, + editorRef, }; }, render() { @@ -57,6 +65,7 @@ export const IBizRadio = defineComponent({ this.disabled ? this.ns.m('disabled') : '', this.readonly ? this.ns.m('readonly') : '', ]} + ref='editorRef' > {this.readonly ? ( this.valueText diff --git a/src/editor/radio-button-list/index.ts b/src/editor/radio-button-list/index.ts index 03f19f89669e12bc00ec42a8a6762410275f073b..1f78fb53137d0bb88a4ec020bf7ecc61a61bdd1c 100644 --- a/src/editor/radio-button-list/index.ts +++ b/src/editor/radio-button-list/index.ts @@ -1,4 +1,3 @@ export { IBizRadio } from './ibiz-radio/ibiz-radio'; -export { IBizGridRadio } from './ibiz-grid-radio/ibiz-grid-radio'; export * from './radio-button-list.controller'; export * from './radio-button-list.provider'; diff --git a/src/editor/radio-button-list/radio-button-list.provider.ts b/src/editor/radio-button-list/radio-button-list.provider.ts index 9c702906602c50ee2a415f57b142c713cca4be7e..2bcecbf003d22761357cfd093e19a2ede2b9a69a 100644 --- a/src/editor/radio-button-list/radio-button-list.provider.ts +++ b/src/editor/radio-button-list/radio-button-list.provider.ts @@ -18,7 +18,7 @@ import { RadioButtonListEditorController } from './radio-button-list.controller' export class RadioButtonListEditorProvider implements IEditorProvider { formEditor: string = 'IBizRadio'; - gridEditor: string = 'IBizGridRadio'; + gridEditor: string = 'IBizRadio'; async createController( editorModel: IRadioButtonList, diff --git a/src/editor/rate/ibiz-rate/ibiz-rate.tsx b/src/editor/rate/ibiz-rate/ibiz-rate.tsx index 9304eb83ceb3f20d991db3f979dac484ad48d0af..516474a7dc2d1520b72d0451f458e966be92a8cc 100644 --- a/src/editor/rate/ibiz-rate/ibiz-rate.tsx +++ b/src/editor/rate/ibiz-rate/ibiz-rate.tsx @@ -2,6 +2,7 @@ import { defineComponent, ref, watch } from 'vue'; import { getEditorEmits, getRateProps, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import { RateEditorController } from '../rate-editor.controller'; @@ -60,6 +61,12 @@ export const IBizRate = defineComponent({ emit('change', currentValue); }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, currentVal, @@ -68,11 +75,12 @@ export const IBizRate = defineComponent({ showText, max, texts, + editorRef, }; }, render() { return ( -
+
= ref(''); + + watch( + () => props.value, + (newVal, oldVal) => { + if (newVal !== oldVal) { + content.value = newVal; + } + }, + ); // 类型 let type = 'TEXT'; @@ -39,11 +48,13 @@ export const IBizRaw = defineComponent({ this.readonly ? this.ns.m('readonly') : '', ]} > - + {this.content && ( + + )}
); }, diff --git a/src/editor/slider/ibiz-slider/ibiz-slider.tsx b/src/editor/slider/ibiz-slider/ibiz-slider.tsx index 73432686ceaba7c0ee438d42de83e7d4f360be70..de40149cb8c952032e113342018565084c609b2e 100644 --- a/src/editor/slider/ibiz-slider/ibiz-slider.tsx +++ b/src/editor/slider/ibiz-slider/ibiz-slider.tsx @@ -2,6 +2,7 @@ import { defineComponent, ref, watch } from 'vue'; import { getEditorEmits, getSliderProps, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import { SliderEditorController } from '../slider-editor.controller'; @@ -83,6 +84,12 @@ export const IBizSlider = defineComponent({ } }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, currentVal, @@ -93,11 +100,12 @@ export const IBizSlider = defineComponent({ showStops, range, showInput, + editorRef, }; }, render() { return ( -
+
(), - setup() { - const ns = useNamespace('grid-span'); - return { ns }; - }, - render() { - return ( -
evt.stopPropagation()} - onClick={evt => evt.stopPropagation()} - > - {h(resolveComponent('IBizSpan'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/span/index.ts b/src/editor/span/index.ts index e7a36a6e2ead89da50130a4852168ada58730e79..326161cef984e05b6466f18da54434aded4a0423 100644 --- a/src/editor/span/index.ts +++ b/src/editor/span/index.ts @@ -1,5 +1,4 @@ export { IBizSpan } from './span/span'; -export { IBizGridSpan } from './grid-span/grid-span'; export { IBizSpanLink } from './span-link/span-link'; export * from './span-editor.controller'; export * from './span-editor.provider'; diff --git a/src/editor/span/span-editor.provider.ts b/src/editor/span/span-editor.provider.ts index e1cb9ba1bdedcfbde72d1c101c367ffc84873df5..b5938475923803e68b457971e4f6855e5c43b37f 100644 --- a/src/editor/span/span-editor.provider.ts +++ b/src/editor/span/span-editor.provider.ts @@ -17,7 +17,7 @@ import { SpanEditorController } from './span-editor.controller'; export class SpanEditorProvider implements IEditorProvider { formEditor: string = 'IBizSpan'; - gridEditor: string = 'IBizGridSpan'; + gridEditor: string = 'IBizSpan'; constructor(editorType?: string) { if (editorType === 'SPAN_LINK') { diff --git a/src/editor/span/span-link/span-link.tsx b/src/editor/span/span-link/span-link.tsx index ce9eab912421175e9b924cb135c6a7dbfb58a316..11a6b3c0314cac0d187ab32f5745ea3b7d0ae397 100644 --- a/src/editor/span/span-link/span-link.tsx +++ b/src/editor/span/span-link/span-link.tsx @@ -3,6 +3,7 @@ import { getSpanProps, getEditorEmits, useNamespace, + useFocusAndBlur, } from '@ibiz-template/vue3-util'; import './span-link.scss'; import { SpanEditorController } from '../span-editor.controller'; @@ -11,7 +12,7 @@ export const IBizSpanLink = defineComponent({ name: 'IBizSpanLink', props: getSpanProps(), emits: getEditorEmits(), - setup(props) { + setup(props, { emit }) { const ns = useNamespace('span-link'); const c = props.controller!; @@ -32,11 +33,21 @@ export const IBizSpanLink = defineComponent({ const openLinkView = async () => { await c.openLinkView(props.data); }; - return { ns, openLinkView, curValue }; + + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + + return { ns, openLinkView, curValue, editorRef }; }, render() { return ( -
+ ); diff --git a/src/editor/span/span/span.tsx b/src/editor/span/span/span.tsx index e8e785270396020c0dfa44952a0c5d8f8018872f..d5d449dc696109812641262d0dd1f5282fd576c6 100644 --- a/src/editor/span/span/span.tsx +++ b/src/editor/span/span/span.tsx @@ -1,5 +1,9 @@ import { ref, defineComponent, Ref, watch, computed } from 'vue'; -import { getSpanProps, useNamespace } from '@ibiz-template/vue3-util'; +import { + getSpanProps, + useFocusAndBlur, + useNamespace, +} from '@ibiz-template/vue3-util'; import dayjs from 'dayjs'; import './span.scss'; import { CodeListItem } from '@ibiz-template/runtime'; @@ -8,7 +12,7 @@ import { SpanEditorController } from '../span-editor.controller'; export const IBizSpan = defineComponent({ name: 'IBizSpan', props: getSpanProps(), - setup(props) { + setup(props, { emit }) { const ns = useNamespace('span'); const c = props.controller; @@ -77,10 +81,17 @@ export const IBizSpan = defineComponent({ return selects.map(item => item.text).join(valueSeparator); }); + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, text, codeListText, + editorRef, }; }, render() { @@ -91,6 +102,7 @@ export const IBizSpan = defineComponent({ this.disabled ? this.ns.m('disabled') : '', this.readonly ? this.ns.m('readonly') : '', ]} + ref='editorRef' > {this.codeListText || this.text} diff --git a/src/editor/stepper/ibiz-stepper/ibiz-stepper.tsx b/src/editor/stepper/ibiz-stepper/ibiz-stepper.tsx index 538306c40058f8601c68ad6a0a81860e95944006..e39e02a84e67ac66c6d20c5de1be09a15cabf1c6 100644 --- a/src/editor/stepper/ibiz-stepper/ibiz-stepper.tsx +++ b/src/editor/stepper/ibiz-stepper/ibiz-stepper.tsx @@ -59,6 +59,16 @@ export const IBizStepper = defineComponent({ const inputRef = ref(); + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, @@ -69,6 +79,8 @@ export const IBizStepper = defineComponent({ precision, max, min, + onFocus, + onBlur, }; }, render() { @@ -89,6 +101,8 @@ export const IBizStepper = defineComponent({ step={this.step} disabled={this.disabled} onChange={this.handleChange} + onFocus={this.onFocus} + onBlur={this.onBlur} >, ]; } diff --git a/src/editor/switch/ibiz-switch/ibiz-switch.tsx b/src/editor/switch/ibiz-switch/ibiz-switch.tsx index f49bbede758f7bad2e9d152b668b0ca754598391..5912eb63af7fc7178a88cc6d819dc791f057569d 100644 --- a/src/editor/switch/ibiz-switch/ibiz-switch.tsx +++ b/src/editor/switch/ibiz-switch/ibiz-switch.tsx @@ -2,6 +2,7 @@ import { defineComponent, ref, watch } from 'vue'; import { getEditorEmits, getSwitchProps, + useFocusAndBlur, useNamespace, } from '@ibiz-template/vue3-util'; import { SwitchEditorController } from '../switch-editor.controller'; @@ -67,6 +68,12 @@ export const IBizSwitch = defineComponent({ emit('change', emitValue); }; + // 聚焦失焦事件 + const { componentRef: editorRef } = useFocusAndBlur( + () => emit('focus'), + () => emit('blur'), + ); + return { ns, currentVal, @@ -74,11 +81,12 @@ export const IBizSwitch = defineComponent({ inactiveText, handleChange, dicData, + editorRef, }; }, render() { return ( -
+
(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-input-number'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizInputNumber'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/text-box/ibiz-grid-input/ibiz-grid-input.tsx b/src/editor/text-box/ibiz-grid-input/ibiz-grid-input.tsx deleted file mode 100644 index ba3b834d5d1f705298e89914436feeef0fd1320f..0000000000000000000000000000000000000000 --- a/src/editor/text-box/ibiz-grid-input/ibiz-grid-input.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent, h, resolveComponent } from 'vue'; -import { - getGridEditorEmits, - getGridInputProps, - useNamespace, -} from '@ibiz-template/vue3-util'; -import { TextBoxEditorController } from '../text-box-editor.controller'; - -export const IBizGridInput = defineComponent({ - name: 'IBizGridInput', - props: getGridInputProps(), - emits: getGridEditorEmits(), - setup() { - const ns = useNamespace('grid-input'); - - return { - ns, - }; - }, - render() { - return ( -
- {h(resolveComponent('IBizInput'), { - ...this.$props, - })} -
- ); - }, -}); diff --git a/src/editor/text-box/ibiz-input-ip/ibiz-input-ip.tsx b/src/editor/text-box/ibiz-input-ip/ibiz-input-ip.tsx index c2f3d799f6633d5a41839f9095e7ebc5c4f2de97..dc274be3a9648071f91b7b84c7c658ca5cffe423 100644 --- a/src/editor/text-box/ibiz-input-ip/ibiz-input-ip.tsx +++ b/src/editor/text-box/ibiz-input-ip/ibiz-input-ip.tsx @@ -85,6 +85,7 @@ export const IBizInputIP = defineComponent({ activeElement.value = true; if (isAllBlur.value) { isAllBlur.value = false; + emit('focus'); } }; @@ -94,6 +95,7 @@ export const IBizInputIP = defineComponent({ setTimeout(() => { if (!activeElement.value) { isAllBlur.value = true; + emit('blur'); } }, 0); }; diff --git a/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx b/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx index 415977370e47a46ae6300a1dc8d9f1860780aeec..d998b4a4f39329748dedece768aae47e7a26e95a 100644 --- a/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx +++ b/src/editor/text-box/ibiz-input-number/ibiz-input-number.tsx @@ -44,12 +44,24 @@ export const IBizInputNumber = defineComponent({ }); } + // 聚焦 + const onFocus = () => { + emit('focus'); + }; + + // 失焦 + const onBlur = () => { + emit('blur'); + }; + return { ns, c, currentVal, handleChange, inputRef, + onFocus, + onBlur, }; }, render() { @@ -73,6 +85,8 @@ export const IBizInputNumber = defineComponent({ precision={this.c.model.precision} disabled={this.disabled} onChange={this.handleChange} + onFocus={this.onFocus} + onBlur={this.onBlur} >, unitName && {unitName}, ]; diff --git a/src/editor/text-box/index.ts b/src/editor/text-box/index.ts index ab9b972ce370a9f0ad6c9f82aa6f191dea3ff5af..27d8a8fc99e1dbe58eef283c1989931b00f09300 100644 --- a/src/editor/text-box/index.ts +++ b/src/editor/text-box/index.ts @@ -1,7 +1,5 @@ export { IBizInput } from './input/input'; export { IBizInputNumber } from './ibiz-input-number/ibiz-input-number'; export { IBizInputIP } from './ibiz-input-ip/ibiz-input-ip'; -export { IBizGridInput } from './ibiz-grid-input/ibiz-grid-input'; -export { IBizGridInputNumber } from './ibiz-grid-input-number/ibiz-grid-input-number'; export * from './text-box-editor.controller'; export * from './text-box-editor.provider'; diff --git a/src/view-engine/pickup-view.engine.ts b/src/view-engine/pickup-view.engine.ts index 9d7a99e7be5c5c73800ca2e56cea1ad5230d42a4..77b579f391ded4a6c50e33484b8a38de04127aee 100644 --- a/src/view-engine/pickup-view.engine.ts +++ b/src/view-engine/pickup-view.engine.ts @@ -63,7 +63,7 @@ export class PickupViewEngine extends ViewEngineBase { async doMounted(): Promise { this.pickupViewPanel.state.singleSelect = true; this.pickupViewPanel.evt.on('onSelectionChange', event => { - this.selectData = this.handleSelectData(event.data); + this.selectData = event.data; }); this.pickupViewPanel.evt.on('onDataActive', event => { this.pickupViewPanelDataActive(event.data); @@ -79,7 +79,7 @@ export class PickupViewEngine extends ViewEngineBase { * @memberof PickupViewEngine */ public pickupViewPanelDataActive(data: IData[]) { - this.selectData = this.handleSelectData(data); + this.selectData = data; this.view.closeView({ ok: true, data: this.selectData }); } @@ -96,23 +96,6 @@ export class PickupViewEngine extends ViewEngineBase { return super.call(key, args); } - /** - * 处理选中数据 - * - * @memberof PickupViewEngine - */ - handleSelectData(data: IData[]): IData[] { - const selectData: IData[] = []; - data.forEach((item: IData) => { - selectData.push({ - srfkey: item.srfkey, - srfmajortext: item.srfmajortext, - data: { ...item }, - }); - }); - return selectData; - } - /** * 确认 *