@tachybase/client 1.6.21 → 1.6.23

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 (191) hide show
  1. package/es/api-client/APIClient.d.ts +2 -1
  2. package/es/api-client/APIClient.mjs +6 -3
  3. package/es/application/Plugin.d.ts +2 -2
  4. package/es/application/hoc/withDynamicSchemaProps.mjs +1 -1
  5. package/es/application/schema-initializer/hooks/index.mjs +4 -1
  6. package/es/application/schema-settings/components/SchemaSettingsChildren.mjs +14 -14
  7. package/es/application/utils/clientModuleRegistry.d.ts +2 -0
  8. package/es/application/utils/clientModuleRegistry.mjs +9 -0
  9. package/es/application/utils/globalDeps.mjs +2 -2
  10. package/es/block-provider/BlockProvider.d.ts +1 -27
  11. package/es/block-provider/BlockProvider.mjs +1 -3
  12. package/es/block-provider/BlockRequestContext.d.ts +27 -0
  13. package/es/block-provider/BlockRequestContext.mjs +5 -0
  14. package/es/block-provider/FormBlockContext.d.ts +32 -0
  15. package/es/block-provider/FormBlockContext.mjs +5 -0
  16. package/es/block-provider/FormBlockProvider.d.ts +1 -33
  17. package/es/block-provider/FormBlockProvider.mjs +4 -5
  18. package/es/built-in/acl/ACLCollectionFieldProvider.d.ts +1 -0
  19. package/es/built-in/acl/ACLCollectionFieldProvider.mjs +42 -0
  20. package/es/built-in/acl/ACLContext.d.ts +9 -0
  21. package/es/built-in/acl/ACLContext.mjs +24 -0
  22. package/es/built-in/acl/ACLPlugin.mjs +2 -1
  23. package/es/built-in/acl/ACLProvider.d.ts +0 -11
  24. package/es/built-in/acl/ACLProvider.mjs +6 -51
  25. package/es/built-in/acl/index.d.ts +2 -0
  26. package/es/built-in/acl/index.mjs +2 -0
  27. package/es/built-in/locale/LocalePlugin.d.ts +2 -0
  28. package/es/built-in/locale/LocalePlugin.mjs +13 -4
  29. package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
  30. package/es/collection-manager/sub-table.d.ts +1 -1
  31. package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
  32. package/es/data-source/data-source/DataSourceManager.mjs +1 -2
  33. package/es/data-source/data-source/constants.d.ts +2 -0
  34. package/es/data-source/data-source/constants.mjs +3 -0
  35. package/es/data-source/utils.d.ts +2 -2
  36. package/es/data-source/utils.mjs +1 -1
  37. package/es/exports.d.ts +46 -0
  38. package/es/exports.mjs +46 -0
  39. package/es/filter-provider/utils.d.ts +2 -14
  40. package/es/filter-provider/utils.mjs +2 -57
  41. package/es/index.d.ts +1 -46
  42. package/es/index.mjs +4 -46
  43. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
  44. package/es/record-provider/index.mjs +3 -3
  45. package/es/schema-component/antd/action/Action.mjs +7 -6
  46. package/es/schema-component/antd/action/hooks.mjs +3 -2
  47. package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
  48. package/es/schema-component/antd/association-field/hooks.mjs +18 -1
  49. package/es/schema-component/antd/cron/CronSet.mjs +9 -3
  50. package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
  51. package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
  52. package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
  53. package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
  54. package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
  55. package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
  56. package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
  57. package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
  58. package/es/schema-component/antd/form/Form.mjs +1 -1
  59. package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
  60. package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
  61. package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
  62. package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
  63. package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
  64. package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
  65. package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
  66. package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
  67. package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
  68. package/es/schema-component/antd/form-v2/Form.mjs +26 -167
  69. package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
  70. package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
  71. package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
  72. package/es/schema-component/antd/grid/Grid.mjs +5 -2
  73. package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
  74. package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
  75. package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
  76. package/es/schema-component/antd/input/Json.d.ts +1 -4
  77. package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
  78. package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
  79. package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
  80. package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
  81. package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
  82. package/es/schema-component/antd/markdown/util.mjs +5 -0
  83. package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
  84. package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
  85. package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
  86. package/es/schema-component/antd/select/Select.mjs +1 -2
  87. package/es/schema-component/antd/select/utils.d.ts +2 -1
  88. package/es/schema-component/antd/select/utils.mjs +2 -2
  89. package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
  90. package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
  91. package/es/schema-component/antd/upload/Upload.mjs +6 -5
  92. package/es/schema-component/antd/variable/Input.mjs +1 -1
  93. package/es/schema-component/antd/variable/TextArea.mjs +1 -1
  94. package/es/schema-component/hooks/useDesigner.mjs +9 -3
  95. package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
  96. package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
  97. package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
  98. package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
  99. package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
  100. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
  101. package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
  102. package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
  103. package/es/style/theme/AntdAppProvider.mjs +2 -2
  104. package/es/user/ChangePassword.d.ts +4 -1
  105. package/es/user/CurrentUserContext.d.ts +2 -0
  106. package/es/user/CurrentUserContext.mjs +5 -0
  107. package/es/user/CurrentUserProvider.d.ts +0 -3
  108. package/es/user/CurrentUserProvider.mjs +3 -5
  109. package/es/user/EditProfile.d.ts +4 -1
  110. package/es/user/LanguageSettings.d.ts +4 -1
  111. package/es/user/SwitchRole.d.ts +4 -1
  112. package/es/user/index.d.ts +1 -0
  113. package/es/user/index.mjs +1 -0
  114. package/es/variables/VariablesProvider.mjs +1 -1
  115. package/lib/api-client/APIClient.js +8 -5
  116. package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
  117. package/lib/application/schema-initializer/hooks/index.js +4 -1
  118. package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
  119. package/lib/application/utils/clientModuleRegistry.js +46 -0
  120. package/lib/application/utils/globalDeps.js +2 -2
  121. package/lib/block-provider/BlockProvider.js +6 -8
  122. package/lib/block-provider/BlockRequestContext.js +42 -0
  123. package/lib/block-provider/FormBlockContext.js +42 -0
  124. package/lib/block-provider/FormBlockProvider.js +13 -14
  125. package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
  126. package/lib/built-in/acl/ACLContext.js +70 -0
  127. package/lib/built-in/acl/ACLPlugin.js +2 -1
  128. package/lib/built-in/acl/ACLProvider.js +13 -76
  129. package/lib/built-in/acl/index.js +27 -9
  130. package/lib/built-in/locale/LocalePlugin.js +17 -5
  131. package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
  132. package/lib/data-source/data-source/DataSourceManager.js +6 -7
  133. package/lib/data-source/data-source/constants.js +40 -0
  134. package/lib/data-source/utils.js +2 -2
  135. package/lib/exports.js +769 -0
  136. package/lib/filter-provider/utils.js +7 -63
  137. package/lib/index.js +10 -714
  138. package/lib/record-provider/index.js +6 -6
  139. package/lib/schema-component/antd/action/Action.js +9 -8
  140. package/lib/schema-component/antd/action/hooks.js +3 -2
  141. package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
  142. package/lib/schema-component/antd/association-field/hooks.js +18 -1
  143. package/lib/schema-component/antd/cron/CronSet.js +8 -2
  144. package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
  145. package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
  146. package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
  147. package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
  148. package/lib/schema-component/antd/form/Form.js +4 -4
  149. package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
  150. package/lib/schema-component/antd/form-item/FormItem.js +23 -20
  151. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
  152. package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
  153. package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
  154. package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
  155. package/lib/schema-component/antd/form-v2/Form.js +204 -317
  156. package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
  157. package/lib/schema-component/antd/form-v2/Templates.js +2 -2
  158. package/lib/schema-component/antd/grid/Grid.js +10 -7
  159. package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
  160. package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
  161. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
  162. package/lib/schema-component/antd/input/ReadPretty.js +10 -10
  163. package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
  164. package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
  165. package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
  166. package/lib/schema-component/antd/markdown/Markdown.js +2 -2
  167. package/lib/schema-component/antd/markdown/util.js +5 -0
  168. package/lib/schema-component/antd/rich-text/RichText.js +2 -2
  169. package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
  170. package/lib/schema-component/antd/select/ReadPretty.js +2 -2
  171. package/lib/schema-component/antd/select/Select.js +1 -2
  172. package/lib/schema-component/antd/select/utils.js +6 -3
  173. package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
  174. package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
  175. package/lib/schema-component/antd/upload/Upload.js +6 -5
  176. package/lib/schema-component/antd/variable/Input.js +1 -1
  177. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  178. package/lib/schema-component/hooks/useDesigner.js +57 -23
  179. package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
  180. package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
  181. package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
  182. package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
  183. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
  184. package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
  185. package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
  186. package/lib/style/theme/AntdAppProvider.js +4 -4
  187. package/lib/user/CurrentUserContext.js +42 -0
  188. package/lib/user/CurrentUserProvider.js +6 -14
  189. package/lib/user/index.js +24 -12
  190. package/lib/variables/VariablesProvider.js +2 -2
  191. package/package.json +5 -4
