@tachybase/client 1.6.19 → 1.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/built-in/attachment-preview/previewers/file-default.mjs +6 -4
- package/es/built-in/attachment-preview/previewers/image-jpeg.mjs +3 -2
- package/es/built-in/attachment-preview/previewers/image-png.mjs +3 -2
- package/es/built-in/attachment-preview/previewers/image-svg.mjs +5 -2
- package/es/filter-provider/utils.mjs +10 -4
- package/es/schema-component/antd/date-picker/util.d.ts +7 -1
- package/es/schema-component/antd/date-picker/util.mjs +18 -10
- package/es/schema-component/antd/filter/useFilterActionProps.mjs +4 -0
- package/es/schema-component/antd/upload/ReadPretty.mjs +33 -5
- package/es/schema-component/antd/upload/Upload.mjs +34 -5
- package/es/schema-initializer/items/CustomFilterFormItemInitializer.mjs +5 -1
- package/lib/built-in/attachment-preview/previewers/file-default.js +6 -4
- package/lib/built-in/attachment-preview/previewers/image-jpeg.js +3 -2
- package/lib/built-in/attachment-preview/previewers/image-png.js +3 -2
- package/lib/built-in/attachment-preview/previewers/image-svg.js +5 -2
- package/lib/filter-provider/utils.js +10 -4
- package/lib/schema-component/antd/date-picker/util.js +18 -10
- package/lib/schema-component/antd/filter/useFilterActionProps.js +4 -0
- package/lib/schema-component/antd/upload/ReadPretty.js +33 -5
- package/lib/schema-component/antd/upload/Upload.js +34 -5
- package/lib/schema-initializer/items/CustomFilterFormItemInitializer.js +5 -1
- package/package.json +3 -3
|
@@ -32,19 +32,20 @@ const fileDef = {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
const ViewComponentImageDefault = (props)=>{
|
|
35
|
-
const { file, prefixCls } = props;
|
|
35
|
+
const { file, prefixCls, style } = props;
|
|
36
36
|
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
37
37
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
38
38
|
style: {
|
|
39
39
|
width: '100%',
|
|
40
|
-
height: '100%'
|
|
40
|
+
height: '100%',
|
|
41
|
+
...style
|
|
41
42
|
},
|
|
42
43
|
alt: file.title,
|
|
43
44
|
className: "".concat(prefixCls, "-list-item-image")
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
47
|
const CheckedComponentImageDefault = (props)=>{
|
|
47
|
-
const { file } = props;
|
|
48
|
+
const { file, style } = props;
|
|
48
49
|
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
49
50
|
...props,
|
|
50
51
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -54,7 +55,8 @@ const CheckedComponentImageDefault = (props)=>{
|
|
|
54
55
|
height: 'auto',
|
|
55
56
|
display: 'flex',
|
|
56
57
|
justifyContent: 'center',
|
|
57
|
-
alignItems: 'center'
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
...style
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
62
|
};
|
|
@@ -16,7 +16,7 @@ const imagejpeg = {
|
|
|
16
16
|
});
|
|
17
17
|
},
|
|
18
18
|
checkedComponent: (props)=>{
|
|
19
|
-
const { file } = props;
|
|
19
|
+
const { file, style } = props;
|
|
20
20
|
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
21
21
|
...props,
|
|
22
22
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -26,7 +26,8 @@ const imagejpeg = {
|
|
|
26
26
|
height: 'auto',
|
|
27
27
|
display: 'flex',
|
|
28
28
|
justifyContent: 'center',
|
|
29
|
-
alignItems: 'center'
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
...style
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
}
|
|
@@ -16,7 +16,7 @@ const imagePng = {
|
|
|
16
16
|
});
|
|
17
17
|
},
|
|
18
18
|
checkedComponent: (props)=>{
|
|
19
|
-
const { file } = props;
|
|
19
|
+
const { file, style } = props;
|
|
20
20
|
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
21
21
|
...props,
|
|
22
22
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -26,7 +26,8 @@ const imagePng = {
|
|
|
26
26
|
height: 'auto',
|
|
27
27
|
display: 'flex',
|
|
28
28
|
justifyContent: 'center',
|
|
29
|
-
alignItems: 'center'
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
...style
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
}
|
|
@@ -10,10 +10,13 @@ const imageSvg = {
|
|
|
10
10
|
});
|
|
11
11
|
},
|
|
12
12
|
checkedComponent: (props)=>{
|
|
13
|
-
const { file } = props;
|
|
13
|
+
const { file, style } = props;
|
|
14
14
|
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
15
15
|
...props,
|
|
16
|
-
src: "".concat(file.url)
|
|
16
|
+
src: "".concat(file.url),
|
|
17
|
+
style: {
|
|
18
|
+
...style
|
|
19
|
+
}
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
22
|
};
|
|
@@ -91,6 +91,10 @@ const resolveFilterOperator = function(schema, path) {
|
|
|
91
91
|
};
|
|
92
92
|
const getDatePickerComponent = (fieldSchema)=>{
|
|
93
93
|
var _fieldSchema_xcomponentprops;
|
|
94
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
95
|
+
var _fieldSchema_xcomponentprops1;
|
|
96
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
97
|
+
}
|
|
94
98
|
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
95
99
|
};
|
|
96
100
|
const getDatePickerShowTime = (fieldSchema)=>{
|
|
@@ -109,7 +113,7 @@ const normalizeDateBetweenBoundary = function(value, boundary) {
|
|
|
109
113
|
if (!m.isValid()) return value;
|
|
110
114
|
if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
111
115
|
if ('date' === options.valueMode) {
|
|
112
|
-
if ('retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
116
|
+
if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
113
117
|
const localBoundary = dayjs(normalizeLocalDateBoundaryInput(value));
|
|
114
118
|
return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
|
|
115
119
|
}
|
|
@@ -182,13 +186,15 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
|
|
|
182
186
|
};
|
|
183
187
|
} else if ('$dateBetween' === operator) {
|
|
184
188
|
if (Array.isArray(value)) {
|
|
189
|
+
const datePickerComponent = getDatePickerComponent(currentFieldSchema);
|
|
190
|
+
const useDefaultDateBoundary = shouldUseDefaultDateBoundary(currentFieldSchema);
|
|
185
191
|
const valueInfo = resolveDatePickerRangeValueInfo(value, {
|
|
186
|
-
component:
|
|
192
|
+
component: datePickerComponent,
|
|
187
193
|
showTime: getDatePickerShowTime(currentFieldSchema),
|
|
188
|
-
preferDateBoundaryFallback:
|
|
194
|
+
preferDateBoundaryFallback: useDefaultDateBoundary
|
|
189
195
|
});
|
|
190
196
|
value = normalizeDateBetweenValue(value, {
|
|
191
|
-
useDefaultDateBoundary
|
|
197
|
+
useDefaultDateBoundary,
|
|
192
198
|
valueMode: valueInfo.mode,
|
|
193
199
|
valueSource: valueInfo.source,
|
|
194
200
|
preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
|
|
@@ -23,7 +23,13 @@ export declare const resolveDatePickerRangeValueInfo: (value: any, options?: {
|
|
|
23
23
|
component?: string;
|
|
24
24
|
preferDateBoundaryFallback?: boolean;
|
|
25
25
|
}) => DatePickerRangeValueInfo;
|
|
26
|
-
export declare const normalizeDatePickerParseOptions: (options?: Moment2strOptions) =>
|
|
26
|
+
export declare const normalizeDatePickerParseOptions: (options?: Moment2strOptions) => {
|
|
27
|
+
showTime?: boolean;
|
|
28
|
+
utc?: boolean;
|
|
29
|
+
picker?: "year" | "month" | "week" | "quarter";
|
|
30
|
+
value?: any;
|
|
31
|
+
component?: string;
|
|
32
|
+
};
|
|
27
33
|
export declare const moment2str: (value?: Dayjs | null, options?: Moment2strOptions) => any;
|
|
28
34
|
export declare const mapDatePicker: () => (props: any) => any;
|
|
29
35
|
export declare const mapRangePicker: () => (props: any) => any;
|
|
@@ -46,18 +46,24 @@ const isDatePickerRetainedLocalBoundaryPair = (value)=>Array.isArray(value) && v
|
|
|
46
46
|
const resolveDatePickerRangeValueInfo = function(value) {
|
|
47
47
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
48
48
|
const metadataMode = getRangeValueMode(value);
|
|
49
|
-
if (metadataMode)
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (metadataMode) {
|
|
50
|
+
if ('date' === metadataMode && isDatePickerDefaultRangeBoundaryPair(value)) return {
|
|
51
|
+
mode: 'date',
|
|
52
|
+
source: 'retained-date-boundary'
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
mode: metadataMode,
|
|
56
|
+
source: 'metadata'
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (options.preferDateBoundaryFallback && isDatePickerRetainedLocalBoundaryPair(value)) return {
|
|
60
|
+
mode: 'date',
|
|
61
|
+
source: 'retained-local-date-boundary'
|
|
52
62
|
};
|
|
53
63
|
if ('DatePicker.RangePicker' === options.component && !options.showTime) return {
|
|
54
64
|
mode: 'date',
|
|
55
65
|
source: 'schema'
|
|
56
66
|
};
|
|
57
|
-
if (options.preferDateBoundaryFallback && options.showTime && isDatePickerRetainedLocalBoundaryPair(value)) return {
|
|
58
|
-
mode: 'date',
|
|
59
|
-
source: 'retained-local-date-boundary'
|
|
60
|
-
};
|
|
61
67
|
if (options.preferDateBoundaryFallback && isDatePickerDefaultRangeBoundaryPair(value)) return {
|
|
62
68
|
mode: 'date',
|
|
63
69
|
source: 'retained-date-boundary'
|
|
@@ -68,7 +74,7 @@ const resolveDatePickerRangeValueInfo = function(value) {
|
|
|
68
74
|
};
|
|
69
75
|
const normalizeDatePickerParseOptions = function() {
|
|
70
76
|
let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
71
|
-
if (false === options.utc ||
|
|
77
|
+
if (false === options.utc || true === options.gmt || options.picker) return options;
|
|
72
78
|
const rangeValueInfo = resolveDatePickerRangeValueInfo(options.value, {
|
|
73
79
|
component: options.component,
|
|
74
80
|
showTime: options.showTime,
|
|
@@ -77,10 +83,12 @@ const normalizeDatePickerParseOptions = function() {
|
|
|
77
83
|
if (options.showTime) {
|
|
78
84
|
if ('date' !== rangeValueInfo.mode || 'retained-local-date-boundary' === rangeValueInfo.source) return options;
|
|
79
85
|
}
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
const { gmt, ...rest } = options;
|
|
87
|
+
if ('retained-date-boundary' === rangeValueInfo.source) return {
|
|
88
|
+
...rest,
|
|
82
89
|
gmt: true
|
|
83
90
|
};
|
|
91
|
+
return rest;
|
|
84
92
|
};
|
|
85
93
|
const moment2str = function(value) {
|
|
86
94
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
@@ -137,6 +137,10 @@ const findCustomFieldSchema = (schema, key)=>{
|
|
|
137
137
|
};
|
|
138
138
|
const getDatePickerComponent = (fieldSchema)=>{
|
|
139
139
|
var _fieldSchema_xcomponentprops;
|
|
140
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
141
|
+
var _fieldSchema_xcomponentprops1;
|
|
142
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
143
|
+
}
|
|
140
144
|
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
141
145
|
};
|
|
142
146
|
const getDatePickerShowTime = (fieldSchema)=>{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { useField } from "@tachybase/schema";
|
|
4
|
-
import { DownloadOutlined } from "@ant-design/icons";
|
|
5
4
|
import { Lightbox, isString } from "@tego/client";
|
|
5
|
+
import { DownloadOutlined, RotateRightOutlined } from "@ant-design/icons";
|
|
6
6
|
import { Button, Space } from "antd";
|
|
7
7
|
import style from "antd/es/upload/style";
|
|
8
8
|
import classnames from "classnames";
|
|
@@ -21,6 +21,7 @@ ReadPretty.File = function(props) {
|
|
|
21
21
|
const app = useApp();
|
|
22
22
|
const [fileIndex, setFileIndex] = useState(0);
|
|
23
23
|
const [visible, setVisible] = useState(false);
|
|
24
|
+
const [rotate, setRotate] = useState(0);
|
|
24
25
|
const { wrapSSR, hashId, componentCls: prefixCls } = useStyles();
|
|
25
26
|
const useUploadStyleVal = style["default"] ? style["default"] : style;
|
|
26
27
|
const previewList = app.AttachmentPreviewManager.get();
|
|
@@ -66,8 +67,14 @@ ReadPretty.File = function(props) {
|
|
|
66
67
|
e.stopPropagation();
|
|
67
68
|
setVisible(false);
|
|
68
69
|
},
|
|
69
|
-
onMovePrevRequest: ()=>
|
|
70
|
-
|
|
70
|
+
onMovePrevRequest: ()=>{
|
|
71
|
+
setFileIndex((fileIndex + images.length - 1) % images.length);
|
|
72
|
+
setRotate(0);
|
|
73
|
+
},
|
|
74
|
+
onMoveNextRequest: ()=>{
|
|
75
|
+
setFileIndex((fileIndex + 1) % images.length);
|
|
76
|
+
setRotate(0);
|
|
77
|
+
},
|
|
71
78
|
imageTitle: null == (_images_fileIndex1 = images[fileIndex]) ? void 0 : _images_fileIndex1.title,
|
|
72
79
|
toolbarButtons: [
|
|
73
80
|
/*#__PURE__*/ jsx("button", {
|
|
@@ -87,8 +94,29 @@ ReadPretty.File = function(props) {
|
|
|
87
94
|
saveAs(file.url, "".concat(file.title).concat(file.extname));
|
|
88
95
|
},
|
|
89
96
|
children: /*#__PURE__*/ jsx(DownloadOutlined, {})
|
|
90
|
-
}, 'download')
|
|
91
|
-
|
|
97
|
+
}, 'download'),
|
|
98
|
+
/*#__PURE__*/ jsx("button", {
|
|
99
|
+
style: {
|
|
100
|
+
fontSize: 22,
|
|
101
|
+
background: 'none',
|
|
102
|
+
lineHeight: 1
|
|
103
|
+
},
|
|
104
|
+
type: "button",
|
|
105
|
+
"aria-label": "Zoom in",
|
|
106
|
+
title: "Zoom in",
|
|
107
|
+
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
108
|
+
onClick: (e)=>{
|
|
109
|
+
setRotate(rotate + 90);
|
|
110
|
+
},
|
|
111
|
+
children: /*#__PURE__*/ jsx(RotateRightOutlined, {})
|
|
112
|
+
}, 'rotate')
|
|
113
|
+
],
|
|
114
|
+
otherProps: {
|
|
115
|
+
style: {
|
|
116
|
+
transform: "rotate(".concat(rotate, "deg)"),
|
|
117
|
+
transition: 'transform 0.3s'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
92
120
|
})
|
|
93
121
|
]
|
|
94
122
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createElement, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { connect, mapProps, mapReadPretty } from "@tachybase/schema";
|
|
4
|
-
import { DeleteOutlined, DownloadOutlined, InboxOutlined, LoadingOutlined, PlusOutlined } from "@ant-design/icons";
|
|
5
4
|
import { Lightbox } from "@tego/client";
|
|
5
|
+
import { DeleteOutlined, DownloadOutlined, InboxOutlined, LoadingOutlined, PlusOutlined, RotateRightOutlined } from "@ant-design/icons";
|
|
6
6
|
import { Button, Progress, Space, Upload } from "antd";
|
|
7
7
|
import classnames from "classnames";
|
|
8
8
|
import { saveAs } from "file-saver";
|
|
@@ -28,6 +28,7 @@ Upload_Upload.Attachment = connect((props)=>{
|
|
|
28
28
|
const images = fileList;
|
|
29
29
|
const [fileIndex, setFileIndex] = useState(0);
|
|
30
30
|
const [visible, setVisible] = useState(false);
|
|
31
|
+
const [rotate, setRotate] = useState(0);
|
|
31
32
|
const { t } = useTranslation();
|
|
32
33
|
const uploadProps = useUploadProps({
|
|
33
34
|
...props
|
|
@@ -124,8 +125,14 @@ Upload_Upload.Attachment = connect((props)=>{
|
|
|
124
125
|
prevFile: images[(fileIndex + images.length - 1) % images.length],
|
|
125
126
|
previewList: previewList,
|
|
126
127
|
onCloseRequest: ()=>setVisible(false),
|
|
127
|
-
onMovePrevRequest: ()=>
|
|
128
|
-
|
|
128
|
+
onMovePrevRequest: ()=>{
|
|
129
|
+
setFileIndex((fileIndex + images.length - 1) % images.length);
|
|
130
|
+
setRotate(0);
|
|
131
|
+
},
|
|
132
|
+
onMoveNextRequest: ()=>{
|
|
133
|
+
setFileIndex((fileIndex + 1) % images.length);
|
|
134
|
+
setRotate(0);
|
|
135
|
+
},
|
|
129
136
|
imageTitle: null == (_images_fileIndex1 = images[fileIndex]) ? void 0 : _images_fileIndex1.title,
|
|
130
137
|
toolbarButtons: [
|
|
131
138
|
/*#__PURE__*/ jsx("button", {
|
|
@@ -140,12 +147,34 @@ Upload_Upload.Attachment = connect((props)=>{
|
|
|
140
147
|
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
141
148
|
onClick: (e)=>{
|
|
142
149
|
e.preventDefault();
|
|
150
|
+
e.stopPropagation();
|
|
143
151
|
const file = images[fileIndex];
|
|
144
152
|
saveAs(file.url, "".concat(file.title).concat(file.extname));
|
|
145
153
|
},
|
|
146
154
|
children: /*#__PURE__*/ jsx(DownloadOutlined, {})
|
|
147
|
-
}, '
|
|
148
|
-
|
|
155
|
+
}, 'download'),
|
|
156
|
+
/*#__PURE__*/ jsx("button", {
|
|
157
|
+
style: {
|
|
158
|
+
fontSize: 22,
|
|
159
|
+
background: 'none',
|
|
160
|
+
lineHeight: 1
|
|
161
|
+
},
|
|
162
|
+
type: "button",
|
|
163
|
+
"aria-label": "Zoom in",
|
|
164
|
+
title: "Zoom in",
|
|
165
|
+
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
166
|
+
onClick: (e)=>{
|
|
167
|
+
setRotate(rotate + 90);
|
|
168
|
+
},
|
|
169
|
+
children: /*#__PURE__*/ jsx(RotateRightOutlined, {})
|
|
170
|
+
}, 'rotate')
|
|
171
|
+
],
|
|
172
|
+
otherProps: {
|
|
173
|
+
style: {
|
|
174
|
+
transform: "rotate(".concat(rotate, "deg)"),
|
|
175
|
+
transition: 'transform 0.3s'
|
|
176
|
+
}
|
|
177
|
+
}
|
|
149
178
|
})
|
|
150
179
|
]
|
|
151
180
|
}));
|
|
@@ -334,11 +334,15 @@ const FilterCustomItemInitializer = /*#__PURE__*/ memo((props)=>{
|
|
|
334
334
|
},
|
|
335
335
|
collectionName: collection
|
|
336
336
|
};
|
|
337
|
-
if ('DatePicker' === component) {
|
|
337
|
+
if ('DatePicker' === component || 'DatePicker.RangePicker' === component) {
|
|
338
338
|
schema['x-settings'] = 'fieldSettings:FilterFormItem';
|
|
339
339
|
schema['x-designer-props'] = {
|
|
340
340
|
interface: 'datetime'
|
|
341
341
|
};
|
|
342
|
+
schema['x-component-props'] = {
|
|
343
|
+
...schema['x-component-props'],
|
|
344
|
+
gmt: false
|
|
345
|
+
};
|
|
342
346
|
}
|
|
343
347
|
insert(gridRowColWrap(schema));
|
|
344
348
|
}, [
|
|
@@ -60,19 +60,20 @@ const fileDef = {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
const ViewComponentImageDefault = (props)=>{
|
|
63
|
-
const { file, prefixCls } = props;
|
|
63
|
+
const { file, prefixCls, style } = props;
|
|
64
64
|
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
65
65
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
66
66
|
style: {
|
|
67
67
|
width: '100%',
|
|
68
|
-
height: '100%'
|
|
68
|
+
height: '100%',
|
|
69
|
+
...style
|
|
69
70
|
},
|
|
70
71
|
alt: file.title,
|
|
71
72
|
className: "".concat(prefixCls, "-list-item-image")
|
|
72
73
|
});
|
|
73
74
|
};
|
|
74
75
|
const CheckedComponentImageDefault = (props)=>{
|
|
75
|
-
const { file } = props;
|
|
76
|
+
const { file, style } = props;
|
|
76
77
|
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
77
78
|
...props,
|
|
78
79
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -82,7 +83,8 @@ const CheckedComponentImageDefault = (props)=>{
|
|
|
82
83
|
height: 'auto',
|
|
83
84
|
display: 'flex',
|
|
84
85
|
justifyContent: 'center',
|
|
85
|
-
alignItems: 'center'
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
...style
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
90
|
};
|
|
@@ -44,7 +44,7 @@ const imagejpeg = {
|
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
46
|
checkedComponent: (props)=>{
|
|
47
|
-
const { file } = props;
|
|
47
|
+
const { file, style } = props;
|
|
48
48
|
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
49
49
|
...props,
|
|
50
50
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -54,7 +54,8 @@ const imagejpeg = {
|
|
|
54
54
|
height: 'auto',
|
|
55
55
|
display: 'flex',
|
|
56
56
|
justifyContent: 'center',
|
|
57
|
-
alignItems: 'center'
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
...style
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
@@ -44,7 +44,7 @@ const imagePng = {
|
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
46
|
checkedComponent: (props)=>{
|
|
47
|
-
const { file } = props;
|
|
47
|
+
const { file, style } = props;
|
|
48
48
|
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
49
49
|
...props,
|
|
50
50
|
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
@@ -54,7 +54,8 @@ const imagePng = {
|
|
|
54
54
|
height: 'auto',
|
|
55
55
|
display: 'flex',
|
|
56
56
|
justifyContent: 'center',
|
|
57
|
-
alignItems: 'center'
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
...style
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
@@ -38,10 +38,13 @@ const imageSvg = {
|
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
40
|
checkedComponent: (props)=>{
|
|
41
|
-
const { file } = props;
|
|
41
|
+
const { file, style } = props;
|
|
42
42
|
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
43
43
|
...props,
|
|
44
|
-
src: "".concat(file.url)
|
|
44
|
+
src: "".concat(file.url),
|
|
45
|
+
style: {
|
|
46
|
+
...style
|
|
47
|
+
}
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
50
|
};
|
|
@@ -143,6 +143,10 @@ const resolveFilterOperator = function(schema, path) {
|
|
|
143
143
|
};
|
|
144
144
|
const getDatePickerComponent = (fieldSchema)=>{
|
|
145
145
|
var _fieldSchema_xcomponentprops;
|
|
146
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
147
|
+
var _fieldSchema_xcomponentprops1;
|
|
148
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
149
|
+
}
|
|
146
150
|
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
147
151
|
};
|
|
148
152
|
const getDatePickerShowTime = (fieldSchema)=>{
|
|
@@ -161,7 +165,7 @@ const normalizeDateBetweenBoundary = function(value, boundary) {
|
|
|
161
165
|
if (!m.isValid()) return value;
|
|
162
166
|
if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
163
167
|
if ('date' === options.valueMode) {
|
|
164
|
-
if ('retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
168
|
+
if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
165
169
|
const localBoundary = external_dayjs_default()(normalizeLocalDateBoundaryInput(value));
|
|
166
170
|
return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
|
|
167
171
|
}
|
|
@@ -234,13 +238,15 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
|
|
|
234
238
|
};
|
|
235
239
|
} else if ('$dateBetween' === operator) {
|
|
236
240
|
if (Array.isArray(value)) {
|
|
241
|
+
const datePickerComponent = getDatePickerComponent(currentFieldSchema);
|
|
242
|
+
const useDefaultDateBoundary = shouldUseDefaultDateBoundary(currentFieldSchema);
|
|
237
243
|
const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
|
|
238
|
-
component:
|
|
244
|
+
component: datePickerComponent,
|
|
239
245
|
showTime: getDatePickerShowTime(currentFieldSchema),
|
|
240
|
-
preferDateBoundaryFallback:
|
|
246
|
+
preferDateBoundaryFallback: useDefaultDateBoundary
|
|
241
247
|
});
|
|
242
248
|
value = normalizeDateBetweenValue(value, {
|
|
243
|
-
useDefaultDateBoundary
|
|
249
|
+
useDefaultDateBoundary,
|
|
244
250
|
valueMode: valueInfo.mode,
|
|
245
251
|
valueSource: valueInfo.source,
|
|
246
252
|
preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
|
|
@@ -95,18 +95,24 @@ const isDatePickerRetainedLocalBoundaryPair = (value)=>Array.isArray(value) && v
|
|
|
95
95
|
const resolveDatePickerRangeValueInfo = function(value) {
|
|
96
96
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
97
97
|
const metadataMode = getRangeValueMode(value);
|
|
98
|
-
if (metadataMode)
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
if (metadataMode) {
|
|
99
|
+
if ('date' === metadataMode && isDatePickerDefaultRangeBoundaryPair(value)) return {
|
|
100
|
+
mode: 'date',
|
|
101
|
+
source: 'retained-date-boundary'
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
mode: metadataMode,
|
|
105
|
+
source: 'metadata'
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (options.preferDateBoundaryFallback && isDatePickerRetainedLocalBoundaryPair(value)) return {
|
|
109
|
+
mode: 'date',
|
|
110
|
+
source: 'retained-local-date-boundary'
|
|
101
111
|
};
|
|
102
112
|
if ('DatePicker.RangePicker' === options.component && !options.showTime) return {
|
|
103
113
|
mode: 'date',
|
|
104
114
|
source: 'schema'
|
|
105
115
|
};
|
|
106
|
-
if (options.preferDateBoundaryFallback && options.showTime && isDatePickerRetainedLocalBoundaryPair(value)) return {
|
|
107
|
-
mode: 'date',
|
|
108
|
-
source: 'retained-local-date-boundary'
|
|
109
|
-
};
|
|
110
116
|
if (options.preferDateBoundaryFallback && isDatePickerDefaultRangeBoundaryPair(value)) return {
|
|
111
117
|
mode: 'date',
|
|
112
118
|
source: 'retained-date-boundary'
|
|
@@ -117,7 +123,7 @@ const resolveDatePickerRangeValueInfo = function(value) {
|
|
|
117
123
|
};
|
|
118
124
|
const normalizeDatePickerParseOptions = function() {
|
|
119
125
|
let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
120
|
-
if (false === options.utc ||
|
|
126
|
+
if (false === options.utc || true === options.gmt || options.picker) return options;
|
|
121
127
|
const rangeValueInfo = resolveDatePickerRangeValueInfo(options.value, {
|
|
122
128
|
component: options.component,
|
|
123
129
|
showTime: options.showTime,
|
|
@@ -126,10 +132,12 @@ const normalizeDatePickerParseOptions = function() {
|
|
|
126
132
|
if (options.showTime) {
|
|
127
133
|
if ('date' !== rangeValueInfo.mode || 'retained-local-date-boundary' === rangeValueInfo.source) return options;
|
|
128
134
|
}
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
const { gmt, ...rest } = options;
|
|
136
|
+
if ('retained-date-boundary' === rangeValueInfo.source) return {
|
|
137
|
+
...rest,
|
|
131
138
|
gmt: true
|
|
132
139
|
};
|
|
140
|
+
return rest;
|
|
133
141
|
};
|
|
134
142
|
const moment2str = function(value) {
|
|
135
143
|
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
@@ -183,6 +183,10 @@ const findCustomFieldSchema = (schema, key)=>{
|
|
|
183
183
|
};
|
|
184
184
|
const getDatePickerComponent = (fieldSchema)=>{
|
|
185
185
|
var _fieldSchema_xcomponentprops;
|
|
186
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
187
|
+
var _fieldSchema_xcomponentprops1;
|
|
188
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
189
|
+
}
|
|
186
190
|
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
187
191
|
};
|
|
188
192
|
const getDatePickerShowTime = (fieldSchema)=>{
|
|
@@ -39,8 +39,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
40
|
const external_react_namespaceObject = require("react");
|
|
41
41
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
42
|
-
const icons_namespaceObject = require("@ant-design/icons");
|
|
43
42
|
const client_namespaceObject = require("@tego/client");
|
|
43
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
44
44
|
const external_antd_namespaceObject = require("antd");
|
|
45
45
|
const style_namespaceObject = require("antd/es/upload/style");
|
|
46
46
|
var style_default = /*#__PURE__*/ __webpack_require__.n(style_namespaceObject);
|
|
@@ -61,6 +61,7 @@ ReadPretty.File = function(props) {
|
|
|
61
61
|
const app = (0, index_js_namespaceObject.useApp)();
|
|
62
62
|
const [fileIndex, setFileIndex] = (0, external_react_namespaceObject.useState)(0);
|
|
63
63
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
64
|
+
const [rotate, setRotate] = (0, external_react_namespaceObject.useState)(0);
|
|
64
65
|
const { wrapSSR, hashId, componentCls: prefixCls } = (0, external_style_js_namespaceObject.useStyles)();
|
|
65
66
|
const useUploadStyleVal = style_default()["default"] ? style_default()["default"] : style_default();
|
|
66
67
|
const previewList = app.AttachmentPreviewManager.get();
|
|
@@ -106,8 +107,14 @@ ReadPretty.File = function(props) {
|
|
|
106
107
|
e.stopPropagation();
|
|
107
108
|
setVisible(false);
|
|
108
109
|
},
|
|
109
|
-
onMovePrevRequest: ()=>
|
|
110
|
-
|
|
110
|
+
onMovePrevRequest: ()=>{
|
|
111
|
+
setFileIndex((fileIndex + images.length - 1) % images.length);
|
|
112
|
+
setRotate(0);
|
|
113
|
+
},
|
|
114
|
+
onMoveNextRequest: ()=>{
|
|
115
|
+
setFileIndex((fileIndex + 1) % images.length);
|
|
116
|
+
setRotate(0);
|
|
117
|
+
},
|
|
111
118
|
imageTitle: null == (_images_fileIndex1 = images[fileIndex]) ? void 0 : _images_fileIndex1.title,
|
|
112
119
|
toolbarButtons: [
|
|
113
120
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
@@ -127,8 +134,29 @@ ReadPretty.File = function(props) {
|
|
|
127
134
|
(0, external_file_saver_namespaceObject.saveAs)(file.url, "".concat(file.title).concat(file.extname));
|
|
128
135
|
},
|
|
129
136
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.DownloadOutlined, {})
|
|
130
|
-
}, 'download')
|
|
131
|
-
|
|
137
|
+
}, 'download'),
|
|
138
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
139
|
+
style: {
|
|
140
|
+
fontSize: 22,
|
|
141
|
+
background: 'none',
|
|
142
|
+
lineHeight: 1
|
|
143
|
+
},
|
|
144
|
+
type: "button",
|
|
145
|
+
"aria-label": "Zoom in",
|
|
146
|
+
title: "Zoom in",
|
|
147
|
+
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
148
|
+
onClick: (e)=>{
|
|
149
|
+
setRotate(rotate + 90);
|
|
150
|
+
},
|
|
151
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.RotateRightOutlined, {})
|
|
152
|
+
}, 'rotate')
|
|
153
|
+
],
|
|
154
|
+
otherProps: {
|
|
155
|
+
style: {
|
|
156
|
+
transform: "rotate(".concat(rotate, "deg)"),
|
|
157
|
+
transition: 'transform 0.3s'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
132
160
|
})
|
|
133
161
|
]
|
|
134
162
|
}));
|
|
@@ -40,8 +40,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
40
40
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
41
|
const external_react_namespaceObject = require("react");
|
|
42
42
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
43
|
-
const icons_namespaceObject = require("@ant-design/icons");
|
|
44
43
|
const client_namespaceObject = require("@tego/client");
|
|
44
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
45
45
|
const external_antd_namespaceObject = require("antd");
|
|
46
46
|
const external_classnames_namespaceObject = require("classnames");
|
|
47
47
|
var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
|
|
@@ -68,6 +68,7 @@ Upload_Upload.Attachment = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
68
68
|
const images = fileList;
|
|
69
69
|
const [fileIndex, setFileIndex] = (0, external_react_namespaceObject.useState)(0);
|
|
70
70
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
71
|
+
const [rotate, setRotate] = (0, external_react_namespaceObject.useState)(0);
|
|
71
72
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
72
73
|
const uploadProps = (0, external_shared_js_namespaceObject.useUploadProps)({
|
|
73
74
|
...props
|
|
@@ -164,8 +165,14 @@ Upload_Upload.Attachment = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
164
165
|
prevFile: images[(fileIndex + images.length - 1) % images.length],
|
|
165
166
|
previewList: previewList,
|
|
166
167
|
onCloseRequest: ()=>setVisible(false),
|
|
167
|
-
onMovePrevRequest: ()=>
|
|
168
|
-
|
|
168
|
+
onMovePrevRequest: ()=>{
|
|
169
|
+
setFileIndex((fileIndex + images.length - 1) % images.length);
|
|
170
|
+
setRotate(0);
|
|
171
|
+
},
|
|
172
|
+
onMoveNextRequest: ()=>{
|
|
173
|
+
setFileIndex((fileIndex + 1) % images.length);
|
|
174
|
+
setRotate(0);
|
|
175
|
+
},
|
|
169
176
|
imageTitle: null == (_images_fileIndex1 = images[fileIndex]) ? void 0 : _images_fileIndex1.title,
|
|
170
177
|
toolbarButtons: [
|
|
171
178
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
@@ -180,12 +187,34 @@ Upload_Upload.Attachment = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
180
187
|
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
181
188
|
onClick: (e)=>{
|
|
182
189
|
e.preventDefault();
|
|
190
|
+
e.stopPropagation();
|
|
183
191
|
const file = images[fileIndex];
|
|
184
192
|
(0, external_file_saver_namespaceObject.saveAs)(file.url, "".concat(file.title).concat(file.extname));
|
|
185
193
|
},
|
|
186
194
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.DownloadOutlined, {})
|
|
187
|
-
}, '
|
|
188
|
-
|
|
195
|
+
}, 'download'),
|
|
196
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
197
|
+
style: {
|
|
198
|
+
fontSize: 22,
|
|
199
|
+
background: 'none',
|
|
200
|
+
lineHeight: 1
|
|
201
|
+
},
|
|
202
|
+
type: "button",
|
|
203
|
+
"aria-label": "Zoom in",
|
|
204
|
+
title: "Zoom in",
|
|
205
|
+
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
206
|
+
onClick: (e)=>{
|
|
207
|
+
setRotate(rotate + 90);
|
|
208
|
+
},
|
|
209
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.RotateRightOutlined, {})
|
|
210
|
+
}, 'rotate')
|
|
211
|
+
],
|
|
212
|
+
otherProps: {
|
|
213
|
+
style: {
|
|
214
|
+
transform: "rotate(".concat(rotate, "deg)"),
|
|
215
|
+
transition: 'transform 0.3s'
|
|
216
|
+
}
|
|
217
|
+
}
|
|
189
218
|
})
|
|
190
219
|
]
|
|
191
220
|
}));
|
|
@@ -377,11 +377,15 @@ const FilterCustomItemInitializer = /*#__PURE__*/ (0, external_react_namespaceOb
|
|
|
377
377
|
},
|
|
378
378
|
collectionName: collection
|
|
379
379
|
};
|
|
380
|
-
if ('DatePicker' === component) {
|
|
380
|
+
if ('DatePicker' === component || 'DatePicker.RangePicker' === component) {
|
|
381
381
|
schema['x-settings'] = 'fieldSettings:FilterFormItem';
|
|
382
382
|
schema['x-designer-props'] = {
|
|
383
383
|
interface: 'datetime'
|
|
384
384
|
};
|
|
385
|
+
schema['x-component-props'] = {
|
|
386
|
+
...schema['x-component-props'],
|
|
387
|
+
gmt: false
|
|
388
|
+
};
|
|
385
389
|
}
|
|
386
390
|
insert((0, external_utils_js_namespaceObject.gridRowColWrap)(schema));
|
|
387
391
|
}, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.21",
|
|
4
4
|
"homepage": "https://github.com/tegojs/tego-standard#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/tegojs/tego-standard/issues"
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@floating-ui/react": "0.26.28",
|
|
31
31
|
"@js-preview/excel": "^1.7.14",
|
|
32
32
|
"@lottiefiles/dotlottie-react": "^0.9.3",
|
|
33
|
-
"@tachybase/schema": "1.6.
|
|
34
|
-
"@tego/client": "1.6.
|
|
33
|
+
"@tachybase/schema": "1.6.11",
|
|
34
|
+
"@tego/client": "1.6.11",
|
|
35
35
|
"ahooks": "^3.9.0",
|
|
36
36
|
"antd": "5.22.5",
|
|
37
37
|
"antd-style": "3.7.1",
|