feat: 合并 @hera/plugin-mobile 到 @tachybase/plugin-mobile-client close #906 (#912)

Reviewed-on: daoyoucloud/tachybase#912
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-05-06 18:50:49 +08:00 committed by sealday
parent 4bb491f2e3
commit d64d092dbd
88 changed files with 487 additions and 450 deletions

View File

@ -1,2 +0,0 @@
/node_modules
/src

View File

@ -1 +0,0 @@
# @hera/plugin-mobile

View File

@ -1,2 +0,0 @@
export * from './dist/client';
export { default } from './dist/client';

View File

@ -1 +0,0 @@
module.exports = require('./dist/client/index.js');

View File

@ -1,26 +0,0 @@
{
"name": "@hera/plugin-mobile",
"displayName": "Mobile client: Customization",
"version": "1.1.20",
"description": "Provides the ability to configure mobile pages,more professional.",
"main": "dist/server/index.js",
"devDependencies": {
"@ant-design/icons": "5.x",
"@tachybase/schema": "workspace:*",
"@types/lodash": "^4.17.0",
"antd": "5.16.1",
"antd-mobile": "^5.35.0",
"antd-mobile-icons": "^0.3.0",
"classnames": "^2.3.1",
"lodash": "4.17.21",
"react-i18next": "^11.15.1"
},
"peerDependencies": {
"@nocobase/client": "workspace:*",
"@nocobase/server": "workspace:*",
"@nocobase/test": "workspace:*",
"@nocobase/utils": "workspace:*"
},
"description.zh-CN": "提提供定制化的移动端页面配置的能力。",
"displayName.zh-CN": "移动端:定制化"
}

View File

@ -1,2 +0,0 @@
export * from './dist/server';
export { default } from './dist/server';

View File

@ -1 +0,0 @@
module.exports = require('./dist/server/index.js');

View File

@ -1,17 +0,0 @@
import { Plugin, tval } from '@nocobase/client';
class PluginCommon extends Plugin {
async afterAdd() {}
async beforeLoad() {}
async load() {
// 扩展原移动端插件的 block 类型
this.app.schemaInitializerManager.addItem('mobilePage:addBlock', 'filterBlocks', {
title: tval('Filter blocks'),
type: 'itemGroup',
children: [],
});
}
}
export default PluginCommon;

View File

@ -1,24 +0,0 @@
import { Plugin } from '@nocobase/client';
import PluginCommon from './common/plugin';
import PluginBlock from './schma-block';
import PluginImageSearch from './schma-component/image-search/plugin';
import PluginSwiper from './schma-component/swiper';
import PluginTabSearch from './schma-component/tab-search';
import './assets/svg/index';
class PluginMobileClient extends Plugin {
async afterAdd() {
this.pm.add(PluginCommon);
this.pm.add(PluginBlock);
this.pm.add(PluginTabSearch);
this.pm.add(PluginSwiper);
this.pm.add(PluginImageSearch);
// this.app.router.add()
}
async beforeLoad() {}
async load() {}
}
export default PluginMobileClient;

View File

@ -1,15 +0,0 @@
import { useApp, tval as nTval, i18n } from '@nocobase/client';
const NAMESPACE = '@hera/plugin-mobile';
export const useTranslation = (): any => {
const { i18n } = useApp();
const t = (key: string, props = {}) => i18n.t(key, { ns: NAMESPACE, ...props });
return { t };
};
export const tval = (key: string) => nTval(key, { ns: NAMESPACE });
export function lang(key: string) {
return i18n.t(key, { ns: NAMESPACE });
}

View File

@ -1,19 +0,0 @@
import { Plugin } from '@nocobase/client';
import { NoticeBlock, NoticeBlockInitializer } from './schema-initializer/NoticeBlockInitializer';
class PluginBlock extends Plugin {
async load() {
this.app.addComponents({
NoticeBlock,
NoticeBlockInitializer,
});
this.app.schemaInitializerManager.addItem('MBlockInitializers', 'dataBlocks.notice', {
title: 'notice',
name: 'notice',
type: 'item',
Component: 'NoticeBlockInitializer',
});
}
}
export default PluginBlock;

View File