@@ -34,8 +34,8 @@ var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
36
  mergeFilter: ()=>mergeFilter,
37
- FILTER_OPERATORS_WITH_ARRAY_VALUES: ()=>FILTER_OPERATORS_WITH_ARRAY_VALUES,
38
- normalizeDateBetweenValue: ()=>normalizeDateBetweenValue,
37
+ FILTER_OPERATORS_WITH_ARRAY_VALUES: ()=>dateValueUtils_js_namespaceObject.FILTER_OPERATORS_WITH_ARRAY_VALUES,
38
+ normalizeDateBetweenValue: ()=>dateValueUtils_js_namespaceObject.normalizeDateBetweenValue,
39
39
  transformToFilter: ()=>transformToFilter,
40
40
  isSameCollection: ()=>isSameCollection,
41
41
  getSupportFieldsByForeignKey: ()=>getSupportFieldsByForeignKey,
@@ -44,21 +44,20 @@ __webpack_require__.d(__webpack_exports__, {
44
44
  isAssocField: ()=>isAssocField,
45
45
  useAssociatedFields: ()=>useAssociatedFields,
46
46
  isInFilterFormBlock: ()=>isInFilterFormBlock,
47
- shouldUseDefaultDateBoundary: ()=>shouldUseDefaultDateBoundary,
47
+ shouldUseDefaultDateBoundary: ()=>dateValueUtils_js_namespaceObject.shouldUseDefaultDateBoundary,
48
48
  useFilterAPI: ()=>useFilterAPI,
49
49
  useSupportedBlocks: ()=>useSupportedBlocks
50
50
  });
