@tachybase/client 1.6.18 → 1.6.20

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.
@@ -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
  };
@@ -1,6 +1,7 @@
1
1
  import { Schema } from '@tachybase/schema';
2
2
  import { FilterTarget } from '../block-provider/hooks';
3
3
  import { Collection_deprecated, CollectionFieldOptions_deprecated, FieldOptions, useCollection_deprecated } from '../collection-manager';
4
+ import { type DatePickerRangeValueMode, type DatePickerRangeValueSource } from '../schema-component/antd/date-picker/util';
4
5
  import { DataBlock } from './FilterProvider';
5
6
  export declare enum FilterBlockType {
6
7
  FORM = 0,
@@ -23,6 +24,9 @@ export declare const getSupportFieldsByForeignKey: (filterBlockCollection: Retur
23
24
  export declare const useSupportedBlocks: (filterBlockType: FilterBlockType) => DataBlock[];
24
25
  type NormalizeDateBetweenOptions = {
25
26
  useDefaultDateBoundary?: boolean;
27
+ valueMode?: DatePickerRangeValueMode;
28
+ valueSource?: DatePickerRangeValueSource;
29
+ preferDateBoundaryFallback?: boolean;
26
30
  };
27
31
  export declare const normalizeDateBetweenValue: (value: any[], options?: NormalizeDateBetweenOptions) => any[];
28
32
  export declare const shouldUseDefaultDateBoundary: (fieldSchema?: any) => boolean;
@@ -6,6 +6,7 @@ import lodash from "lodash";
6
6
  import { findFilterTargets } from "../block-provider/hooks/index.mjs";
7
7
  import { useCollectionManager_deprecated, useCollection_deprecated } from "../collection-manager/index.mjs";
8
8
  import { removeNullCondition } from "../schema-component/index.mjs";
9
+ import { isDatePickerDefaultRangeBoundaryValue, resolveDatePickerRangeValueInfo } from "../schema-component/antd/date-picker/util.mjs";
9
10
  import { findFilterOperators, getDefaultFilterOperatorValue } from "../schema-component/antd/form-item/SchemaSettingOptions.mjs";
10
11
  import { useFilterBlock } from "./FilterProvider.mjs";
11
12
  import { getFilterSourceDefaultFilter } from "./incomingFilterFromSources.mjs";
@@ -88,32 +89,45 @@ const resolveFilterOperator = function(schema, path) {
88
89
  if (!operatorList.length || !fieldSchema) return;
89
90
  return getDefaultFilterOperatorValue(fieldSchema, operatorList);
90
91
  };
92
+ const getDatePickerComponent = (fieldSchema)=>{
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
+ }
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);
99
+ };
100
+ const getDatePickerShowTime = (fieldSchema)=>{
101
+ var _fieldSchema_xcomponentprops;
102
+ return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
103
+ };
91
104
  const isDateOnlyString = (value)=>'string' == typeof value && /^\d{4}-\d{2}-\d{2}$/.test(value);
92
105
  const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
