@aappddeevv/dynamics-client-ui 中文文档教程

发布于 7年前 浏览 24 项目主页 更新于 3年前

dynamics-client-ui

What is it?

帮助您创建出色的动态应用程序的库。

该库包含实用程序和 UI 组件,用 typescript 和 react 编写,但可直接从 javascript 中使用。

一些部分:

  • Robust web api client and data management interfaces proven in multiple applications.
  • Robust metadata client, caching.
  • Dynamics react wrapper component, provides an XRM, user message notifier and other supporting components
  • EntityForm react wrapper component, acts like a redux store. Supports "new" and "existing" form control.
  • EventBus for coordinating different web components in a master-detail fashion.
  • FormContextHolder to properly obtain a form context and make it available to WebResources.
  • HTML traditional/UCI UI utilities to help your UI work in any environment
  • SortedDetailsList react components for displaying tabular data nicely. Based on office-fabric-ui-react.
  • Misc react components for UI construction
  • Redux combineReducers that provides the full state to all reducers.
  • …and more…

Using

使用 npm 安装:

npm install install --save @aappddeevv/dynamics-client-ui

如果你想在开发模式下使用库,只需将它与 npm 链接。 这 库构建仍在建设中,但如果你使用 npm,它是可用的 关联。 克隆后:

cd dynamics-client-ui
npm run build
npm link
cd ../yourapp
npm link dynamics-client-ui

该库确实创建了一个 typescript 解析输出分布,因此您可以使用 该模块与其他任何模块一样。

转换成 js/.d.ts 文件很流行,但我不确定那是 如果您假设消费者都在使用,那么最好的发布方式 打字稿。 将 CSS 文件转换成更多内容可能很重要 可消化,因此您不需要使用相同的 CSS 加载器捆绑 配置为 dynamics-client-cli。 有一些 office-fabric-ui-react 构建块,例如,提供可分类的、漂亮的 DetailsList 可用于列出主从数据并与之交互 交互模型。

您需要将模块 BuildSettings 定义为导出一个 几个常数。 有关详细信息,请参阅配置/README.md。

CSS 目前是使用 cssnext 编写的。 如果你使用 webpack 进行打包, 应该工作的 postcss 配置是:

const finalStyleLoaders = [
    { loader: "style-loader" },
    { loader: "css-loader", options: { modules: true, importLoaders: 1 } },
    { loader: "postcss-loader",
      options: {
          ident: 'postcss',
          plugins: (loader) => [
              require("postcss-import")({root: loader.resourcePath}),
              require("postcss-mixins")(),
              require("postcss-cssnext")(),
              require("postcss-reporter")({clearMessages: true}),
          ] }}
]

我提到这个是因为大多数库给你一个单一版本的 CSS 来使用或 传递 LESS/SCSS 文件。 使用这个加载器相当于提供 你的消息来源。

Documentation

我正在致力于发布 API 文档,但还没有完成。

dynamics-client-ui

What is it?

A library to help you create great dynamics applications.

The library contains utilities and UI components, written in typescript and react but directly usable from javascript.

Some parts:

  • Robust web api client and data management interfaces proven in multiple applications.
  • Robust metadata client, caching.
  • Dynamics react wrapper component, provides an XRM, user message notifier and other supporting components
  • EntityForm react wrapper component, acts like a redux store. Supports "new" and "existing" form control.
  • EventBus for coordinating different web components in a master-detail fashion.
  • FormContextHolder to properly obtain a form context and make it available to WebResources.
  • HTML traditional/UCI UI utilities to help your UI work in any environment
  • SortedDetailsList react components for displaying tabular data nicely. Based on office-fabric-ui-react.
  • Misc react components for UI construction
  • Redux combineReducers that provides the full state to all reducers.
  • …and more…

Using

Install using npm:

npm install install --save @aappddeevv/dynamics-client-ui

If you wish to use the library in development mode, just link it with npm. The library build is still under construction but it is usable if you use npm link. After cloning:

cd dynamics-client-ui
npm run build
npm link
cd ../yourapp
npm link dynamics-client-ui

The library does creates a typescript parsed output distribution so you can use the module like any other.

Transpiling down to js/.d.ts files is quite popular, but I am not sure that's the best way to publish if you assume that the consumers are all using typescript. It may be critical to transpile CSS files though into something more digestable so that you do not need to use the same CSS loader bundling configuration as dynamics-client-cli. There are some office-fabric-ui-react building blocks as well, for example, providing a sortable, nice looking DetailsList you can use to list and interact with data in a master-detail interaction model.

You will need to define the module BuildSettings to be a module that exports a few constants. See config/README.md for details.

The CSS is currently written using cssnext. If you use webpack for bundling, the postcss configuration that should work is:

const finalStyleLoaders = [
    { loader: "style-loader" },
    { loader: "css-loader", options: { modules: true, importLoaders: 1 } },
    { loader: "postcss-loader",
      options: {
          ident: 'postcss',
          plugins: (loader) => [
              require("postcss-import")({root: loader.resourcePath}),
              require("postcss-mixins")(),
              require("postcss-cssnext")(),
              require("postcss-reporter")({clearMessages: true}),
          ] }}
]

I mention this because most libraries give you a single version of CSS to use or pass along the LESS/SCSS files. Using this loader is the equivalent of providing you the sources.

Documentation

I am working on publishing API documentation but am not quite there yet.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文