51
51
  const external_react_namespaceObject = require("react");
52
52
  const schema_namespaceObject = require("@tachybase/schema");
53
53
  const client_namespaceObject = require("@tego/client");
54
- const external_dayjs_namespaceObject = require("dayjs");
55
- var external_dayjs_default = /*#__PURE__*/ __webpack_require__.n(external_dayjs_namespaceObject);
56
54
  const external_lodash_namespaceObject = require("lodash");
57
55
  var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
58
56
  const index_js_namespaceObject = require("../block-provider/hooks/index.js");
59
57
  const external_collection_manager_index_js_namespaceObject = require("../collection-manager/index.js");
60
58
  const external_schema_component_index_js_namespaceObject = require("../schema-component/index.js");
61
59
  const util_js_namespaceObject = require("../schema-component/antd/date-picker/util.js");
60
+ const dateValueUtils_js_namespaceObject = require("../schema-component/antd/filter/dateValueUtils.js");
62
61
  const SchemaSettingOptions_js_namespaceObject = require("../schema-component/antd/form-item/SchemaSettingOptions.js");
63
62
  const external_FilterProvider_js_namespaceObject = require("./FilterProvider.js");
64
63
  const external_incomingFilterFromSources_js_namespaceObject = require("./incomingFilterFromSources.js");
