@tachybase/client 1.3.19 → 1.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/es/application/Application.mjs +1 -9
  2. package/es/application/components/index.d.ts +0 -2
  3. package/es/application/components/index.mjs +0 -2
  4. package/es/application/schema-initializer/context/index.d.ts +1 -1
  5. package/es/application/utils/globalDeps.mjs +1 -1
  6. package/es/block-provider/hooks/index.mjs +1 -1
  7. package/es/built-in/index.d.ts +2 -1
  8. package/es/built-in/index.mjs +3 -2
  9. package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
  10. package/es/collection-manager/collectionPlugin.mjs +36 -0
  11. package/es/collection-manager/interfaces/url.d.ts +4 -0
  12. package/es/collection-manager/interfaces/url.mjs +10 -1
  13. package/es/collection-manager/templates/sql.d.ts +3 -3
  14. package/es/collection-manager/templates/view.d.ts +3 -3
  15. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
  16. package/es/flag-provider/FlagProvider.d.ts +1 -0
  17. package/es/flag-provider/hooks/useFlag.mjs +1 -1
  18. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
  19. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
  20. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
  21. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
  22. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
  23. package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
  24. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
  25. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
  26. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
  27. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
  28. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
  29. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
  30. package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
  31. package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
  32. package/es/schema-component/antd/association-field/hooks.mjs +52 -1
  33. package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
  34. package/es/schema-component/antd/date-picker/util.d.ts +13 -0
  35. package/es/schema-component/antd/date-picker/util.mjs +14 -1
  36. package/es/schema-component/antd/input/Input.mjs +2 -1
  37. package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
  38. package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
  39. package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
  40. package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
  41. package/es/schema-component/antd/page/Page.mjs +46 -95
  42. package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
  43. package/es/schema-component/antd/page/hooks/index.mjs +1 -1
  44. package/es/schema-component/antd/page/index.d.ts +1 -0
  45. package/es/schema-component/antd/page/index.mjs +1 -0
  46. package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
  47. package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
  48. package/es/schema-component/antd/page/style.d.ts +0 -5
  49. package/es/schema-component/antd/page/style.mjs +1 -45
  50. package/es/schema-component/antd/password/utils.d.ts +1 -1
  51. package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
  52. package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
  53. package/es/schema-component/antd/select/Select.mjs +6 -1
  54. package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
  55. package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
  56. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
  57. package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
  58. package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
  59. package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
  60. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
  61. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
  62. package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
  63. package/es/user/ChangePassword.mjs +109 -6
  64. package/es/user/index.d.ts +1 -0
  65. package/es/user/index.mjs +2 -0
  66. package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
  67. package/lib/application/Application.js +0 -8
  68. package/lib/application/components/index.js +0 -18
  69. package/lib/block-provider/hooks/index.js +5 -5
  70. package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
  71. package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
  72. package/lib/built-in/index.js +30 -4
  73. package/lib/built-in/pm/index.js +1 -1
  74. package/lib/collection-manager/Configuration/components/Summary.js +3 -3
  75. package/lib/collection-manager/collectionPlugin.js +36 -0
  76. package/lib/collection-manager/index.js +17 -17
  77. package/lib/collection-manager/interfaces/url.js +10 -1
  78. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
  79. package/lib/flag-provider/hooks/useFlag.js +1 -1
  80. package/lib/icon/Icon.js +2 -2
  81. package/lib/locale/zh-CN.js +6 -0
  82. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
  83. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
  84. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
  85. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
  86. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
  87. package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
  88. package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
  89. package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
  90. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
  91. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
  92. package/lib/schema-component/antd/action/Action.Container.js +2 -2
  93. package/lib/schema-component/antd/action/Action.Modal.js +2 -2
  94. package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
  95. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
  96. package/lib/schema-component/antd/association-field/hooks.js +54 -0
  97. package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
  98. package/lib/schema-component/antd/date-picker/util.js +16 -0
  99. package/lib/schema-component/antd/form-tab/index.js +2 -2
  100. package/lib/schema-component/antd/form-v2/index.js +2 -2
  101. package/lib/schema-component/antd/input/Input.js +2 -1
  102. package/lib/schema-component/antd/input/ReadPretty.js +28 -0
  103. package/lib/schema-component/antd/markdown/Markdown.js +5 -5
  104. package/lib/schema-component/antd/page/Page.Settings.js +0 -33
  105. package/lib/schema-component/antd/page/Page.js +41 -90
  106. package/lib/schema-component/antd/page/hooks/index.js +5 -5
  107. package/lib/schema-component/antd/page/index.js +9 -0
  108. package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
  109. package/lib/schema-component/antd/page/style.js +2 -49
  110. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
  111. package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
  112. package/lib/schema-component/antd/select/ReadPretty.js +15 -2
  113. package/lib/schema-component/antd/select/Select.js +6 -1
  114. package/lib/schema-component/antd/table-v2/index.js +3 -3
  115. package/lib/schema-component/antd/upload/shared.js +4 -4
  116. package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
  117. package/lib/schema-settings/EditFormulaTitleField.js +19 -1
  118. package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
  119. package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
  120. package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
  121. package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
  122. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
  123. package/lib/user/ChangePassword.js +118 -5
  124. package/lib/user/index.js +24 -4
  125. package/lib/variables/VariablesProvider.js +2 -2
  126. package/lib/variables/hooks/useBuiltinVariables.js +7 -1
  127. package/package.json +10 -10
  128. package/es/application/components/SharePage.d.ts +0 -4
  129. package/es/application/components/SharePage.mjs +0 -113
  130. package/es/application/components/ShareSchemaComponent.d.ts +0 -1
  131. package/es/application/components/ShareSchemaComponent.mjs +0 -10
  132. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
  133. package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
  134. package/lib/application/components/SharePage.js +0 -156
  135. package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
