index.ts 812 Bytes
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';

export enum ViewTypeEnum {
  PRIVATE_VIEW = 'PRIVATE_VIEW',
  PUBLIC_VIEW = 'PUBLIC_VIEW',
}

export enum ViewTypeNameEnum {
  PRIVATE_VIEW = '私有',
  PUBLIC_VIEW = '公共',
}

export enum FieldsEnum {
  IS_SHARE = 'isShare',
  ACCESS_CREDENTIALS = 'accessCredentials',
}

const { t } = useI18n();

export const schemas: FormSchema[] = [
  {
    field: FieldsEnum.IS_SHARE,
    label: t('visual.dataview.isShareText'),
    component: 'Switch',
    defaultValue: false,
  },
  {
    field: FieldsEnum.ACCESS_CREDENTIALS,
    label: t('visual.dataview.shareAccess'),
    component: 'InputPassword',
    ifShow: ({ model }) => model[FieldsEnum.IS_SHARE],
    componentProps: {
      maxLength: 64,
    },
  },
];