@tachybase/client 1.6.17 → 1.6.19

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.
Files changed (30) hide show
  1. package/es/block-provider/hooks/index.mjs +2 -8
  2. package/es/data-source/data-block/DataBlockRequestProvider.mjs +5 -5
  3. package/es/filter-provider/utils.d.ts +10 -0
  4. package/es/filter-provider/utils.mjs +68 -16
  5. package/es/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.mjs +2 -3
  6. package/es/modules/fields/component/Nester/subformComponentFieldSettings.mjs +1 -2
  7. package/es/modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs +2 -3
  8. package/es/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.mjs +1 -2
  9. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +1 -2
  10. package/es/schema-component/antd/association-select/AssociationSelect.mjs +3 -3
  11. package/es/schema-component/antd/date-picker/util.d.ts +18 -0
  12. package/es/schema-component/antd/date-picker/util.mjs +62 -5
  13. package/es/schema-component/antd/filter/useFilterActionProps.mjs +85 -7
  14. package/es/schema-component/antd/form-item/FormItem.Settings.mjs +1 -2
  15. package/es/schema-initializer/utils.d.ts +1 -0
  16. package/es/schema-initializer/utils.mjs +7 -6
  17. package/lib/block-provider/hooks/index.js +2 -8
  18. package/lib/data-source/data-block/DataBlockRequestProvider.js +5 -5
  19. package/lib/filter-provider/utils.js +73 -15
  20. package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +2 -3
  21. package/lib/modules/fields/component/Nester/subformComponentFieldSettings.js +1 -2
  22. package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +2 -3
  23. package/lib/modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.js +1 -2
  24. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -2
  25. package/lib/schema-component/antd/association-select/AssociationSelect.js +3 -3
  26. package/lib/schema-component/antd/date-picker/util.js +81 -6
  27. package/lib/schema-component/antd/filter/useFilterActionProps.js +84 -6
  28. package/lib/schema-component/antd/form-item/FormItem.Settings.js +1 -2
  29. package/lib/schema-initializer/utils.js +9 -5
  30. package/package.json +1 -1
@@ -327,7 +327,7 @@ const useFilterFormItemInitializerFields = (options)=>{
327
327
  'x-component': 'CollectionField',
328
328
  'x-decorator': 'FormItem',
329
329
  'x-collection-field': "".concat(name, ".").concat(field.name),
330
- 'x-component-props': null == (_field_uiSchema2 = field.uiSchema) ? void 0 : _field_uiSchema2['x-component-props']
330
+ 'x-component-props': (null == (_field_uiSchema2 = field.uiSchema) ? void 0 : _field_uiSchema2['x-component-props']) || {}
331
331
  };
332
332
  }
