调整list组件及一些类型声明
This commit is contained in:
parent
9dcac9e0d1
commit
78220a4321
|
|
@ -3,7 +3,7 @@ import { Item } from './types';
|
|||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
entity: string | number;
|
||||
items: Item[];
|
||||
mode: "cell" | "default" | "table-cell";
|
||||
mode: "default" | "cell" | "table-cell";
|
||||
column: number;
|
||||
fixed: boolean;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
import { AttrRender, OakAbsAttrJudgeDef, ED } from '../../types/AbstractComponent';
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
lg: ColSpanType;
|
||||
md: ColSpanType;
|
||||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
import { AttrRender, OakAbsAttrJudgeDef, ED, ColumnMapType } from '../../types/AbstractComponent';
|
||||
export default function Render(props: WebComponentProps<ED, keyof ED, false, {
|
||||
entity: string;
|
||||
title: string;
|
||||
|
|
@ -23,4 +14,3 @@ export default function Render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
}, {
|
||||
getColor: (attr: string, value: any) => `#${string}` | undefined;
|
||||
}>): React.JSX.Element;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,16 +1,7 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
import { ColSpanType, ColumnProps } from '../../types/Filter';
|
||||
type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
lg: ColSpanType;
|
||||
md: ColSpanType;
|
||||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
import { ED, ColSpanType, ColumnMapType, Width } from '../../types/AbstractComponent';
|
||||
import { ColumnProps } from '../../types/Filter';
|
||||
export default function Render<ED2 extends ED>(props: WebComponentProps<ED, keyof ED, false, {
|
||||
entity: keyof ED;
|
||||
columns: Array<ColumnProps<ED2, keyof ED2>>;
|
||||
|
|
@ -20,4 +11,3 @@ export default function Render<ED2 extends ED>(props: WebComponentProps<ED, keyo
|
|||
}, {
|
||||
getNamedFilters: () => Record<string, any>[];
|
||||
}>): React.JSX.Element | null;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Space, Button } from 'antd';
|
||||
export default function Render(props) {
|
||||
const { methods, data } = props;
|
||||
const { data } = props;
|
||||
const { items } = data;
|
||||
if (!items || items.length === 0) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactCompo
|
|||
type: 'single' | 'multiple' | 'none';
|
||||
}) => void;
|
||||
} | undefined;
|
||||
hideHeader: boolean;
|
||||
hideHeader?: boolean | undefined;
|
||||
disableSerialNumber?: boolean | undefined;
|
||||
size?: "small" | "large" | "middle" | undefined;
|
||||
scroll?: TableProps<RowWithActions<ED, keyof ED>[]>['scroll'];
|
||||
locale?: TableProps<RowWithActions<ED, keyof ED>[]>['locale'];
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ export default OakComponent({
|
|||
tablePagination: undefined,
|
||||
rowSelection: undefined,
|
||||
hideHeader: false,
|
||||
disableSerialNumber: false,
|
||||
size: 'large',
|
||||
scroll: undefined,
|
||||
locale: undefined
|
||||
locale: undefined,
|
||||
},
|
||||
formData({ props }) {
|
||||
const { converter } = this.state;
|
||||
|
|
@ -68,6 +69,6 @@ export default OakComponent({
|
|||
},
|
||||
getColor(attr, value) {
|
||||
return this.features.style.getColor(this.props.entity, attr, value);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import { ButtonProps } from 'antd';
|
||||
import { ButtonType } from '../../../types/AbstractComponent';
|
||||
type buttonProps = {
|
||||
label: string;
|
||||
type?: ButtonProps['type'];
|
||||
type?: ButtonType;
|
||||
onClick: () => void;
|
||||
};
|
||||
type ToolBarProps = {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
|||
import { OakAbsAttrDef, onActionFnDef, OakExtraActionProps, OakAbsAttrJudgeDef, ED } from '../../types/AbstractComponent';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
export default function Render(props: WebComponentProps<ED, keyof ED, false, {
|
||||
width: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
||||
loading: boolean;
|
||||
extraActions: OakExtraActionProps[] | ((row: any) => OakExtraActionProps[]);
|
||||
entity: string;
|
||||
|
|
@ -17,6 +16,7 @@ export default function Render(props: WebComponentProps<ED, keyof ED, false, {
|
|||
rowSelection?: TableProps<any[]>['rowSelection'];
|
||||
i18n: any;
|
||||
hideHeader?: boolean;
|
||||
disableSerialNumber?: boolean;
|
||||
judgeAttributes: OakAbsAttrJudgeDef[];
|
||||
size?: 'large' | 'middle' | 'small';
|
||||
scroll?: TableProps<any[]>['scroll'];
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { TableContext } from '../listPro';
|
|||
export default function Render(props) {
|
||||
const { methods, data: oakData } = props;
|
||||
const { t, getColor } = methods;
|
||||
const { loading, entity, schema, extraActions, data, disabledOp = false, tablePagination, onAction, rowSelection, attributes, i18n, hideHeader, judgeAttributes, size = 'large', scroll, locale, } = oakData;
|
||||
const { loading, entity, schema, extraActions, data, disabledOp = false, tablePagination, onAction, rowSelection, attributes, i18n, hideHeader, disableSerialNumber, judgeAttributes, size = 'large', scroll, locale, } = oakData;
|
||||
const [tableColumns, setTableColumns] = useState([]);
|
||||
const { tableAttributes, setSchema } = useContext(TableContext);
|
||||
// 为了i18更新时能够重新渲染
|
||||
|
|
@ -26,59 +26,71 @@ export default function Render(props) {
|
|||
.filter((ele) => ele.show)
|
||||
.map((ele) => ele.attribute);
|
||||
}
|
||||
const tableColumns = showAttributes &&
|
||||
showAttributes.map((ele) => {
|
||||
if (ele.entity === 'notExist') {
|
||||
assert(ele.attribute.width, `非schema属性${ele.attr}需要自定义width`);
|
||||
assert(ele.attribute.type, `非schema属性${ele.attr}需要自定义type`);
|
||||
assert(ele.attribute.label, `非schema属性${ele.attr}需要自定义label`);
|
||||
}
|
||||
const title = getLabel(ele.attribute, ele.entity, ele.attr, t);
|
||||
const width = getWidth(ele.attribute, ele.attrType);
|
||||
const type = getType(ele.attribute, ele.attrType);
|
||||
const align = getAlign(ele.attribute);
|
||||
const fixed = getFixed(ele.attribute);
|
||||
const column = {
|
||||
key: ele.path,
|
||||
title,
|
||||
align,
|
||||
fixed,
|
||||
render: (v, row) => {
|
||||
if (typeof ele.attribute !== 'string' &&
|
||||
ele.attribute.render) {
|
||||
return ele.attribute.render(row);
|
||||
}
|
||||
const value = getValue(row, ele.path, ele.entity, ele.attr, ele.attrType, t);
|
||||
const stateValue = get(row, ele.path);
|
||||
let href = '';
|
||||
if ([null, undefined, ''].includes(stateValue)) {
|
||||
return <></>;
|
||||
}
|
||||
const color = getColor(ele.attr, stateValue);
|
||||
if (type === 'enum' && !color) {
|
||||
console.warn(color, `${ele.entity}实体${ele.attr}颜色定义缺失`);
|
||||
}
|
||||
if (type === 'link') {
|
||||
href = getLinkUrl(ele.attribute, {
|
||||
oakId: row?.id,
|
||||
});
|
||||
}
|
||||
return (<TableCell color={color} value={value} type={type} linkUrl={href}/>);
|
||||
const tableColumns = showAttributes?.map((ele) => {
|
||||
if (ele.entity === 'notExist') {
|
||||
assert(ele.attribute.width, `非schema属性${ele.attr}需要自定义width`);
|
||||
assert(ele.attribute.type, `非schema属性${ele.attr}需要自定义type`);
|
||||
assert(ele.attribute.label, `非schema属性${ele.attr}需要自定义label`);
|
||||
}
|
||||
const title = getLabel(ele.attribute, ele.entity, ele.attr, t);
|
||||
const width = getWidth(ele.attribute, ele.attrType);
|
||||
const type = getType(ele.attribute, ele.attrType);
|
||||
const align = getAlign(ele.attribute);
|
||||
const fixed = getFixed(ele.attribute);
|
||||
const column = {
|
||||
key: ele.path,
|
||||
title,
|
||||
align,
|
||||
fixed,
|
||||
render: (v, row) => {
|
||||
if (typeof ele.attribute !== 'string' &&
|
||||
ele.attribute.render) {
|
||||
return ele.attribute.render(row);
|
||||
}
|
||||
const value = getValue(row, ele.path, ele.entity, ele.attr, ele.attrType, t);
|
||||
const stateValue = get(row, ele.path);
|
||||
let href = '';
|
||||
if ([null, undefined, ''].includes(stateValue)) {
|
||||
return <></>;
|
||||
}
|
||||
const color = getColor(ele.attr, stateValue);
|
||||
if (type === 'enum' && !color) {
|
||||
console.warn(color, `${ele.entity}实体${ele.attr}颜色定义缺失`);
|
||||
}
|
||||
if (type === 'link') {
|
||||
href = getLinkUrl(ele.attribute, {
|
||||
oakId: row?.id,
|
||||
});
|
||||
}
|
||||
return (<TableCell color={color} value={value} type={type} linkUrl={href}/>);
|
||||
},
|
||||
};
|
||||
if (width) {
|
||||
Object.assign(column, { width });
|
||||
}
|
||||
else {
|
||||
// 没有宽度的设置ellipsis
|
||||
Object.assign(column, {
|
||||
ellipsis: {
|
||||
showTitle: false,
|
||||
},
|
||||
};
|
||||
if (width) {
|
||||
Object.assign(column, { width });
|
||||
}
|
||||
else {
|
||||
// 没有宽度的设置ellipsis
|
||||
Object.assign(column, {
|
||||
ellipsis: {
|
||||
showTitle: false,
|
||||
},
|
||||
});
|
||||
}
|
||||
return column;
|
||||
});
|
||||
}
|
||||
return column;
|
||||
});
|
||||
if (!disableSerialNumber && tablePagination) {
|
||||
// 存在分页配置 启用#序号
|
||||
tableColumns.unshift({
|
||||
fixed: 'left',
|
||||
align: 'left',
|
||||
title: '#',
|
||||
key: '#',
|
||||
width: 100,
|
||||
render: (value, row) => {
|
||||
return row['#'];
|
||||
},
|
||||
});
|
||||
}
|
||||
if (!disabledOp && tableColumns) {
|
||||
tableColumns.push({
|
||||
fixed: 'right',
|
||||
|
|
@ -95,7 +107,7 @@ export default function Render(props) {
|
|||
else {
|
||||
extraActions2 = extraActions;
|
||||
}
|
||||
return (<ActionBtn entity={entity} extraActions={extraActions2} actions={oakActions || []} cascadeActions={row?.['#oakLegalCascadeActions']} onAction={(action, cascadeAction) => onAction &&
|
||||
return (<ActionBtn entity={entity} extraActions={extraActions2} actions={oakActions} cascadeActions={row?.['#oakLegalCascadeActions']} onAction={(action, cascadeAction) => onAction &&
|
||||
onAction(row, action, cascadeAction)}/>);
|
||||
},
|
||||
});
|
||||
|
|
@ -110,10 +122,25 @@ export default function Render(props) {
|
|||
rowSelection?.onChange &&
|
||||
rowSelection?.onChange(selectedRowKeys, row, info);
|
||||
},
|
||||
}} size={size} loading={loading} dataSource={data} columns={tableColumns} pagination={tablePagination} locale={locale} scroll={data?.length > 0 ? Object.assign({}, showScroll && {
|
||||
scrollToFirstRowOnChange: true,
|
||||
x: 1200,
|
||||
}, scroll) : undefined} onRow={(record) => {
|
||||
}} size={size} loading={loading}
|
||||
// dataSource={data}
|
||||
dataSource={!disableSerialNumber
|
||||
? data?.map((ele, index) => {
|
||||
if (tablePagination) {
|
||||
const total = tablePagination.total || 0;
|
||||
const pageSize = tablePagination.pageSize || 20; //条数
|
||||
const current = tablePagination.current || 1; //当前页
|
||||
ele['#'] =
|
||||
pageSize * (current - 1) + (index + 1);
|
||||
}
|
||||
return ele;
|
||||
})
|
||||
: data} columns={tableColumns} pagination={tablePagination} locale={locale} scroll={data?.length > 0
|
||||
? Object.assign({}, showScroll && {
|
||||
scrollToFirstRowOnChange: true,
|
||||
x: 1200,
|
||||
}, scroll)
|
||||
: undefined} onRow={(record) => {
|
||||
return {
|
||||
onClick: () => {
|
||||
const index = selectedRowKeys.findIndex((ele) => ele === record.id);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import ToolBar from '../list/toolBar';
|
|||
import ButtonGroup from '../list/buttonGroup';
|
||||
import Style from './index.module.less';
|
||||
import { useWidth } from '../../platforms/web/responsive/useWidth';
|
||||
import { useFeatures } from '../../platforms/web';
|
||||
export const TableContext = createContext({
|
||||
tableAttributes: undefined,
|
||||
entity: undefined,
|
||||
|
|
@ -16,7 +15,6 @@ export const TableContext = createContext({
|
|||
});
|
||||
const ProList = (props) => {
|
||||
const { buttonGroup, entity, extraActions, onAction, disabledOp, attributes, data, loading, tablePagination, rowSelection, onReload, disableSerialNumber, title, hideDefaultButtons = false, extraContent, size = 'large', scroll, locale, } = props;
|
||||
const features = useFeatures();
|
||||
const [tableAttributes, setTableAttributes] = useState([]);
|
||||
const [schema, setSchema] = useState(undefined);
|
||||
const width = useWidth();
|
||||
|
|
@ -28,35 +26,12 @@ const ProList = (props) => {
|
|||
attribute: ele,
|
||||
show: true,
|
||||
}));
|
||||
if (tablePagination && !disableSerialNumber) {
|
||||
// 存在分页配置 启用#序号
|
||||
newTableAttributes.unshift({
|
||||
attribute: {
|
||||
path: '#',
|
||||
attribute: {
|
||||
label: '#',
|
||||
path: '#',
|
||||
width: 100,
|
||||
},
|
||||
attrType: 'number',
|
||||
attr: '#',
|
||||
entity: entity,
|
||||
},
|
||||
show: true,
|
||||
disabled: true,
|
||||
disableCheckbox: true,
|
||||
});
|
||||
}
|
||||
setTableAttributes(newTableAttributes);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
initTableAttributes();
|
||||
}, [attributes, schema]);
|
||||
// const showTotal: PaginationProps['showTotal'] = (total) => {
|
||||
// const totalStr = features.locales.t('total number of rows');
|
||||
// return `${totalStr}:${total > 999 ? `${total} +` : total}`;
|
||||
// };
|
||||
return (<TableContext.Provider value={{
|
||||
tableAttributes,
|
||||
entity: entity,
|
||||
|
|
@ -70,19 +45,7 @@ const ProList = (props) => {
|
|||
<div className={Style.container}>
|
||||
{!isMobile && !hideDefaultButtons && (<ToolBar title={title} extraContent={extraContent} buttonGroup={buttonGroup} reload={onReload}/>)}
|
||||
{isMobile && <ButtonGroup items={buttonGroup}/>}
|
||||
<List entity={entity} extraActions={extraActions} onAction={onAction} disabledOp={disabledOp} attributes={attributes} scroll={scroll} locale={locale} data={!disableSerialNumber
|
||||
? data?.map((ele, index) => {
|
||||
if (tablePagination) {
|
||||
const total = tablePagination.total || 0;
|
||||
const pageSize = tablePagination.pageSize || 20; //条数
|
||||
const current = tablePagination.current || 1; //当前页
|
||||
ele['#'] =
|
||||
pageSize * (current - 1) +
|
||||
(index + 1);
|
||||
}
|
||||
return ele;
|
||||
})
|
||||
: data} loading={loading} size={size} tablePagination={tablePagination} rowSelection={rowSelection}/>
|
||||
<List entity={entity} extraActions={extraActions} onAction={onAction} disabledOp={disabledOp} attributes={attributes} scroll={scroll} locale={locale} data={data} loading={loading} size={size} tablePagination={tablePagination} rowSelection={rowSelection} disableSerialNumber={disableSerialNumber}/>
|
||||
</div>
|
||||
</TableContext.Provider>);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@ import { Empty } from 'antd';
|
|||
import AbstractList from '../list';
|
||||
export default function Render(props) {
|
||||
const { oakLoading, rows, onSelect, titleLabel, multiple = false, entity, } = props.data;
|
||||
const { t } = props.methods;
|
||||
const columns = [{
|
||||
dataIndex: 'title',
|
||||
title: titleLabel,
|
||||
}];
|
||||
if (rows && rows.length) {
|
||||
return (<AbstractList entity={entity} data={rows} loading={oakLoading} attributes={[titleLabel]} disabledOp={true} rowSelection={{
|
||||
type: multiple ? 'checkbox' : 'radio',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Input, } from 'antd';
|
||||
import { Input } from 'antd';
|
||||
const { Search } = Input;
|
||||
export default function Render(props) {
|
||||
const { methods, data } = props;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
// export { Cache } from './features/cache';
|
||||
// export { LocalStorage } from './features/localStorage';
|
||||
export * from './types/Feature';
|
||||
export * from './types/Notification';
|
||||
export * from './types/Message';
|
||||
|
|
@ -10,8 +8,5 @@ export * from './types/Exception';
|
|||
export * from './types/Pagination';
|
||||
export * from './types/NamedCondition';
|
||||
export * from './types/ErrorPage';
|
||||
// export { CacheStore } from './cacheStore/CacheStore';
|
||||
// export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
// export { DebugStore } from './debugStore/DebugStore';
|
||||
export { FrontendRuntimeContext } from './context/FrontendRuntimeContext';
|
||||
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { DataType, DataTypeParams } from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import { ButtonProps } from 'antd';
|
||||
import { ActionDef } from './Page';
|
||||
export type ED = BaseEntityDict & EntityDict;
|
||||
export type RenderWidth = 1 | 2 | 3 | 4;
|
||||
export type RenderAlign = 'left' | 'right' | 'center';
|
||||
export type RenderFixed = 'left' | 'right';
|
||||
export type ButtonType = "link" | "text" | "default" | "primary" | "dashed";
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
export type OakActionBtnProps = {
|
||||
label: string;
|
||||
action: string;
|
||||
|
|
@ -25,7 +26,7 @@ export type OakActionsProps = {
|
|||
};
|
||||
export type OakAbsNativeAttrDef = {
|
||||
path: string;
|
||||
width?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
};
|
||||
export type OakAbsDerivedAttrDef = {
|
||||
path: string;
|
||||
|
|
@ -100,9 +101,9 @@ export type OakAbsAttrUpsertDef<ED extends EntityDict & BaseEntityDict, T extend
|
|||
export type AttrRender = {
|
||||
label: string;
|
||||
value: any;
|
||||
type: DataType | ('image' | 'link' | 'ref');
|
||||
type: DataType | 'image' | 'link' | 'ref';
|
||||
color?: string;
|
||||
span?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
attr: string;
|
||||
};
|
||||
export interface OakAbsNativeAttrUpsertRender<ED extends EntityDict & BaseEntityDict, T extends keyof ED, A extends keyof ED[T]['OpSchema']> extends Omit<OakAbsNativeAttrUpsertDef<ED, T, A>, 'type'> {
|
||||
|
|
@ -123,7 +124,7 @@ export type ColumnDefProps = {
|
|||
attr: string;
|
||||
path: string;
|
||||
type: DataType & ('img' | 'file' | 'avatar');
|
||||
fixed?: 'right' | 'left';
|
||||
fixed?: RenderFixed;
|
||||
};
|
||||
export type DataTransformer = (data: object) => AttrRender[];
|
||||
export type DataUpsertTransformer<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = (data: object) => AttrUpsertRender<ED, T>[];
|
||||
|
|
@ -139,11 +140,10 @@ export type CascadeActionDef = {
|
|||
export type ListButtonProps = {
|
||||
label: string;
|
||||
show?: boolean;
|
||||
type?: ButtonProps['type'];
|
||||
type?: ButtonType;
|
||||
icon?: React.ReactNode;
|
||||
onClick: () => void;
|
||||
};
|
||||
type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
|
|
@ -152,4 +152,3 @@ export type ColumnMapType = {
|
|||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
/// <reference types="react" />
|
||||
import { Dayjs } from 'dayjs';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { OakAbsRefAttrPickerDef } from './AbstractComponent';
|
||||
import { OakAbsRefAttrPickerDef, ColSpanType, ED } from './AbstractComponent';
|
||||
export type ViewType = 'Input' | 'Select' | 'DatePicker' | 'DatePicker.RangePicker' | 'RefAttr';
|
||||
export type Ops = '$gt' | '$lt' | '$gte' | '$lte' | '$eq' | '$ne' | '$startsWith' | '$endsWith' | '$includes' | '$in' | '$nin' | '$between' | '$text' | '$search';
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type ValueType = string | boolean | number | Array<Dayjs> | Dayjs | null | React.Key[];
|
||||
export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof ED> = {
|
||||
export type ColumnProps<ED2 extends ED, T extends keyof ED2> = {
|
||||
attr: string;
|
||||
label?: string;
|
||||
value?: any;
|
||||
|
|
@ -28,9 +25,9 @@ export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof
|
|||
range?: boolean;
|
||||
showTime?: boolean;
|
||||
};
|
||||
refProps?: OakAbsRefAttrPickerDef<ED, keyof ED>;
|
||||
transformFilter?: (column: ColumnProps<ED, T>, value: ValueType) => ED[T]['Selection']['filter'];
|
||||
transformValue?: (column: ColumnProps<ED, T>, filter: ED[T]['Selection']['filter']) => any;
|
||||
refProps?: OakAbsRefAttrPickerDef<ED2, keyof ED2>;
|
||||
transformFilter?: (column: ColumnProps<ED2, T>, value: ValueType) => ED2[T]['Selection']['filter'];
|
||||
transformValue?: (column: ColumnProps<ED2, T>, filter: ED2[T]['Selection']['filter']) => any;
|
||||
filterName?: string;
|
||||
colSpan?: ColSpanType;
|
||||
render?: React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
export type PromisefyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
export type PromisefyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
export type PromisifyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
export type PromisifyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,39 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
import { PromisefyOption } from '../../types/Wx';
|
||||
import { PromisifyOption } from '../../types/Wx';
|
||||
export declare class Bluetooth {
|
||||
private serverDict;
|
||||
constructor();
|
||||
startScanDevice(option: PromisefyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
startScanDevice(option: PromisifyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
stopScanDevice(): Promise<WechatMiniprogram.BluetoothError>;
|
||||
openAdapter(option: PromisefyOption<WechatMiniprogram.OpenBluetoothAdapterOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
openAdapter(option: PromisifyOption<WechatMiniprogram.OpenBluetoothAdapterOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
closeAdapter(): Promise<WechatMiniprogram.BluetoothError>;
|
||||
onDeviceFound(callback: WechatMiniprogram.OnBluetoothDeviceFoundCallback): void;
|
||||
onAdapterStateChanged(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback): void;
|
||||
offDeviceFound(callback: WechatMiniprogram.OnBluetoothDeviceFoundCallback): void;
|
||||
offAdapterStateChaned(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback): void;
|
||||
getConnectedDevices(option: PromisefyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>): Promise<WechatMiniprogram.GetConnectedBluetoothDevicesSuccessCallbackResult>;
|
||||
getConnectedDevices(option: PromisifyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>): Promise<WechatMiniprogram.GetConnectedBluetoothDevicesSuccessCallbackResult>;
|
||||
getDevices(): Promise<WechatMiniprogram.GetBluetoothDevicesSuccessCallbackResult>;
|
||||
getAdapterState(): Promise<WechatMiniprogram.GetBluetoothAdapterStateSuccessCallbackResult>;
|
||||
writeBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
readBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
writeBLECharacteristicValue(option: PromisifyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
readBLECharacteristicValue(option: PromisifyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
onBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback): void;
|
||||
onBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback): void;
|
||||
offBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback): void;
|
||||
offBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback): void;
|
||||
notifyBLECharacteristicValueChange(option: PromisefyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>): Promise<void>;
|
||||
getBLEDeviceServices(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceServicesOption>): Promise<WechatMiniprogram.GetBLEDeviceServicesSuccessCallbackResult>;
|
||||
getBLEDeviceCharacteristics(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>): Promise<WechatMiniprogram.GetBLEDeviceCharacteristicsSuccessCallbackResult>;
|
||||
createBLEConnection(option: PromisefyOption<WechatMiniprogram.CreateBLEConnectionOption>): Promise<void>;
|
||||
closeBLEConnection(option: PromisefyOption<WechatMiniprogram.CloseBLEConnectionOption>): Promise<void>;
|
||||
notifyBLECharacteristicValueChange(option: PromisifyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>): Promise<void>;
|
||||
getBLEDeviceServices(option: PromisifyOption<WechatMiniprogram.GetBLEDeviceServicesOption>): Promise<WechatMiniprogram.GetBLEDeviceServicesSuccessCallbackResult>;
|
||||
getBLEDeviceCharacteristics(option: PromisifyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>): Promise<WechatMiniprogram.GetBLEDeviceCharacteristicsSuccessCallbackResult>;
|
||||
createBLEConnection(option: PromisifyOption<WechatMiniprogram.CreateBLEConnectionOption>): Promise<void>;
|
||||
closeBLEConnection(option: PromisifyOption<WechatMiniprogram.CloseBLEConnectionOption>): Promise<void>;
|
||||
onPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback): void;
|
||||
offPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback): void;
|
||||
createPeripheralServer(): Promise<string>;
|
||||
closePeripheralServer(id: string): void;
|
||||
addPeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.AddServiceOption>): void;
|
||||
removePeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.RemoveServiceOption>): void;
|
||||
startPeripheralAdvertising(id: string, option: PromisefyOption<WechatMiniprogram.StartAdvertisingObject>): void;
|
||||
addPeripheralService(id: string, option: PromisifyOption<WechatMiniprogram.AddServiceOption>): void;
|
||||
removePeripheralService(id: string, option: PromisifyOption<WechatMiniprogram.RemoveServiceOption>): void;
|
||||
startPeripheralAdvertising(id: string, option: PromisifyOption<WechatMiniprogram.StartAdvertisingObject>): void;
|
||||
stopPeripheralAdvertising(id: string): void;
|
||||
writePeripheralCharacteristicValue(id: string, option: PromisefyOption<WechatMiniprogram.WriteCharacteristicValueObject>): void;
|
||||
writePeripheralCharacteristicValue(id: string, option: PromisifyOption<WechatMiniprogram.WriteCharacteristicValueObject>): void;
|
||||
onPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback): void;
|
||||
offPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback): void;
|
||||
onPeripheralCharacteristicWriteRequest(id: string, callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback): void;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BackendRuntimeContext = exports.FrontendRuntimeContext = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
// export { Cache } from './features/cache';
|
||||
// export { LocalStorage } from './features/localStorage';
|
||||
tslib_1.__exportStar(require("./types/Feature"), exports);
|
||||
tslib_1.__exportStar(require("./types/Notification"), exports);
|
||||
tslib_1.__exportStar(require("./types/Message"), exports);
|
||||
|
|
@ -14,9 +12,6 @@ tslib_1.__exportStar(require("./types/Exception"), exports);
|
|||
tslib_1.__exportStar(require("./types/Pagination"), exports);
|
||||
tslib_1.__exportStar(require("./types/NamedCondition"), exports);
|
||||
tslib_1.__exportStar(require("./types/ErrorPage"), exports);
|
||||
// export { CacheStore } from './cacheStore/CacheStore';
|
||||
// export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
// export { DebugStore } from './debugStore/DebugStore';
|
||||
var FrontendRuntimeContext_1 = require("./context/FrontendRuntimeContext");
|
||||
Object.defineProperty(exports, "FrontendRuntimeContext", { enumerable: true, get: function () { return FrontendRuntimeContext_1.FrontendRuntimeContext; } });
|
||||
var BackendRuntimeContext_1 = require("./context/BackendRuntimeContext");
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { DataType, DataTypeParams } from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import { ButtonProps } from 'antd';
|
||||
import { ActionDef } from './Page';
|
||||
export type ED = BaseEntityDict & EntityDict;
|
||||
export type RenderWidth = 1 | 2 | 3 | 4;
|
||||
export type RenderAlign = 'left' | 'right' | 'center';
|
||||
export type RenderFixed = 'left' | 'right';
|
||||
export type ButtonType = "link" | "text" | "default" | "primary" | "dashed";
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
export type OakActionBtnProps = {
|
||||
label: string;
|
||||
action: string;
|
||||
|
|
@ -25,7 +26,7 @@ export type OakActionsProps = {
|
|||
};
|
||||
export type OakAbsNativeAttrDef = {
|
||||
path: string;
|
||||
width?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
};
|
||||
export type OakAbsDerivedAttrDef = {
|
||||
path: string;
|
||||
|
|
@ -100,9 +101,9 @@ export type OakAbsAttrUpsertDef<ED extends EntityDict & BaseEntityDict, T extend
|
|||
export type AttrRender = {
|
||||
label: string;
|
||||
value: any;
|
||||
type: DataType | ('image' | 'link' | 'ref');
|
||||
type: DataType | 'image' | 'link' | 'ref';
|
||||
color?: string;
|
||||
span?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
attr: string;
|
||||
};
|
||||
export interface OakAbsNativeAttrUpsertRender<ED extends EntityDict & BaseEntityDict, T extends keyof ED, A extends keyof ED[T]['OpSchema']> extends Omit<OakAbsNativeAttrUpsertDef<ED, T, A>, 'type'> {
|
||||
|
|
@ -123,7 +124,7 @@ export type ColumnDefProps = {
|
|||
attr: string;
|
||||
path: string;
|
||||
type: DataType & ('img' | 'file' | 'avatar');
|
||||
fixed?: 'right' | 'left';
|
||||
fixed?: RenderFixed;
|
||||
};
|
||||
export type DataTransformer = (data: object) => AttrRender[];
|
||||
export type DataUpsertTransformer<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = (data: object) => AttrUpsertRender<ED, T>[];
|
||||
|
|
@ -139,11 +140,10 @@ export type CascadeActionDef = {
|
|||
export type ListButtonProps = {
|
||||
label: string;
|
||||
show?: boolean;
|
||||
type?: ButtonProps['type'];
|
||||
type?: ButtonType;
|
||||
icon?: React.ReactNode;
|
||||
onClick: () => void;
|
||||
};
|
||||
type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
|
|
@ -152,4 +152,3 @@ export type ColumnMapType = {
|
|||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
/// <reference types="react" />
|
||||
import { Dayjs } from 'dayjs';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { OakAbsRefAttrPickerDef } from './AbstractComponent';
|
||||
import { OakAbsRefAttrPickerDef, ColSpanType, ED } from './AbstractComponent';
|
||||
export type ViewType = 'Input' | 'Select' | 'DatePicker' | 'DatePicker.RangePicker' | 'RefAttr';
|
||||
export type Ops = '$gt' | '$lt' | '$gte' | '$lte' | '$eq' | '$ne' | '$startsWith' | '$endsWith' | '$includes' | '$in' | '$nin' | '$between' | '$text' | '$search';
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type ValueType = string | boolean | number | Array<Dayjs> | Dayjs | null | React.Key[];
|
||||
export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof ED> = {
|
||||
export type ColumnProps<ED2 extends ED, T extends keyof ED2> = {
|
||||
attr: string;
|
||||
label?: string;
|
||||
value?: any;
|
||||
|
|
@ -28,9 +25,9 @@ export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof
|
|||
range?: boolean;
|
||||
showTime?: boolean;
|
||||
};
|
||||
refProps?: OakAbsRefAttrPickerDef<ED, keyof ED>;
|
||||
transformFilter?: (column: ColumnProps<ED, T>, value: ValueType) => ED[T]['Selection']['filter'];
|
||||
transformValue?: (column: ColumnProps<ED, T>, filter: ED[T]['Selection']['filter']) => any;
|
||||
refProps?: OakAbsRefAttrPickerDef<ED2, keyof ED2>;
|
||||
transformFilter?: (column: ColumnProps<ED2, T>, value: ValueType) => ED2[T]['Selection']['filter'];
|
||||
transformValue?: (column: ColumnProps<ED2, T>, filter: ED2[T]['Selection']['filter']) => any;
|
||||
filterName?: string;
|
||||
colSpan?: ColSpanType;
|
||||
render?: React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
export type PromisefyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
export type PromisefyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
export type PromisifyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
export type PromisifyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,39 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
import { PromisefyOption } from '../../types/Wx';
|
||||
import { PromisifyOption } from '../../types/Wx';
|
||||
export declare class Bluetooth {
|
||||
private serverDict;
|
||||
constructor();
|
||||
startScanDevice(option: PromisefyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
startScanDevice(option: PromisifyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
stopScanDevice(): Promise<WechatMiniprogram.BluetoothError>;
|
||||
openAdapter(option: PromisefyOption<WechatMiniprogram.OpenBluetoothAdapterOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
openAdapter(option: PromisifyOption<WechatMiniprogram.OpenBluetoothAdapterOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
closeAdapter(): Promise<WechatMiniprogram.BluetoothError>;
|
||||
onDeviceFound(callback: WechatMiniprogram.OnBluetoothDeviceFoundCallback): void;
|
||||
onAdapterStateChanged(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback): void;
|
||||
offDeviceFound(callback: WechatMiniprogram.OnBluetoothDeviceFoundCallback): void;
|
||||
offAdapterStateChaned(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback): void;
|
||||
getConnectedDevices(option: PromisefyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>): Promise<WechatMiniprogram.GetConnectedBluetoothDevicesSuccessCallbackResult>;
|
||||
getConnectedDevices(option: PromisifyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>): Promise<WechatMiniprogram.GetConnectedBluetoothDevicesSuccessCallbackResult>;
|
||||
getDevices(): Promise<WechatMiniprogram.GetBluetoothDevicesSuccessCallbackResult>;
|
||||
getAdapterState(): Promise<WechatMiniprogram.GetBluetoothAdapterStateSuccessCallbackResult>;
|
||||
writeBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
readBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
writeBLECharacteristicValue(option: PromisifyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
readBLECharacteristicValue(option: PromisifyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>): Promise<WechatMiniprogram.BluetoothError>;
|
||||
onBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback): void;
|
||||
onBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback): void;
|
||||
offBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback): void;
|
||||
offBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback): void;
|
||||
notifyBLECharacteristicValueChange(option: PromisefyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>): Promise<void>;
|
||||
getBLEDeviceServices(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceServicesOption>): Promise<WechatMiniprogram.GetBLEDeviceServicesSuccessCallbackResult>;
|
||||
getBLEDeviceCharacteristics(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>): Promise<WechatMiniprogram.GetBLEDeviceCharacteristicsSuccessCallbackResult>;
|
||||
createBLEConnection(option: PromisefyOption<WechatMiniprogram.CreateBLEConnectionOption>): Promise<void>;
|
||||
closeBLEConnection(option: PromisefyOption<WechatMiniprogram.CloseBLEConnectionOption>): Promise<void>;
|
||||
notifyBLECharacteristicValueChange(option: PromisifyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>): Promise<void>;
|
||||
getBLEDeviceServices(option: PromisifyOption<WechatMiniprogram.GetBLEDeviceServicesOption>): Promise<WechatMiniprogram.GetBLEDeviceServicesSuccessCallbackResult>;
|
||||
getBLEDeviceCharacteristics(option: PromisifyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>): Promise<WechatMiniprogram.GetBLEDeviceCharacteristicsSuccessCallbackResult>;
|
||||
createBLEConnection(option: PromisifyOption<WechatMiniprogram.CreateBLEConnectionOption>): Promise<void>;
|
||||
closeBLEConnection(option: PromisifyOption<WechatMiniprogram.CloseBLEConnectionOption>): Promise<void>;
|
||||
onPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback): void;
|
||||
offPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback): void;
|
||||
createPeripheralServer(): Promise<string>;
|
||||
closePeripheralServer(id: string): void;
|
||||
addPeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.AddServiceOption>): void;
|
||||
removePeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.RemoveServiceOption>): void;
|
||||
startPeripheralAdvertising(id: string, option: PromisefyOption<WechatMiniprogram.StartAdvertisingObject>): void;
|
||||
addPeripheralService(id: string, option: PromisifyOption<WechatMiniprogram.AddServiceOption>): void;
|
||||
removePeripheralService(id: string, option: PromisifyOption<WechatMiniprogram.RemoveServiceOption>): void;
|
||||
startPeripheralAdvertising(id: string, option: PromisifyOption<WechatMiniprogram.StartAdvertisingObject>): void;
|
||||
stopPeripheralAdvertising(id: string): void;
|
||||
writePeripheralCharacteristicValue(id: string, option: PromisefyOption<WechatMiniprogram.WriteCharacteristicValueObject>): void;
|
||||
writePeripheralCharacteristicValue(id: string, option: PromisifyOption<WechatMiniprogram.WriteCharacteristicValueObject>): void;
|
||||
onPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback): void;
|
||||
offPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback): void;
|
||||
onPeripheralCharacteristicWriteRequest(id: string, callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback): void;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
"react-responsive": "^9.0.2",
|
||||
"rmc-pull-to-refresh": "^1.0.13",
|
||||
"socket.io-client": "^4.7.2",
|
||||
"uuid": "^8.3.2",
|
||||
"weapp.socket.io": "^2.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -41,7 +40,7 @@
|
|||
"antd-mobile-icons": ">=0.3.0",
|
||||
"react": ">=18.2.0",
|
||||
"react-dom": ">=18.1.0",
|
||||
"react-native": "^0.72.7",
|
||||
"react-native": ">=0.72.7",
|
||||
"react-router-dom": ">=6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -75,6 +74,7 @@
|
|||
"ts-node": "^10.9.1",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^5.2.2",
|
||||
"uuid": "^8.3.2",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
import {
|
||||
DataType,
|
||||
DataTypeParams,
|
||||
} from 'oak-domain/lib/types/schema/DataTypes';
|
||||
|
||||
import {
|
||||
DataTransformer,
|
||||
ED,
|
||||
OakAbsAttrDef,
|
||||
OakAbsAttrUpsertDef,
|
||||
ColumnMapType,
|
||||
OakAbsAttrJudgeDef,
|
||||
} from '../../types/AbstractComponent';
|
||||
import { makeDataTransformer, translateAttributes } from '../../utils/usefulFn';
|
||||
|
|
@ -15,15 +10,6 @@ import { ReactComponentProps } from '../../types/Page';
|
|||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { Breakpoint } from 'antd';
|
||||
|
||||
type AttrRender = {
|
||||
label: string;
|
||||
value: any;
|
||||
type: DataType;
|
||||
params: DataTypeParams;
|
||||
width?: 1 | 2 | 3 | 4;
|
||||
ref?: string;
|
||||
};
|
||||
|
||||
export default OakComponent({
|
||||
isList: false,
|
||||
properties: {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Tag, Space, Image } from 'antd-mobile';
|
||||
import React from 'react';
|
||||
import { Space, Image } from 'antd-mobile';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
import styles from './mobile.module.less';
|
||||
import { AttrRender, OakAbsAttrJudgeDef, ED } from '../../types/AbstractComponent';
|
||||
|
||||
import { getLabel, getType, getValue, getWidth } from '../../utils/usefulFn';
|
||||
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
lg: ColSpanType;
|
||||
md: ColSpanType;
|
||||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
import {
|
||||
AttrRender,
|
||||
OakAbsAttrJudgeDef,
|
||||
ED,
|
||||
ColumnMapType,
|
||||
} from '../../types/AbstractComponent';
|
||||
|
||||
import { getLabel, getType, getValue } from '../../utils/usefulFn';
|
||||
|
||||
function RenderRow(props: { label: string; value: any; type: AttrRender['type'] }) {
|
||||
const { type, label, value } = props;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,22 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import {
|
||||
Input,
|
||||
Button,
|
||||
Space,
|
||||
Form,
|
||||
Select,
|
||||
DatePicker,
|
||||
InputNumber,
|
||||
} from 'antd';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
|
||||
import {
|
||||
ED,
|
||||
OakAbsRefAttrPickerDef,
|
||||
OakAbsRefAttrPickerRender,
|
||||
} from '../../types/AbstractComponent';
|
||||
import { initinctiveAttributes } from 'oak-domain/lib/types/Entity';
|
||||
import { ED, OakAbsRefAttrPickerRender } from '../../types/AbstractComponent';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import weekday from 'dayjs/plugin/weekday';
|
||||
import localeData from 'dayjs/plugin/localeData';
|
||||
import type { DatePickerProps, RangePickerProps } from 'antd/es/date-picker';
|
||||
|
||||
dayjs.extend(weekday);
|
||||
dayjs.extend(localeData);
|
||||
|
||||
import { get, set } from 'oak-domain/lib/utils/lodash';
|
||||
|
||||
import {
|
||||
ColumnProps,
|
||||
ColSpanType,
|
||||
Ops,
|
||||
ValueType,
|
||||
ViewType,
|
||||
} from '../../types/Filter';
|
||||
import { getFilterName, getOp, getOp2 } from './utils';
|
||||
import { ColumnProps, Ops, ValueType, ViewType } from '../../types/Filter';
|
||||
import { getFilterName, getOp } from './utils';
|
||||
import RefAttr from '../refAttr';
|
||||
|
||||
export default function Render<ED2 extends ED>(
|
||||
|
|
|
|||
|
|
@ -1,26 +1,13 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Input, Button, Space, Form, Badge, Row, Col } from 'antd';
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Space, Form, Badge, Row, Col } from 'antd';
|
||||
import { DownOutlined, UpOutlined } from '@ant-design/icons';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
import { ED, ColSpanType, ColumnMapType, Width } from '../../types/AbstractComponent';
|
||||
import { ColumnProps } from '../../types/Filter';
|
||||
import Filter from '../filter';
|
||||
import { ColSpanType, ColumnProps } from '../../types/Filter';
|
||||
import { getFilterName } from '../filter/utils';
|
||||
import Style from './web.module.less';
|
||||
|
||||
|
||||
|
||||
type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
|
||||
type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
lg: ColSpanType;
|
||||
md: ColSpanType;
|
||||
sm: ColSpanType;
|
||||
xs: ColSpanType;
|
||||
};
|
||||
|
||||
const DEFAULT_COLUMN_MAP: ColumnMapType = {
|
||||
xxl: 4,
|
||||
xl: 4,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default function Render(
|
|||
{}
|
||||
>
|
||||
) {
|
||||
const { methods, data } = props;
|
||||
const { data } = props;
|
||||
const { items } = data;
|
||||
if (!items || items.length === 0) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -31,11 +31,14 @@ export default OakComponent({
|
|||
}
|
||||
| undefined,
|
||||
hideHeader: false,
|
||||
disableSerialNumber: false, //是否禁用序号 默认启用
|
||||
size: 'large',
|
||||
scroll: undefined as
|
||||
| TableProps<RowWithActions<ED, keyof ED>[]>['scroll']
|
||||
| undefined,
|
||||
locale: undefined as TableProps<RowWithActions<ED, keyof ED>[]>['locale'] | undefined
|
||||
locale: undefined as
|
||||
| TableProps<RowWithActions<ED, keyof ED>[]>['locale']
|
||||
| undefined,
|
||||
},
|
||||
formData({ props }) {
|
||||
const { converter } = this.state;
|
||||
|
|
@ -96,8 +99,12 @@ export default OakComponent({
|
|||
});
|
||||
},
|
||||
getColor(attr: string, value: any) {
|
||||
return this.features.style.getColor(this.props.entity!, attr, value);
|
||||
}
|
||||
return this.features.style.getColor(
|
||||
this.props.entity!,
|
||||
attr,
|
||||
value
|
||||
);
|
||||
},
|
||||
},
|
||||
}) as <ED2 extends ED, T2 extends keyof ED2>(
|
||||
props: ReactComponentProps<
|
||||
|
|
@ -126,7 +133,8 @@ export default OakComponent({
|
|||
info?: { type: 'single' | 'multiple' | 'none' }
|
||||
) => void;
|
||||
};
|
||||
hideHeader: boolean;
|
||||
hideHeader?: boolean;
|
||||
disableSerialNumber?: boolean; //是否禁用序号 默认启用
|
||||
size?: 'large' | 'middle' | 'small';
|
||||
scroll?: TableProps<RowWithActions<ED, keyof ED>[]>['scroll'];
|
||||
locale?: TableProps<RowWithActions<ED, keyof ED>[]>['locale'];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Space, Tooltip, ButtonProps } from 'antd';
|
||||
import {
|
||||
ReloadOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { Space, Tooltip } from 'antd';
|
||||
import { ReloadOutlined } from '@ant-design/icons';
|
||||
import { ButtonType } from '../../../types/AbstractComponent';
|
||||
import ButtonGroup from '../buttonGroup';
|
||||
import ColumnSetting from '../columnSetting';
|
||||
import { useFeatures } from '../../../platforms/web';
|
||||
|
|
@ -11,9 +10,9 @@ import Style from './index.module.less';
|
|||
|
||||
type buttonProps = {
|
||||
label: string;
|
||||
type?: ButtonProps['type'];
|
||||
type?: ButtonType;
|
||||
onClick: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
type ToolBarProps = {
|
||||
title?: React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import { Table, Tag, TableProps, PaginationProps, Space, Button, Avatar } from 'antd';
|
||||
import type { ColumnsType, ColumnType, ColumnGroupType } from 'antd/es/table';
|
||||
import { Table, TableProps } from 'antd';
|
||||
import type { ColumnsType, ColumnType } from 'antd/es/table';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { get } from 'oak-domain/lib/utils/lodash';
|
||||
|
||||
import { StyleDict } from 'oak-domain/lib/types/Style';
|
||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||
import { DataType } from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import { OakAbsAttrDef, onActionFnDef, CascadeActionProps, OakAbsDerivedAttrDef, OakExtraActionProps, OakAbsAttrJudgeDef, ED } from '../../types/AbstractComponent';
|
||||
import { getPath, getWidth, getValue, getLabel, resolvePath, getType, getAlign, getLinkUrl, getFixed } from '../../utils/usefulFn';
|
||||
import { WebComponentProps } from '../../types/Page';
|
||||
|
|
@ -22,7 +20,6 @@ export default function Render(
|
|||
keyof ED,
|
||||
false,
|
||||
{
|
||||
width: 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
||||
loading: boolean;
|
||||
extraActions:
|
||||
| OakExtraActionProps[]
|
||||
|
|
@ -37,6 +34,7 @@ export default function Render(
|
|||
rowSelection?: TableProps<any[]>['rowSelection'];
|
||||
i18n: any;
|
||||
hideHeader?: boolean;
|
||||
disableSerialNumber?: boolean; //是否禁用序号 默认启用
|
||||
judgeAttributes: OakAbsAttrJudgeDef[];
|
||||
size?: 'large' | 'middle' | 'small';
|
||||
scroll?: TableProps<any[]>['scroll'];
|
||||
|
|
@ -62,6 +60,7 @@ export default function Render(
|
|||
attributes,
|
||||
i18n,
|
||||
hideHeader,
|
||||
disableSerialNumber,
|
||||
judgeAttributes,
|
||||
size = 'large',
|
||||
scroll,
|
||||
|
|
@ -85,9 +84,8 @@ export default function Render(
|
|||
.filter((ele) => ele.show)
|
||||
.map((ele) => ele.attribute);
|
||||
}
|
||||
const tableColumns: ColumnsType<any> =
|
||||
showAttributes &&
|
||||
showAttributes.map((ele) => {
|
||||
const tableColumns: ColumnsType<any> = showAttributes?.map(
|
||||
(ele) => {
|
||||
if (ele.entity === 'notExist') {
|
||||
assert(
|
||||
(ele.attribute as OakAbsDerivedAttrDef).width,
|
||||
|
|
@ -170,7 +168,21 @@ export default function Render(
|
|||
});
|
||||
}
|
||||
return column;
|
||||
}
|
||||
);
|
||||
if (!disableSerialNumber && tablePagination) {
|
||||
// 存在分页配置 启用#序号
|
||||
tableColumns.unshift({
|
||||
fixed: 'left',
|
||||
align: 'left',
|
||||
title: '#',
|
||||
key: '#',
|
||||
width: 100,
|
||||
render: (value, row) => {
|
||||
return row['#'];
|
||||
},
|
||||
});
|
||||
}
|
||||
if (!disabledOp && tableColumns) {
|
||||
tableColumns.push({
|
||||
fixed: 'right',
|
||||
|
|
@ -192,7 +204,7 @@ export default function Render(
|
|||
<ActionBtn
|
||||
entity={entity}
|
||||
extraActions={extraActions2}
|
||||
actions={oakActions || []}
|
||||
actions={oakActions}
|
||||
cascadeActions={
|
||||
row?.['#oakLegalCascadeActions']
|
||||
}
|
||||
|
|
@ -226,18 +238,36 @@ export default function Render(
|
|||
}
|
||||
size={size}
|
||||
loading={loading}
|
||||
dataSource={data}
|
||||
// dataSource={data}
|
||||
dataSource={
|
||||
!disableSerialNumber
|
||||
? data?.map((ele, index) => {
|
||||
if (tablePagination) {
|
||||
const total = tablePagination.total || 0;
|
||||
const pageSize = tablePagination.pageSize || 20; //条数
|
||||
const current = tablePagination.current || 1; //当前页
|
||||
(ele as any)['#'] =
|
||||
pageSize * (current - 1) + (index + 1);
|
||||
}
|
||||
return ele;
|
||||
})
|
||||
: data
|
||||
}
|
||||
columns={tableColumns}
|
||||
pagination={tablePagination}
|
||||
locale={locale}
|
||||
scroll={data?.length > 0 ? Object.assign(
|
||||
{},
|
||||
showScroll && {
|
||||
scrollToFirstRowOnChange: true,
|
||||
x: 1200,
|
||||
},
|
||||
scroll
|
||||
) : undefined}
|
||||
scroll={
|
||||
data?.length > 0
|
||||
? Object.assign(
|
||||
{},
|
||||
showScroll && {
|
||||
scrollToFirstRowOnChange: true,
|
||||
x: 1200,
|
||||
},
|
||||
scroll
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onClick: () => {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import ToolBar from '../list/toolBar';
|
|||
import ButtonGroup from '../list/buttonGroup';
|
||||
import Style from './index.module.less';
|
||||
import { useWidth } from '../../platforms/web/responsive/useWidth';
|
||||
import { useFeatures } from '../../platforms/web';
|
||||
import { Locales } from '../../features/locales';
|
||||
|
||||
type Props<ED2 extends ED, T extends keyof ED2> = {
|
||||
title?: string | React.ReactNode;
|
||||
|
|
@ -96,9 +94,6 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
|
|||
scroll,
|
||||
locale,
|
||||
} = props;
|
||||
const features = useFeatures<{
|
||||
locales: Locales<ED2>;
|
||||
}>();
|
||||
|
||||
const [tableAttributes, setTableAttributes] = useState<
|
||||
TableAttributeType[]
|
||||
|
|
@ -119,25 +114,6 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
|
|||
attribute: ele,
|
||||
show: true,
|
||||
}));
|
||||
if (tablePagination && !disableSerialNumber) {
|
||||
// 存在分页配置 启用#序号
|
||||
newTableAttributes.unshift({
|
||||
attribute: {
|
||||
path: '#',
|
||||
attribute: {
|
||||
label: '#',
|
||||
path: '#',
|
||||
width: 100,
|
||||
},
|
||||
attrType: 'number',
|
||||
attr: '#',
|
||||
entity: entity as string,
|
||||
},
|
||||
show: true,
|
||||
disabled: true,
|
||||
disableCheckbox: true,
|
||||
});
|
||||
}
|
||||
setTableAttributes(newTableAttributes);
|
||||
}
|
||||
};
|
||||
|
|
@ -146,11 +122,6 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
|
|||
initTableAttributes();
|
||||
}, [attributes, schema]);
|
||||
|
||||
// const showTotal: PaginationProps['showTotal'] = (total) => {
|
||||
// const totalStr = features.locales.t('total number of rows');
|
||||
// return `${totalStr}:${total > 999 ? `${total} +` : total}`;
|
||||
// };
|
||||
|
||||
return (
|
||||
<TableContext.Provider
|
||||
value={{
|
||||
|
|
@ -182,27 +153,12 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
|
|||
attributes={attributes}
|
||||
scroll={scroll}
|
||||
locale={locale}
|
||||
data={
|
||||
!disableSerialNumber
|
||||
? data?.map((ele, index) => {
|
||||
if (tablePagination) {
|
||||
const total = tablePagination.total || 0;
|
||||
const pageSize =
|
||||
tablePagination.pageSize || 20; //条数
|
||||
const current =
|
||||
tablePagination.current || 1; //当前页
|
||||
(ele as any)['#'] =
|
||||
pageSize * (current - 1) +
|
||||
(index + 1);
|
||||
}
|
||||
return ele;
|
||||
})
|
||||
: data
|
||||
}
|
||||
data={data}
|
||||
loading={loading}
|
||||
size={size}
|
||||
tablePagination={tablePagination}
|
||||
rowSelection={rowSelection}
|
||||
disableSerialNumber={disableSerialNumber}
|
||||
/>
|
||||
</div>
|
||||
</TableContext.Provider>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { Empty } from 'antd';
|
||||
import { WebComponentProps, RowWithActions } from '../../types/Page';
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
|
|
@ -30,12 +30,6 @@ export default function Render(
|
|||
multiple = false,
|
||||
entity,
|
||||
} = props.data;
|
||||
const { t } = props.methods;
|
||||
|
||||
const columns = [{
|
||||
dataIndex: 'title',
|
||||
title: titleLabel,
|
||||
}]
|
||||
|
||||
if (rows && rows.length) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import {
|
||||
Input,
|
||||
} from 'antd';
|
||||
import React from 'react';
|
||||
import { Input } from 'antd';
|
||||
import { ActionDef, WebComponentProps } from '../../types/Page';
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useEffect} from 'react';
|
||||
import React from 'react';
|
||||
import {
|
||||
SearchBar
|
||||
} from 'antd-mobile';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import React, { useState } from 'react';
|
||||
import {
|
||||
Space,
|
||||
Form,
|
||||
Input,
|
||||
TextArea,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
export type { BasicFeatures } from './features';
|
||||
// export { Cache } from './features/cache';
|
||||
// export { LocalStorage } from './features/localStorage';
|
||||
|
||||
export * from './types/Feature';
|
||||
export * from './types/Notification';
|
||||
|
|
@ -13,8 +11,5 @@ export * from './types/Pagination';
|
|||
export * from './types/NamedCondition';
|
||||
export * from './types/ErrorPage';
|
||||
|
||||
// export { CacheStore } from './cacheStore/CacheStore';
|
||||
// export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
// export { DebugStore } from './debugStore/DebugStore';
|
||||
export { FrontendRuntimeContext, SerializedData } from './context/FrontendRuntimeContext';
|
||||
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
||||
|
|
@ -4,14 +4,15 @@ import {
|
|||
DataType,
|
||||
DataTypeParams,
|
||||
} from 'oak-domain/lib/types/schema/DataTypes';
|
||||
// @ts-ignore
|
||||
import { ButtonProps } from 'antd';
|
||||
import { ActionDef, RowWithActions } from './Page'
|
||||
|
||||
export type ED = BaseEntityDict & EntityDict;
|
||||
export type RenderWidth = 1 | 2 | 3 | 4;
|
||||
export type RenderAlign = 'left' | 'right' | 'center';
|
||||
export type RenderFixed = 'left' | 'right';
|
||||
export type ButtonType = "link" | "text" | "default" | "primary" | "dashed"
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
|
||||
|
||||
export type OakActionBtnProps = {
|
||||
label: string;
|
||||
|
|
@ -33,7 +34,7 @@ export type OakActionsProps = {
|
|||
|
||||
export type OakAbsNativeAttrDef = {
|
||||
path: string;
|
||||
width?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
};
|
||||
|
||||
export type OakAbsDerivedAttrDef = {
|
||||
|
|
@ -138,9 +139,9 @@ export type OakAbsAttrUpsertDef<
|
|||
export type AttrRender = {
|
||||
label: string;
|
||||
value: any;
|
||||
type: DataType | ('image' | 'link' | 'ref');
|
||||
type: DataType | 'image' | 'link' | 'ref';
|
||||
color?: string;
|
||||
span?: RenderWidth;
|
||||
span?: ColSpanType;
|
||||
attr: string;
|
||||
};
|
||||
|
||||
|
|
@ -170,7 +171,7 @@ export type ColumnDefProps = {
|
|||
attr: string;
|
||||
path: string;
|
||||
type: DataType & ('img' | 'file' | 'avatar');
|
||||
fixed?: 'right' | 'left';
|
||||
fixed?: RenderFixed;
|
||||
};
|
||||
|
||||
export type DataTransformer = (data: object) => AttrRender[];
|
||||
|
|
@ -200,13 +201,12 @@ export type CascadeActionDef = {
|
|||
export type ListButtonProps = {
|
||||
label: string;
|
||||
show?: boolean;
|
||||
type?: ButtonProps['type'];
|
||||
type?: ButtonType;
|
||||
icon?: React.ReactNode;
|
||||
onClick: () => void;
|
||||
};
|
||||
|
||||
|
||||
type ColSpanType = 1 | 2 | 3 | 4;
|
||||
export type ColumnMapType = {
|
||||
xxl: ColSpanType;
|
||||
xl: ColSpanType;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { Dayjs } from 'dayjs';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { OakAbsRefAttrPickerDef } from './AbstractComponent';
|
||||
import { OakAbsRefAttrPickerDef, ColSpanType, ED } from './AbstractComponent';
|
||||
|
||||
export type ViewType = 'Input' | 'Select' | 'DatePicker' | 'DatePicker.RangePicker' | 'RefAttr'
|
||||
|
||||
export type Ops =
|
||||
|
|
@ -20,11 +19,13 @@ export type Ops =
|
|||
| '$text'
|
||||
| '$search';
|
||||
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
|
||||
export type ValueType = string | boolean | number | Array<Dayjs> | Dayjs | null | React.Key[];
|
||||
|
||||
export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof ED> = {
|
||||
export type ColumnProps<
|
||||
ED2 extends ED,
|
||||
T extends keyof ED2
|
||||
> = {
|
||||
attr: string;
|
||||
label?: string;
|
||||
value?: any;
|
||||
|
|
@ -49,14 +50,14 @@ export type ColumnProps<ED extends BaseEntityDict & EntityDict, T extends keyof
|
|||
range?: boolean;
|
||||
showTime?: boolean;
|
||||
};
|
||||
refProps?: OakAbsRefAttrPickerDef<ED, keyof ED>;
|
||||
refProps?: OakAbsRefAttrPickerDef<ED2, keyof ED2>;
|
||||
transformFilter?: (
|
||||
column: ColumnProps<ED, T>,
|
||||
column: ColumnProps<ED2, T>,
|
||||
value: ValueType
|
||||
) => ED[T]['Selection']['filter'];
|
||||
) => ED2[T]['Selection']['filter'];
|
||||
transformValue?: (
|
||||
column: ColumnProps<ED, T>,
|
||||
filter: ED[T]['Selection']['filter']
|
||||
column: ColumnProps<ED2, T>,
|
||||
filter: ED2[T]['Selection']['filter']
|
||||
) => any;
|
||||
filterName?: string;
|
||||
colSpan?: ColSpanType;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export type PromisefyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
export type PromisifyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
|
||||
|
||||
export type PromisefyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
export type PromisifyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { unset } from 'oak-domain/lib/utils/lodash';
|
||||
import { generateNewId } from 'oak-domain/lib/utils/uuid';
|
||||
import { PromisefyOption } from '../../types/Wx';
|
||||
import { PromisifyOption } from '../../types/Wx';
|
||||
|
||||
export class Bluetooth {
|
||||
private serverDict: Record<string, WechatMiniprogram.BLEPeripheralServer>;
|
||||
|
|
@ -8,7 +8,9 @@ export class Bluetooth {
|
|||
constructor() {
|
||||
this.serverDict = {};
|
||||
}
|
||||
startScanDevice(option: PromisefyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>) {
|
||||
startScanDevice(
|
||||
option: PromisifyOption<WechatMiniprogram.StartBluetoothDevicesDiscoveryOption>
|
||||
) {
|
||||
return wx.startBluetoothDevicesDiscovery(option);
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +18,9 @@ export class Bluetooth {
|
|||
return wx.stopBluetoothDevicesDiscovery({});
|
||||
}
|
||||
|
||||
openAdapter(option: PromisefyOption<WechatMiniprogram.OpenBluetoothAdapterOption>) {
|
||||
openAdapter(
|
||||
option: PromisifyOption<WechatMiniprogram.OpenBluetoothAdapterOption>
|
||||
) {
|
||||
return wx.openBluetoothAdapter(option);
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +32,9 @@ export class Bluetooth {
|
|||
wx.onBluetoothDeviceFound(callback);
|
||||
}
|
||||
|
||||
onAdapterStateChanged(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback) {
|
||||
onAdapterStateChanged(
|
||||
callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback
|
||||
) {
|
||||
wx.onBluetoothAdapterStateChange(callback);
|
||||
}
|
||||
|
||||
|
|
@ -36,11 +42,15 @@ export class Bluetooth {
|
|||
wx.offBluetoothDeviceFound(callback);
|
||||
}
|
||||
|
||||
offAdapterStateChaned(callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback) {
|
||||
offAdapterStateChaned(
|
||||
callback: WechatMiniprogram.OnBluetoothAdapterStateChangeCallback
|
||||
) {
|
||||
wx.offBluetoothAdapterStateChange(callback);
|
||||
}
|
||||
|
||||
getConnectedDevices(option: PromisefyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>) {
|
||||
getConnectedDevices(
|
||||
option: PromisifyOption<WechatMiniprogram.GetConnectedBluetoothDevicesOption>
|
||||
) {
|
||||
return wx.getConnectedBluetoothDevices(option);
|
||||
}
|
||||
|
||||
|
|
@ -53,31 +63,45 @@ export class Bluetooth {
|
|||
}
|
||||
|
||||
// ble
|
||||
writeBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>) {
|
||||
writeBLECharacteristicValue(
|
||||
option: PromisifyOption<WechatMiniprogram.WriteBLECharacteristicValueOption>
|
||||
) {
|
||||
return wx.writeBLECharacteristicValue(option);
|
||||
}
|
||||
|
||||
readBLECharacteristicValue(option: PromisefyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>) {
|
||||
readBLECharacteristicValue(
|
||||
option: PromisifyOption<WechatMiniprogram.ReadBLECharacteristicValueOption>
|
||||
) {
|
||||
return wx.readBLECharacteristicValue(option);
|
||||
}
|
||||
|
||||
onBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback) {
|
||||
onBLEConnectionStateChange(
|
||||
callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback
|
||||
) {
|
||||
wx.onBLEConnectionStateChange(callback);
|
||||
}
|
||||
|
||||
onBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback) {
|
||||
onBLECharacteristicValueChange(
|
||||
callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback
|
||||
) {
|
||||
wx.onBLECharacteristicValueChange(callback);
|
||||
}
|
||||
|
||||
offBLEConnectionStateChange(callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback) {
|
||||
offBLEConnectionStateChange(
|
||||
callback: WechatMiniprogram.OnBLEConnectionStateChangeCallback
|
||||
) {
|
||||
wx.offBLEConnectionStateChange(callback);
|
||||
}
|
||||
|
||||
offBLECharacteristicValueChange(callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback) {
|
||||
offBLECharacteristicValueChange(
|
||||
callback: WechatMiniprogram.OnBLECharacteristicValueChangeCallback
|
||||
) {
|
||||
wx.offBLECharacteristicValueChange(callback);
|
||||
}
|
||||
|
||||
async notifyBLECharacteristicValueChange(option: PromisefyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>) {
|
||||
async notifyBLECharacteristicValueChange(
|
||||
option: PromisifyOption<WechatMiniprogram.NotifyBLECharacteristicValueChangeOption>
|
||||
) {
|
||||
const result = await wx.notifyBLECharacteristicValueChange(option);
|
||||
if (result.errCode !== 0) {
|
||||
const { errCode, errMsg } = result;
|
||||
|
|
@ -85,15 +109,21 @@ export class Bluetooth {
|
|||
}
|
||||
}
|
||||
|
||||
getBLEDeviceServices(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceServicesOption>) {
|
||||
getBLEDeviceServices(
|
||||
option: PromisifyOption<WechatMiniprogram.GetBLEDeviceServicesOption>
|
||||
) {
|
||||
return wx.getBLEDeviceServices(option);
|
||||
}
|
||||
|
||||
getBLEDeviceCharacteristics(option: PromisefyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>) {
|
||||
getBLEDeviceCharacteristics(
|
||||
option: PromisifyOption<WechatMiniprogram.GetBLEDeviceCharacteristicsOption>
|
||||
) {
|
||||
return wx.getBLEDeviceCharacteristics(option);
|
||||
}
|
||||
|
||||
async createBLEConnection(option: PromisefyOption<WechatMiniprogram.CreateBLEConnectionOption>) {
|
||||
async createBLEConnection(
|
||||
option: PromisifyOption<WechatMiniprogram.CreateBLEConnectionOption>
|
||||
) {
|
||||
const result = await wx.createBLEConnection(option);
|
||||
if (result.errCode !== 0) {
|
||||
const { errCode, errMsg } = result;
|
||||
|
|
@ -101,20 +131,26 @@ export class Bluetooth {
|
|||
}
|
||||
}
|
||||
|
||||
async closeBLEConnection(option: PromisefyOption<WechatMiniprogram.CloseBLEConnectionOption>) {
|
||||
async closeBLEConnection(
|
||||
option: PromisifyOption<WechatMiniprogram.CloseBLEConnectionOption>
|
||||
) {
|
||||
const result = await wx.closeBLEConnection(option);
|
||||
if (result.errCode !== 0) {
|
||||
const { errCode, errMsg } = result;
|
||||
throw new Error(`[${errCode}]${errMsg}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// peripheral
|
||||
onPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback) {
|
||||
onPeripheralConnectionStateChanged(
|
||||
callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback
|
||||
) {
|
||||
wx.onBLEPeripheralConnectionStateChanged(callback);
|
||||
}
|
||||
|
||||
offPeripheralConnectionStateChanged(callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback) {
|
||||
offPeripheralConnectionStateChanged(
|
||||
callback: WechatMiniprogram.OnBLEPeripheralConnectionStateChangedCallback
|
||||
) {
|
||||
wx.offBLEPeripheralConnectionStateChanged(callback);
|
||||
}
|
||||
|
||||
|
|
@ -133,17 +169,26 @@ export class Bluetooth {
|
|||
unset(this.serverDict, id);
|
||||
}
|
||||
|
||||
addPeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.AddServiceOption>) {
|
||||
addPeripheralService(
|
||||
id: string,
|
||||
option: PromisifyOption<WechatMiniprogram.AddServiceOption>
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.addService(option);
|
||||
}
|
||||
|
||||
removePeripheralService(id: string, option: PromisefyOption<WechatMiniprogram.RemoveServiceOption>) {
|
||||
removePeripheralService(
|
||||
id: string,
|
||||
option: PromisifyOption<WechatMiniprogram.RemoveServiceOption>
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
return server.removeService(option);
|
||||
}
|
||||
|
||||
startPeripheralAdvertising(id: string, option: PromisefyOption<WechatMiniprogram.StartAdvertisingObject>) {
|
||||
startPeripheralAdvertising(
|
||||
id: string,
|
||||
option: PromisifyOption<WechatMiniprogram.StartAdvertisingObject>
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
return server.startAdvertising(option);
|
||||
}
|
||||
|
|
@ -153,47 +198,74 @@ export class Bluetooth {
|
|||
return server.stopAdvertising();
|
||||
}
|
||||
|
||||
writePeripheralCharacteristicValue(id: string, option: PromisefyOption<WechatMiniprogram.WriteCharacteristicValueObject>) {
|
||||
writePeripheralCharacteristicValue(
|
||||
id: string,
|
||||
option: PromisifyOption<WechatMiniprogram.WriteCharacteristicValueObject>
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
return server.writeCharacteristicValue(option);
|
||||
}
|
||||
|
||||
onPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback) {
|
||||
onPeripheralCharacteristicReadRequest(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicReadRequestCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.onCharacteristicReadRequest(callback);
|
||||
}
|
||||
|
||||
offPeripheralCharacteristicReadRequest(id: string, callback: WechatMiniprogram.OnCharacteristicReadRequestCallback) {
|
||||
offPeripheralCharacteristicReadRequest(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicReadRequestCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.offCharacteristicReadRequest(callback);
|
||||
}
|
||||
|
||||
onPeripheralCharacteristicWriteRequest(id: string, callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback) {
|
||||
onPeripheralCharacteristicWriteRequest(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.onCharacteristicWriteRequest(callback);
|
||||
}
|
||||
|
||||
offPeripheralCharacteristicWriteRequest(id: string, callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback) {
|
||||
offPeripheralCharacteristicWriteRequest(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicWriteRequestCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.offCharacteristicWriteRequest(callback);
|
||||
}
|
||||
|
||||
onPeripheralCharacteristicSubscribed(id: string, callback: WechatMiniprogram.OnCharacteristicSubscribedCallback) {
|
||||
onPeripheralCharacteristicSubscribed(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicSubscribedCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.onCharacteristicSubscribed(callback);
|
||||
}
|
||||
|
||||
offPeripheralCharacteristicSubscribed(id: string, callback: WechatMiniprogram.OnCharacteristicSubscribedCallback) {
|
||||
offPeripheralCharacteristicSubscribed(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicSubscribedCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.offCharacteristicSubscribed(callback);
|
||||
}
|
||||
|
||||
onPeripheralCharacteristicUnsubscribed(id: string, callback: WechatMiniprogram.OnCharacteristicUnsubscribedCallback) {
|
||||
onPeripheralCharacteristicUnsubscribed(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicUnsubscribedCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.onCharacteristicUnsubscribed(callback);
|
||||
}
|
||||
|
||||
offPeripheralCharacteristicUnsubscribed(id: string, callback: WechatMiniprogram.OnCharacteristicUnsubscribedCallback) {
|
||||
offPeripheralCharacteristicUnsubscribed(
|
||||
id: string,
|
||||
callback: WechatMiniprogram.OnCharacteristicUnsubscribedCallback
|
||||
) {
|
||||
const server = this.serverDict[id];
|
||||
server.offCharacteristicUnsubscribed(callback);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,9 @@ import { StorageSchema, Attribute } from 'oak-domain/lib/types';
|
|||
import { judgeRelation } from 'oak-domain/lib/store/relation';
|
||||
import {
|
||||
OakAbsAttrDef,
|
||||
CardDef,
|
||||
DataTransformer,
|
||||
DataConverter,
|
||||
ColumnDefProps,
|
||||
RenderWidth,
|
||||
AttrRender,
|
||||
OakAbsAttrUpsertDef,
|
||||
DataUpsertTransformer,
|
||||
AttrUpsertRender,
|
||||
OakAbsDerivedAttrDef,
|
||||
OakAbsRefAttrPickerDef,
|
||||
|
|
@ -22,10 +17,7 @@ import {
|
|||
OakAbsAttrJudgeDef,
|
||||
} from '../types/AbstractComponent';
|
||||
import { get } from 'oak-domain/lib/utils/lodash';
|
||||
import {
|
||||
DataType,
|
||||
DataTypeParams,
|
||||
} from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import { DataType } from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import dayjs from 'dayjs';
|
||||
import { ThousandCont, ToYuan } from 'oak-domain/lib/utils/money';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue