Skip to content

Commit

Permalink
feat: add Affix meta to yunti-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandiasnow committed May 9, 2024
1 parent 75f4c0e commit 8e19c6f
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
126 changes: 126 additions & 0 deletions packages/yunti-ui-lowcode-materials/lowcode/Affix/meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import { IPublicTypeComponentMetadata } from '@alilc/lowcode-types';

import { COMMON_CONFIGURE_PROPS } from '../utils';
import { AffixSnippets } from './snippets';

const AffixMetaInfo: IPublicTypeComponentMetadata = {
componentName: 'Affix',
title: 'Affix',
docUrl: '',
screenshot: '',
devMode: 'proCode',
npm: {
package: '@yuntijs/ui-lowcode-materials',
version: '{{version}}',
exportName: 'Affix',
destructuring: true,
subName: '',
},
configure: {
props: [
...COMMON_CONFIGURE_PROPS,
{
title: {
label: {
'type': 'i18n',
'en-US': 'offsetTop',
'zh-CN': '距离窗口顶部达到指定偏移量后触发 ',
},
tip: 'offsetTop | Triggered when the specified offset is reached from the top of the window',
},
name: 'offsetTop',
description: 'Triggered when the specified offset is reached from the top of the window',
setter: {
componentName: 'NumberSetter',
isRequired: false,
initialValue: 0,
},
},
{
title: {
label: {
'type': 'i18n',
'en-US': 'offsetBottom',
'zh-CN': '距离窗口底部达到指定偏移量后触发',
},
tip: 'offsetBottom | Triggered when the specified offset is reached from the bottom of the window',
},
name: 'offsetBottom',
description: 'Triggered when the specified offset is reached from the bottom of the window',
setter: {
componentName: 'NumberSetter',
isRequired: false,
initialValue: 0,
},
},
{
title: {
label: {
'type': 'i18n',
'en-US': 'target',
'zh-CN': '监听其滚动事件的元素',
},
tip: 'target | Set the element that Affix needs to listen to its scroll event, the value is a function that returns the corresponding DOM element',
},
name: 'target',
description:
'Set the element that Affix needs to listen to its scroll event, the value is a function that returns the corresponding DOM element',
setter: {
componentName: 'FunctionSetter',
isRequired: false,
},
},
{
title: {
label: {
'type': 'i18n',
'en-US': 'prefixCls',
'zh-CN': 'prefixCls',
},
},
name: 'prefixCls',
setter: {
componentName: 'StringSetter',
isRequired: false,
initialValue: '',
},
},
{
title: {
label: {
'type': 'i18n',
'en-US': 'rootClassName',
'zh-CN': 'rootClassName',
},
},
name: 'rootClassName',
setter: {
componentName: 'StringSetter',
isRequired: false,
initialValue: '',
},
},
],
supports: {
loop: true,
condition: true,
style: true,
className: true,
events: [
{
name: 'onChange',
description: '固定状态改变时触发的回调函数',
template:
"onChange(affixed, ${extParams}){\n// 固定状态改变时触发的回调函数 \nconsole.log('onChange', affixed);}",
},
],
},
component: {},
},
category: '其他',
};

export const AffixMeta = {
...AffixMetaInfo,
snippets: AffixSnippets,
};
24 changes: 24 additions & 0 deletions packages/yunti-ui-lowcode-materials/lowcode/Affix/snippets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { IPublicTypeSnippet } from '@alilc/lowcode-types';

export const AffixSnippets: IPublicTypeSnippet[] = [
{
title: '固钉(Affix)',
screenshot: '',
schema: {
componentName: 'Affix',
props: {
__component_name: 'Affix',
offsetTop: 120,
children: [
{
componentName: 'Button',
props: {
__component_name: 'Button',
children: 'Affix Top',
},
},
],
},
},
},
];
2 changes: 2 additions & 0 deletions packages/yunti-ui-lowcode-materials/lowcode/meta.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pkgJson from '../package.json';
import { AffixMeta } from './Affix/meta';
import { AlertMeta } from './Alert/meta';
import { ButtonMeta } from './Button/meta';
import { MonacoDiffEditorMeta, MonacoEditorMeta } from './MonacoEditor/meta';
Expand All @@ -11,6 +12,7 @@ const components = [
MonacoDiffEditorMeta,
SliderInputMeta,
AlertMeta,
AffixMeta,
ButtonMeta,
].map(c => {
if (c.npm) {
Expand Down

0 comments on commit 8e19c6f

Please sign in to comment.