93
- const isDefaultDateBoundaryValue = (value, boundary)=>{
94
- if (isDateOnlyString(value)) return true;
95
- if ('string' != typeof value) return false;
96
- const match = value.match(/^\d{4}-\d{2}-\d{2}[T\s](\d{2}:\d{2}:\d{2})(?:\.\d{3})?(?:Z|[+-]\d\d:\d\d)?$/);
97
- if (!match) return false;
98
- return 'start' === boundary ? '00:00:00' === match[1] : '23:59:59' === match[1];
99
- };
100
- const normalizeDefaultDateBoundaryInput = (value)=>{
106
+ const normalizeLocalDateBoundaryInput = (value)=>{
101
107
  if ('string' != typeof value) return value;
102
108
  return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
103
109
  };
104
110
  const normalizeDateBetweenBoundary = function(value, boundary) {
105
111
  let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
106
- const rawValue = options.useDefaultDateBoundary ? normalizeDefaultDateBoundaryInput(value) : value;
107
- const m = dayjs(rawValue);
112
+ const m = dayjs(value);
108
113
  if (!m.isValid()) return value;
109
- if (!options.useDefaultDateBoundary && hasExplicitTime(rawValue) && !isDateOnlyString(rawValue)) return m.toISOString();
114
+ if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
115
+ if ('date' === options.valueMode) {
116
+ if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
117
+ const localBoundary = dayjs(normalizeLocalDateBoundaryInput(value));
118
+ return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
119
+ }
120
+ if (hasExplicitTime(value)) return m.toISOString();
121
+ if (!options.useDefaultDateBoundary) return m.toISOString();
110
122
  return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
111
123
  };
112
- const shouldApplyDefaultDateBoundary = function(start, end) {
113
- let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
124
+ const shouldApplyDefaultDateBoundary = function(start, end, value) {
125
+ let options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
126
+ if ('datetime' === options.valueMode) return false;
127
+ if ('date' === options.valueMode) return true;
114
128
  if (!options.useDefaultDateBoundary) return false;
115
129
  if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
116
- return isDefaultDateBoundaryValue(start, 'start') && isDefaultDateBoundaryValue(end, 'end');
130
+ return options.preferDateBoundaryFallback && 'date' === options.valueMode && isDatePickerDefaultRangeBoundaryValue(start, 'start') && isDatePickerDefaultRangeBoundaryValue(end, 'end');
117
131
  };
118
132
  const normalizeDateBetweenValue = function(value) {
119
133
  let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
@@ -123,19 +137,14 @@ const normalizeDateBetweenValue = function(value) {
123
137
  const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
124
138
  const boundaryOptions = {
125
139
  ...options,
126
- useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, options)
140
+ useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
127
141
  };
128
142
  return [
129
143
  normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
130
144
  normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
131
145
  ];
132
146
  };
133
- const shouldUseDefaultDateBoundary = (fieldSchema)=>{
134
- var _fieldSchema_xcomponentprops;
135
- if (!fieldSchema) return false;
136
- const component = fieldSchema['x-component'] || (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
137
- return 'DatePicker.RangePicker' === component;
138
- };
147
+ const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
139
148
  const transformToFilter = (values, fieldSchema, getCollectionJoinField, collectionName, getOperatorList)=>{
140
149
  const { operators } = findFilterOperators(fieldSchema);
141
150
  values = flatten(values, {
@@ -177,8 +186,18 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
177
186
  };
178
187
  } else if ('$dateBetween' === operator) {
179
188
  if (Array.isArray(value)) {
189
+ const datePickerComponent = getDatePickerComponent(currentFieldSchema);
190
+ const useDefaultDateBoundary = shouldUseDefaultDateBoundary(currentFieldSchema);
191
+ const valueInfo = resolveDatePickerRangeValueInfo(value, {
192
+ component: datePickerComponent,
193
+ showTime: getDatePickerShowTime(currentFieldSchema),
194
+ preferDateBoundaryFallback: useDefaultDateBoundary
195
+ });
180
196
  value = normalizeDateBetweenValue(value, {
181
- useDefaultDateBoundary: shouldUseDefaultDateBoundary(currentFieldSchema)
197
+ useDefaultDateBoundary,
198
+ valueMode: valueInfo.mode,
199
+ valueSource: valueInfo.source,
200
+ preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
182
201
  });
183
202
  if (!value) return null;
184
203
  }
@@ -4,8 +4,32 @@ export interface Moment2strOptions {
4
4
  gmt?: boolean;
5
5
  utc?: boolean;
6
6
  picker?: 'year' | 'month' | 'week' | 'quarter';
7
+ value?: any;
8
+ component?: string;
7
9
  }
8
- export declare const normalizeDatePickerParseOptions: (options?: Moment2strOptions) => Moment2strOptions;
10
+ export declare const DATE_PICKER_RANGE_VALUE_MODE: unique symbol;
11
+ export type DatePickerRangeValueMode = 'date' | 'datetime';
12
+ export type DatePickerRangeValueSource = 'metadata' | 'schema' | 'retained-date-boundary' | 'retained-local-date-boundary' | 'unknown';
13
+ export interface DatePickerRangeValueInfo {
14
+ mode?: DatePickerRangeValueMode;
15
+ source: DatePickerRangeValueSource;
16
+ }
17
+ export declare const getRangeValueMode: (value: any) => DatePickerRangeValueMode | undefined;
18
+ export declare const markRangeValueMode: (value: any[], mode: DatePickerRangeValueMode) => any[];
19
+ export declare const isDatePickerDefaultRangeBoundaryValue: (value: any, boundary: "start" | "end") => boolean;
20
+ export declare const isDatePickerDefaultRangeBoundaryPair: (value: any) => boolean;
21
+ export declare const resolveDatePickerRangeValueInfo: (value: any, options?: {
22
+ showTime?: boolean;
23
+ component?: string;
24
+ preferDateBoundaryFallback?: boolean;
25
+ }) => DatePickerRangeValueInfo;
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
+ };
9
33
  export declare const moment2str: (value?: Dayjs | null, options?: Moment2strOptions) => any;
10
34
  export declare const mapDatePicker: () => (props: any) => any;
11
35
  export declare const mapRangePicker: () => (props: any) => any;
@@ -20,14 +20,72 @@ const toLocalByPicker = (value, picker)=>{
20
20
  if (!value || !dayjs.isDayjs(value)) return value;
21
21
  return toStringByPicker(value, picker, 'local');
22
22
  };
23
- const normalizeDatePickerParseOptions = function() {
24
- let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
25
- if (false === options.utc || options.showTime || 'boolean' == typeof options.gmt || options.picker) return options;
23
+ const DATE_PICKER_RANGE_VALUE_MODE = Symbol.for('tachybase.datePicker.rangeValueMode');
24
+ const getRangeValueMode = (value)=>Array.isArray(value) ? value[DATE_PICKER_RANGE_VALUE_MODE] : void 0;
25
+ const markRangeValueMode = (value, mode)=>{
26
+ Object.defineProperty(value, DATE_PICKER_RANGE_VALUE_MODE, {
27
+ configurable: true,
28
+ enumerable: false,
29
+ value: mode
30
+ });
31
+ return value;
32
+ };
33
+ const isDatePickerDefaultRangeBoundaryValue = (value, boundary)=>{
34
+ if ('string' != typeof value) return false;
35
+ const match = value.match(/^\d{4}-\d{2}-\d{2}[T\s](\d{2}:\d{2}:\d{2})(?:\.\d{3})?(?:Z|[+-]\d\d:\d\d)?$/);
36
+ if (!match) return false;
37
+ return 'start' === boundary ? '00:00:00' === match[1] : '23:59:59' === match[1];
38
+ };
39
+ const isDatePickerDefaultRangeBoundaryPair = (value)=>Array.isArray(value) && value.length >= 2 && isDatePickerDefaultRangeBoundaryValue(value[0], 'start') && isDatePickerDefaultRangeBoundaryValue(value[value.length - 1], 'end');
40
+ const isDatePickerLocalRangeBoundaryValue = (value, boundary)=>{
41
+ const m = dayjs(value);
42
+ if (!m.isValid()) return false;
43
+ return 'start' === boundary ? '00:00:00' === m.format('HH:mm:ss') : '23:59:59' === m.format('HH:mm:ss');
44
+ };
45
+ const isDatePickerRetainedLocalBoundaryPair = (value)=>Array.isArray(value) && value.length >= 2 && isDatePickerLocalRangeBoundaryValue(value[0], 'start') && isDatePickerLocalRangeBoundaryValue(value[value.length - 1], 'end');
46
+ const resolveDatePickerRangeValueInfo = function(value) {
47
+ let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
48
+ const metadataMode = getRangeValueMode(value);
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'
62
+ };
63
+ if ('DatePicker.RangePicker' === options.component && !options.showTime) return {
64
+ mode: 'date',
65
+ source: 'schema'
66
+ };
67
+ if (options.preferDateBoundaryFallback && isDatePickerDefaultRangeBoundaryPair(value)) return {
68
+ mode: 'date',
69
+ source: 'retained-date-boundary'
70
+ };
26
71
  return {
27
- ...options,
28
- gmt: true
72
+ source: 'unknown'
29
73
  };
30
74
  };
75
+ const normalizeDatePickerParseOptions = function() {
76
+ let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
77
+ if (false === options.utc || true === options.gmt || options.picker) return options;
78
+ const rangeValueInfo = resolveDatePickerRangeValueInfo(options.value, {
79
+ component: options.component,
80
+ showTime: options.showTime,
81
+ preferDateBoundaryFallback: 'DatePicker.RangePicker' === options.component
82
+ });
83
+ if (options.showTime) {
84
+ if ('date' !== rangeValueInfo.mode || 'retained-local-date-boundary' === rangeValueInfo.source) return options;
85
+ }
86
+ const { gmt, ...rest } = options;
87
+ return rest;
88
+ };
31
89
  const moment2str = function(value) {
32
90
  let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
33
91
  const { showTime, gmt, picker, utc = true } = options;
@@ -64,12 +122,15 @@ const mapRangePicker = function() {
64
122
  return {
65
123
  ...props,
66
124
  format: format,
67
- value: str2moment(props.value, normalizeDatePickerParseOptions(props)),
125
+ value: str2moment(props.value, normalizeDatePickerParseOptions({
126
+ ...props,
127
+ component: 'DatePicker.RangePicker'
128
+ })),
68
129
  onChange: (value)=>{
69
- if (onChange) onChange(value ? [
130
+ if (onChange) onChange(value ? markRangeValueMode([
70
131
  moment2str(getRangeStart(value[0], props), props),
71
132
  moment2str(getRangeEnd(value[1], props), props)
72
- ] : []);
133
+ ], props.showTime ? 'datetime' : 'date') : []);
73
134
  }
74
135
  };
75
136
  };
@@ -198,4 +259,4 @@ const getDateExact = ()=>({
198
259
  tomorrowLocal: ()=>dayjs().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
199
260
  tomorrowDate: ()=>dayjs().add(1, 'day').format('YYYY-MM-DD')
200
261
  });
201
- export { getDateExact, getDateRanges, mapDatePicker, mapRangePicker, moment2str, normalizeDatePickerParseOptions };
262
+ export { DATE_PICKER_RANGE_VALUE_MODE, getDateExact, getDateRanges, getRangeValueMode, isDatePickerDefaultRangeBoundaryPair, isDatePickerDefaultRangeBoundaryValue, mapDatePicker, mapRangePicker, markRangeValueMode, moment2str, normalizeDatePickerParseOptions, resolveDatePickerRangeValueInfo };
@@ -6,6 +6,7 @@ import { useBlockRequestContext } from "../../../block-provider/index.mjs";
6
6
  import { useCollectionManager_deprecated, useCollection_deprecated } from "../../../collection-manager/index.mjs";
7
7
  import { FILTER_OPERATORS_WITH_ARRAY_VALUES, mergeFilter, normalizeDateBetweenValue, shouldUseDefaultDateBoundary } from "../../../filter-provider/utils.mjs";
8
8
  import { useDataLoadingMode } from "../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.mjs";
9
+ import { resolveDatePickerRangeValueInfo } from "../date-picker/util.mjs";
9
10
  import { hasDuplicateKeys } from "./utils.mjs";
10
11
  const useGetFilterOptions = ()=>{
11
12
  const { getCollectionFields } = useCollectionManager_deprecated();
@@ -107,7 +108,9 @@ const useFilterFieldOptions = (fields)=>{
107
108
  };
108
109
  const isEmpty = (obj)=>Array.isArray(obj) && 0 === obj.length || obj && 0 === Object.keys(obj).length && Object.getPrototypeOf(obj) === Object.prototype;
109
110
  const CUSTOM_FILTER_VARIABLE_REGEXP = /^\{\{\$nFilter\.([^}]+)\}\}$/;
110
- const getCustomFilterValue = (items, key)=>{
111
+ const getCustomFilterValue = function(items, key) {
112
+ let rawItems = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
113
+ if (rawItems && key in rawItems) return rawItems[key];
111
114
  if (key in items) return items[key];
112
115
  const arrayItems = Object.keys(items).filter((itemKey)=>itemKey.startsWith("".concat(key, ".")) && /^\d+$/.test(itemKey.slice(key.length + 1))).sort((a, b)=>Number(a.slice(key.length + 1)) - Number(b.slice(key.length + 1))).map((itemKey)=>items[itemKey]);
113
116
  return arrayItems.length ? arrayItems : void 0;
@@ -132,18 +135,41 @@ const findCustomFieldSchema = (schema, key)=>{
132
135
  }
133
136
  return null;
134
137
  };
138
+ const getDatePickerComponent = (fieldSchema)=>{
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
+ }
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);
145
+ };
146
+ const getDatePickerShowTime = (fieldSchema)=>{
147
+ var _fieldSchema_xcomponentprops;
148
+ return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
149
+ };
135
150
  const expandArrayValueFilter = function(filterSchemaItem, filterKey, value, customFlat) {
136
151
  let options = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
137
152
  const pathParts = filterKey.split('.');
138
153
  const operator = pathParts.pop();
139
154
  if ('$dateBetween' === operator && Array.isArray(value)) {
140
- filterSchemaItem[filterKey] = normalizeDateBetweenValue(value, options);
155
+ const valueInfo = resolveDatePickerRangeValueInfo(value, {
156
+ component: options.component,
157
+ showTime: options.showTime,
158
+ preferDateBoundaryFallback: options.useDefaultDateBoundary
159
+ });
160
+ filterSchemaItem[filterKey] = normalizeDateBetweenValue(value, {
161
+ useDefaultDateBoundary: options.useDefaultDateBoundary,
162
+ valueMode: valueInfo.mode,
163
+ valueSource: valueInfo.source,
164
+ preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
165
+ });
141
166
  return;
142
167
  }
143
168
  if (!Array.isArray(value) || FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator || '')) {
144
169
  filterSchemaItem[filterKey] = value;
145
170
  return;
146
171
  }
172
+ if (0 === value.length) return void delete filterSchemaItem[filterKey];
147
173
  let branchEndIndex = -1;
148
174
  for(let index = pathParts.length - 2; index >= 0; index--)if ([
149
175
  '$and',
@@ -176,8 +202,10 @@ const getCustomCondition = function(filter, fieldSchema) {
176
202
  const match = 'string' == typeof filterSchemaItem[filterKey] && filterSchemaItem[filterKey].match(CUSTOM_FILTER_VARIABLE_REGEXP);
177
203
  if (!match) continue;
178
204
  const customFieldSchema = findCustomFieldSchema(fieldSchema, match[1]);
179
- expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1]), customFlat, {
180
- useDefaultDateBoundary: shouldUseDefaultDateBoundary(customFieldSchema)
205
+ expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1], filter || {}), customFlat, {
206
+ useDefaultDateBoundary: shouldUseDefaultDateBoundary(customFieldSchema),
207
+ component: getDatePickerComponent(customFieldSchema),
208
+ showTime: getDatePickerShowTime(customFieldSchema)
181
209
  });
182
210
  }
183
211
  for(const item in filterSchemaItem)if (!filterSchemaItem[item] || filterSchemaItem[item].includes('$nFilter')) delete filterSchemaItem[item];
@@ -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: ()=>setFileIndex((fileIndex + images.length - 1) % images.length),
70
- onMoveNextRequest: ()=>setFileIndex((fileIndex + 1) % images.length),
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: ()=>setFileIndex((fileIndex + images.length - 1) % images.length),
128
- onMoveNextRequest: ()=>setFileIndex((fileIndex + 1) % images.length),
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
- }, 'preview-img')
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
  };