@@ -28,12 +28,10 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  getImageByUrl: ()=>getImageByUrl,
29
29
  testOpts: ()=>testOpts,
30
30
  isPdf: ()=>isPdf,
31
- toValue: ()=>toValue,
32
31
  getState: ()=>getState,
33
- isImage: ()=>isImage,
34
32
  useValidator: ()=>useValidator,
33
+ isImage: ()=>isImage,
35
34
  toItem: ()=>toItem,
36
- useUploadValidator: ()=>useUploadValidator,
37
35
  getURL: ()=>getURL,
38
36
  normalizeFileList: ()=>normalizeFileList,
39
37
  getErrorMessage: ()=>getErrorMessage,
@@ -41,7 +39,9 @@ __webpack_require__.d(__webpack_exports__, {
41
39
  toArr: ()=>toArr,
42
40
  toImages: ()=>toImages,
43
41
  toMap: ()=>toMap,
44
- useUploadProps: ()=>useUploadProps
42
+ useUploadValidator: ()=>useUploadValidator,
43
+ useUploadProps: ()=>useUploadProps,
44
+ toValue: ()=>toValue
45
45
  });
46
46
  const external_react_namespaceObject = require("react");
47
47
  const schema_namespaceObject = require("@tachybase/schema");
@@ -30,8 +30,10 @@ const external_react_namespaceObject = require("react");
30
30
  const schema_namespaceObject = require("@tachybase/schema");
31
31
  const external_react_i18next_namespaceObject = require("react-i18next");
32
32
  const index_js_namespaceObject = require("../../collection-manager/index.js");
33
+ const external_data_source_index_js_namespaceObject = require("../../data-source/index.js");
34
+ const external_useCompile_js_namespaceObject = require("./useCompile.js");
33
35
  const useFieldModeOptions = (props)=>{
34
- var _fieldSchema_xcomponentprops;
36
+ var _fieldSchema_xcomponentprops, _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
35
37
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
36
38
  const { getCollectionJoinField, getCollection } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
37
39
  const currentFieldSchema = (0, schema_namespaceObject.useFieldSchema)();
@@ -39,12 +41,15 @@ const useFieldModeOptions = (props)=>{
39
41
  const field = (0, schema_namespaceObject.useField)();
40
42
  const form = (0, schema_namespaceObject.useForm)();
41
43
  const isReadPretty = (null == fieldSchema ? void 0 : fieldSchema['x-read-pretty']) || field.readPretty || form.readPretty;
44
+ const dm = (0, external_data_source_index_js_namespaceObject.useDataSourceManager)();
42
45
  const isTableField = null == props ? void 0 : props.fieldSchema;
43
46
  const { getField } = (0, index_js_namespaceObject.useCollection_deprecated)();
44
47
  const collectionField = (null == props ? void 0 : props.collectionField) || getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
48
+ const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
45
49
  const { label } = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.fieldNames) || {};
50
+ const compile = (0, external_useCompile_js_namespaceObject.useCompile)();
46
51
  const fieldModeOptions = (0, external_react_namespaceObject.useMemo)(()=>{
47
- if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return;
52
+ if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return [];
48
53
  if (![
49
54
  'o2o',
50
55
  'oho',
@@ -234,10 +239,6 @@ const useFieldModeOptions = (props)=>{
234
239
  label: t('Tag'),
235
240
  value: 'Tag'
236
241
  },
237
- {
238
- label: t('Custom Title'),
239
- value: 'CustomTitle'
240
- },
241
242
  !isTableField && {
242
243
  label: t('Sub-details'),
243
244
  value: 'Nester'
@@ -266,10 +267,6 @@ const useFieldModeOptions = (props)=>{
266
267
  {
267
268
  label: t('Cascader'),
268
269
  value: 'Cascader'
269
- },
270
- {
271
- label: t('Custom Title'),
272
- value: 'CustomTitle'
273
270
  }
274
271
  ];
275
272
  default:
@@ -314,6 +311,12 @@ const useFieldModeOptions = (props)=>{
314
311
  null == collectionField ? void 0 : collectionField.interface,
315
312
  label
316
313
  ]);
314
+ null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
315
+ if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
316
+ label: compile(item.label),
317
+ value: item.value
318
+ });
319
+ });
317
320
  return (fieldModeOptions || []).filter(Boolean);
318
321
  };