@ -1,40 +0,0 @@
import { Plugin } from '@nocobase/client';
import { ImageSearchView } from './ImageSearch.view';
import { ImageSearchInitializer } from './ImageSearch.initializer';
import { ImageSearchConfigureFields } from './ImageSearch.configure';
import { ImageSearchProvider } from './ImageSearch.provider';
import { ImageSearchItemIntializer } from './search-item/ImageSearchItem.intializer';
import { ImageSearchItemToolbar } from './search-item/ImageSearchItem.toolbar';
import { ImageSearchItemView } from './search-item/ImageSearchItem.view';
import { ImageSearchItemFieldSettings } from './search-item/ImageSearchItem.setting';
import { usePropsOptionalImageSearchItemField } from './search-item/useProps.Optional';
import { usePropsRelatedImageSearchItemField } from './search-item/useProps.Related';
class PluginImageSearch extends Plugin {
async load() {
this.app.addScopes({
usePropsOptionalImageSearchItemField: usePropsOptionalImageSearchItemField,
usePropsRelatedImageSearchItemField: usePropsRelatedImageSearchItemField,
});
this.app.addComponents({
ImageSearchView: ImageSearchView,
ImageSearchInitializer: ImageSearchInitializer,
ImageSearchProvider: ImageSearchProvider,
ImageSearchItemIntializer: ImageSearchItemIntializer,
ImageSearchItemToolbar: ImageSearchItemToolbar,
ImageSearchItemView: ImageSearchItemView,
});
this.app.schemaInitializerManager.add(ImageSearchConfigureFields);
this.schemaSettingsManager.add(ImageSearchItemFieldSettings);
this.app.schemaInitializerManager.addItem('mobilePage:addBlock', 'filterBlocks.imageSearch', {
name: 'imageSearch',
title: 'imageSearch',
icon: 'tab-search',
Component: 'ImageSearchInitializer',
});
}
}
export default PluginImageSearch;

View File

@ -1,33 +0,0 @@
import { Plugin } from '@nocobase/client';
import { SwiperBlockInitializer } from './SwiperBlockInitializer';
import { SwiperBlock } from './SwiperBlock';
import { SwiperFieldSettings } from './SwiperFieldSettings';
import { useSwiperBlockProps } from './useSwiperBlockProps';
import { SwiperPage } from './SwiperPage';
class PluginSwiper extends Plugin {
async load() {
this.app.addScopes({
useSwiperBlockProps,
});
this.app.addComponents({
SwiperBlockInitializer,
SwiperBlock,
SwiperPage,
});
this.app.schemaInitializerManager.addItem('mobilePage:addBlock', 'dataBlocks.swiper', {
title: 'swiper',
name: 'swiper',
type: 'item',
Component: 'SwiperBlockInitializer',
});
this.app.schemaSettingsManager.add(SwiperFieldSettings);
this.app.router.add('mobile.swiper.page', {
path: '/mobile/:name/image/:collection/:field/:fieldParams',
Component: 'SwiperPage',
});
}
}
export default PluginSwiper;

View File

@ -1,47 +0,0 @@
import { Plugin } from '@nocobase/client';
import { TabSearch } from './components/TabSearch';
import { TabSearchProvider } from './provider/TabSearchProvider';
import { TabSearchBlockInitializer } from './initializer/TabSearchBlockInitializer';
import { TabSearchFieldItem } from './components/field-item/TabSearchFieldItem';
import { TabSearchCollapsibleInputItem } from './components/field-item/TabSearchCollapsibleInputItem';
import { TabSearchFieldSchemaInitializerGadget } from './initializer/TabSearchFieldSchemaInitializerGadget';
import { useTabSearchFieldItemRelatedProps } from './components/field-item/TabSerachFieldItemRelatedProps';
import { useTabSearchFieldItemProps } from './components/field-item/TabSearchFieldItemProps';
import { TabSearchFieldSchemaInitializer } from './initializer/TabSearchFieldSchemaInitializer';
import { TabSearchItemFieldSettings } from './settings/TabSearchItemFieldSettings';
import { TabSearchFieldMItem } from './components/field-item/TabSearchFieldMItem';
import { TabSearchCollapsibleInputMItem } from './components/field-item/TabSearchCollapsibleInputMItem';
class PluginTabSearch extends Plugin {
async load() {
this.app.addScopes({
useTabSearchFieldItemProps,
useTabSearchFieldItemRelatedProps,
});
this.app.addComponents({
TabSearch,
TabSearchProvider,
TabSearchBlockInitializer,
TabSearchFieldItem,
TabSearchFieldMItem,
TabSearchCollapsibleInputItem,
TabSearchCollapsibleInputMItem,
TabSearchFieldSchemaInitializerGadget,
});
this.app.schemaInitializerManager.add(TabSearchFieldSchemaInitializer);
this.schemaSettingsManager.add(TabSearchItemFieldSettings);
this.app.schemaInitializerManager.addItem('mobilePage:addBlock', 'filterBlocks.tabSearch', {
name: 'tabSearch',
title: 'tabSearch',
Component: 'TabSearchBlockInitializer',
});
this.app.schemaInitializerManager.addItem('page:addBlock', 'filterBlocks.tabSearch', {
name: 'tabSearch',
title: 'tabSearch',
Component: 'TabSearchBlockInitializer',
});
}
}
export default PluginTabSearch;

