table 支持列设置fixed:left、right
This commit is contained in:
parent
24aab52e84
commit
b4b17a9b4a
|
|
@ -1,9 +1,9 @@
|
|||
export default OakComponent({
|
||||
isList: false,
|
||||
data: {
|
||||
slideWidth: 0, //小程序使用
|
||||
slideLeft: 0, //小程序使用
|
||||
slideShow: false, //小程序使用
|
||||
slideWidth: 0,
|
||||
slideLeft: 0,
|
||||
slideShow: false,
|
||||
commonAction: [
|
||||
'create',
|
||||
'update',
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export default OakComponent({
|
|||
let currentUrl = event.currentTarget.dataset.src;
|
||||
let urlList = event.currentTarget.dataset.list;
|
||||
wx.previewImage({
|
||||
current: currentUrl, // 当前显示图片的http链接
|
||||
current: currentUrl,
|
||||
urls: urlList, // 需要预览的图片http链接列表
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export default OakComponent({
|
|||
code: '',
|
||||
title: '',
|
||||
desc: '',
|
||||
icon: '', //web独有
|
||||
icon: '',
|
||||
imagePath: '', //小程序独有
|
||||
},
|
||||
lifetimes: {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default OakComponent({
|
|||
attribute: {},
|
||||
options: [],
|
||||
inputType: '',
|
||||
timeStartStr: '', // 小程序选择时间显示
|
||||
timeStartStr: '',
|
||||
timeEndStr: '',
|
||||
selectedLabel: '',
|
||||
minDateMp: new Date(1980, 1, 1).getTime(),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Table } from 'antd';
|
|||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { get } from 'oak-domain/lib/utils/lodash';
|
||||
import ActionBtn from '../actionBtn';
|
||||
import { getWidth, getValue, getLabel, getType, getAlign, getLinkUrl } from '../../utils/usefulFn';
|
||||
import { getWidth, getValue, getLabel, getType, getAlign, getLinkUrl, getFixed } from '../../utils/usefulFn';
|
||||
import TableCell from './renderCell';
|
||||
import { TableContext } from '../listPro';
|
||||
export default function Render(props) {
|
||||
|
|
@ -38,6 +38,7 @@ export default function Render(props) {
|
|||
key: ele.path,
|
||||
title,
|
||||
align,
|
||||
fixed: getFixed(ele.attribute),
|
||||
render: (v, row) => {
|
||||
if (typeof ele.attribute !== 'string' && ele.attribute.render) {
|
||||
return ele.attribute.render(row);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default OakComponent({
|
|||
multiple: false,
|
||||
entityId: '',
|
||||
entityIds: [],
|
||||
pickerRender: {}, // OakAbsRefAttrPickerRender
|
||||
pickerRender: {},
|
||||
onChange: (() => undefined),
|
||||
},
|
||||
formData() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export default OakComponent({
|
|||
return this.props.entity;
|
||||
},
|
||||
properties: {
|
||||
helps: {}, // Record<string, string>;
|
||||
helps: {},
|
||||
entity: '',
|
||||
attributes: [],
|
||||
layout: 'horizontal',
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ export class Cache extends Feature {
|
|||
opers.forEach((oper) => {
|
||||
const { entity, operation } = oper;
|
||||
this.cacheStore.operate(entity, operation, this.context, {
|
||||
checkerTypes: ['logical'], // 这里不能检查data,不然在数据没填完前会有大量异常
|
||||
checkerTypes: ['logical'],
|
||||
dontCollect: true,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
export const keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
||||
export const values = {
|
||||
xs: 576, //小于576
|
||||
xs: 576,
|
||||
sm: 576,
|
||||
md: 768,
|
||||
lg: 992,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export type OakAbsDerivedAttrDef = {
|
|||
type?: 'image' | 'link' | DataType | 'ref';
|
||||
linkUrl?: string;
|
||||
render?: (row: any) => React.ReactNode | undefined;
|
||||
fixed?: 'right' | 'left';
|
||||
};
|
||||
export type OakAbsAttrDef = string | OakAbsDerivedAttrDef;
|
||||
export type OakAbsAttrJudgeDef = {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export declare function getLabel<ED extends EntityDict & BaseEntityDict>(attribu
|
|||
export declare function getWidth(attribute: OakAbsAttrDef, attrType: DataType | 'ref' | undefined): number | undefined;
|
||||
export declare function getValue<ED extends EntityDict & BaseEntityDict>(data: any, path: string, entity: keyof ED, attr: string, attrType: DataType | 'ref' | undefined, t: (k: string, params?: object) => string): any;
|
||||
export declare function getAlign(attrType: DataType): 'left' | 'right' | 'center';
|
||||
export declare function getFixed(attribute: OakAbsAttrDef): 'left' | 'right' | undefined;
|
||||
export declare function getType(attribute: OakAbsAttrDef, attrType: OakAbsDerivedAttrDef['type']): "link" | "ref" | DataType | undefined;
|
||||
export declare function makeDataTransformer<ED extends EntityDict & BaseEntityDict>(dataSchema: StorageSchema<ED>, entity: keyof ED, attrDefs: OakAbsAttrDef[], t: (k: string, params?: object) => string, colorDict?: ColorDict<ED>): DataTransformer;
|
||||
export declare function analyzeDataUpsertTransformer<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(dataSchema: StorageSchema<ED>, entity: T, attrUpsertDefs: OakAbsAttrUpsertDef<ED, T>[]): (data: any) => AttrUpsertRender<ED, T>[];
|
||||
|
|
|
|||
|
|
@ -168,6 +168,12 @@ export function getAlign(attrType) {
|
|||
}
|
||||
return 'left';
|
||||
}
|
||||
export function getFixed(attribute) {
|
||||
if (typeof attribute?.fixed === 'function') {
|
||||
return undefined;
|
||||
}
|
||||
return attribute?.fixed;
|
||||
}
|
||||
export function getType(attribute, attrType) {
|
||||
let type = attrType;
|
||||
if (isAttrbuteType(attribute).type) {
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ class Cache extends Feature_1.Feature {
|
|||
opers.forEach((oper) => {
|
||||
const { entity, operation } = oper;
|
||||
this.cacheStore.operate(entity, operation, this.context, {
|
||||
checkerTypes: ['logical'], // 这里不能检查data,不然在数据没填完前会有大量异常
|
||||
checkerTypes: ['logical'],
|
||||
dontCollect: true,
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|||
const react_1 = tslib_1.__importDefault(require("react"));
|
||||
exports.keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
||||
exports.values = {
|
||||
xs: 576, //小于576
|
||||
xs: 576,
|
||||
sm: 576,
|
||||
md: 768,
|
||||
lg: 992,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export type OakAbsDerivedAttrDef = {
|
|||
type?: 'image' | 'link' | DataType | 'ref';
|
||||
linkUrl?: string;
|
||||
render?: (row: any) => React.ReactNode | undefined;
|
||||
fixed?: 'right' | 'left';
|
||||
};
|
||||
export type OakAbsAttrDef = string | OakAbsDerivedAttrDef;
|
||||
export type OakAbsAttrJudgeDef = {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export declare function getLabel<ED extends EntityDict & BaseEntityDict>(attribu
|
|||
export declare function getWidth(attribute: OakAbsAttrDef, attrType: DataType | 'ref' | undefined): number | undefined;
|
||||
export declare function getValue<ED extends EntityDict & BaseEntityDict>(data: any, path: string, entity: keyof ED, attr: string, attrType: DataType | 'ref' | undefined, t: (k: string, params?: object) => string): any;
|
||||
export declare function getAlign(attrType: DataType): 'left' | 'right' | 'center';
|
||||
export declare function getFixed(attribute: OakAbsAttrDef): 'left' | 'right' | undefined;
|
||||
export declare function getType(attribute: OakAbsAttrDef, attrType: OakAbsDerivedAttrDef['type']): "link" | "ref" | DataType | undefined;
|
||||
export declare function makeDataTransformer<ED extends EntityDict & BaseEntityDict>(dataSchema: StorageSchema<ED>, entity: keyof ED, attrDefs: OakAbsAttrDef[], t: (k: string, params?: object) => string, colorDict?: ColorDict<ED>): DataTransformer;
|
||||
export declare function analyzeDataUpsertTransformer<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(dataSchema: StorageSchema<ED>, entity: T, attrUpsertDefs: OakAbsAttrUpsertDef<ED, T>[]): (data: any) => AttrUpsertRender<ED, T>[];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.analyzeAttrMobileForCard = exports.translateAttributes = exports.analyzeDataUpsertTransformer = exports.makeDataTransformer = exports.getType = exports.getAlign = exports.getValue = exports.getWidth = exports.getLabel = exports.getPath = exports.getLinkUrl = exports.resolvePath = exports.getAttributes = void 0;
|
||||
exports.analyzeAttrMobileForCard = exports.translateAttributes = exports.analyzeDataUpsertTransformer = exports.makeDataTransformer = exports.getType = exports.getFixed = exports.getAlign = exports.getValue = exports.getWidth = exports.getLabel = exports.getPath = exports.getLinkUrl = exports.resolvePath = exports.getAttributes = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||
const relation_1 = require("oak-domain/lib/store/relation");
|
||||
|
|
@ -180,6 +180,13 @@ function getAlign(attrType) {
|
|||
return 'left';
|
||||
}
|
||||
exports.getAlign = getAlign;
|
||||
function getFixed(attribute) {
|
||||
if (typeof attribute?.fixed === 'function') {
|
||||
return undefined;
|
||||
}
|
||||
return attribute?.fixed;
|
||||
}
|
||||
exports.getFixed = getFixed;
|
||||
function getType(attribute, attrType) {
|
||||
let type = attrType;
|
||||
if (isAttrbuteType(attribute).type) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|||
import { ColorDict } from 'oak-domain/lib/types/Style';
|
||||
import { StorageSchema } from 'oak-domain/lib/types/Storage';
|
||||
import { OakAbsAttrDef, onActionFnDef, CascadeActionProps, OakAbsDerivedAttrDef, OakExtraActionProps, OakAbsAttrJudgeDef } from '../../types/AbstractComponent';
|
||||
import { getPath, getWidth, getValue, getLabel, resolvePath, getType, getAlign, getLinkUrl } from '../../utils/usefulFn';
|
||||
import { getPath, getWidth, getValue, getLabel, resolvePath, getType, getAlign, getLinkUrl, getFixed } from '../../utils/usefulFn';
|
||||
import { DataType } from 'oak-domain/lib/types/schema/DataTypes';
|
||||
import TableCell from './renderCell';
|
||||
import Style from './web.module.less';
|
||||
|
|
@ -92,6 +92,7 @@ export default function Render(
|
|||
key: ele.path,
|
||||
title,
|
||||
align,
|
||||
fixed: getFixed(ele.attribute),
|
||||
render: (v: string, row: any) => {
|
||||
if (typeof ele.attribute !== 'string' && ele.attribute.render) {
|
||||
return ele.attribute.render(row);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export type OakAbsDerivedAttrDef = {
|
|||
type?: 'image' | 'link' | DataType | 'ref';
|
||||
linkUrl?: string;
|
||||
render?: (row: any) => React.ReactNode | undefined;
|
||||
fixed?: 'right' | 'left';
|
||||
};
|
||||
|
||||
export type OakAbsAttrDef = string | OakAbsDerivedAttrDef;
|
||||
|
|
|
|||
|
|
@ -235,6 +235,13 @@ export function getAlign(attrType: DataType): 'left' | 'right' | 'center' {
|
|||
return 'left';
|
||||
}
|
||||
|
||||
export function getFixed(attribute: OakAbsAttrDef): 'left' | 'right' | undefined {
|
||||
if (typeof attribute?.fixed === 'function') {
|
||||
return undefined;
|
||||
}
|
||||
return attribute?.fixed;
|
||||
}
|
||||
|
||||
export function getType(
|
||||
attribute: OakAbsAttrDef,
|
||||
attrType: OakAbsDerivedAttrDef['type']
|
||||
|
|
|
|||
Loading…
Reference in New Issue