@@ -80,17 +79,6 @@ const mergeFilter = function(filters) {
80
79
  [op]: items
81
80
  };
82
81
  };
83
- const FILTER_OPERATORS_WITH_ARRAY_VALUES = new Set([
84
- '$match',
85
- '$notMatch',
86
- '$anyOf',
87
- '$noneOf',
88
- '$childIn',
89
- '$childNotIn',
90
- '$dateBetween',
91
- '$in',
92
- '$notIn'
93
- ]);
94
82
  const getSupportFieldsByAssociation = (inheritCollectionsChain, block)=>{
95
83
  var _block_associatedFields;
96
84
  return null == (_block_associatedFields = block.associatedFields) ? void 0 : _block_associatedFields.filter((field)=>null == inheritCollectionsChain ? void 0 : inheritCollectionsChain.some((collectionName)=>collectionName === field.target));
@@ -153,50 +141,6 @@ const getDatePickerShowTime = (fieldSchema)=>{
153
141
  var _fieldSchema_xcomponentprops;
154
142
  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);
157
- const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
158
- const normalizeLocalDateBoundaryInput = (value)=>{
159
- if ('string' != typeof value) return value;
160
- return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
161
- };
162
- const normalizeDateBetweenBoundary = function(value, boundary) {
163
- let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
164
- const m = external_dayjs_default()(value);
165
- if (!m.isValid()) return value;
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();
174
- return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
175
- };
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;
180
- if (!options.useDefaultDateBoundary) return false;
181
- if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
182
- return options.preferDateBoundaryFallback && 'date' === options.valueMode && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(start, 'start') && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(end, 'end');
183
- };
184
- const normalizeDateBetweenValue = function(value) {
185
- let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
186
- const normalized = value.filter(Boolean);
187
- if (0 === normalized.length) return null;
188
- const start = normalized[0];
189
- const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
190
- const boundaryOptions = {
191
- ...options,
192
- useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
193
- };
194
- return [
195
- normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
196
- normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
197
- ];
198
- };
199
- const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
200
144
  const transformToFilter = (values, fieldSchema, getCollectionJoinField, collectionName, getOperatorList)=>{
201
145
  const { operators } = (0, SchemaSettingOptions_js_namespaceObject.findFilterOperators)(fieldSchema);
202
146
  values = (0, client_namespaceObject.flatten)(values, {
@@ -204,7 +148,7 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
204
148
  let { value, path } = param;
205
149
  const collectionField = getCollectionJoinField("".concat(collectionName, ".").concat(path));
206
150
  const operator = resolveFilterOperator(fieldSchema, path, operators, getOperatorList, collectionField);
207
- if (FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator)) return true;
151
+ if (dateValueUtils_js_namespaceObject.FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator)) return true;
208
152
  if (null == collectionField ? void 0 : collectionField.target) {
209
153
  if (Array.isArray(value)) return true;
210
154
  const targetKey = collectionField.targetKey || 'id';
@@ -239,13 +183,13 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
239
183
  } else if ('$dateBetween' === operator) {
240
184
  if (Array.isArray(value)) {
241
185
  const datePickerComponent = getDatePickerComponent(currentFieldSchema);
242
- const useDefaultDateBoundary = shouldUseDefaultDateBoundary(currentFieldSchema);
186
+ const useDefaultDateBoundary = (0, dateValueUtils_js_namespaceObject.shouldUseDefaultDateBoundary)(currentFieldSchema);
243
187
  const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
244
188
  component: datePickerComponent,
245
189
  showTime: getDatePickerShowTime(currentFieldSchema),
246
190
  preferDateBoundaryFallback: useDefaultDateBoundary
247
191
  });
248
- value = normalizeDateBetweenValue(value, {
192
+ value = (0, dateValueUtils_js_namespaceObject.normalizeDateBetweenValue)(value, {
249
193
  useDefaultDateBoundary,
250
194
  valueMode: valueInfo.mode,
251
195
  valueSource: valueInfo.source,