import { type ActiveRecord, type ActiveRecords, ActiveRecordsOperator, isRelation2OField, type Pagination, type QueryContext, type QueryPageResult, QueryService, type QueryVariables, type QueryWrapper, type RequestModelField, type RuntimeRelationField } from '@oinone/kunlun-engine'; import { GraphqlHelper, RSQLCondition } from '@oinone/kunlun-shared'; import { type SelectItem, SelectMode } from '@oinone/kunlun-vue-ui-common'; import { Widget } from '@oinone/kunlun-vue-widget'; import { DefaultSelect } from '../../../../components'; import type { FormComplexFieldProps } from '../FormComplexFieldWidget'; import { BaseSelectFieldWidget } from './BaseSelectFieldWidget'; export abstract class SelectFieldWidget< Option extends ActiveRecord = ActiveRecord, Value extends ActiveRecords = ActiveRecords, Field extends RuntimeRelationField = RuntimeRelationField, Props extends FormComplexFieldProps = FormComplexFieldProps > extends BaseSelectFieldWidget { @Widget.Reactive() protected mode: SelectMode = SelectMode.single; public initialize(props: Props) { super.initialize(props); this.setComponent(DefaultSelect); return this; } @Widget.Reactive() protected get bizStyle(): string | undefined { return this.getDsl().bizStyle; } @Widget.Method() public change(val: Value | null | undefined) { super.change(val); if (isRelation2OField(this.field)) { this.updateX2OValue(val as ActiveRecord); } } protected isNeedReloadOptions = false; @Widget.Method() protected async initLoad() { if (!this.options || (this.lastDomain || '') !== (this.domain || '') || this.isNeedReloadOptions) { this.isNeedReloadOptions = false; await this.$$initLoad(); } } protected async $$initLoad(condition?: RSQLCondition): Promise { this.pagination = undefined; const data = await this.fetchData(condition); const options: SelectItem