mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 23:49:27 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
49d822ee9c
@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Input, Select } from 'antd';
|
import { Input, Select } from 'antd';
|
||||||
|
import { css } from '@emotion/css';
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import React, { useCallback, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useFormBlockContext } from '../../block-provider/FormBlockProvider';
|
import { useFormBlockContext } from '../../block-provider/FormBlockProvider';
|
||||||
@ -47,7 +48,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
|
|||||||
blockCollectionName: collectionName,
|
blockCollectionName: collectionName,
|
||||||
});
|
});
|
||||||
const constantStyle = useMemo(() => {
|
const constantStyle = useMemo(() => {
|
||||||
return { minWidth: 150, maxWidth: 430, marginLeft: 5 };
|
return { minWidth: 150, maxWidth: 430 };
|
||||||
}, []);
|
}, []);
|
||||||
const handleChangeOfConstant = useCallback(
|
const handleChangeOfConstant = useCallback(
|
||||||
(value) => {
|
(value) => {
|
||||||
@ -73,7 +74,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
|
|||||||
[collectionName, mode, setValue],
|
[collectionName, mode, setValue],
|
||||||
);
|
);
|
||||||
const textAreaStyle = useMemo(() => {
|
const textAreaStyle = useMemo(() => {
|
||||||
return { minWidth: 460 };
|
return { minWidth: 460, borderRadius: 0 };
|
||||||
}, []);
|
}, []);
|
||||||
const compatScope = useMemo(() => {
|
const compatScope = useMemo(() => {
|
||||||
return compatOldVariables(scope, {
|
return compatOldVariables(scope, {
|
||||||
@ -83,7 +84,16 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
|
|||||||
const modeMap = {
|
const modeMap = {
|
||||||
// 常量
|
// 常量
|
||||||
constant: (
|
constant: (
|
||||||
<div role="button" aria-label="dynamic-component-linkage-rules" style={constantStyle}>
|
<div
|
||||||
|
role="button"
|
||||||
|
aria-label="dynamic-component-linkage-rules"
|
||||||
|
style={constantStyle}
|
||||||
|
className={css`
|
||||||
|
.ant-input-affix-wrapper {
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
>
|
||||||
{React.createElement(DynamicComponent, {
|
{React.createElement(DynamicComponent, {
|
||||||
value: fieldValue?.value,
|
value: fieldValue?.value,
|
||||||
schema,
|
schema,
|
||||||
@ -140,7 +150,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
|
|||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setMode(value);
|
setMode(value);
|
||||||
setValue({
|
setValue({
|
||||||
mode: value,
|
mode: fieldValue?.mode,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -150,7 +160,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
|
|||||||
</Option>
|
</Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
{modeMap[mode]}
|
{modeMap[fieldValue?.mode || mode]}
|
||||||
</Input.Group>
|
</Input.Group>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -27,7 +27,7 @@ const LinkageRulesTitle = (props) => {
|
|||||||
const value = array?.field?.value[index];
|
const value = array?.field?.value[index];
|
||||||
return (
|
return (
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
value={value.title}
|
value={value.title || t('Linkage rule')}
|
||||||
defaultValue={t('Linkage rule')}
|
defaultValue={t('Linkage rule')}
|
||||||
onChange={(ev) => {
|
onChange={(ev) => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
@ -289,6 +289,12 @@ export const querySchema: ISchema = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
distinct: {
|
||||||
|
type: 'boolean',
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
'x-component': 'Checkbox',
|
||||||
|
'x-content': '{{t("Distinct")}}',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -94,5 +94,6 @@
|
|||||||
"Aspect ratio": "Aspect ratio",
|
"Aspect ratio": "Aspect ratio",
|
||||||
"Fixed height": "Fixed height",
|
"Fixed height": "Fixed height",
|
||||||
"Show background": "Show background",
|
"Show background": "Show background",
|
||||||
"Show padding": "Show padding"
|
"Show padding": "Show padding",
|
||||||
|
"Distinct": "Distinct"
|
||||||
}
|
}
|
||||||
|
@ -95,5 +95,6 @@
|
|||||||
"Aspect ratio": "宽高比",
|
"Aspect ratio": "宽高比",
|
||||||
"Fixed height": "固定高度",
|
"Fixed height": "固定高度",
|
||||||
"Show background": "显示背景",
|
"Show background": "显示背景",
|
||||||
"Show padding": "显示内边距"
|
"Show padding": "显示内边距",
|
||||||
|
"Distinct": "去重"
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ type MeasureProps = {
|
|||||||
type?: string;
|
type?: string;
|
||||||
aggregation?: string;
|
aggregation?: string;
|
||||||
alias?: string;
|
alias?: string;
|
||||||
|
distinct?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DimensionProps = {
|
type DimensionProps = {
|
||||||
@ -117,7 +118,7 @@ export const parseBuilder = async (ctx: Context, next: Next) => {
|
|||||||
let hasAgg = false;
|
let hasAgg = false;
|
||||||
|
|
||||||
measures.forEach((measure: MeasureProps & { field: string }) => {
|
measures.forEach((measure: MeasureProps & { field: string }) => {
|
||||||
const { field, aggregation, alias } = measure;
|
const { field, aggregation, alias, distinct } = measure;
|
||||||
const attribute = [];
|
const attribute = [];
|
||||||
const col = sequelize.col(field);
|
const col = sequelize.col(field);
|
||||||
if (aggregation) {
|
if (aggregation) {
|
||||||
@ -125,7 +126,7 @@ export const parseBuilder = async (ctx: Context, next: Next) => {
|
|||||||
throw new Error(`Invalid aggregation function: ${aggregation}`);
|
throw new Error(`Invalid aggregation function: ${aggregation}`);
|
||||||
}
|
}
|
||||||
hasAgg = true;
|
hasAgg = true;
|
||||||
attribute.push(sequelize.fn(aggregation, col));
|
attribute.push(sequelize.fn(aggregation, distinct ? sequelize.fn('DISTINCT', col) : col));
|
||||||
} else {
|
} else {
|
||||||
attribute.push(col);
|
attribute.push(col);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user