@@ -58,6 +58,7 @@ var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodas
58
58
  const index_js_namespaceObject = require("../block-provider/hooks/index.js");
59
59
  const external_collection_manager_index_js_namespaceObject = require("../collection-manager/index.js");
60
60
  const external_schema_component_index_js_namespaceObject = require("../schema-component/index.js");
61
+ const util_js_namespaceObject = require("../schema-component/antd/date-picker/util.js");
61
62
  const SchemaSettingOptions_js_namespaceObject = require("../schema-component/antd/form-item/SchemaSettingOptions.js");
62
63
  const external_FilterProvider_js_namespaceObject = require("./FilterProvider.js");
63
64
  const external_incomingFilterFromSources_js_namespaceObject = require("./incomingFilterFromSources.js");
@@ -140,32 +141,45 @@ const resolveFilterOperator = function(schema, path) {
140
141
  if (!operatorList.length || !fieldSchema) return;
141
142
  return (0, SchemaSettingOptions_js_namespaceObject.getDefaultFilterOperatorValue)(fieldSchema, operatorList);
142
143
  };
144
+ const getDatePickerComponent = (fieldSchema)=>{
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
+ }
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);
151
+ };
152
+ const getDatePickerShowTime = (fieldSchema)=>{
153
+ var _fieldSchema_xcomponentprops;
154
+ return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
155
+ };
143
156
  const isDateOnlyString = (value)=>'string' == typeof value && /^\d{4}-\d{2}-\d{2}$/.test(value);