319
322
  exports.useFieldModeOptions = __webpack_exports__.useFieldModeOptions;
@@ -45,6 +45,12 @@ function useFormulaTitleOptions() {
45
45
  const collectionManage = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
46
46
  const collectionManageField = collectionManage.collections.filter((value)=>value.name === fieldSchema['x-decorator-props'])[0];
47
47
  const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
48
+ const isAssociationField = collectionField && [
49
+ 'hasOne',
50
+ 'hasMany',
51
+ 'belongsTo',
52
+ 'belongsToMany'
53
+ ].includes(collectionField.type);
48
54
  let fields = [];
49
55
  if (collectionField) fields = getCollectionFields(collectionField ? collectionField.target ? collectionField.target : collectionField.collectionName : fieldSchema['name']);
50
56
  else if (collectionManageField) fields = collectionManageField['fields'];
@@ -53,7 +59,7 @@ function useFormulaTitleOptions() {
53
59
  if (![
54
60
  'm2m',
55
61
  'o2m'
56
- ].includes(field.interface)) {
62
+ ].includes(field.interface) && isAssociationField) {
57
63
  if (field.uiSchema) {
58
64
  var _getCollectionFields;
59
65
  var _getCollectionFields_filter_map;
@@ -67,6 +73,18 @@ function useFormulaTitleOptions() {
67
73
  });
68
74
  }
69
75
  }
76
+ if (!isAssociationField && field.name === fieldSchema['name']) {
77
+ var _getCollectionFields1;
78
+ var _getCollectionFields_filter_map1;
79
+ options.push({
80
+ label: compile(field.uiSchema.title),
81
+ value: field.name,
82
+ children: null != (_getCollectionFields_filter_map1 = null == (_getCollectionFields1 = getCollectionFields(field.target)) ? void 0 : _getCollectionFields1.filter((subField)=>subField.uiSchema).map((subField)=>({
83
+ label: subField.uiSchema ? compile(subField.uiSchema.title) : '',
84
+ value: subField.name
85
+ }))) ? _getCollectionFields_filter_map1 : []
86
+ });
87
+ }
70
88
  });
71
89
  return options;
72
90
  }
@@ -126,6 +126,7 @@ const SchemaSettingsDefaultValue = function(props) {
126
126
  isInSubForm: isInSubForm,
127
127
  isInSubTable: isInSubTable,
128
128
  isInSetDefaultValueDialog: true,
129
+ collectionField: collectionField,
129
130
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariableInput_js_namespaceObject.VariableInput, {
130
131
  ...props
131
132
  })