View File

@ -1,2 +0,0 @@
export * from './server';
export { default } from './server';

View File

@ -1,17 +0,0 @@
{
"Choices fields":"Choices fields",
"Text fields":"Text fields",
"Generic properties":"Generic properties",
"Search":"Search",
"Please enter search content":"Please enter search content",
"Title field":"Title field",
"Set show field":"Set show field",
"Set field count":"Set field count",
"Configure field": "Configure field",
"Configure fields": "Configure fields",
"Configure columns": "Configure columns",
"Add block": "Add block",
"all": "all",
"AllProducts": "AllProducts",
"sort":"sort"
}

View File

@ -1,17 +0,0 @@
{
"Choices fields":"选择字段",
"Text fields":"文本字段",
"Generic properties":"通用属性",
"Search":"搜索",
"Please enter search content":"请输入查询内容",
"Title field":"标题字段",
"Set show field":"设置展示字段",
"Set field count":"设置展示数量",
"Configure field": "配置字段",
"Configure fields": "配置字段",
"Configure columns": "配置字段",
"Add block": "创建区块",
"all": "全部",
"AllProducts": "全部商品",
"sort": "排序"
}

View File

@ -1 +0,0 @@
export { default } from './plugin';

View File

@ -1,19 +0,0 @@
import { Plugin } from '@nocobase/server';
export class PluginMobileServer extends Plugin {
async afterAdd() {}
async beforeLoad() {}
async load() {}
async install() {}
async afterEnable() {}
async afterDisable() {}
async remove() {}
}
export default PluginMobileServer;

View File

@ -14,6 +14,7 @@
"ahooks": "3.x", "ahooks": "3.x",
"antd": "5.16.1", "antd": "5.16.1",
"antd-mobile": "^5.35.0", "antd-mobile": "^5.35.0",
"antd-mobile-icons": "^0.3.0",
"antd-style": "3.x", "antd-style": "3.x",
"classnames": "2.x", "classnames": "2.x",
"lodash": "4.17.21", "lodash": "4.17.21",

View File