333
333
  const resultItem = {
@@ -438,7 +438,7 @@ const getItem = (field, schemaName, collectionName, getCollectionFields, process
438
438
  'oho',
439
439
  'o2m',
440
440
  'm2m'
441
- ].includes(subField.interface)) options.push(getResultSchema("".concat(schemaName, ".").concat(subField.name), subField, collectionName, (fieldPath || '') + field.key));
441
+ ].includes(subField.interface)) options.push(createFilterAssociatedResultSchema("".concat(schemaName, ".").concat(subField.name), subField, collectionName, (fieldPath || '') + field.key));
442
442
  options.push(getItem(subField, "".concat(schemaName, ".").concat(subField.name), collectionName, getCollectionFields, [
443
443
  ...processedCollections,
444
444
  field.target
@@ -453,9 +453,9 @@ const getItem = (field, schemaName, collectionName, getCollectionFields, process
453
453
  };
454
454
  }
455
455
  if (isAssocField(field)) return null;
456
- return getResultSchema(schemaName, field, collectionName, (fieldPath || '') + field.key);
456
+ return createFilterAssociatedResultSchema(schemaName, field, collectionName, (fieldPath || '') + field.key);
457
457
  };
458
- const getResultSchema = (schemaName, field, collectionName, fieldPath)=>{
458
+ const createFilterAssociatedResultSchema = (schemaName, field, collectionName, fieldPath)=>{
459
459
  var _field_uiSchema, _field_uiSchema1, _field_uiSchema2;
460
460
  const schema = {
461
461
  type: 'string',
@@ -468,7 +468,8 @@ const getResultSchema = (schemaName, field, collectionName, fieldPath)=>{
468
468
  'x-component': 'CollectionField',
469
469
  'x-read-pretty': false,
470
470
  'x-decorator': 'FormItem',
471
- 'x-collection-field': "".concat(collectionName, ".").concat(schemaName)
471
+ 'x-collection-field': "".concat(collectionName, ".").concat(schemaName),
472
+ 'x-component-props': {}
472
473
  };
473
474
  const result = {
474
475
  name: (null == (_field_uiSchema = field.uiSchema) ? void 0 : _field_uiSchema.title) || field.name,
@@ -1374,4 +1375,4 @@ function useAssociationFields(param) {
1374
1375
  t
1375
1376
  ]);
1376
1377
  }
1377
- export { createDetailsBlockSchema, createFormBlockSchema, createReadPrettyFormBlockSchema, createTableBlockSchema, findSchema, findTableColumn, gridRowColWrap, itemsMerge, removeGridFormItem, removeTableColumn, useAssociatedFormItemInitializerFields, useAssociatedTableColumnInitializerFields, useCollectionDataSourceItems, useCurrentSchema, useCustomFormItemInitializerFields, useFilterAssociatedFormItemInitializerFields, useFilterFormItemInitializerFields, useFilterInheritsFormItemInitializerFields, useFormItemInitializerFields, useInheritsFormItemInitializerFields, useInheritsTableColumnInitializerFields, useRecordCollectionDataSourceItems, useRemoveGridFormItem, useTableColumnInitializerFields };
1378
+ export { createDetailsBlockSchema, createFilterAssociatedResultSchema, createFormBlockSchema, createReadPrettyFormBlockSchema, createTableBlockSchema, findSchema, findTableColumn, gridRowColWrap, itemsMerge, removeGridFormItem, removeTableColumn, useAssociatedFormItemInitializerFields, useAssociatedTableColumnInitializerFields, useCollectionDataSourceItems, useCurrentSchema, useCustomFormItemInitializerFields, useFilterAssociatedFormItemInitializerFields, useFilterFormItemInitializerFields, useFilterInheritsFormItemInitializerFields, useFormItemInitializerFields, useInheritsFormItemInitializerFields, useInheritsTableColumnInitializerFields, useRecordCollectionDataSourceItems, useRemoveGridFormItem, useTableColumnInitializerFields };
@@ -740,7 +740,6 @@ var __webpack_exports__ = {};
740
740
  async onClick () {
741
741
  const { targets = [], uid } = findFilterTargets(fieldSchema);
742
742
  actionField.data.loading = true;
743
- let prevMergedFilter = {};
744
743
  try {
745
744
  await Promise.all(getDataBlocks().map(async (block)=>{
746
745
  var _block_service_params, _block_service_params_, _block_service_params1, _Object_keys;
@@ -777,11 +776,9 @@ var __webpack_exports__ = {};
777
776
  ...Object.values(storedFilter).map((filter)=>(0, _schema_component__WEBPACK_IMPORTED_MODULE_19__.removeNullCondition)(filter)),
778
777
  (0, _filter_provider_incomingFilterFromSources__WEBPACK_IMPORTED_MODULE_16__.getFilterSourceDefaultFilter)(getDataBlocks(), uid),
779
778
  block.defaultFilter,
780
- filter.customFilter,
781
- prevMergedFilter
779
+ filter.customFilter
782
780
  ]);
783
781
  const currFilter = filterByCleanedFields(mergedFilter);
784
- prevMergedFilter = currFilter;
785
782
  if ('manual' === block.dataLoadingMode && lodash__WEBPACK_IMPORTED_MODULE_5___default().isEmpty(currFilter)) return block.clearData();
786
783
  return block.doFilter({
787
784
  ...param,
@@ -809,7 +806,6 @@ var __webpack_exports__ = {};
809
806
  const { targets, uid } = findFilterTargets(fieldSchema);
810
807
  form.reset();
811
808
  actionField.data.loading = true;
812
- let prevMergedFilter = {};
813
809
  try {
814
810
  await Promise.all(getDataBlocks().map(async (block)=>{
815
811
  var _block_service_params, _block_service_params_, _block_service_params1;
@@ -822,11 +818,9 @@ var __webpack_exports__ = {};
822
818
  const currFilter = (0, _filter_provider_utils__WEBPACK_IMPORTED_MODULE_17__.mergeFilter)([
823
819
  ...Object.values(storedFilter),
824
820
  (0, _filter_provider_incomingFilterFromSources__WEBPACK_IMPORTED_MODULE_16__.getFilterSourceDefaultFilter)(getDataBlocks(), uid),
825
- block.defaultFilter,
826
- prevMergedFilter
821
+ block.defaultFilter
827
822
  ]);
828
823
  const mergedFilter = filterByCleanedFields(currFilter);
829
- prevMergedFilter = mergedFilter;
830
824
  return block.doFilter({
831
825
  ...param,
832
826
  page: 1,
@@ -82,14 +82,14 @@ function useParentRequest(options) {
82
82
  if (parentRecord) return Promise.resolve({
83
83
  data: parentRecord
84
84
  });
85
- if (!association || !sourceKey) return Promise.resolve({
85
+ if (!association || !sourceKey || null == sourceId) return Promise.resolve({
86
86
  data: void 0
87
87
  });
88
88
  const arr = association.split('.');
89
- const url = "".concat(arr[0], ":get?filter[").concat(sourceKey, "]=").concat(sourceId);
90
- const res = await api.request({
91
- url,
92
- headers
89
+ const res = await api.resource(arr[0], void 0, headers).get({
90
+ filter: {
91
+ [sourceKey]: sourceId
92
+ }
93
93
  });
94
94
  return res.data;
95
95
  }, {
@@ -35,6 +35,7 @@ __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
36
  mergeFilter: ()=>mergeFilter,
37
37
  FILTER_OPERATORS_WITH_ARRAY_VALUES: ()=>FILTER_OPERATORS_WITH_ARRAY_VALUES,
38
+ normalizeDateBetweenValue: ()=>normalizeDateBetweenValue,
38
39
  transformToFilter: ()=>transformToFilter,
39
40
  isSameCollection: ()=>isSameCollection,
40
41
  getSupportFieldsByForeignKey: ()=>getSupportFieldsByForeignKey,
@@ -43,6 +44,7 @@ __webpack_require__.d(__webpack_exports__, {
43
44
  isAssocField: ()=>isAssocField,
44
45
  useAssociatedFields: ()=>useAssociatedFields,
45
46
  isInFilterFormBlock: ()=>isInFilterFormBlock,
47
+ shouldUseDefaultDateBoundary: ()=>shouldUseDefaultDateBoundary,
46
48
  useFilterAPI: ()=>useFilterAPI,
47
49
  useSupportedBlocks: ()=>useSupportedBlocks
48
50
  });
@@ -56,6 +58,7 @@ var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodas
56
58
  const index_js_namespaceObject = require("../block-provider/hooks/index.js");
57
59
  const external_collection_manager_index_js_namespaceObject = require("../collection-manager/index.js");
58
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");
59
62
  const SchemaSettingOptions_js_namespaceObject = require("../schema-component/antd/form-item/SchemaSettingOptions.js");
60
63
  const external_FilterProvider_js_namespaceObject = require("./FilterProvider.js");
61
64
  const external_incomingFilterFromSources_js_namespaceObject = require("./incomingFilterFromSources.js");
@@ -112,6 +115,7 @@ const findSchemaByName = (schema, name)=>{
112
115
  if (schema.name === name) return schema;
113
116
  const properties = schema.properties || {};
114
117
  for (const key of Object.keys(properties)){
118
+ if (key === name) return properties[key];
115
119
  const found = findSchemaByName(properties[key], name);
116
120
  if (found) return found;
117
121
  }
@@ -137,6 +141,58 @@ const resolveFilterOperator = function(schema, path) {
137
141
  if (!operatorList.length || !fieldSchema) return;
138
142
  return (0, SchemaSettingOptions_js_namespaceObject.getDefaultFilterOperatorValue)(fieldSchema, operatorList);
139
143
  };
144
+ const getDatePickerComponent = (fieldSchema)=>{
145
+ var _fieldSchema_xcomponentprops;
146
+ 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
+ };
148
+ const getDatePickerShowTime = (fieldSchema)=>{
149
+ var _fieldSchema_xcomponentprops;
150
+ return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
151
+ };
152
+ const isDateOnlyString = (value)=>'string' == typeof value && /^\d{4}-\d{2}-\d{2}$/.test(value);
153
+ const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
154
+ const normalizeLocalDateBoundaryInput = (value)=>{
155
+ if ('string' != typeof value) return value;
156
+ return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
157
+ };
158
+ const normalizeDateBetweenBoundary = function(value, boundary) {
159
+ let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
160
+ const m = external_dayjs_default()(value);
161
+ if (!m.isValid()) return value;
162
+ if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
163
+ if ('date' === options.valueMode) {
164
+ if ('retained-local-date-boundary' === options.valueSource) return m.toISOString();
165
+ const localBoundary = external_dayjs_default()(normalizeLocalDateBoundaryInput(value));
166
+ return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
167
+ }
168
+ if (hasExplicitTime(value)) return m.toISOString();
169
+ if (!options.useDefaultDateBoundary) return m.toISOString();
170
+ return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
171
+ };
172
+ const shouldApplyDefaultDateBoundary = function(start, end, value) {
173
+ let options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
174
+ if ('datetime' === options.valueMode) return false;
175
+ if ('date' === options.valueMode) return true;
176
+ if (!options.useDefaultDateBoundary) return false;
177
+ if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
178
+ return options.preferDateBoundaryFallback && 'date' === options.valueMode && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(start, 'start') && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(end, 'end');
179
+ };
180
+ const normalizeDateBetweenValue = function(value) {
181
+ let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
182
+ const normalized = value.filter(Boolean);
183
+ if (0 === normalized.length) return null;
184
+ const start = normalized[0];
185
+ const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
186
+ const boundaryOptions = {
187
+ ...options,
188
+ useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
189
+ };
190
+ return [
191
+ normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
192
+ normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
193
+ ];
194
+ };
195
+ const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
140
196
  const transformToFilter = (values, fieldSchema, getCollectionJoinField, collectionName, getOperatorList)=>{
141
197
  const { operators } = (0, SchemaSettingOptions_js_namespaceObject.findFilterOperators)(fieldSchema);
142
198
  values = (0, client_namespaceObject.flatten)(values, {
@@ -158,6 +214,7 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
158
214
  const defKey = key;
159
215
  let value = external_lodash_default().get(values, key);
160
216
  const collectionField = getCollectionJoinField("".concat(collectionName, ".").concat(key));
217
+ const currentFieldSchema = findSchemaByName(getFilterSchemaRoot(fieldSchema), defKey);
161
218
  const operator = resolveFilterOperator(fieldSchema, defKey, operators, getOperatorList, collectionField);
162
219
  if (null == collectionField ? void 0 : collectionField.target) {
163
220
  value = (0, client_namespaceObject.getValuesByPath)(value, collectionField.targetKey || 'id');
@@ -177,21 +234,18 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
177
234
  };
178
235
  } else if ('$dateBetween' === operator) {
179
236
  if (Array.isArray(value)) {
180
- const normalized = [];
181
- for(const index in value){
182
- if (!value[index]) continue;
183
- let v = value[index];
184
- if ('string' != typeof v && !(v instanceof Date)) v = external_dayjs_default()(v).toISOString();
185
- normalized.push(v);
186
- }
187
- if (0 === normalized.length) return null;
188
- value = 1 === normalized.length ? [
189
- normalized[0],
190
- normalized[0]
191
- ] : [
192
- normalized[0],
193
- normalized[normalized.length - 1]
194
- ];
237
+ const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
238
+ component: getDatePickerComponent(currentFieldSchema),
239
+ showTime: getDatePickerShowTime(currentFieldSchema),
240
+ preferDateBoundaryFallback: shouldUseDefaultDateBoundary(currentFieldSchema)
241
+ });
242
+ value = normalizeDateBetweenValue(value, {
243
+ useDefaultDateBoundary: shouldUseDefaultDateBoundary(currentFieldSchema),
244
+ valueMode: valueInfo.mode,
245
+ valueSource: valueInfo.source,
246
+ preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
247
+ });
248
+ if (!value) return null;
195
249
  }
196
250
  }
197
251
  return {
@@ -289,6 +343,8 @@ exports.isAssocField = __webpack_exports__.isAssocField;
289
343
  exports.isInFilterFormBlock = __webpack_exports__.isInFilterFormBlock;
290
344
  exports.isSameCollection = __webpack_exports__.isSameCollection;
291
345
  exports.mergeFilter = __webpack_exports__.mergeFilter;
346
+ exports.normalizeDateBetweenValue = __webpack_exports__.normalizeDateBetweenValue;
347
+ exports.shouldUseDefaultDateBoundary = __webpack_exports__.shouldUseDefaultDateBoundary;
292
348
  exports.transformToFilter = __webpack_exports__.transformToFilter;
293
349
  exports.useAssociatedFields = __webpack_exports__.useAssociatedFields;
294
350
  exports.useFilterAPI = __webpack_exports__.useFilterAPI;
@@ -302,6 +358,8 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
302
358
  "isInFilterFormBlock",
303
359
  "isSameCollection",
304
360
  "mergeFilter",
361
+ "normalizeDateBetweenValue",
362
+ "shouldUseDefaultDateBoundary",
305
363
  "transformToFilter",
306
364
  "useAssociatedFields",
307
365
  "useFilterAPI",
@@ -48,14 +48,13 @@ const allowMultiple = {
48
48
  ].includes(null == collectionField ? void 0 : collectionField.type);
49
49
  },
50
50
  useComponentProps () {
51
- var _fieldSchema_xcomponentprops;
52
51
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
53
52
  const field = (0, schema_namespaceObject.useField)();
54
53
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
55
54
  const { dn, refresh } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
56
55
  return {
57
56
  title: t('Allow multiple'),
58
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
57
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
59
58
  onChange (value) {
60
59
  const schema = {
61
60
  ['x-uid']: fieldSchema['x-uid']
@@ -154,7 +153,7 @@ const drawerSubTableComponentFieldSettings = new SchemaSettings_js_namespaceObje
154
153
  value: 'large'
155
154
  }
156
155
  ],
157
- value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) == 'modal' ? 'large' : 'middle',
156
+ value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) === 'modal' ? 'large' : 'middle',
158
157
  onChange: (value)=>{
159
158
  field.componentProps.openSize = value;
160
159
  fieldSchema['x-component-props'] = {
@@ -47,14 +47,13 @@ const allowMultiple = {
47
47
  ].includes(null == collectionField ? void 0 : collectionField.type);
48
48
  },
49
49
  useComponentProps () {
50
- var _fieldSchema_xcomponentprops;
51
50
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
52
51
  const field = (0, schema_namespaceObject.useField)();
53
52
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
54
53
  const { dn, refresh } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
55
54
  return {
56
55
  title: t('Allow multiple'),
57
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
56
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
58
57
  onChange (value) {
59
58
  const schema = {
60
59
  ['x-uid']: fieldSchema['x-uid']
@@ -89,14 +89,13 @@ const allowMultiple = {
89
89
  ].includes(null == collectionField ? void 0 : collectionField.type);
90
90
  },
91
91
  useComponentProps () {
92
- var _fieldSchema_xcomponentprops;
93
92
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
94
93
  const field = (0, schema_namespaceObject.useField)();
95
94
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
96
95
  const { dn, refresh } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
97
96
  return {
98
97
  title: t('Allow multiple'),
99
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
98
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
100
99
  onChange (value) {
101
100
  const schema = {
102
101
  ['x-uid']: fieldSchema['x-uid']
@@ -194,7 +193,7 @@ const recordPickerComponentFieldSettings = new SchemaSettings_js_namespaceObject
194
193
  value: 'large'
195
194
  }
196
195
  ],
197
- value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) == 'modal' ? 'large' : 'middle',
196
+ value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) === 'modal' ? 'large' : 'middle',
198
197
  onChange: (value)=>{
199
198
  field.componentProps.openSize = value;
200
199
  fieldSchema['x-component-props'] = {
@@ -48,14 +48,13 @@ const allowMultiple = {
48
48
  ].includes(null == collectionField ? void 0 : collectionField.type);
49
49
  },
50
50
  useComponentProps () {
51
- var _fieldSchema_xcomponentprops;
52
51
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
53
52
  const field = (0, schema_namespaceObject.useField)();
54
53
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
55
54
  const { dn, refresh } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
56
55
  return {
57
56
  title: t('Allow multiple'),
58
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
57
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
59
58
  onChange (value) {
60
59
  const schema = {
61
60
  ['x-uid']: fieldSchema['x-uid']
@@ -169,7 +169,6 @@ const allowMultiple = {
169
169
  ].includes(null == collectionField ? void 0 : collectionField.type);
170
170
  },
171
171
  useComponentProps () {
172
- var _fieldSchema_xcomponentprops;
173
172
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
174
173
  const field = (0, schema_namespaceObject.useField)();
175
174
  const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
@@ -178,7 +177,7 @@ const allowMultiple = {
178
177
  const { dn, refresh } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
179
178
  return {
180
179
  title: t('Allow multiple'),
181
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
180
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
182
181
  onChange (value) {
183
182
  const schema = {
184
183
  ['x-uid']: fieldSchema['x-uid']
@@ -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_lodash_namespaceObject = require("lodash");
45
45
  var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
46
46
  const external_react_i18next_namespaceObject = require("react-i18next");
@@ -106,7 +106,7 @@ const InternalAssociationSelect = (0, schema_namespaceObject.connect)((props)=>{
106
106
  })), (0, schema_namespaceObject.mapReadPretty)(external_ReadPretty_js_namespaceObject.ReadPretty));
107
107
  const AssociationSelect = InternalAssociationSelect;
108
108
  AssociationSelect.Designer = function() {
109
- var _interfaceConfig_validateSchema, _collectionField_uiSchema, _field_componentProps_service_params, _field_componentProps_service, _field_componentProps, _fieldSchema_xcomponentprops, _field_componentProps_service_params1, _field_componentProps_service1, _field_componentProps1, _field_componentProps_fieldNames, _field_componentProps2;
109
+ var _interfaceConfig_validateSchema, _collectionField_uiSchema, _field_componentProps_service_params, _field_componentProps_service, _field_componentProps, _field_componentProps_service_params1, _field_componentProps_service1, _field_componentProps1, _field_componentProps_fieldNames, _field_componentProps2;
110
110
  const { getCollectionFields, getInterface, getCollectionJoinField, getCollection, isTitleField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
111
111
  const { getField } = (0, external_collection_manager_index_js_namespaceObject.useCollection_deprecated)();
112
112
  const { form } = (0, index_js_namespaceObject.useFormBlockContext)();
@@ -358,7 +358,7 @@ AssociationSelect.Designer = function() {
358
358
  }),
359
359
  IsShowMultipleSwitch() ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaSettings_js_namespaceObject.SchemaSettingsSwitchItem, {
360
360
  title: t('Allow multiple'),
361
- checked: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 ? true : fieldSchema['x-component-props'].multiple,
361
+ checked: void 0 === (fieldSchema['x-component-props'] || {}).multiple ? true : fieldSchema['x-component-props'].multiple,
362
362
  onChange: (value)=>{
363
363
  const schema = {
364
364
  ['x-uid']: fieldSchema['x-uid']
@@ -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,9 +69,63 @@ const toLocalByPicker = (value, picker)=>{
63
69
  if (!value || !external_dayjs_default().isDayjs(value)) return value;
64
70
  return toStringByPicker(value, picker, 'local');
65
71
  };
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) return {
99
+ mode: metadataMode,
100
+ source: 'metadata'
101
+ };
102
+ if ('DatePicker.RangePicker' === options.component && !options.showTime) return {
103
+ mode: 'date',
104
+ source: 'schema'
105
+ };
106
+ if (options.preferDateBoundaryFallback && options.showTime && isDatePickerRetainedLocalBoundaryPair(value)) return {
107
+ mode: 'date',
108
+ source: 'retained-local-date-boundary'
109
+ };
110
+ if (options.preferDateBoundaryFallback && isDatePickerDefaultRangeBoundaryPair(value)) return {
111
+ mode: 'date',
112
+ source: 'retained-date-boundary'
113
+ };
114
+ return {
115
+ source: 'unknown'
116
+ };
117
+ };
66
118
  const normalizeDatePickerParseOptions = function() {
67
119
  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;
120
+ if (false === options.utc || 'boolean' == typeof options.gmt || options.picker) return options;
121
+ const rangeValueInfo = resolveDatePickerRangeValueInfo(options.value, {
122
+ component: options.component,
123
+ showTime: options.showTime,
124
+ preferDateBoundaryFallback: 'DatePicker.RangePicker' === options.component
125
+ });
126
+ if (options.showTime) {
127
+ if ('date' !== rangeValueInfo.mode || 'retained-local-date-boundary' === rangeValueInfo.source) return options;
128
+ }
69
129
  return {
70
130
  ...options,
71
131
  gmt: true
@@ -107,12 +167,15 @@ const mapRangePicker = function() {
107
167
  return {
108
168
  ...props,
109
169
  format: format,
110
- value: (0, client_namespaceObject.str2moment)(props.value, normalizeDatePickerParseOptions(props)),
170
+ value: (0, client_namespaceObject.str2moment)(props.value, normalizeDatePickerParseOptions({
171
+ ...props,
172
+ component: 'DatePicker.RangePicker'
173
+ })),
111
174
  onChange: (value)=>{
112
- if (onChange) onChange(value ? [
175
+ if (onChange) onChange(value ? markRangeValueMode([
113
176
  moment2str(getRangeStart(value[0], props), props),
114
177
  moment2str(getRangeEnd(value[1], props), props)
115
- ] : []);
178
+ ], props.showTime ? 'datetime' : 'date') : []);
116
179
  }
117
180
  };
118
181
  };
@@ -241,19 +304,31 @@ const getDateExact = ()=>({
241
304
  tomorrowLocal: ()=>external_dayjs_default()().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
242
305
  tomorrowDate: ()=>external_dayjs_default()().add(1, 'day').format('YYYY-MM-DD')
243
306
  });
307
+ exports.DATE_PICKER_RANGE_VALUE_MODE = __webpack_exports__.DATE_PICKER_RANGE_VALUE_MODE;
244
308
  exports.getDateExact = __webpack_exports__.getDateExact;
245
309
  exports.getDateRanges = __webpack_exports__.getDateRanges;
310
+ exports.getRangeValueMode = __webpack_exports__.getRangeValueMode;
311
+ exports.isDatePickerDefaultRangeBoundaryPair = __webpack_exports__.isDatePickerDefaultRangeBoundaryPair;
312
+ exports.isDatePickerDefaultRangeBoundaryValue = __webpack_exports__.isDatePickerDefaultRangeBoundaryValue;
246
313
  exports.mapDatePicker = __webpack_exports__.mapDatePicker;
247
314
  exports.mapRangePicker = __webpack_exports__.mapRangePicker;
315
+ exports.markRangeValueMode = __webpack_exports__.markRangeValueMode;
248
316
  exports.moment2str = __webpack_exports__.moment2str;
249
317
  exports.normalizeDatePickerParseOptions = __webpack_exports__.normalizeDatePickerParseOptions;
318
+ exports.resolveDatePickerRangeValueInfo = __webpack_exports__.resolveDatePickerRangeValueInfo;
250
319
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
320
+ "DATE_PICKER_RANGE_VALUE_MODE",
251
321
  "getDateExact",
252
322
  "getDateRanges",
323
+ "getRangeValueMode",
324
+ "isDatePickerDefaultRangeBoundaryPair",
325
+ "isDatePickerDefaultRangeBoundaryValue",
253
326
  "mapDatePicker",
254
327
  "mapRangePicker",
328
+ "markRangeValueMode",
255
329
  "moment2str",
256
- "normalizeDatePickerParseOptions"
330
+ "normalizeDatePickerParseOptions",
331
+ "resolveDatePickerRangeValueInfo"
257
332
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
258
333
  Object.defineProperty(exports, '__esModule', {
259
334
  value: true