diff --git a/packages/arcodesign-vue/components/components.ts b/packages/arcodesign-vue/components/components.ts index 83404a9a..c4385033 100644 --- a/packages/arcodesign-vue/components/components.ts +++ b/packages/arcodesign-vue/components/components.ts @@ -1,12 +1,14 @@ import badgeDefault from './badge'; import cellDefault from './cell'; import contextProviderDefault from './context-provider'; +import loadingDefault from './loading'; import notifyDefault from './notify'; import transitionDefault from './transition'; export * from './badge'; export * from './cell'; export * from './context-provider'; +export * from './loading'; export * from './notify'; export * from './transition'; @@ -14,6 +16,7 @@ export const allCompInstall = [ badgeDefault.install, cellDefault.install, contextProviderDefault.install, + loadingDefault.install, notifyDefault.install, transitionDefault.install, ]; diff --git a/packages/arcodesign-vue/components/loading/Loading.vue b/packages/arcodesign-vue/components/loading/Loading.vue new file mode 100644 index 00000000..22131a00 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/Loading.vue @@ -0,0 +1,258 @@ + + + + diff --git a/packages/arcodesign-vue/components/loading/README.en-US.md b/packages/arcodesign-vue/components/loading/README.en-US.md new file mode 100644 index 00000000..785253ee --- /dev/null +++ b/packages/arcodesign-vue/components/loading/README.en-US.md @@ -0,0 +1,36 @@ + + +### Feedback + +# Loading + +Loading component, divided into four types, `circle` is a ring, `arc` is an arc `spin` is a rotation, and `dot` is a dot. All types can be customized in color, ring and arc types can be customized with coil radius and thickness, and rotation and dot types can be customized with internal element transparency. + +====== + +> Props + +| Property | Description | Type | DefaultValue | +| -------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ------------ | +| style | Custom stylesheet | CSSProperties | - | +| class | Custom classname | string | - | +| color | The main color, if you want to use css to control the main color, you can use the public mixin \`\.set\-loading\-color(@color)\` | string | - | +| type | Loading type | "spin" \| "circle" \| "arc" \| "dot" | "dot" | +| list | Valid when the type is \`dot\` or \`spin\`, defines the transparency of each element inside | number\[\] | - | +| duration | A loading cycle in millisecond | number | 1000 | +| svgKey | Distinguish the \`\\` content of different svg | string | - | +| radius | Circle radius, available when type is \`circle\` or \`arc\` | number | 9 | +| stroke | Circle stroke width, available when type is \`circle\` or \`arc\` or \`spin\` | number | 2 | +| filleted | Whether the edges are rounded | boolean | true | + +> Refs + +| Property | Description | Type | +| -------- | ------------------------- | -------------- | +| dom | The outermost element DOM | HTMLDivElement | + +> LoadingType + +``` +"spin" | "circle" | "arc" | "dot" +``` diff --git a/packages/arcodesign-vue/components/loading/README.md b/packages/arcodesign-vue/components/loading/README.md new file mode 100644 index 00000000..6a97ae83 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/README.md @@ -0,0 +1,36 @@ + + +### 反馈 + +# 加载 Loading + +加载中组件,分为四种类型,`circle`为环形,`arc`为弧线,`spin`为旋转,`dot`为圆点。所有类型均可定制颜色,环形和弧线类型可定制线圈半径及粗细,旋转和圆点类型可定制内部元素透明度。 + +====== + +> 属性/Props + +| 参数 | 描述 | 类型 | 默认值 | +| -------- | ------------------------------------------------------------------------------------- | ------------------------------------ | ------ | +| style | 自定义样式 | CSSProperties | - | +| class | 自定义类名 | string | - | +| color | 主颜色,如果想使用 css 控制主颜色,可使用公共 mixin \`\.set\-loading\-color(@color)\` | string | - | +| type | loading 类型 | "spin" \| "circle" \| "arc" \| "dot" | "dot" | +| list | 当类型为\`dot\`或\`spin\`时有效,定义内部各元素的透明度 | number\[\] | - | +| duration | 一次 loading 周期的毫秒数 | number | 1000 | +| svgKey | 区分不同 loading 组件间的\`\\`内容 | string | - | +| radius | 圆圈半径,类型为\`circle\`或\`arc\`时可用 | number | 9 | +| stroke | 圆圈描边宽度,类型为\`circle\`或\`arc\`或\`spin\`时可用 | number | 2 | +| filleted | 边缘是否为圆角 | boolean | true | + +> 引用/Refs + +| 参数 | 描述 | 类型 | +| ---- | -------------- | -------------- | +| dom | 最外层元素 DOM | HTMLDivElement | + +> LoadingType + +``` +"spin" | "circle" | "arc" | "dot" +``` diff --git a/packages/arcodesign-vue/components/loading/__demo__/custom-color.md b/packages/arcodesign-vue/components/loading/__demo__/custom-color.md new file mode 100644 index 00000000..63965a77 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/__demo__/custom-color.md @@ -0,0 +1,27 @@ + + +## 自定义加载颜色/透明度 @en{Custom loading color/transparent} + +#### 3 + +旋转和圆点类型可定制内部元素透明度。@en{Inner element transparency of spin and dot types can be customized.} + +```vue + +``` + +```less +.loading-demo-basic { + .@{prefix}-loading { + .rem(margin-right, 20); + vertical-align: middle; + } +} +``` diff --git a/packages/arcodesign-vue/components/loading/__demo__/custom-size.md b/packages/arcodesign-vue/components/loading/__demo__/custom-size.md new file mode 100644 index 00000000..27f3a083 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/__demo__/custom-size.md @@ -0,0 +1,26 @@ + + +## 自定义加载大小/粗细 @en{Custom loading size/thickness} + +#### 2 + +环形和弧线类型可定制线圈半径及粗细。 @en{ The coil radius and thickness of circle and arc types can be customized.} + +```vue + +``` + +```less +.loading-demo-basic { + .@{prefix}-loading { + .rem(margin-right, 20); + vertical-align: middle; + } +} +``` diff --git a/packages/arcodesign-vue/components/loading/__demo__/filleted.md b/packages/arcodesign-vue/components/loading/__demo__/filleted.md new file mode 100644 index 00000000..45689efe --- /dev/null +++ b/packages/arcodesign-vue/components/loading/__demo__/filleted.md @@ -0,0 +1,25 @@ + + +## 去除圆角 @en{No fillet} + +#### 4 + +```vue + +``` + +```less +.loading-demo-basic { + .@{prefix}-loading { + .rem(margin-right, 20); + vertical-align: middle; + } +} +``` diff --git a/packages/arcodesign-vue/components/loading/__demo__/index.md b/packages/arcodesign-vue/components/loading/__demo__/index.md new file mode 100644 index 00000000..d0c1848f --- /dev/null +++ b/packages/arcodesign-vue/components/loading/__demo__/index.md @@ -0,0 +1,25 @@ + + +## 基础用法 @en{Basic Usage} + +#### 1 + +```vue + +``` + +```less +.loading-demo-basic { + .@{prefix}-loading { + .rem(margin-right, 20); + vertical-align: middle; + } +} +``` diff --git a/packages/arcodesign-vue/components/loading/index.ts b/packages/arcodesign-vue/components/loading/index.ts new file mode 100644 index 00000000..5d2e950a --- /dev/null +++ b/packages/arcodesign-vue/components/loading/index.ts @@ -0,0 +1,11 @@ +// Note: Generated by AI, needs verification +import Loading from './Loading.vue'; +import { installFactory } from '../_helpers/install'; + +const install = installFactory(Loading); + +export { Loading }; + +export default { + install, +}; diff --git a/packages/arcodesign-vue/components/loading/style/index.less b/packages/arcodesign-vue/components/loading/style/index.less new file mode 100644 index 00000000..43a29753 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/style/index.less @@ -0,0 +1,99 @@ +// Note: Generated by AI, needs verification +@import '../../../style/mixin.less'; + +.@{prefix}-loading { + .set-loading-color-var(loading-color); + display: inline-block; + font-size: 0; + line-height: 0; + position: relative; + @keyframes changDeg { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + + &.circle, + &.arc, + &.spin { + animation: changDeg 1s infinite linear; + } + + &.circle { + .loading-circle-middle { + stop-opacity: 0.5; + } + + .loading-circle-end { + stop-opacity: 0; + } + } + + &.dot { + .dot-cell { + display: inline-block; + .use-var(width, loading-dot-size); + .use-var(height, loading-dot-size); + .use-var(margin-left, loading-dot-gutter); + + &:first-of-type { + margin-left: 0; + } + + &.filleted { + border-radius: 50%; + } + } + } + + &.spin { + .rem(height, 22); + .rem(width, 22); + position: relative; + + .spin-cell { + position: absolute; + .rem(left, 10); + .rem(top, 1); + display: inline-block; + .rem(height, 10); + .rem(padding-bottom, 4); + overflow: hidden; + transform-origin: 50% bottom; + + &-inner { + display: inline-block; + position: absolute; + top: 0; + left: 0; + width: 200%; + transform: scale(0.5); + transform-origin: top left; + .rem(height, 12); + } + } + } + + &.arc { + .arc-bg { + .use-var(stroke, loading-arc-background-color); + } + } + + &.line { + width: 100%; + + .loading-line-start, + .loading-line-end { + .use-var(stop-color, loading-color); + } + + .loading-line-start { + stop-opacity: 0; + } + } +} diff --git a/packages/arcodesign-vue/components/loading/style/index.ts b/packages/arcodesign-vue/components/loading/style/index.ts new file mode 100644 index 00000000..b7d76bc9 --- /dev/null +++ b/packages/arcodesign-vue/components/loading/style/index.ts @@ -0,0 +1,3 @@ +// Note: Generated by AI, needs verification +import '../../../style/public.less'; +import './index.less'; diff --git a/packages/arcodesign-vue/components/loading/type.ts b/packages/arcodesign-vue/components/loading/type.ts new file mode 100644 index 00000000..f58b64bb --- /dev/null +++ b/packages/arcodesign-vue/components/loading/type.ts @@ -0,0 +1,70 @@ +// Note: Generated by AI, needs verification +import { CSSProperties } from 'vue'; + +export type LoadingType = 'spin' | 'circle' | 'arc' | 'dot'; + +export interface LoadingProps { + /** + * 自定义样式 + * @en Custom stylesheet + */ + style?: CSSProperties; + /** + * 自定义类名 + * @en Custom classname + */ + class?: string; + /** + * 主颜色,如果想使用 css 控制主颜色,可使用公共 mixin `.set-loading-color(@color)` + * @en The main color, if you want to use css to control the main color, you can use the public mixin `.set-loading-color(@color)` + */ + color?: string; + /** + * loading类型 + * @en Loading type + * @default "dot" + */ + type?: LoadingType; + /** + * 当类型为`dot`或`spin`时有效,定义内部各元素的透明度 + * @en Valid when the type is `dot` or `spin`, defines the transparency of each element inside + */ + list?: number[]; + /** + * 一次loading周期的毫秒数 + * @en A loading cycle in millisecond + * @default 1000 + */ + duration?: number; + /** + * 区分不同loading组件间的``内容 + * @en Distinguish the `` content of different svg + */ + svgKey?: string; + /** + * 圆圈半径,类型为`circle`或`arc`时可用 + * @en Circle radius, available when type is `circle` or `arc` + * @default 9 + */ + radius?: number; + /** + * 圆圈描边宽度,类型为`circle`或`arc`或`spin`时可用 + * @en Circle stroke width, available when type is `circle` or `arc` or `spin` + * @default 2 + */ + stroke?: number; + /** + * 边缘是否为圆角 + * @en Whether the edges are rounded + * @default true + */ + filleted?: boolean; +} + +export interface LoadingRef { + /** + * 最外层元素 DOM + * @en The outermost element DOM + */ + dom: HTMLDivElement | null; +} diff --git a/packages/arcodesign-vue/components/style.ts b/packages/arcodesign-vue/components/style.ts index 49306c78..352b81c4 100644 --- a/packages/arcodesign-vue/components/style.ts +++ b/packages/arcodesign-vue/components/style.ts @@ -2,5 +2,6 @@ import '../style/public.less'; import './badge/style'; import './cell/style'; import './context-provider/style'; +import './loading/style'; import './notify/style'; import './transition/style';