@@ -142,7 +143,7 @@ const SchemaSettingsDefaultValue = function(props) {
142
143
  'x-decorator': 'FormItem',
143
144
  'x-component': 'VariableInput',
144
145
  'x-component-props': {
145
- ...(null == fieldSchema ? void 0 : fieldSchema['x-component-props']) || {},
146
+ ...null == fieldSchema ? void 0 : fieldSchema['x-component-props'],
146
147
  collectionField,
147
148
  contextCollectionName: isAllowContextVariable && tableCtx.collection,
148
149
  schema: null == collectionField ? void 0 : collectionField.uiSchema,
@@ -171,7 +172,7 @@ const SchemaSettingsDefaultValue = function(props) {
171
172
  s.type = 'void';
172
173
  }
173
174
  const schema = {
174
- ...s || {},
175
+ ...s,
175
176
  'x-decorator': 'FormItem',
176
177
  'x-component-props': {
177
178
  ...s['x-component-props'],
@@ -71,6 +71,8 @@ const fileManagerComponentFieldSettings_js_namespaceObject = require("../modules
71
71
  const uploadAttachmentComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.js");
72
72
  const inputComponentFieldsSettings_js_namespaceObject = require("../modules/fields/component/Input/inputComponentFieldsSettings.js");
73
73
  const inputNumberComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/InputNumber/inputNumberComponentFieldSettings.js");
74
+ const inputPreviewComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js");
75
+ const multipleSelectComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js");
74
76
  const subformComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Nester/subformComponentFieldSettings.js");
75
77
  const recordPickerComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Picker/recordPickerComponentFieldSettings.js");
76
78
  const subformPopoverComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.js");
@@ -128,6 +130,7 @@ class SchemaSettingsPlugin extends Plugin_js_namespaceObject.Plugin {
128
130
  this.schemaSettingsManager.add(datePickerComponentFieldSettings_js_namespaceObject.datePickerComponentFieldSettings);
129
131
  this.schemaSettingsManager.add(unixTimestampComponentFieldSettings_js_namespaceObject.unixTimestampComponentFieldSettings);
130
132
  this.schemaSettingsManager.add(inputComponentFieldsSettings_js_namespaceObject.inputComponentFieldSettings);
133
+ this.schemaSettingsManager.add(inputPreviewComponentFieldSettings_js_namespaceObject.inputPreviewComponentFieldSettings);
131
134
  this.schemaSettingsManager.add(inputNumberComponentFieldSettings_js_namespaceObject.inputNumberComponentFieldSettings);
132
135
  this.schemaSettingsManager.add(checkboxComponentFieldSettings_js_namespaceObject.checkboxComponentFieldSettings);
133
136
  this.schemaSettingsManager.add(radioComponentFieldSettings_js_namespaceObject.radioComponentFieldSettings);
@@ -137,6 +140,7 @@ class SchemaSettingsPlugin extends Plugin_js_namespaceObject.Plugin {
137
140
  this.schemaSettingsManager.add(cascadeSelectComponentFieldSettings_js_namespaceObject.cascadeSelectComponentFieldSettings);
138
141
  this.schemaSettingsManager.add(uploadAttachmentComponentFieldSettings_js_namespaceObject.uploadAttachmentComponentFieldSettings);
139
142
  this.schemaSettingsManager.add(cascaderComponentFieldSettings_js_namespaceObject.cascaderComponentFieldSettings);
143
+ this.schemaSettingsManager.add(multipleSelectComponentFieldSettings_js_namespaceObject.multipleComponentFieldSettings);
140
144
  }
141
145
  }
142
146
  exports.SchemaSettingsPlugin = __webpack_exports__.SchemaSettingsPlugin;
@@ -6,6 +6,9 @@ var __webpack_modules__ = {
6
6
  "./useDateVariable": function(module) {
7
7
  module.exports = require("./useDateVariable.js");
8
8
  },
9
+ "./useExactDateVariable": function(module) {
10
+ module.exports = require("./useExactDateVariable.js");
11
+ },
9
12
  "./useUserVariable": function(module) {
10
13
  module.exports = require("./useUserVariable.js");
11
14
  }
@@ -71,6 +74,12 @@ var __webpack_exports__ = {};
71
74
  return _useUserVariable__WEBPACK_IMPORTED_MODULE_2__[key];
72
75
  }).bind(0, __WEBPACK_IMPORT_KEY__);
73
76
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
77
+ var _useExactDateVariable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./useExactDateVariable");
78
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
79
+ for(var __WEBPACK_IMPORT_KEY__ in _useExactDateVariable__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
80
+ return _useExactDateVariable__WEBPACK_IMPORTED_MODULE_3__[key];
81
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
82
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
74
83
  })();
75
84
  for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
76
85
  Object.defineProperty(exports, '__esModule', {
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ useExactDateVariable: ()=>useExactDateVariable,
28
+ useExactDateVariableContext: ()=>useExactDateVariableContext
29
+ });
30
+ const external_react_namespaceObject = require("react");
31
+ const external_react_i18next_namespaceObject = require("react-i18next");
32
+ const operators_js_namespaceObject = require("../../../collection-manager/interfaces/properties/operators.js");
33
+ const index_js_namespaceObject = require("../../../flag-provider/index.js");
34
+ const util_js_namespaceObject = require("../../../schema-component/antd/date-picker/util.js");
35
+ const useExactDateVariableContext = ()=>{
36
+ const exactDateTimeCtx = (0, external_react_namespaceObject.useMemo)(()=>(0, util_js_namespaceObject.getDateExact)(), []);
37
+ return {
38
+ exactDateTimeCtx
39
+ };
40
+ };
41
+ const useExactDateVariable = function() {
42
+ let { schema, targetFieldSchema } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
43
+ var _collectionField_uiSchema;
44
+ const { collectionField } = (0, index_js_namespaceObject.useFlag)();
45
+ const { dateOnly, utc, accuracy, picker } = (null == collectionField ? void 0 : null == (_collectionField_uiSchema = collectionField.uiSchema) ? void 0 : _collectionField_uiSchema['x-component-props']) || {};
46
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
47
+ const exactDateTimeSettings = (0, external_react_namespaceObject.useMemo)(()=>{
48
+ const getDateKeys = (key)=>{
49
+ if (!picker) {
50
+ if ('now' === key) return 'nowLocal';
51
+ if ('today' === key) return 'todayDate';
52
+ if ('yesterday' === key) return 'yesterdayDate';
53
+ if ('tomorrow' === key) return 'tomorrowDate';
54
+ }
55
+ if (dateOnly) {
56
+ if ('now' === key) return null;
57
+ return "".concat(key, "Date");
58
+ }
59
+ return "".concat(key).concat(utc || accuracy ? 'Utc' : 'Local');
60
+ };
61
+ const dateOptions = [
62
+ {
63
+ key: 'now',
64
+ value: getDateKeys('now'),
65
+ label: t('Now'),
66
+ operators: operators_js_namespaceObject.datetime
67
+ },
68
+ {
69
+ key: 'today',
70
+ value: getDateKeys('today'),
71
+ label: t('Today'),
72
+ operators: operators_js_namespaceObject.datetime
73
+ },
74
+ {
75
+ key: 'yesterday',
76
+ value: getDateKeys('yesterday'),
77
+ label: t('Yesterday'),
78
+ operators: operators_js_namespaceObject.datetime
79
+ },
80
+ {
81
+ key: 'tomorrow',
82
+ value: getDateKeys('tomorrow'),
83
+ label: t('Tomorrow'),
84
+ operators: operators_js_namespaceObject.datetime
85
+ }
86
+ ].filter((v)=>v.value);
87
+ return {
88
+ label: t('Date variables'),
89
+ value: '$nExactDate',
90
+ key: '$nExactDate',
91
+ children: dateOptions
92
+ };
93
+ }, [
94
+ null == schema ? void 0 : schema['x-component'],
95
+ targetFieldSchema
96
+ ]);
97
+ const { exactDateTimeCtx } = useExactDateVariableContext();
98
+ return {
99
+ exactDateTimeSettings,
100
+ exactDateTimeCtx,
101
+ shouldDisplayExactDate: !!collectionField
102
+ };
103
+ };
104
+ exports.useExactDateVariable = __webpack_exports__.useExactDateVariable;
105
+ exports.useExactDateVariableContext = __webpack_exports__.useExactDateVariableContext;
106
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
107
+ "useExactDateVariable",
108
+ "useExactDateVariableContext"
109
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
110
+ Object.defineProperty(exports, '__esModule', {
111
+ value: true
112
+ });
@@ -29,6 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const external_react_namespaceObject = require("react");
30
30
  const external_useBlockCollection_js_namespaceObject = require("./useBlockCollection.js");
31
31
  const external_useDateVariable_js_namespaceObject = require("./useDateVariable.js");
32
+ const external_useExactDateVariable_js_namespaceObject = require("./useExactDateVariable.js");
32
33
  const external_useFilterVariable_js_namespaceObject = require("./useFilterVariable.js");
33
34
  const external_useFormVariable_js_namespaceObject = require("./useFormVariable.js");
34
35
  const external_useIterationVariable_js_namespaceObject = require("./useIterationVariable.js");
@@ -60,6 +61,12 @@ const useVariableOptions = (param)=>{
60
61
  schema: uiSchema,
61
62
  noDisabled
62
63
  });
64
+ const { exactDateTimeSettings, shouldDisplayExactDate } = (0, external_useExactDateVariable_js_namespaceObject.useExactDateVariable)({
65
+ operator,
66
+ schema: uiSchema,
67
+ noDisabled: true,
68
+ targetFieldSchema
69
+ });
63
70
  const { currentFormSettings, shouldDisplayCurrentForm } = (0, external_useFormVariable_js_namespaceObject.useCurrentFormVariable)({
64
71
  schema: uiSchema,
65
72
  collectionField,
@@ -102,7 +109,8 @@ const useVariableOptions = (param)=>{
102
109
  return (0, external_react_namespaceObject.useMemo)(()=>[
103
110
  currentUserSettings,
104
111
  currentRoleSettings,
105
- datetimeSettings,
112
+ !shouldDisplayExactDate && datetimeSettings,
113
+ shouldDisplayExactDate && exactDateTimeSettings,
106
114
  shouldDisplayCurrentForm && currentFormSettings,
107
115
  shouldDisplayCurrentObject && currentObjectSettings,
108
116
  shouldDisplayCurrentRecord && currentRecordSettings,
@@ -113,6 +121,8 @@ const useVariableOptions = (param)=>{
113
121
  currentUserSettings,
114
122
  currentRoleSettings,
115
123
  datetimeSettings,
124
+ exactDateTimeSettings,
125
+ shouldDisplayExactDate,
116
126
  shouldDisplayCurrentForm,
117
127
  currentFormSettings,
118
128
  shouldDisplayCurrentObject,
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
3
12
  (()=>{
4
13
  __webpack_require__.d = (exports1, definition)=>{
5
14
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -32,6 +41,8 @@ const schema_namespaceObject = require("@tachybase/schema");
32
41
  const external_react_i18next_namespaceObject = require("react-i18next");
33
42
  const external_index_js_namespaceObject = require("../index.js");
34
43
  const index_js_namespaceObject = require("../api-client/index.js");
44
+ const external_VerificationCode_js_namespaceObject = require("./VerificationCode.js");
45
+ var external_VerificationCode_js_default = /*#__PURE__*/ __webpack_require__.n(external_VerificationCode_js_namespaceObject);
35
46
  const useCloseAction = ()=>{
36
47
  const { setVisible } = (0, external_index_js_namespaceObject.useActionContext)();
37
48
  const form = (0, schema_namespaceObject.useForm)();
@@ -77,13 +88,101 @@ const schema = {
77
88
  type: 'void',
78
89
  title: '{{t("Change password")}}',
79
90
  properties: {
91
+ verifyMethod: {
92
+ type: 'string',
93
+ required: true,
94
+ title: '{{t("Verify method")}}',
95
+ enum: [
96
+ {
97
+ label: '{{t("Use old password")}}',
98
+ value: 'password'
99
+ },
100
+ {
101
+ label: '{{t("Use verification code")}}',
102
+ value: 'code'
103
+ }
104
+ ],
105
+ 'x-component': 'Radio.Group',
106
+ 'x-decorator': 'FormItem',
107
+ 'x-reactions': [
108
+ {
109
+ dependencies: [
110
+ '.phoneExist',
111
+ '.oldPasswordExist'
112
+ ],
113
+ fulfill: {
114
+ state: {
115
+ hidden: '{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}',
116
+ value: '{{ undefined }}'
117
+ }
118
+ }
119
+ }
120
+ ]
121
+ },
122
+ phoneExist: {
123
+ type: 'boolean',
124
+ default: '{{ !!phoneNumber }}',
125
+ 'x-hidden': true
126
+ },
127
+ phone: {
128
+ type: 'string',
129
+ title: '{{t("Phone")}}',
130
+ default: '{{ phoneNumber }}',
131
+ 'x-component': 'Input',
132
+ 'x-validator': 'phone',
133
+ 'x-decorator': 'FormItem',
134
+ 'x-hidden': true
135
+ },
136
+ code: {
137
+ type: 'string',
138
+ title: '{{t("Verification code")}}',
139
+ description: "{{codeDescription}}",
140
+ 'x-component': 'VerificationCode',
141
+ 'x-component-props': {
142
+ actionType: 'auth:changePassword',
143
+ targetFieldName: 'phone'
144
+ },
145
+ required: true,
146
+ 'x-decorator': 'FormItem',
147
+ 'x-reactions': [
148
+ {
149
+ dependencies: [
150
+ '.verifyMethod',
151
+ '.phoneExist',
152
+ '.phone'
153
+ ],
154
+ fulfill: {
155
+ state: {
156
+ hidden: "{{ \n !$deps[1] || \n !smsVerifyEnabled ||\n ($deps[0] !== 'code' && $deps[0] !== undefined) // \u6709 verifyMethod \u4F46\u672A\u9009 code\n }}"
157
+ }
158
+ }
159
+ }
160
+ ]
161
+ },
162
+ oldPasswordExist: {
163
+ type: 'boolean',
164
+ default: '{{ oldPassword }}',
165
+ 'x-hidden': true
166
+ },
80
167
  oldPassword: {
81
168
  type: 'string',
82
169
  title: '{{t("Old password")}}',
83
170
  required: true,
84
171
  'x-component': 'Password',
85
172
  'x-decorator': 'FormItem',
86
- 'x-hidden': '{{ hideOldPassword }}'
173
+ 'x-reactions': [
174
+ {
175
+ dependencies: [
176
+ '.verifyMethod',
177
+ '.oldPasswordExist'
178
+ ],
179
+ fulfill: {
180
+ state: {
181
+ hidden: "{{ \n !$deps[1] || \n (smsVerifyEnabled && $deps[0] !== 'password' && $deps[0] !== undefined)\n }}"
182
+ }
183
+ }
184
+ }
185
+ ]
87
186
  },
88
187
  newPassword: {
89
188
  type: 'string',
@@ -157,12 +256,20 @@ const schema = {
157
256
  }
158
257
  };
159
258
  const useChangePassword = ()=>{
160
- var _currentUser_data_data, _currentUser_data;
259
+ var _currentUser_data_data, _currentUser_data, _currentUser_data_data1, _currentUser_data1;
161
260
  const ctx = (0, external_react_namespaceObject.useContext)(external_index_js_namespaceObject.DropdownVisibleContext);
162
261
  const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
163
262
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
263
+ const pm = (0, external_index_js_namespaceObject.useApp)().pluginManager;
264
+ const otp = pm.get('@tachybase/plugin-otp');
265
+ const sms = pm.get('@tachybase/plugin-auth-sms');
266
+ const smsVerifyEnabled = !!otp && !!sms;
164
267
  const currentUser = (0, external_index_js_namespaceObject.useCurrentUserContext)();
165
- const hideOldPassword = (null == currentUser ? void 0 : null == (_currentUser_data = currentUser.data) ? void 0 : null == (_currentUser_data_data = _currentUser_data.data) ? void 0 : _currentUser_data_data.password) === null;
268
+ const oldPassword = (null == currentUser ? void 0 : null == (_currentUser_data = currentUser.data) ? void 0 : null == (_currentUser_data_data = _currentUser_data.data) ? void 0 : _currentUser_data_data.password) !== null;
269
+ const phoneNumber = null == currentUser ? void 0 : null == (_currentUser_data1 = currentUser.data) ? void 0 : null == (_currentUser_data_data1 = _currentUser_data1.data) ? void 0 : _currentUser_data_data1.phone;
270
+ const codeDescription = phoneNumber ? t('Send verification code to phone: {{phoneNumber}}', {
271
+ phoneNumber
272
+ }) : t('Please fill in your mobile phone number in your personal information first');
166
273
  return (0, external_react_namespaceObject.useMemo)(()=>({
167
274
  key: 'password',
168
275
  eventKey: 'ChangePassword',
@@ -184,7 +291,13 @@ const useChangePassword = ()=>{
184
291
  scope: {
185
292
  useCloseAction,
186
293
  useSaveCurrentUserValues,
187
- hideOldPassword
294
+ oldPassword,
295
+ codeDescription,
296
+ phoneNumber,
297
+ smsVerifyEnabled
298
+ },
299
+ components: {
300
+ VerificationCode: external_VerificationCode_js_default()
188
301
  },
189
302
  schema: schema
190
303
  })
@@ -194,7 +307,7 @@ const useChangePassword = ()=>{
194
307
  })
195
308
  }), [
196
309
  visible,
197
- hideOldPassword
310
+ oldPassword
198
311
  ]);
199
312
  };
200
313
  exports.useChangePassword = __webpack_exports__.useChangePassword;
package/lib/user/index.js CHANGED
@@ -8,6 +8,9 @@ var __webpack_modules__ = {
8
8
  },
9
9
  "./CurrentUserSettingsMenuProvider": function(module) {
10
10
  module.exports = require("./CurrentUserSettingsMenuProvider.js");
11
+ },
12
+ "./VerificationCode": function(module) {
13
+ module.exports = require("./VerificationCode.js");
11
14
  }
12
15
  };
13
16
  var __webpack_module_cache__ = {};
@@ -53,26 +56,43 @@ function __webpack_require__(moduleId) {
53
56
  var __webpack_exports__ = {};
54
57
  (()=>{
55
58
  __webpack_require__.r(__webpack_exports__);
59
+ __webpack_require__.d(__webpack_exports__, {
60
+ VerificationCode: ()=>_VerificationCode__WEBPACK_IMPORTED_MODULE_3___default.a
61
+ });
56
62
  var _CurrentUser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./CurrentUser");
57
63
  var __WEBPACK_REEXPORT_OBJECT__ = {};
58
- for(var __WEBPACK_IMPORT_KEY__ in _CurrentUser__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
64
+ for(var __WEBPACK_IMPORT_KEY__ in _CurrentUser__WEBPACK_IMPORTED_MODULE_0__)if ([
65
+ "VerificationCode",
66
+ "default"
67
+ ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
59
68
  return _CurrentUser__WEBPACK_IMPORTED_MODULE_0__[key];
60
69
  }).bind(0, __WEBPACK_IMPORT_KEY__);
61
70
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
62
71
  var _CurrentUserProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./CurrentUserProvider");
63
72
  var __WEBPACK_REEXPORT_OBJECT__ = {};
64
- for(var __WEBPACK_IMPORT_KEY__ in _CurrentUserProvider__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
73
+ for(var __WEBPACK_IMPORT_KEY__ in _CurrentUserProvider__WEBPACK_IMPORTED_MODULE_1__)if ([
74
+ "VerificationCode",
75
+ "default"
76
+ ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
65
77
  return _CurrentUserProvider__WEBPACK_IMPORTED_MODULE_1__[key];
66
78
  }).bind(0, __WEBPACK_IMPORT_KEY__);
67
79
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
68
80
  var _CurrentUserSettingsMenuProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./CurrentUserSettingsMenuProvider");
69
81
  var __WEBPACK_REEXPORT_OBJECT__ = {};
70
- for(var __WEBPACK_IMPORT_KEY__ in _CurrentUserSettingsMenuProvider__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
82
+ for(var __WEBPACK_IMPORT_KEY__ in _CurrentUserSettingsMenuProvider__WEBPACK_IMPORTED_MODULE_2__)if ([
83
+ "VerificationCode",
84
+ "default"
85
+ ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
71
86
  return _CurrentUserSettingsMenuProvider__WEBPACK_IMPORTED_MODULE_2__[key];
72
87
  }).bind(0, __WEBPACK_IMPORT_KEY__);
73
88
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
89
+ var _VerificationCode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./VerificationCode");
90
+ var _VerificationCode__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/ __webpack_require__.n(_VerificationCode__WEBPACK_IMPORTED_MODULE_3__);
74
91
  })();
75
- for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
92
+ exports.VerificationCode = __webpack_exports__.VerificationCode;
93
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
94
+ "VerificationCode"
95
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
76
96
  Object.defineProperty(exports, '__esModule', {
77
97
  value: true
78
98
  });
@@ -33,8 +33,8 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- default: ()=>VariablesProvider,
37
- VariablesContext: ()=>VariablesContext
36
+ VariablesContext: ()=>VariablesContext,
37
+ default: ()=>VariablesProvider
38
38
  });
39
39
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
40
40
  const external_react_namespaceObject = require("react");
@@ -34,6 +34,7 @@ const useBuiltInVariables = ()=>{
34
34
  const { currentUserCtx } = (0, index_js_namespaceObject.useCurrentUserVariable)();
35
35
  const { currentRoleCtx } = (0, useRoleVariable_js_namespaceObject.useCurrentRoleVariable)();
36
36
  const { datetimeCtx } = (0, index_js_namespaceObject.useDatetimeVariable)();
37
+ const { exactDateTimeCtx } = (0, index_js_namespaceObject.useExactDateVariable)();
37
38
  const builtinVariables = (0, external_react_namespaceObject.useMemo)(()=>[
38
39
  {
39
40
  name: '$user',
@@ -58,6 +59,10 @@ const useBuiltInVariables = ()=>{
58
59
  name: '$date',
59
60
  ctx: datetimeCtx
60
61
  },
62
+ {
63
+ name: '$nExactDate',
64
+ ctx: exactDateTimeCtx
65
+ },
61
66
  {
62
67
  name: '$system',
63
68
  ctx: {
@@ -69,7 +74,8 @@ const useBuiltInVariables = ()=>{
69
74
  ctx: ()=>(0, client_namespaceObject.dayjs)().toISOString()
70
75
  }
71
76
  ], [
72
- currentUserCtx
77
+ currentUserCtx,
78
+ exactDateTimeCtx
73
79
  ]);
74
80
  return {
75
81
  builtinVariables