{
+ const shouldShowIndex = this.controller.enableSort
+ ? columnIndex === 1
+ : columnIndex === 0;
+ return shouldShowIndex ? this.ns.b('index') : '';
+ }}
+ {...heightObject}
+ >
+ {{
+ default: (): VNodeArrayChildren => {
+ return [
+ this.controller.enableSort && (
+
+ {{
+ default: () => {
+ if (isEmpty) {
+ return '';
+ }
+ return (
+
+ );
+ },
+ }}
+
+ ),
+
+ {{
+ default: (opts: IData) => {
+ if (isEmpty) {
+ return '';
+ }
+ const { $index } = opts;
+ return {$index + 1};
+ },
+ }}
+ ,
+ this.formItems.length > 0 &&
+ this.formItems.map(item => {
+ // 重复器表格列自适应(表单项label宽度配置为1)
+ const width = item.labelWidth;
+ let widthName = 'width';
+ let columnWidth = '';
+ if (typeof width === 'number') {
+ if (width === 1) {
+ widthName = 'min-width';
+ }
+ columnWidth = `${width}px`;
+ }
+ return (
+
+ {{
+ default: (opts: IData) => {
+ if (isEmpty) {
+ return '';
+ }
+ const { $index } = opts;
+ const formC = toRaw(
+ this.formControllers[$index],
+ ) as EditFormController;
+ if (!formC || !formC.state.isLoaded) {
+ return (
+
+ {ibiz.i18n.t(
+ 'control.form.repeaterGrid.absentOrLoad',
+ )}
+
+ );
+ }
+ const formItemC = formC.formItems.find(
+ x => x.name === item.id,
+ )!;
+
+ let editor = null;
+ if (!formItemC.editorProvider) {
+ editor = (
+
+ );
+ } else {
+ const component = resolveComponent(
+ formItemC.editorProvider.formEditor,
+ );
+ editor = h(component, {
+ value: formItemC.value,
+ data: formItemC.data,
+ controller: formItemC.editor,
+ disabled: formItemC.state.disabled,
+ readonly: formItemC.state.readonly,
+ onChange: (
+ val: unknown,
+ name?: string,
+ ): void => {
+ formItemC.setDataValue(val, name);
+ },
+ });
+ }
+
+ return (
+
+ {editor}
+
+ );
+ },
+ }}
+
+ );
+ }),
+
+ {{
+ default: (opts: IData) => {
+ const { $index } = opts;
+ return (
+
+ {this.controller.enableCreate && (
+ {
+ this.controller.create(
+ isEmpty ? 0 : $index + 1,
+ );
+ }}
+ >
+ )}
+ {this.controller.enableDelete &&
+ !isEmpty &&
+ this.renderRemoveBtn($index)}
+
+ );
+ },
+ }}
+ ,
+ ];
+ },
+ append: () => {
+ return [
+ tableHeight && (
+ this.loadMore()}
+ infinite-scroll-distance={20}
+ >
+ ),
+ ];
+ },
+ }}
+