@ -11,8 +11,31 @@ import {
MSettings, MSettings,
useGridCardBlockItemProps, useGridCardBlockItemProps,
useGridCardBlockProps, useGridCardBlockProps,
TabSearch,
TabSearchProvider,
TabSearchBlockInitializer,
TabSearchFieldItem,
TabSearchFieldMItem,
TabSearchCollapsibleInputItem,
TabSearchCollapsibleInputMItem,
TabSearchFieldSchemaInitializerGadget,
SwiperBlockInitializer,
SwiperBlock,
SwiperPage,
ImageSearchView,
ImageSearchInitializer,
ImageSearchProvider,
ImageSearchItemIntializer,
ImageSearchItemToolbar,
ImageSearchItemView,
NoticeBlock,
NoticeBlockInitializer,
useSwiperBlockProps,
usePropsOptionalImageSearchItemField,
usePropsRelatedImageSearchItemField,
} from './schema'; } from './schema';
import './bridge'; import './bridge';
import './assets/svg';
export const MobileCore: React.FC = (props) => { export const MobileCore: React.FC = (props) => {
return ( return (
@ -26,10 +49,32 @@ export const MobileCore: React.FC = (props) => {
MPage, MPage,
MHeader, MHeader,
MSettings, MSettings,
TabSearch,
TabSearchProvider,
TabSearchBlockInitializer,
TabSearchFieldItem,
TabSearchFieldMItem,
TabSearchCollapsibleInputItem,
TabSearchCollapsibleInputMItem,
TabSearchFieldSchemaInitializerGadget,
SwiperBlockInitializer,
SwiperBlock,
SwiperPage,
ImageSearchView: ImageSearchView,
ImageSearchInitializer: ImageSearchInitializer,
ImageSearchProvider: ImageSearchProvider,
ImageSearchItemIntializer: ImageSearchItemIntializer,
ImageSearchItemToolbar: ImageSearchItemToolbar,
ImageSearchItemView: ImageSearchItemView,
// NoticeBlock,
// NoticeBlockInitializer,
}} }}
scope={{ scope={{
useGridCardBlockItemProps, useGridCardBlockItemProps,
useGridCardBlockProps, useGridCardBlockProps,
useSwiperBlockProps,
usePropsOptionalImageSearchItemField: usePropsOptionalImageSearchItemField,
usePropsRelatedImageSearchItemField: usePropsRelatedImageSearchItemField,
}} }}
> >
{props.children} {props.children}

View File

@ -1,19 +1,18 @@
import { SchemaInitializer, useCollection, useCollectionManager } from '@nocobase/client'; import { SchemaInitializer, useCollection, useCollectionManager } from '@nocobase/client';
import { tval } from '../../locale';
import { useIsMobile } from '../tab-search/components/field-item/hooks'; import { useIsMobile } from '../tab-search/components/field-item/hooks';
import { canBeOptionalField, canBeRelatedField } from '../tab-search/utils'; import { canBeOptionalField, canBeRelatedField } from '../tab-search/utils';
import { createSchemaImageSearchItem } from './search-item/ImageSearchItem.schema'; import { createSchemaImageSearchItem } from './search-item/ImageSearchItem.schema';
export const ImageSearchConfigureFields = new SchemaInitializer({ export const ImageSearchConfigureFields = new SchemaInitializer({
name: 'ImageSearchView:configureFields', name: 'ImageSearchView:configureFields',
title: tval('Configure fields'), title: '{{t("Configure fields")}}',
style: { marginTop: 16 }, style: { marginTop: 16 },
icon: 'SettingOutlined', icon: 'SettingOutlined',
items: [ items: [
{ {
name: 'choicesFields', name: 'choicesFields',
type: 'itemGroup', type: 'itemGroup',
title: tval('Choices fields'), title: '{{t("Choices fields")}}',
useChildren: useChildrenChoicesFieldSchemas, useChildren: useChildrenChoicesFieldSchemas,
}, },
], ],

View File

@ -0,0 +1,2 @@
export * from './useAction.ImageSearchItemView';
export * from './useSelect';

View File

@ -1,7 +1,7 @@
import { useCollection, useDesigner } from '@nocobase/client'; import { useCollection, useDesigner } from '@nocobase/client';
import { useFieldSchema } from '@tachybase/schema'; import { useFieldSchema } from '@tachybase/schema';
import React from 'react'; import React from 'react';
import { useTranslation } from '../../../locale'; import { useTranslation } from '../../../../../locale';
export function useActionImageSearchItemView(props) { export function useActionImageSearchItemView(props) {
const { list, onSelected, valueKey: _valueKey, labelKey: _labelKey, filterKey } = props; const { list, onSelected, valueKey: _valueKey, labelKey: _labelKey, filterKey } = props;

View File

@ -0,0 +1,8 @@
export * from './ImageSearch.configure';
export * from './ImageSearch.initializer';
export * from './ImageSearch.provider';
export * from './ImageSearch.schema';
export * from './ImageSearch.view';
export * from './data';
export * from './hooks';
export * from './search-item';

View File

@ -9,7 +9,7 @@ import {
} from '@nocobase/client'; } from '@nocobase/client';
import { useField, useFieldSchema } from '@tachybase/schema'; import { useField, useFieldSchema } from '@tachybase/schema';
import _ from 'lodash'; import _ from 'lodash';
import { useTranslation } from '../../../locale'; import { useTranslation } from '../../../../../locale';
import { isTabSearchCollapsibleInputItem } from '../../tab-search/utils'; import { isTabSearchCollapsibleInputItem } from '../../tab-search/utils';
export const ImageSearchItemFieldSettings = new SchemaSettings({ export const ImageSearchItemFieldSettings = new SchemaSettings({

View File

@ -0,0 +1,7 @@
export * from './ImageSearchItem.intializer';
export * from './ImageSearchItem.schema';
export * from './ImageSearchItem.setting';
export * from './ImageSearchItem.toolbar';
export * from './ImageSearchItem.view';
export * from './useProps.Optional';
export * from './useProps.Related';

View File

@ -4,3 +4,7 @@ export * from './tab-bar';
export * from './page'; export * from './page';
export * from './header'; export * from './header';
export * from './settings'; export * from './settings';
export * from './image-search';
export * from './swiper';
export * from './tab-search';
export * from './notice';

View File

@ -0,0 +1 @@
export * from './schema-initializer';

View File

@ -8,7 +8,7 @@ import {
} from '@nocobase/client'; } from '@nocobase/client';
import { NoticeBar } from 'antd-mobile'; import { NoticeBar } from 'antd-mobile';
import { createGridCardBlockSchema } from '../schema-create/createGridCardBlockSchma'; import { createGridCardBlockSchema } from '../schema-create/createGridCardBlockSchma';
import { NoticeIcon } from '../../assets/svg'; import { NoticeIcon } from '../../../../assets/svg';
export const NoticeBlock = () => { export const NoticeBlock = () => {
return <NoticeBar content="月底冲量佣金上调" color="alert" />; return <NoticeBar content="月底冲量佣金上调" color="alert" />;

View File

@ -0,0 +1 @@
export * from './NoticeBlockInitializer';

View File

@ -1,7 +1,6 @@
import { BlockItem, css, useDesignable, useRequest, withDynamicSchemaProps } from '@nocobase/client'; import { BlockItem, css, useDesignable, useRequest, withDynamicSchemaProps } from '@nocobase/client';
import { useFieldSchema } from '@tachybase/schema';
import { Swiper } from 'antd-mobile'; import { Swiper } from 'antd-mobile';
import React, { useEffect, useState } from 'react'; import React from 'react';
export const SwiperBlock = withDynamicSchemaProps((props) => { export const SwiperBlock = withDynamicSchemaProps((props) => {
const { fieldValue, data, changeNav } = props; const { fieldValue, data, changeNav } = props;

View File

@ -6,7 +6,6 @@ import {
useSchemaInitializerItem, useSchemaInitializerItem,
} from '@nocobase/client'; } from '@nocobase/client';
import React from 'react'; import React from 'react';
import { createGridCardBlockSchema } from '../../schma-block/schema-create/createGridCardBlockSchma';
import { ISchema } from '@tachybase/schema'; import { ISchema } from '@tachybase/schema';
import { Toast } from 'antd-mobile'; import { Toast } from 'antd-mobile';

View File

@ -8,7 +8,7 @@ import {
} from '@nocobase/client'; } from '@nocobase/client';
import { useField, useFieldSchema } from '@tachybase/schema'; import { useField, useFieldSchema } from '@tachybase/schema';
import _ from 'lodash'; import _ from 'lodash';
import { useTranslation } from '../../locale'; import { useTranslation } from '../../../../locale';
export const SwiperFieldSettings = new SchemaSettings({ export const SwiperFieldSettings = new SchemaSettings({
name: 'SwiperFieldSettings', name: 'SwiperFieldSettings',

View File

@ -1,9 +1,4 @@
import { import { CollectionRecordProvider, DataBlockProvider, RemoteSchemaComponent } from '@nocobase/client';
CollectionRecordProvider,
DataBlockProvider,
RemoteSchemaComponent,
useCollectionRecord,
} from '@nocobase/client';
import React from 'react'; import React from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';

View File

@ -0,0 +1,5 @@
export * from './SwiperBlock';
export * from './SwiperBlockInitializer';
export * from './SwiperFieldSettings';
export * from './SwiperPage';
export * from './useSwiperBlockProps';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Button, Col, Divider, Input, Select } from 'antd'; import { Button, Col, Divider, Input, Select } from 'antd';
import { useTranslation } from '../../../../locale'; import { useTranslation } from '../../../../../../locale';
export const ISelect = (props) => { export const ISelect = (props) => {
const { options, onChange } = props; const { options, onChange } = props;

View File

@ -4,7 +4,7 @@ import React from 'react';
import { useTabSearchCollapsibleInputItemAction } from './TabSearchCollapsibleInputItemAction'; import { useTabSearchCollapsibleInputItemAction } from './TabSearchCollapsibleInputItemAction';
import { IButton, IDatePicker, IInput, ISelect } from './TabSearchCollapsibleInputMItemChild'; import { IButton, IDatePicker, IInput, ISelect } from './TabSearchCollapsibleInputMItemChild';
import { canBeDataField } from '../../utils'; import { canBeDataField } from '../../utils';
import { useTranslation } from '../../../../locale'; import { useTranslation } from '../../../../../../locale';
export const TabSearchCollapsibleInputMItem = withDynamicSchemaProps( export const TabSearchCollapsibleInputMItem = withDynamicSchemaProps(
(props) => { (props) => {

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from '../../../../locale'; import { useTranslation } from '../../../../../../locale';
import { Grid, Divider, Picker, Input, Space, ActionSheet, DatePicker, CalendarPicker } from 'antd-mobile'; import { Grid, Divider, Picker, Input, Space, ActionSheet, DatePicker, CalendarPicker } from 'antd-mobile';
import { DownOutline } from 'antd-mobile-icons'; import { DownOutline } from 'antd-mobile-icons';
import type { Action } from 'antd-mobile/es/components/action-sheet'; import type { Action } from 'antd-mobile/es/components/action-sheet';

View File

@ -2,7 +2,7 @@ import React from 'react';
import { MenuProps } from 'antd'; import { MenuProps } from 'antd';
import { useCollection, useDesigner } from '@nocobase/client'; import { useCollection, useDesigner } from '@nocobase/client';
import { useFieldSchema } from '@tachybase/schema'; import { useFieldSchema } from '@tachybase/schema';
import { useTranslation } from '../../../../locale'; import { useTranslation } from '../../../../../../locale';
export const useTabSearchFieldItemAction = (props) => { export const useTabSearchFieldItemAction = (props) => {
const { list, onSelected, valueKey: _valueKey, labelKey: _labelKey, filterKey } = props; const { list, onSelected, valueKey: _valueKey, labelKey: _labelKey, filterKey } = props;

View File

@ -0,0 +1,6 @@
export * from './TabSearchCollapsibleInputItem';
export * from './TabSearchCollapsibleInputMItem';
export * from './TabSearchFieldItem';
export * from './TabSearchFieldItemProps';
export * from './TabSearchFieldMItem';
export * from './TabSerachFieldItemRelatedProps';

View File

@ -0,0 +1,3 @@
export * from './TabSearch';
export * from './TabSearchAction';
export * from './field-item';

View File

@ -0,0 +1,4 @@
export * from './components';
export * from './initializer';
export * from './provider';
export * from './settings';

View File

@ -1,9 +1,9 @@
import { SchemaInitializer, SchemaInitializerItemType, useCollection, useCollectionManager } from '@nocobase/client'; import { SchemaInitializer, SchemaInitializerItemType, useCollection, useCollectionManager } from '@nocobase/client';
import _ from 'lodash'; import _ from 'lodash';
import { tval } from '../../../locale';
import { canBeDataField, canBeOptionalField, canBeRelatedField, canBeSearchField } from '../utils'; import { canBeDataField, canBeOptionalField, canBeRelatedField, canBeSearchField } from '../utils';
import { createTabSearchItemSchema } from '../create/createTabSearchItemSchema'; import { createTabSearchItemSchema } from '../create/createTabSearchItemSchema';
import { useIsMobile } from '../components/field-item/hooks'; import { useIsMobile } from '../components/field-item/hooks';
import { tval } from '../../../../../locale';
const textFieldsItem: SchemaInitializerItemType<any> = { const textFieldsItem: SchemaInitializerItemType<any> = {
name: 'textFields', name: 'textFields',

View File

@ -0,0 +1,3 @@
export * from './TabSearchBlockInitializer';
export * from './TabSearchFieldSchemaInitializer';
export * from './TabSearchFieldSchemaInitializerGadget';

View File

@ -0,0 +1 @@
export * from './TabSearchProvider';

View File

@ -7,7 +7,7 @@ import {
useDesignable, useDesignable,
useFormBlockContext, useFormBlockContext,
} from '@nocobase/client'; } from '@nocobase/client';
import { useTranslation } from '../../../locale'; import { useTranslation } from '../../../../../locale';
import { useField, useFieldSchema } from '@tachybase/schema'; import { useField, useFieldSchema } from '@tachybase/schema';
import _ from 'lodash'; import _ from 'lodash';
import { isTabSearchCollapsibleInputItem } from '../utils'; import { isTabSearchCollapsibleInputItem } from '../utils';

View File

@ -0,0 +1 @@
export * from './TabSearchItemFieldSettings';

View File

@ -1,5 +1,5 @@
import { CompatibleSchemaInitializer, gridRowColWrap } from '@nocobase/client'; import { CompatibleSchemaInitializer, gridRowColWrap } from '@nocobase/client';
import { generateNTemplate } from '../../../locale'; import { generateNTemplate, tval } from '../../../locale';
/** /**
* @deprecated * @deprecated
@ -31,11 +31,11 @@ export const mBlockInitializers_deprecated = new CompatibleSchemaInitializer({
title: '{{t("Form")}}', title: '{{t("Form")}}',
Component: 'FormBlockInitializer', Component: 'FormBlockInitializer',
}, },
{ // {
name: 'details', // name: 'details',
title: '{{t("Details")}}', // title: '{{t("Details")}}',
Component: 'DetailsBlockInitializer', // Component: 'DetailsBlockInitializer',
}, // },
{ {
name: 'calendar', name: 'calendar',
title: '{{t("Calendar")}}', title: '{{t("Calendar")}}',
@ -96,11 +96,11 @@ export const mBlockInitializers = new CompatibleSchemaInitializer(
title: '{{t("Table")}}', title: '{{t("Table")}}',
Component: 'TableBlockInitializer', Component: 'TableBlockInitializer',
}, },
{ // {
name: 'form', // name: 'form',
title: '{{t("Form")}}', // title: '{{t("Form")}}',
Component: 'FormBlockInitializer', // Component: 'FormBlockInitializer',
}, // },
{ {
name: 'details', name: 'details',
title: '{{t("Details")}}', title: '{{t("Details")}}',
@ -116,6 +116,18 @@ export const mBlockInitializers = new CompatibleSchemaInitializer(
title: generateNTemplate('Map'), title: generateNTemplate('Map'),
Component: 'MapBlockInitializer', Component: 'MapBlockInitializer',
}, },
{
title: tval('Swiper'),
name: 'swiper',
type: 'item',
Component: 'SwiperBlockInitializer',
},
{
title: 'notice',
name: 'notice',
type: 'item',
Component: 'NoticeBlockInitializer',
},
], ],
}, },
{ {
@ -130,7 +142,7 @@ export const mBlockInitializers = new CompatibleSchemaInitializer(
}, },
{ {
name: 'markdown', name: 'markdown',
title: '{{t("Markdown")}}', title: tval('Markdown'),
Component: 'MarkdownBlockInitializer', Component: 'MarkdownBlockInitializer',
}, },
{ {
@ -140,6 +152,24 @@ export const mBlockInitializers = new CompatibleSchemaInitializer(
}, },
], ],
}, },
{
name: 'filterBlocks',
type: 'itemGroup',
title: '{{t("Filter blocks")}}',
children: [
{
name: 'tabSearch',
title: tval('TabSearch'),
Component: 'TabSearchBlockInitializer',
},
{
name: 'imageSearch',
title: tval('ImageSearch'),
icon: 'tab-search',
Component: 'ImageSearchInitializer',
},
],
},
], ],
}, },
mBlockInitializers_deprecated, mBlockInitializers_deprecated,

View File

@ -3,7 +3,13 @@ import React from 'react';
import { Navigate, Outlet } from 'react-router-dom'; import { Navigate, Outlet } from 'react-router-dom';
import { MobileClientProvider } from './MobileClientProvider'; import { MobileClientProvider } from './MobileClientProvider';
import MApplication from './router/Application'; import MApplication from './router/Application';
import { mBlockInitializers, mBlockInitializers_deprecated } from './core/schema'; import {
ImageSearchConfigureFields,
ImageSearchItemFieldSettings,
mBlockInitializers,
mBlockInitializers_deprecated,
TabSearchFieldSchemaInitializer,
} from './core/schema';
import { AppConfiguration, InterfaceConfiguration } from './configuration'; import { AppConfiguration, InterfaceConfiguration } from './configuration';
import { NAMESPACE } from './locale'; import { NAMESPACE } from './locale';
@ -16,6 +22,9 @@ export class MobileClientPlugin extends Plugin {
this.app.use(MobileClientProvider); this.app.use(MobileClientProvider);
this.app.schemaInitializerManager.add(mBlockInitializers_deprecated); this.app.schemaInitializerManager.add(mBlockInitializers_deprecated);
this.app.schemaInitializerManager.add(mBlockInitializers); this.app.schemaInitializerManager.add(mBlockInitializers);
this.app.schemaInitializerManager.add(ImageSearchConfigureFields);
this.app.schemaSettingsManager.add(ImageSearchItemFieldSettings);
this.app.schemaInitializerManager.add(TabSearchFieldSchemaInitializer);
} }
addSettings() { addSettings() {
@ -66,6 +75,10 @@ export class MobileClientPlugin extends Plugin {
path: '/mobile/:name', path: '/mobile/:name',
Component: 'RouteSchemaComponent', Component: 'RouteSchemaComponent',
}); });
this.app.router.add('mobile.swiper.page', {
path: '/mobile/:name/image/:collection/:field/:fieldParams',
Component: 'SwiperPage',
});
} }
} }

View File

@ -1,4 +1,4 @@
import { i18n } from '@nocobase/client'; import {tval as nTval, i18n } from '@nocobase/client';
import { useTranslation as useT } from 'react-i18next'; import { useTranslation as useT } from 'react-i18next';
export const NAMESPACE = 'mobile-client'; export const NAMESPACE = 'mobile-client';
@ -14,6 +14,8 @@ export function generateNTemplate(key: string) {
return `{{t('${key}', { ns: '${NAMESPACE}', nsMode: 'fallback' })}}`; return `{{t('${key}', { ns: '${NAMESPACE}', nsMode: 'fallback' })}}`;
} }
export const tval = (key: string) => nTval(key, { ns: NAMESPACE });
export function useTranslation() { export function useTranslation() {
return useT([NAMESPACE, 'client'], { return useT([NAMESPACE, 'client'], {
nsMode: 'fallback', nsMode: 'fallback',

View File

@ -28,5 +28,20 @@
"Delete menu block": "Delete menu block", "Delete menu block": "Delete menu block",
"Mobile client access address": "Mobile client access address", "Mobile client access address": "Mobile client access address",
"The full address is": "The full address is", "The full address is": "The full address is",
"Preview": "Preview" "Preview": "Preview",
"Choices fields":"Choices fields",
"Text fields":"Text fields",
"Generic properties":"Generic properties",
"Search":"Search",
"Please enter search content":"Please enter search content",
"Title field":"Title field",
"Set show field":"Set show field",
"Set field count":"Set field count",
"Configure field": "Configure field",
"Configure fields": "Configure fields",
"Configure columns": "Configure columns",
"Add block": "Add block",
"all": "all",
"AllProducts": "AllProducts",
"sort":"sort"
} }

View File

@ -28,5 +28,23 @@
"Delete menu block": "删除菜单区块", "Delete menu block": "删除菜单区块",
"Mobile client access address": "移动端访问地址", "Mobile client access address": "移动端访问地址",
"The full address is": "完整的地址是", "The full address is": "完整的地址是",
"Preview": "预览" "Preview": "预览",
"Choices fields":"选择字段",
"Text fields":"文本字段",
"Generic properties":"通用属性",
"Search":"搜索",
"Please enter search content":"请输入查询内容",
"Title field":"标题字段",
"Set show field":"设置展示字段",
"Set field count":"设置展示数量",
"Configure field": "配置字段",
"Configure fields": "配置字段",
"Configure columns": "配置字段",
"Add block": "创建区块",
"all": "全部",
"AllProducts": "全部商品",
"sort": "排序",
"Swiper":"轮播图",
"TabSearch":"表格搜索",
"ImageSearch":"图片搜索"
} }

File diff suppressed because it is too large Load Diff