@ant-design/icons#VerticalAlignBottomOutlined TypeScript Examples

The following examples show how to use @ant-design/icons#VerticalAlignBottomOutlined. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: config-toolbar.ts    From XFlow with MIT License 6 votes vote down vote up
registerIcon = () => {
  IconStore.set('SaveOutlined', SaveOutlined)
  IconStore.set('UndoOutlined', UndoOutlined)
  IconStore.set('RedoOutlined', RedoOutlined)
  IconStore.set('VerticalAlignTopOutlined', VerticalAlignTopOutlined)
  IconStore.set('VerticalAlignBottomOutlined', VerticalAlignBottomOutlined)
  IconStore.set('GatewayOutlined', GatewayOutlined)
  IconStore.set('GroupOutlined', GroupOutlined)
  IconStore.set('UngroupOutlined', UngroupOutlined)
  IconStore.set('CopyOutlined', CopyOutlined)
  IconStore.set('SnippetsOutlined', SnippetsOutlined)
}
Example #2
Source File: verticalAlign.tsx    From imove with MIT License 6 votes vote down vote up
ALIGN_MAP: { [key: string]: AlignItem } = {
  top: {
    text: '上对齐',
    icon: <VerticalAlignTopOutlined />,
    attrs: {
      refY: 0,
      refY2: 10,
      textVerticalAlign: 'start',
      align: {
        vertical: 'top',
      },
    },
  },
  center: {
    text: '居中对齐',
    icon: <VerticalAlignMiddleOutlined />,
    attrs: {
      refY: 0.5,
      refY2: 0,
      textVerticalAlign: 'middle',
      align: {
        vertical: 'center',
      },
    },
  },
  bottom: {
    text: '下对齐',
    icon: <VerticalAlignBottomOutlined />,
    attrs: {
      refY: 0.99,
      refY2: -10,
      textVerticalAlign: 'end',
      align: {
        vertical: 'bottom',
      },
    },
  },
}
Example #3
Source File: ToTopToBottom.tsx    From datart with Apache License 2.0 6 votes vote down vote up
ToBottomBtn: FC<{
  fn: MouseEventHandler<HTMLElement> | undefined;
  title: string;
}> = ({ fn, title }) => {
  return (
    <Tooltip title={title}>
      <ToolbarButton onClick={fn} icon={<VerticalAlignBottomOutlined />} />
    </Tooltip>
  );
}
Example #4
Source File: StoryOverLay.tsx    From datart with Apache License 2.0 5 votes vote down vote up
StoryOverLay: React.FC<BoardOverLayProps> = memo(
  ({ onOpenShareLink, allowShare, allowManage, onPublish, isArchived }) => {
    const t = useI18NPrefix(`viz.action`);
    const tg = useI18NPrefix(`global`);
    const { storyId: stroyId, orgId } = useContext(StoryContext);
    const recycleViz = useRecycleViz(orgId, stroyId, 'STORYBOARD');
    const renderList = useMemo(
      () => [
        {
          key: 'shareLink',
          icon: <ShareAltOutlined />,
          onClick: onOpenShareLink,
          disabled: false,
          render: allowShare,
          content: t('share.shareLink'),
          className: 'line',
        },
        {
          key: 'publish',
          icon: <VerticalAlignBottomOutlined />,
          onClick: onPublish,
          disabled: false,
          render: allowManage && !isArchived && onPublish,
          content: t('unpublish'),
        },
        {
          key: 'delete',
          icon: <DeleteOutlined />,
          disabled: false,
          render: allowManage,
          content: (
            <Popconfirm
              title={tg('operation.archiveConfirm')}
              onConfirm={recycleViz}
            >
              {tg('button.archive')}
            </Popconfirm>
          ),
        },
      ],
      [
        onOpenShareLink,
        allowShare,
        t,
        onPublish,
        allowManage,
        isArchived,
        tg,
        recycleViz,
      ],
    );
    const actionItems = useMemo(
      () =>
        renderList
          .filter(item => item.render)
          .map(item => {
            return (
              <>
                <Menu.Item
                  key={item.key}
                  icon={item.icon}
                  onClick={item.onClick}
                >
                  {item.content}
                </Menu.Item>
                {item.className && <Menu.Divider />}
              </>
            );
          }),
      [renderList],
    );
    return <Menu>{actionItems}</Menu>;
  },
)
Example #5
Source File: MoveUpDownRow.tsx    From dnde with GNU General Public License v3.0 4 votes vote down vote up
MoveUpDown = ({ className, idRef, active }: MoveUpDownProps) => {
  const { mjmlJson, setMjmlJson } = useEditor();
  const [upActive, setUpActive] = useState(true);
  const [downActive, setDownActive] = useState(true);

  useEffect(() => {
    if (idRef.current === active) {
      const uniqueClassName = findUniqueIdentifierFromString(className);
      if (uniqueClassName) {
        const child = findElementInJson(mjmlJson, findUniqueIdentifierFromString(className));
        const parent = findElementInJson(mjmlJson, 'identifier-mj-body');
        if (child && parent) {
          const [parentItem] = parent;
          const [childItem] = child;

          // if section element is the first element
          if (parentItem && parentItem.children && parentItem.children.length === 1) {
            setUpActive(false);
            setDownActive(false);
            return;
          } else if (parentItem && parentItem.children && parentItem.children.length > 1) {
            const lastItem = parentItem.children.length - 1;
            for (let i = 0; i < parentItem.children.length; i++) {
              const childSection = parentItem.children[i];
              if (
                childSection &&
                childSection.attributes &&
                childSection.attributes['css-class'] &&
                childSection.attributes['css-class'].includes(uniqueClassName)
              ) {
                if (i === lastItem) {
                  setDownActive(false);
                  setUpActive(true);
                  break;
                } else if (i === 0) {
                  setUpActive(false);
                  setDownActive(true);
                  break;
                }
              }
            }
          }
        }
      }
    }
  }, [mjmlJson, idRef, active]);

  const MoveUp = (e: any) => {
    ResetEventBehaviour(e);
    moveSectionUp(className, mjmlJson, setMjmlJson);
  };

  const MoveDown = (e: any) => {
    ResetEventBehaviour(e);
    moveSectionDown(className, mjmlJson, setMjmlJson);
  };

  return (
    <div onMouseDown={ResetEventBehaviour} style={{ display: active === idRef.current ? 'block' : 'none' }}>
      <div
        style={{
          zIndex: 200,
          position: 'absolute',
          left: -38,
          bottom: 0,
          display: 'flex',
          flexDirection: 'column',
          rowGap: '4px',
        }}
      >
        <Button
          type="primary"
          disabled={!upActive}
          onClick={MoveUp}
          icon={<VerticalAlignTopOutlined style={{ fontSize: '20px' }} />}
        />
        <Button
          type="primary"
          disabled={!downActive}
          onClick={MoveDown}
          icon={<VerticalAlignBottomOutlined style={{ fontSize: '20px' }} />}
        />
      </div>
    </div>
  );
}
Example #6
Source File: Icon.tsx    From html2sketch with MIT License 4 votes vote down vote up
IconSymbol: FC = () => {
  return (
    <Row>
      {/*<CaretUpOutlined*/}
      {/*  className="icon"*/}
      {/*  symbolName={'1.General/2.Icons/1.CaretUpOutlined'}*/}
      {/*/>*/}
      {/*  className="icon"*/}
      {/*  symbolName={'1.General/2.Icons/2.MailOutlined'}*/}
      {/*/>*/}
      {/*<StepBackwardOutlined*/}
      {/*  className="icon"*/}
      {/*  symbolName={'1.General/2.Icons/2.StepBackwardOutlined'}*/}
      {/*/>*/}
      {/*<StepForwardOutlined*/}
      {/*  className="icon"*/}
      {/*  symbolName={'1.General/2.Icons/2.StepBackwardOutlined'}*/}
      {/*/>*/}
      <StepForwardOutlined />
      <ShrinkOutlined />
      <ArrowsAltOutlined />
      <DownOutlined />
      <UpOutlined />
      <LeftOutlined />
      <RightOutlined />
      <CaretUpOutlined />
      <CaretDownOutlined />
      <CaretLeftOutlined />
      <CaretRightOutlined />
      <VerticalAlignTopOutlined />
      <RollbackOutlined />
      <FastBackwardOutlined />
      <FastForwardOutlined />
      <DoubleRightOutlined />
      <DoubleLeftOutlined />
      <VerticalLeftOutlined />
      <VerticalRightOutlined />
      <VerticalAlignMiddleOutlined />
      <VerticalAlignBottomOutlined />
      <ForwardOutlined />
      <BackwardOutlined />
      <EnterOutlined />
      <RetweetOutlined />
      <SwapOutlined />
      <SwapLeftOutlined />
      <SwapRightOutlined />
      <ArrowUpOutlined />
      <ArrowDownOutlined />
      <ArrowLeftOutlined />
      <ArrowRightOutlined />
      <LoginOutlined />
      <LogoutOutlined />
      <MenuFoldOutlined />
      <MenuUnfoldOutlined />
      <BorderBottomOutlined />
      <BorderHorizontalOutlined />
      <BorderInnerOutlined />
      <BorderOuterOutlined />
      <BorderLeftOutlined />
      <BorderRightOutlined />
      <BorderTopOutlined />
      <BorderVerticleOutlined />
      <PicCenterOutlined />
      <PicLeftOutlined />
      <PicRightOutlined />
      <RadiusBottomleftOutlined />
      <RadiusBottomrightOutlined />
      <RadiusUpleftOutlined />
      <RadiusUprightOutlined />
      <FullscreenOutlined />
      <FullscreenExitOutlined />
      <QuestionOutlined />
      <PauseOutlined />
      <MinusOutlined />
      <PauseCircleOutlined />
      <InfoOutlined />
      <CloseOutlined />
      <ExclamationOutlined />
      <CheckOutlined />
      <WarningOutlined />
      <IssuesCloseOutlined />
      <StopOutlined />
      <EditOutlined />
      <CopyOutlined />
      <ScissorOutlined />
      <DeleteOutlined />
      <SnippetsOutlined />
      <DiffOutlined />
      <HighlightOutlined />
      <AlignCenterOutlined />
      <AlignLeftOutlined />
      <AlignRightOutlined />
      <BgColorsOutlined />
      <BoldOutlined />
      <ItalicOutlined />
      <UnderlineOutlined />
      <StrikethroughOutlined />
      <RedoOutlined />
      <UndoOutlined />
      <ZoomInOutlined />
      <ZoomOutOutlined />
      <FontColorsOutlined />
      <FontSizeOutlined />
      <LineHeightOutlined />
      <SortAscendingOutlined />
      <SortDescendingOutlined />
      <DragOutlined />
      <OrderedListOutlined />
      <UnorderedListOutlined />
      <RadiusSettingOutlined />
      <ColumnWidthOutlined />
      <ColumnHeightOutlined />
      <AreaChartOutlined />
      <PieChartOutlined />
      <BarChartOutlined />
      <DotChartOutlined />
      <LineChartOutlined />
      <RadarChartOutlined />
      <HeatMapOutlined />
      <FallOutlined />
      <RiseOutlined />
      <StockOutlined />
      <BoxPlotOutlined />
      <FundOutlined />
      <SlidersOutlined />
      <AndroidOutlined />
      <AppleOutlined />
      <WindowsOutlined />
      <IeOutlined />
      <ChromeOutlined />
      <GithubOutlined />
      <AliwangwangOutlined />
      <DingdingOutlined />
      <WeiboSquareOutlined />
      <WeiboCircleOutlined />
      <TaobaoCircleOutlined />
      <Html5Outlined />
      <WeiboOutlined />
      <TwitterOutlined />
      <WechatOutlined />
      <AlipayCircleOutlined />
      <TaobaoOutlined />
      <SkypeOutlined />
      <FacebookOutlined />
      <CodepenOutlined />
      <CodeSandboxOutlined />
      <AmazonOutlined />
      <GoogleOutlined />
      <AlipayOutlined />
      <AntDesignOutlined />
      <AntCloudOutlined />
      <ZhihuOutlined />
      <SlackOutlined />
      <SlackSquareOutlined />
      <BehanceSquareOutlined />
      <DribbbleOutlined />
      <DribbbleSquareOutlined />
      <InstagramOutlined />
      <YuqueOutlined />
      <AlibabaOutlined />
      <YahooOutlined />
      <RedditOutlined />
      <SketchOutlined />
      <AccountBookOutlined />
      <AlertOutlined />
      <ApartmentOutlined />
      <ApiOutlined />
      <QqOutlined />
      <MediumWorkmarkOutlined />
      <GitlabOutlined />
      <MediumOutlined />
      <GooglePlusOutlined />
      <AppstoreAddOutlined />
      <AppstoreOutlined />
      <AudioOutlined />
      <AudioMutedOutlined />
      <AuditOutlined />
      <BankOutlined />
      <BarcodeOutlined />
      <BarsOutlined />
      <BellOutlined />
      <BlockOutlined />
      <BookOutlined />
      <BorderOutlined />
      <BranchesOutlined />
      <BuildOutlined />
      <BulbOutlined />
      <CalculatorOutlined />
      <CalendarOutlined />
      <CameraOutlined />
      <CarOutlined />
      <CarryOutOutlined />
      <CiCircleOutlined />
      <CiOutlined />
      <CloudOutlined />
      <ClearOutlined />
      <ClusterOutlined />
      <CodeOutlined />
      <CoffeeOutlined />
      <CompassOutlined />
      <CompressOutlined />
      <ContactsOutlined />
      <ContainerOutlined />
      <ControlOutlined />
      <CopyrightCircleOutlined />
      <CopyrightOutlined />
      <CreditCardOutlined />
      <CrownOutlined />
      <CustomerServiceOutlined />
      <DashboardOutlined />
      <DatabaseOutlined />
      <DeleteColumnOutlined />
      <DeleteRowOutlined />
      <DisconnectOutlined />
      <DislikeOutlined />
      <DollarCircleOutlined />
      <DollarOutlined />
      <DownloadOutlined />
      <EllipsisOutlined />
      <EnvironmentOutlined />
      <EuroCircleOutlined />
      <EuroOutlined />
      <ExceptionOutlined />
      <ExpandAltOutlined />
      <ExpandOutlined />
      <ExperimentOutlined />
      <ExportOutlined />
      <EyeOutlined />
      <FieldBinaryOutlined />
      <FieldNumberOutlined />
      <FieldStringOutlined />
      <DesktopOutlined />
      <DingtalkOutlined />
      <FileAddOutlined />
      <FileDoneOutlined />
      <FileExcelOutlined />
      <FileExclamationOutlined />
      <FileOutlined />
      <FileImageOutlined />
      <FileJpgOutlined />
      <FileMarkdownOutlined />
      <FilePdfOutlined />
      <FilePptOutlined />
      <FileProtectOutlined />
      <FileSearchOutlined />
      <FileSyncOutlined />
      <FileTextOutlined />
      <FileUnknownOutlined />
      <FileWordOutlined />
      <FilterOutlined />
      <FireOutlined />
      <FlagOutlined />
      <FolderAddOutlined />
      <FolderOutlined />
      <FolderOpenOutlined />
      <ForkOutlined />
      <FormatPainterOutlined />
      <FrownOutlined />
      <FunctionOutlined />
      <FunnelPlotOutlined />
      <GatewayOutlined />
      <GifOutlined />
      <GiftOutlined />
      <GlobalOutlined />
      <GoldOutlined />
      <GroupOutlined />
      <HddOutlined />
      <HeartOutlined />
      <HistoryOutlined />
      <HomeOutlined />
      <HourglassOutlined />
      <IdcardOutlined />
      <ImportOutlined />
      <InboxOutlined />
      <InsertRowAboveOutlined />
      <InsertRowBelowOutlined />
      <InsertRowLeftOutlined />
      <InsertRowRightOutlined />
      <InsuranceOutlined />
      <InteractionOutlined />
      <KeyOutlined />
      <LaptopOutlined />
      <LayoutOutlined />
      <LikeOutlined />
      <LineOutlined />
      <LinkOutlined />
      <Loading3QuartersOutlined />
      <LoadingOutlined />
      <LockOutlined />
      <MailOutlined />
      <ManOutlined />
      <MedicineBoxOutlined />
      <MehOutlined />
      <MenuOutlined />
      <MergeCellsOutlined />
      <MessageOutlined />
      <MobileOutlined />
      <MoneyCollectOutlined />
      <MonitorOutlined />
      <MoreOutlined />
      <NodeCollapseOutlined />
      <NodeExpandOutlined />
      <NodeIndexOutlined />
      <NotificationOutlined />
      <NumberOutlined />
      <PaperClipOutlined />
      <PartitionOutlined />
      <PayCircleOutlined />
      <PercentageOutlined />
      <PhoneOutlined />
      <PictureOutlined />
      <PoundCircleOutlined />
      <PoundOutlined />
      <PoweroffOutlined />
      <PrinterOutlined />
      <ProfileOutlined />
      <ProjectOutlined />
      <PropertySafetyOutlined />
      <PullRequestOutlined />
      <PushpinOutlined />
      <QrcodeOutlined />
      <ReadOutlined />
      <ReconciliationOutlined />
      <RedEnvelopeOutlined />
      <ReloadOutlined />
      <RestOutlined />
      <RobotOutlined />
      <RocketOutlined />
      <SafetyCertificateOutlined />
      <SafetyOutlined />
      <ScanOutlined />
      <ScheduleOutlined />
      <SearchOutlined />
      <SecurityScanOutlined />
      <SelectOutlined />
      <SendOutlined />
      <SettingOutlined />
      <ShakeOutlined />
      <ShareAltOutlined />
      <ShopOutlined />
      <ShoppingCartOutlined />
      <ShoppingOutlined />
      <SisternodeOutlined />
      <SkinOutlined />
      <SmileOutlined />
      <SolutionOutlined />
      <SoundOutlined />
      <SplitCellsOutlined />
      <StarOutlined />
      <SubnodeOutlined />
      <SyncOutlined />
      <TableOutlined />
      <TabletOutlined />
      <TagOutlined />
      <TagsOutlined />
      <TeamOutlined />
      <ThunderboltOutlined />
      <ToTopOutlined />
      <ToolOutlined />
      <TrademarkCircleOutlined />
      <TrademarkOutlined />
      <TransactionOutlined />
      <TrophyOutlined />
      <UngroupOutlined />
      <UnlockOutlined />
      <UploadOutlined />
      <UsbOutlined />
      <UserAddOutlined />
      <UserDeleteOutlined />
      <UserOutlined />
      <UserSwitchOutlined />
      <UsergroupAddOutlined />
      <UsergroupDeleteOutlined />
      <VideoCameraOutlined />
      <WalletOutlined />
      <WifiOutlined />
      <BorderlessTableOutlined />
      <WomanOutlined />
      <BehanceOutlined />
      <DropboxOutlined />
      <DeploymentUnitOutlined />
      <UpCircleOutlined />
      <DownCircleOutlined />
      <LeftCircleOutlined />
      <RightCircleOutlined />
      <UpSquareOutlined />
      <DownSquareOutlined />
      <LeftSquareOutlined />
      <RightSquareOutlined />
      <PlayCircleOutlined />
      <QuestionCircleOutlined />
      <PlusCircleOutlined />
      <PlusSquareOutlined />
      <MinusSquareOutlined />
      <MinusCircleOutlined />
      <InfoCircleOutlined />
      <ExclamationCircleOutlined />
      <CloseCircleOutlined />
      <CloseSquareOutlined />
      <CheckCircleOutlined />
      <CheckSquareOutlined />
      <ClockCircleOutlined />
      <FormOutlined />
      <DashOutlined />
      <SmallDashOutlined />
      <YoutubeOutlined />
      <CodepenCircleOutlined />
      <AliyunOutlined />
      <PlusOutlined />
      <LinkedinOutlined />
      <AimOutlined />
      <BugOutlined />
      <CloudDownloadOutlined />
      <CloudServerOutlined />
      <CloudSyncOutlined />
      <CloudUploadOutlined />
      <CommentOutlined />
      <ConsoleSqlOutlined />
      <EyeInvisibleOutlined />
      <FileGifOutlined />
      <DeliveredProcedureOutlined />
      <FieldTimeOutlined />
      <FileZipOutlined />
      <FolderViewOutlined />
      <FundProjectionScreenOutlined />
      <FundViewOutlined />
      <MacCommandOutlined />
      <PlaySquareOutlined />
      <OneToOneOutlined />
      <RotateLeftOutlined />
      <RotateRightOutlined />
      <SaveOutlined />
      <SwitcherOutlined />
      <TranslationOutlined />
      <VerifiedOutlined />
      <VideoCameraAddOutlined />
      <WhatsAppOutlined />

      {/*</Col>*/}
    </Row>
  );
}
Example #7
Source File: flex.tsx    From visual-layout with MIT License 4 votes vote down vote up
config = [
  {
    title: '主轴方向 / Flex-Direction',
    key: 'flex-direction',
    getValue: ({ style }: CssProps) =>
      style?.filter(css => css.key === 'flex-direction')[0]?.value,
    items: [
      {
        value: 'column',
        icon: (
          <Tooltip placement="right" title="column">
            <InsertRowBelowOutlined />
          </Tooltip>
        ),
      },
      {
        value: 'row',
        icon: (
          <Tooltip placement="right" title="row">
            <InsertRowLeftOutlined />
          </Tooltip>
        ),
      },
    ],
  },
  {
    title: '主轴对齐 / Justify-Content',
    key: 'justify-content',
    getValue: ({ style }: CssProps) =>
      style?.filter(css => css.key === 'justify-content')[0]?.value,
    items: [
      {
        value: 'flex-start',
        icon: (
          <Tooltip placement="right" title="flex-start">
            <img alt="" src={FlexStart} />
          </Tooltip>
        ),
      },
      {
        value: 'flex-end',
        icon: (
          <Tooltip placement="right" title="flex-end">
            <img alt="" src={FlexEnd} />
          </Tooltip>
        ),
      },
      {
        value: 'center',
        icon: (
          <Tooltip placement="right" title="center">
            <img alt="" src={center} />
          </Tooltip>
        ),
      },
      {
        value: 'space-between',
        icon: (
          <Tooltip placement="right" title="space-between">
            <img alt="" src={SpaceBetween} />
          </Tooltip>
        ),
      },
      {
        value: 'space-around',
        icon: (
          <Tooltip placement="right" title="space-around">
            <img alt="" src={SpaceAround} />
          </Tooltip>
        ),
      },
    ],
  },
  {
    title: '交叉轴对齐 / Align-Items:',
    key: 'align-items',
    getValue: ({ style }: CssProps) =>
      style?.filter(css => css.key === 'align-items')[0]?.value,
    items: [
      {
        value: 'flex-start',
        icon: (
          <Tooltip placement="right" title="flex-start">
            <img alt="" src={ItemStart} />
          </Tooltip>
        ),
      },
      {
        value: 'flex-end',
        icon: (
          <Tooltip placement="right" title="flex-end">
            <img alt="" src={ItemEnd} />
          </Tooltip>
        ),
      },
      {
        value: 'center',
        icon: (
          <Tooltip placement="right" title="center">
            <img alt="" src={center} />
          </Tooltip>
        ),
      },
      {
        value: 'baseline',
        icon: (
          <Tooltip placement="right" title="baseline">
            <img alt="" src={baseline} />
          </Tooltip>
        ),
      },
      {
        value: 'stretch',
        icon: (
          <Tooltip placement="right" title="stretch">
            <img alt="" src={stretch} />
          </Tooltip>
        ),
      },
    ],
  },
  {
    title: '排列规则 / Flex-Wrap',
    key: 'flex-wrap',
    getValue: ({ style }: CssProps) =>
      style?.filter(css => css.key === 'flex-wrap')[0]?.value,
    items: [
      {
        value: 'wrap',
        icon: (
          <Tooltip placement="right" title="wrap">
            <img alt="" src={wrap} />
          </Tooltip>
        ),
      },
      {
        value: 'nowrap',
        icon: (
          <Tooltip placement="right" title="nowrap">
            <img alt="" src={nowrap} />
          </Tooltip>
        ),
      },
      {
        value: 'wrap-reverse',
        icon: (
          <Tooltip placement="right" title="wrap-reverse">
            <VerticalAlignBottomOutlined />
          </Tooltip>
        ),
      },
    ],
  },
  {
    title: '多轴对齐 / align-content',
    key: 'align-content',
    getValue: ({ style }: CssProps) =>
      style?.filter(css => css.key === 'align-content')[0]?.value,
    items: [
      {
        value: 'flex-start',
        icon: (
          <Tooltip placement="right" title="flex-start">
            <img alt="" src={FlexStart} />
          </Tooltip>
        ),
      },
      {
        value: 'flex-end',
        icon: (
          <Tooltip placement="right" title="flex-end">
            <img alt="" src={FlexEnd} />
          </Tooltip>
        ),
      },
      {
        value: 'center',
        icon: (
          <Tooltip placement="right" title="center">
            <img alt="" src={center} />
          </Tooltip>
        ),
      },
      {
        value: 'space-between',
        icon: (
          <Tooltip placement="right" title="space-between">
            <img alt="" src={SpaceBetween} />
          </Tooltip>
        ),
      },
      {
        value: 'space-around',
        icon: (
          <Tooltip placement="right" title="space-around">
            <img alt="" src={SpaceAround} />
          </Tooltip>
        ),
      },
      {
        value: 'stretch',
        icon: (
          <Tooltip placement="right" title="stretch">
            <img alt="" src={stretch} />
          </Tooltip>
        ),
      },
    ],
  },
]
Example #8
Source File: field.card.tsx    From ui with GNU Affero General Public License v3.0 4 votes vote down vote up
FieldCard: React.FC<Props> = ({
  form,
  field,
  fields,
  onChangeFields,
  remove,
  move,
  index,
}) => {
  const { t } = useTranslation()

  const type = form.getFieldValue([
    'form', 'fields', field.name as string, 'type',
  ]) as string
  const TypeComponent = (fieldTypes[type] || fieldTypes['textfield']).adminFormField()

  const [shouldUpdate, setShouldUpdate] = useState(false)
  const [nextTitle, setNextTitle] = useState<string>(
    form.getFieldValue([
      'form', 'fields', field.name as string, 'title',
    ])
  )

  useEffect(() => {
    if (!shouldUpdate) {
      return
    }

    const id = setTimeout(() => {
      setShouldUpdate(false)
      onChangeFields(
        fields.map((field, i) => {
          if (i === index) {
            return {
              ...field,
              title: nextTitle,
            }
          } else {
            return field
          }
        })
      )
    }, 500)

    return () => clearTimeout(id)
  }, [
    nextTitle, shouldUpdate, fields,
  ])

  const addLogic = useCallback((add: (defaults: unknown) => void, index: number) => {
    return (
      <Form.Item wrapperCol={{ span: 24 }}>
        <Space
          style={{
            width: '100%',
            justifyContent: 'flex-end',
          }}
        >
          <Button
            type="dashed"
            onClick={() => {
              const defaults: FormFieldLogicFragment = {
                id: `NEW-${Date.now()}`,
                formula: null,
                action: null,
                jumpTo: null,
                visible: null,
                disable: null,
                require: null,
                enabled: false,
              }

              add(defaults)
            }}
          >
            <PlusOutlined /> {t('form:logic.add')}
          </Button>
        </Space>
      </Form.Item>
    )
  }, [])

  return (
    <Card
      title={nextTitle}
      type={'inner'}
      extra={
        <Space>
          <Tooltip title={t('form:field.move.up')}>
            <Button
              type={'text'}
              disabled={index === 0}
              onClick={() => move(index, index - 1)}
              icon={<VerticalAlignTopOutlined />}
            />
          </Tooltip>
          <Tooltip title={t('form:field.move.down')}>
            <Button
              type={'text'}
              disabled={index + 1 >= form.getFieldValue(['form', 'fields']).length}
              onClick={() => move(index, index + 1)}
              icon={<VerticalAlignBottomOutlined />}
            />
          </Tooltip>
          <Form.Item noStyle shouldUpdate>
            {() => {
              // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
              const slug = form.getFieldValue([
                'form', 'fields', field.name as string, 'slug',
              ])

              if (!slug) {
                return null
              }

              return <Tag color={'warning'}>Slug: {slug}</Tag>
            }}
          </Form.Item>
          <Popover
            placement={'left'}
            content={
              <Form.Item
                name={[field.name as string, 'slug']}
                label={false}
                rules={[
                  {
                    pattern: /^[a-z0-9_]+$/,
                    message: t('validation:invalidSlug'),
                  },
                ]}
                help={t('type:slugInfo')}
              >
                <Input />
              </Form.Item>
            }
            title={t('type:slug')}
          >
            <Tag color={'blue'}>{t(`type:${type}.name`)}</Tag>
          </Popover>
          <Popconfirm
            placement={'left'}
            title={t('type:confirmDelete')}
            okText={t('type:deleteNow')}
            okButtonProps={{ danger: true }}
            onConfirm={() => {
              remove(index)
              onChangeFields(fields.filter((e, i) => i !== index))
            }}
          >
            <Button danger>
              <DeleteOutlined />
            </Button>
          </Popconfirm>
        </Space>
      }
    >
      <Form.Item name={[field.name as string, 'type']} noStyle>
        <Input type={'hidden'} />
      </Form.Item>
      <Form.Item
        label={t('type:title')}
        name={[field.name as string, 'title']}
        rules={[{ required: true, message: 'Title is required' }]}
        labelCol={{ span: 6 }}
      >
        <Input
          onChange={(e) => {
            setNextTitle(e.target.value)
            setShouldUpdate(true)
          }}
        />
      </Form.Item>
      <Form.Item
        label={t('type:description')}
        name={[field.name as string, 'description']}
        labelCol={{ span: 6 }}
        extra={t('type:descriptionInfo')}
      >
        <Input.TextArea autoSize />
      </Form.Item>
      <Form.Item
        label={t('type:required')}
        name={[field.name as string, 'required']}
        labelCol={{ span: 6 }}
        valuePropName={'checked'}
        extra={type === 'hidden' && t('type:requiredInfo')}
      >
        <Checkbox />
      </Form.Item>

      <TypeComponent field={field} form={form} />

      <Form.List name={[field.name as string, 'logic']}>
        {(logic, { add, remove, move }) => {
          const addAndMove = (index: number) => (defaults) => {
            add(defaults)
            move(fields.length, index)
          }

          return (
            <div>
              {addLogic(addAndMove(0), 0)}
              {logic.map((field, index) => (
                <div key={field.key}>
                  <Form.Item wrapperCol={{ span: 24 }} noStyle>
                    <LogicBlock
                      field={field}
                      form={form}
                      fields={fields}
                      index={index}
                      remove={remove}
                    />
                  </Form.Item>
                  {addLogic(addAndMove(index + 1), index + 1)}
                </div>
              ))}
            </div>
          )
        }}
      </Form.List>
    </Card>
  )
}
Example #9
Source File: VizOperationMenu.tsx    From datart with Apache License 2.0 4 votes vote down vote up
VizOperationMenu: FC<{
  onShareLinkClick?;
  onDownloadDataLinkClick?;
  onSaveAsVizs?;
  onReloadData?;
  onAddToDashBoard?;
  onPublish?;
  onRecycleViz?;
  allowDownload?: boolean;
  allowShare?: boolean;
  allowManage?: boolean;
  isArchived?: boolean;
}> = memo(
  ({
    onShareLinkClick,
    onDownloadDataLinkClick,
    onSaveAsVizs,
    onReloadData,
    onAddToDashBoard,
    onPublish,
    allowDownload,
    allowShare,
    allowManage,
    isArchived,
    onRecycleViz,
  }) => {
    const t = useI18NPrefix(`viz.action`);
    const tg = useI18NPrefix(`global`);

    const moreActionMenu = () => {
      const menus: any[] = [];

      if (onReloadData) {
        menus.push(
          <Menu.Item
            key="reloadData"
            icon={<ReloadOutlined />}
            onClick={onReloadData}
          >
            {t('syncData')}
          </Menu.Item>,
          <Menu.Divider key={'reloadDataLine'} />,
        );
      }

      if (allowManage && onSaveAsVizs) {
        menus.push(
          <Menu.Item key="saveAs" icon={<CopyFilled />} onClick={onSaveAsVizs}>
            {tg('button.saveAs')}
          </Menu.Item>,
        );
      }

      if (allowManage && onSaveAsVizs) {
        menus.push(
          <Menu.Item
            key="addToDash"
            icon={<FileAddOutlined />}
            onClick={() => onAddToDashBoard(true)}
          >
            {t('addToDash')}
          </Menu.Item>,
          <Menu.Divider key="addToDashLine" />,
        );
      }

      if (allowShare && onShareLinkClick) {
        menus.push(
          <Menu.Item
            key="shareLink"
            icon={<ShareAltOutlined />}
            onClick={onShareLinkClick}
          >
            {t('share.shareLink')}
          </Menu.Item>,
        );
      }

      if (allowDownload && onDownloadDataLinkClick) {
        menus.push(
          <Menu.Item key="downloadData" icon={<CloudDownloadOutlined />}>
            <Popconfirm
              placement="left"
              title={t('common.confirm')}
              onConfirm={() => {
                onDownloadDataLinkClick(DownloadFileType.Excel);
              }}
              okText={t('common.ok')}
              cancelText={t('common.cancel')}
            >
              {t('share.downloadData')}
            </Popconfirm>
          </Menu.Item>,
          <Menu.Item key="downloadPDF" icon={<CloudDownloadOutlined />}>
            <Popconfirm
              placement="left"
              title={t('common.confirm')}
              onConfirm={() => {
                onDownloadDataLinkClick(DownloadFileType.Pdf);
              }}
              okText={t('common.ok')}
              cancelText={t('common.cancel')}
            >
              {t('share.downloadPDF')}
            </Popconfirm>
          </Menu.Item>,
          <Menu.Item key="downloadPicture" icon={<CloudDownloadOutlined />}>
            <Popconfirm
              placement="left"
              title={t('common.confirm')}
              onConfirm={() => {
                onDownloadDataLinkClick(DownloadFileType.Image);
              }}
              okText={t('common.ok')}
              cancelText={t('common.cancel')}
            >
              {t('share.downloadPicture')}
            </Popconfirm>
          </Menu.Item>,
          <Menu.Divider />,
          <Menu.Divider key="downloadDataLine" />,
        );
      }

      if (allowManage && !isArchived && onPublish) {
        menus.push(
          <Menu.Item
            key="publish"
            icon={<VerticalAlignBottomOutlined />}
            onClick={onPublish}
          >
            {t('unpublish')}
          </Menu.Item>,
        );
      }

      if (allowManage && onRecycleViz) {
        menus.push(
          <Menu.Item key="delete" icon={<DeleteOutlined />}>
            <Popconfirm
              title={tg('operation.archiveConfirm')}
              onConfirm={onRecycleViz}
            >
              {tg('button.archive')}
            </Popconfirm>
          </Menu.Item>,
        );
      }

      return <Menu>{menus}</Menu>;
    };

    return <StyleVizOperationMenu>{moreActionMenu()}</StyleVizOperationMenu>;
  },
)