144
157
  const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
145
- const isDefaultDateBoundaryValue = (value, boundary)=>{
146
- if (isDateOnlyString(value)) return true;
147
- if ('string' != typeof value) return false;
148
- const match = value.match(/^\d{4}-\d{2}-\d{2}[T\s](\d{2}:\d{2}:\d{2})(?:\.\d{3})?(?:Z|[+-]\d\d:\d\d)?$/);
149
- if (!match) return false;
150
- return 'start' === boundary ? '00:00:00' === match[1] : '23:59:59' === match[1];
151
- };
152
- const normalizeDefaultDateBoundaryInput = (value)=>{
158
+ const normalizeLocalDateBoundaryInput = (value)=>{
153
159
  if ('string' != typeof value) return value;
154
160
  return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
155
161
  };
156
162
  const normalizeDateBetweenBoundary = function(value, boundary) {
157
163
  let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
158
- const rawValue = options.useDefaultDateBoundary ? normalizeDefaultDateBoundaryInput(value) : value;
159
- const m = external_dayjs_default()(rawValue);
164
+ const m = external_dayjs_default()(value);
160
165
  if (!m.isValid()) return value;
161
- if (!options.useDefaultDateBoundary && hasExplicitTime(rawValue) && !isDateOnlyString(rawValue)) return m.toISOString();
166
+ if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
167
+ if ('date' === options.valueMode) {
168
+ if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
169
+ const localBoundary = external_dayjs_default()(normalizeLocalDateBoundaryInput(value));
170
+ return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
171
+ }
172
+ if (hasExplicitTime(value)) return m.toISOString();
173
+ if (!options.useDefaultDateBoundary) return m.toISOString();
162
174
  return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
163
175
  };
164
- const shouldApplyDefaultDateBoundary = function(start, end) {
165
- let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
176
+ const shouldApplyDefaultDateBoundary = function(start, end, value) {
177
+ let options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
178
+ if ('datetime' === options.valueMode) return false;
179
+ if ('date' === options.valueMode) return true;
166
180
  if (!options.useDefaultDateBoundary) return false;
167
181
  if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
168
- return isDefaultDateBoundaryValue(start, 'start') && isDefaultDateBoundaryValue(end, 'end');
182
+ return options.preferDateBoundaryFallback && 'date' === options.valueMode && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(start, 'start') && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(end, 'end');
169
183
  };
170
184
  const normalizeDateBetweenValue = function(value) {
171
185
  let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
@@ -175,19 +189,14 @@ const normalizeDateBetweenValue = function(value) {
175
189
  const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
176
190
  const boundaryOptions = {
177
191
  ...options,
178
- useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, options)
192
+ useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
179
193
  };
180
194
  return [
181
195
  normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
182
196
  normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
183
197
  ];
184
198
  };
185
- const shouldUseDefaultDateBoundary = (fieldSchema)=>{
186
- var _fieldSchema_xcomponentprops;
187
- if (!fieldSchema) return false;
188
- const component = fieldSchema['x-component'] || (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
189
- return 'DatePicker.RangePicker' === component;
190
- };
199
+ const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
191
200
  const transformToFilter = (values, fieldSchema, getCollectionJoinField, collectionName, getOperatorList)=>{
192
201
  const { operators } = (0, SchemaSettingOptions_js_namespaceObject.findFilterOperators)(fieldSchema);
193
202
  values = (0, client_namespaceObject.flatten)(values, {
@@ -229,8 +238,18 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
229
238
  };
230
239
  } else if ('$dateBetween' === operator) {
231
240
  if (Array.isArray(value)) {
241
+ const datePickerComponent = getDatePickerComponent(currentFieldSchema);
242
+ const useDefaultDateBoundary = shouldUseDefaultDateBoundary(currentFieldSchema);
243
+ const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
244
+ component: datePickerComponent,
245
+ showTime: getDatePickerShowTime(currentFieldSchema),
246
+ preferDateBoundaryFallback: useDefaultDateBoundary
247
+ });
232
248
  value = normalizeDateBetweenValue(value, {
233
- useDefaultDateBoundary: shouldUseDefaultDateBoundary(currentFieldSchema)
249
+ useDefaultDateBoundary,
250
+ valueMode: valueInfo.mode,
251
+ valueSource: valueInfo.source,
252
+ preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
234
253
  });
235
254
  if (!value) return null;
236
255
  }
@@ -33,11 +33,17 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
+ getRangeValueMode: ()=>getRangeValueMode,
36
37
  mapRangePicker: ()=>mapRangePicker,
37
- moment2str: ()=>moment2str,
38
+ isDatePickerDefaultRangeBoundaryValue: ()=>isDatePickerDefaultRangeBoundaryValue,
38
39
  mapDatePicker: ()=>mapDatePicker,
39
40
  normalizeDatePickerParseOptions: ()=>normalizeDatePickerParseOptions,
41
+ resolveDatePickerRangeValueInfo: ()=>resolveDatePickerRangeValueInfo,
42
+ markRangeValueMode: ()=>markRangeValueMode,
43
+ moment2str: ()=>moment2str,
44
+ DATE_PICKER_RANGE_VALUE_MODE: ()=>DATE_PICKER_RANGE_VALUE_MODE,
40
45
  getDateExact: ()=>getDateExact,
46
+ isDatePickerDefaultRangeBoundaryPair: ()=>isDatePickerDefaultRangeBoundaryPair,
41
47
  getDateRanges: ()=>getDateRanges
42
48
  });
43
49
  const client_namespaceObject = require("@tego/client");
@@ -63,14 +69,72 @@ const toLocalByPicker = (value, picker)=>{
63
69
  if (!value || !external_dayjs_default().isDayjs(value)) return value;
64
70
  return toStringByPicker(value, picker, 'local');
65
71
  };
66
- const normalizeDatePickerParseOptions = function() {
67
- let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
68
- if (false === options.utc || options.showTime || 'boolean' == typeof options.gmt || options.picker) return options;
72
+ const DATE_PICKER_RANGE_VALUE_MODE = Symbol.for('tachybase.datePicker.rangeValueMode');
73
+ const getRangeValueMode = (value)=>Array.isArray(value) ? value[DATE_PICKER_RANGE_VALUE_MODE] : void 0;
74
+ const markRangeValueMode = (value, mode)=>{
75
+ Object.defineProperty(value, DATE_PICKER_RANGE_VALUE_MODE, {
76
+ configurable: true,
77
+ enumerable: false,
78
+ value: mode
79
+ });
80
+ return value;
81
+ };
82
+ const isDatePickerDefaultRangeBoundaryValue = (value, boundary)=>{
83
+ if ('string' != typeof value) return false;
84
+ const match = value.match(/^\d{4}-\d{2}-\d{2}[T\s](\d{2}:\d{2}:\d{2})(?:\.\d{3})?(?:Z|[+-]\d\d:\d\d)?$/);
85
+ if (!match) return false;
86
+ return 'start' === boundary ? '00:00:00' === match[1] : '23:59:59' === match[1];
87
+ };
88
+ const isDatePickerDefaultRangeBoundaryPair = (value)=>Array.isArray(value) && value.length >= 2 && isDatePickerDefaultRangeBoundaryValue(value[0], 'start') && isDatePickerDefaultRangeBoundaryValue(value[value.length - 1], 'end');
89
+ const isDatePickerLocalRangeBoundaryValue = (value, boundary)=>{
90
+ const m = external_dayjs_default()(value);
91
+ if (!m.isValid()) return false;
92
+ return 'start' === boundary ? '00:00:00' === m.format('HH:mm:ss') : '23:59:59' === m.format('HH:mm:ss');
93
+ };
94
+ const isDatePickerRetainedLocalBoundaryPair = (value)=>Array.isArray(value) && value.length >= 2 && isDatePickerLocalRangeBoundaryValue(value[0], 'start') && isDatePickerLocalRangeBoundaryValue(value[value.length - 1], 'end');
95
+ const resolveDatePickerRangeValueInfo = function(value) {
96
+ let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
97
+ const metadataMode = getRangeValueMode(value);
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'
111
+ };
112
+ if ('DatePicker.RangePicker' === options.component && !options.showTime) return {
113
+ mode: 'date',
114
+ source: 'schema'
115
+ };
116
+ if (options.preferDateBoundaryFallback && isDatePickerDefaultRangeBoundaryPair(value)) return {
117
+ mode: 'date',
118
+ source: 'retained-date-boundary'
119
+ };
69
120
  return {
70
- ...options,
71
- gmt: true
121
+ source: 'unknown'
72
122
  };
73
123
  };
124
+ const normalizeDatePickerParseOptions = function() {
125
+ let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
126
+ if (false === options.utc || true === options.gmt || options.picker) return options;
127
+ const rangeValueInfo = resolveDatePickerRangeValueInfo(options.value, {
128
+ component: options.component,
129
+ showTime: options.showTime,
130
+ preferDateBoundaryFallback: 'DatePicker.RangePicker' === options.component
131
+ });
132
+ if (options.showTime) {
133
+ if ('date' !== rangeValueInfo.mode || 'retained-local-date-boundary' === rangeValueInfo.source) return options;
134
+ }
135
+ const { gmt, ...rest } = options;
136
+ return rest;
137
+ };
74
138
  const moment2str = function(value) {
75
139
  let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
76
140
  const { showTime, gmt, picker, utc = true } = options;
@@ -107,12 +171,15 @@ const mapRangePicker = function() {
107
171
  return {
108
172
  ...props,
109
173
  format: format,
110
- value: (0, client_namespaceObject.str2moment)(props.value, normalizeDatePickerParseOptions(props)),
174
+ value: (0, client_namespaceObject.str2moment)(props.value, normalizeDatePickerParseOptions({
175
+ ...props,
176
+ component: 'DatePicker.RangePicker'
177
+ })),
111
178
  onChange: (value)=>{
112
- if (onChange) onChange(value ? [
179
+ if (onChange) onChange(value ? markRangeValueMode([
113
180
  moment2str(getRangeStart(value[0], props), props),
114
181
  moment2str(getRangeEnd(value[1], props), props)
115
- ] : []);
182
+ ], props.showTime ? 'datetime' : 'date') : []);
116
183
  }
117
184
  };
118
185
  };
@@ -241,19 +308,31 @@ const getDateExact = ()=>({
241
308
  tomorrowLocal: ()=>external_dayjs_default()().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
242
309
  tomorrowDate: ()=>external_dayjs_default()().add(1, 'day').format('YYYY-MM-DD')
243
310
  });
311
+ exports.DATE_PICKER_RANGE_VALUE_MODE = __webpack_exports__.DATE_PICKER_RANGE_VALUE_MODE;
244
312
  exports.getDateExact = __webpack_exports__.getDateExact;
245
313
  exports.getDateRanges = __webpack_exports__.getDateRanges;
314
+ exports.getRangeValueMode = __webpack_exports__.getRangeValueMode;
315
+ exports.isDatePickerDefaultRangeBoundaryPair = __webpack_exports__.isDatePickerDefaultRangeBoundaryPair;
316
+ exports.isDatePickerDefaultRangeBoundaryValue = __webpack_exports__.isDatePickerDefaultRangeBoundaryValue;
246
317
  exports.mapDatePicker = __webpack_exports__.mapDatePicker;
247
318
  exports.mapRangePicker = __webpack_exports__.mapRangePicker;
319
+ exports.markRangeValueMode = __webpack_exports__.markRangeValueMode;
248
320
  exports.moment2str = __webpack_exports__.moment2str;
249
321
  exports.normalizeDatePickerParseOptions = __webpack_exports__.normalizeDatePickerParseOptions;
322
+ exports.resolveDatePickerRangeValueInfo = __webpack_exports__.resolveDatePickerRangeValueInfo;
250
323
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
324
+ "DATE_PICKER_RANGE_VALUE_MODE",
251
325
  "getDateExact",
252
326
  "getDateRanges",
327
+ "getRangeValueMode",
328
+ "isDatePickerDefaultRangeBoundaryPair",
329
+ "isDatePickerDefaultRangeBoundaryValue",
253
330
  "mapDatePicker",
254
331
  "mapRangePicker",
332
+ "markRangeValueMode",
255
333
  "moment2str",
256
- "normalizeDatePickerParseOptions"
334
+ "normalizeDatePickerParseOptions",
335
+ "resolveDatePickerRangeValueInfo"
257
336
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
258
337
  Object.defineProperty(exports, '__esModule', {
259
338
  value: true
@@ -52,6 +52,7 @@ const index_js_namespaceObject = require("../../../block-provider/index.js");
52
52
  const external_collection_manager_index_js_namespaceObject = require("../../../collection-manager/index.js");
53
53
  const utils_js_namespaceObject = require("../../../filter-provider/utils.js");
54
54
  const setDataLoadingModeSettingsItem_js_namespaceObject = require("../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.js");
55
+ const util_js_namespaceObject = require("../date-picker/util.js");
55
56
  const external_utils_js_namespaceObject = require("./utils.js");
56
57
  const useGetFilterOptions = ()=>{
57
58
  const { getCollectionFields } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
@@ -153,7 +154,9 @@ const useFilterFieldOptions = (fields)=>{
153
154
  };
154
155
  const isEmpty = (obj)=>Array.isArray(obj) && 0 === obj.length || obj && 0 === Object.keys(obj).length && Object.getPrototypeOf(obj) === Object.prototype;
155
156
  const CUSTOM_FILTER_VARIABLE_REGEXP = /^\{\{\$nFilter\.([^}]+)\}\}$/;
156
- const getCustomFilterValue = (items, key)=>{
157
+ const getCustomFilterValue = function(items, key) {
158
+ let rawItems = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
159
+ if (rawItems && key in rawItems) return rawItems[key];
157
160
  if (key in items) return items[key];
158
161
  const arrayItems = Object.keys(items).filter((itemKey)=>itemKey.startsWith("".concat(key, ".")) && /^\d+$/.test(itemKey.slice(key.length + 1))).sort((a, b)=>Number(a.slice(key.length + 1)) - Number(b.slice(key.length + 1))).map((itemKey)=>items[itemKey]);
159
162
  return arrayItems.length ? arrayItems : void 0;
@@ -178,18 +181,41 @@ const findCustomFieldSchema = (schema, key)=>{
178
181
  }
179
182
  return null;
180
183
  };
184
+ const getDatePickerComponent = (fieldSchema)=>{
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
+ }
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);
191
+ };
192
+ const getDatePickerShowTime = (fieldSchema)=>{
193
+ var _fieldSchema_xcomponentprops;
194
+ return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
195
+ };
181
196
  const expandArrayValueFilter = function(filterSchemaItem, filterKey, value, customFlat) {
182
197
  let options = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
183
198
  const pathParts = filterKey.split('.');
184
199
  const operator = pathParts.pop();
185
200
  if ('$dateBetween' === operator && Array.isArray(value)) {
186
- filterSchemaItem[filterKey] = (0, utils_js_namespaceObject.normalizeDateBetweenValue)(value, options);
201
+ const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
202
+ component: options.component,
203
+ showTime: options.showTime,
204
+ preferDateBoundaryFallback: options.useDefaultDateBoundary
205
+ });
206
+ filterSchemaItem[filterKey] = (0, utils_js_namespaceObject.normalizeDateBetweenValue)(value, {
207
+ useDefaultDateBoundary: options.useDefaultDateBoundary,
208
+ valueMode: valueInfo.mode,
209
+ valueSource: valueInfo.source,
210
+ preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
211
+ });
187
212
  return;
188
213
  }
189
214
  if (!Array.isArray(value) || utils_js_namespaceObject.FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator || '')) {
190
215
  filterSchemaItem[filterKey] = value;
191
216
  return;
192
217
  }
218
+ if (0 === value.length) return void delete filterSchemaItem[filterKey];
193
219
  let branchEndIndex = -1;
194
220
  for(let index = pathParts.length - 2; index >= 0; index--)if ([
195
221
  '$and',
@@ -222,8 +248,10 @@ const getCustomCondition = function(filter, fieldSchema) {
222
248
  const match = 'string' == typeof filterSchemaItem[filterKey] && filterSchemaItem[filterKey].match(CUSTOM_FILTER_VARIABLE_REGEXP);
223
249
  if (!match) continue;
224
250
  const customFieldSchema = findCustomFieldSchema(fieldSchema, match[1]);
225
- expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1]), customFlat, {
226
- useDefaultDateBoundary: (0, utils_js_namespaceObject.shouldUseDefaultDateBoundary)(customFieldSchema)
251
+ expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1], filter || {}), customFlat, {
252
+ useDefaultDateBoundary: (0, utils_js_namespaceObject.shouldUseDefaultDateBoundary)(customFieldSchema),
253
+ component: getDatePickerComponent(customFieldSchema),
254
+ showTime: getDatePickerShowTime(customFieldSchema)
227
255
  });
228
256
  }
229
257
  for(const item in filterSchemaItem)if (!filterSchemaItem[item] || filterSchemaItem[item].includes('$nFilter')) delete filterSchemaItem[item];
@@ -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: ()=>setFileIndex((fileIndex + images.length - 1) % images.length),
110
- onMoveNextRequest: ()=>setFileIndex((fileIndex + 1) % images.length),
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: ()=>setFileIndex((fileIndex + images.length - 1) % images.length),
168
- onMoveNextRequest: ()=>setFileIndex((fileIndex + 1) % images.length),
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
- }, 'preview-img')
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.18",
3
+ "version": "1.6.20",
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.10",
34
- "@tego/client": "1.6.10",
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",