@pisell/materials 6.0.6 → 6.0.7

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 (173) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +7 -7
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +21 -53
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -50
  11. package/es/components/config-provider/index.js +1 -1
  12. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -11
  13. package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  14. package/es/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
  15. package/es/components/dataSourceComponents/dataSourceForm/index.js +4 -2
  16. package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
  17. package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +11 -3
  18. package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +10 -3
  19. package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
  20. package/es/components/dataSourceComponents/dataSourceForm/serve.js +36 -20
  21. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +46 -25
  22. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
  23. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
  24. package/es/components/dataSourceComponents/dataSourceForm/utils.js +38 -10
  25. package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
  26. package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
  27. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
  28. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +28 -5
  29. package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
  30. package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +9 -1
  31. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +7 -1
  32. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
  33. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
  34. package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
  35. package/es/components/dataSourceComponents/fields/Select/index.js +7 -1
  36. package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
  37. package/es/components/dataSourceComponents/fields/Upload/serve.js +10 -31
  38. package/es/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
  39. package/es/components/dataSourceComponents/hooks/useActions.js +73 -36
  40. package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
  41. package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
  42. package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +49 -3
  43. package/es/components/login-and-register/index.d.ts +82 -0
  44. package/es/components/login-and-register/index.js +360 -0
  45. package/es/components/login-and-register/index.less +211 -0
  46. package/es/components/organizationTenantSwitcher/defaultLogo.png +0 -0
  47. package/es/components/organizationTenantSwitcher/index.d.ts +17 -0
  48. package/es/components/organizationTenantSwitcher/index.js +96 -0
  49. package/es/components/organizationTenantSwitcher/index.less +88 -0
  50. package/es/components/page/index.js +4 -4
  51. package/es/components/page-header/index.d.ts +14 -0
  52. package/es/components/page-header/index.js +36 -0
  53. package/es/components/page-header/index.less +45 -0
  54. package/es/components/pisellAvatar/index.d.ts +19 -0
  55. package/es/components/pisellAvatar/index.js +89 -0
  56. package/es/components/pisellAvatar/index.less +26 -0
  57. package/es/components/pisellModal/components/PcModal/index.js +1 -1
  58. package/es/components/pisellTags/index.d.ts +13 -0
  59. package/es/components/pisellTags/index.js +83 -0
  60. package/es/components/pisellTags/index.less +17 -0
  61. package/es/components/pisellTags/utils.d.ts +1 -0
  62. package/es/components/pisellTags/utils.js +89 -0
  63. package/es/components/pisellText/components/Amount/index.js +1 -1
  64. package/es/components/profileMenu/index.d.ts +26 -0
  65. package/es/components/profileMenu/index.js +115 -0
  66. package/es/components/profileMenu/index.less +135 -0
  67. package/es/components/table/Header/index.js +8 -11
  68. package/es/index.d.ts +6 -0
  69. package/es/index.js +7 -1
  70. package/es/locales/en-US.d.ts +1 -0
  71. package/es/locales/en-US.js +1 -0
  72. package/es/locales/zh-CN.d.ts +1 -0
  73. package/es/locales/zh-CN.js +1 -0
  74. package/es/locales/zh-TW.d.ts +1 -0
  75. package/es/locales/zh-TW.js +1 -0
  76. package/lib/components/config-provider/index.js +1 -1
  77. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +22 -4
  78. package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  79. package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
  80. package/lib/components/dataSourceComponents/dataSourceForm/index.js +3 -2
  81. package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
  82. package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +17 -3
  83. package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +16 -6
  84. package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
  85. package/lib/components/dataSourceComponents/dataSourceForm/serve.js +9 -5
  86. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +15 -4
  87. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
  88. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
  89. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +51 -5
  90. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
  91. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
  92. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +7 -0
  93. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +24 -3
  94. package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
  95. package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +9 -1
  96. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -1
  97. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
  98. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
  99. package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
  100. package/lib/components/dataSourceComponents/fields/Select/index.js +5 -1
  101. package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
  102. package/lib/components/dataSourceComponents/fields/Upload/serve.js +20 -12
  103. package/lib/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
  104. package/lib/components/dataSourceComponents/hooks/useActions.js +25 -7
  105. package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
  106. package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
  107. package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +49 -3
  108. package/lib/components/login-and-register/index.d.ts +82 -0
  109. package/lib/components/login-and-register/index.js +261 -0
  110. package/lib/components/login-and-register/index.less +211 -0
  111. package/lib/components/organizationTenantSwitcher/defaultLogo.png +0 -0
  112. package/lib/components/organizationTenantSwitcher/index.d.ts +17 -0
  113. package/lib/components/organizationTenantSwitcher/index.js +119 -0
  114. package/lib/components/organizationTenantSwitcher/index.less +88 -0
  115. package/lib/components/page/index.js +4 -4
  116. package/lib/components/page-header/index.d.ts +14 -0
  117. package/lib/components/page-header/index.js +63 -0
  118. package/lib/components/page-header/index.less +45 -0
  119. package/lib/components/pisellAvatar/index.d.ts +19 -0
  120. package/lib/components/pisellAvatar/index.js +108 -0
  121. package/lib/components/pisellAvatar/index.less +26 -0
  122. package/lib/components/pisellModal/components/PcModal/index.js +1 -1
  123. package/lib/components/pisellTags/index.d.ts +13 -0
  124. package/lib/components/pisellTags/index.js +113 -0
  125. package/lib/components/pisellTags/index.less +17 -0
  126. package/lib/components/pisellTags/utils.d.ts +1 -0
  127. package/lib/components/pisellTags/utils.js +86 -0
  128. package/lib/components/pisellText/components/Amount/index.js +2 -2
  129. package/lib/components/profileMenu/index.d.ts +26 -0
  130. package/lib/components/profileMenu/index.js +113 -0
  131. package/lib/components/profileMenu/index.less +135 -0
  132. package/lib/components/table/Header/index.js +11 -1
  133. package/lib/index.d.ts +6 -0
  134. package/lib/index.js +18 -0
  135. package/lib/locales/en-US.d.ts +1 -0
  136. package/lib/locales/en-US.js +1 -0
  137. package/lib/locales/zh-CN.d.ts +1 -0
  138. package/lib/locales/zh-CN.js +1 -0
  139. package/lib/locales/zh-TW.d.ts +1 -0
  140. package/lib/locales/zh-TW.js +1 -0
  141. package/lowcode/_utils/defaultSchema.ts +64 -0
  142. package/lowcode/data-source-form/meta.ts +130 -0
  143. package/lowcode/data-source-form/utils.ts +33 -3
  144. package/lowcode/data-source-table/meta.ts +139 -3
  145. package/lowcode/data-source-table/utils.tsx +6 -0
  146. package/lowcode/form-item-date-picker/snippets.ts +3 -0
  147. package/lowcode/form-item-input/snippets.ts +3 -1
  148. package/lowcode/form-item-input-number/snippets.ts +4 -0
  149. package/lowcode/form-item-input.email/snippets.ts +3 -0
  150. package/lowcode/form-item-input.json/snippets.ts +4 -1
  151. package/lowcode/form-item-input.password/snippets.ts +3 -0
  152. package/lowcode/form-item-input.phone/snippets.ts +3 -0
  153. package/lowcode/form-item-input.text-area/snippets.ts +3 -1
  154. package/lowcode/form-item-input.url/snippets.ts +3 -0
  155. package/lowcode/form-item-select/meta.ts +2 -1
  156. package/lowcode/form-item-select/snippets.ts +6 -0
  157. package/lowcode/form-item-time-picker/snippets.ts +3 -0
  158. package/lowcode/form-item-translation/snippets.ts +3 -1
  159. package/lowcode/login-and-register/meta.ts +541 -0
  160. package/lowcode/login-and-register/snippets.ts +38 -0
  161. package/lowcode/organization-tenant-switch/meta.ts +127 -0
  162. package/lowcode/page-header/meta.ts +68 -124
  163. package/lowcode/page-header/snippets.ts +1 -1
  164. package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
  165. package/lowcode/pisell-avatar/meta.ts +111 -0
  166. package/lowcode/pisell-avatar/snippets.ts +14 -0
  167. package/lowcode/pisell-tags/__screenshots__/tag-1.png +0 -0
  168. package/lowcode/pisell-tags/meta.ts +123 -0
  169. package/lowcode/pisell-tags/snippets.ts +14 -0
  170. package/lowcode/profile-menu/meta.ts +175 -0
  171. package/lowcode/profile-menu/snippets.ts +71 -0
  172. package/lowcode/submit-button/meta.ts +6 -0
  173. package/package.json +3 -3
@@ -74,6 +74,11 @@ export var formItemNameReverse = function formItemNameReverse(name) {
74
74
  return name.replace(new RegExp(FORM_ITEM_SPLIT_CHAR, 'g'), '.');
75
75
  };
76
76
 
77
+ // 验证域名
78
+ export var isValidDomain = function isValidDomain(value) {
79
+ return /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z]{2,})+$/.test(value);
80
+ };
81
+
77
82
  /**
78
83
  * @title: 追加formItem层
79
84
  * @description:
@@ -157,6 +162,13 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
157
162
  message: typeobj.message || getText('pisell-data-source-form-email-message')
158
163
  }));
159
164
  }
165
+ if (typeobj.type === 'domain' && typeobj.enabled) {
166
+ rules.push({
167
+ validator: function validator(_, value) {
168
+ return isValidDomain(value) ? Promise.resolve() : Promise.reject(new Error(typeobj.message || getText('pisell-data-source-form-domain-message')));
169
+ }
170
+ });
171
+ }
160
172
  if (typeobj.type === 'url' && typeobj.enabled) {
161
173
  rules.push(_objectSpread(_objectSpread({}, typeobj), {}, {
162
174
  message: typeobj.message || getText('pisell-data-source-form-url-message')
@@ -166,10 +178,15 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
166
178
  rules.push({
167
179
  validator: function validator(_, value) {
168
180
  var _parsePhoneNumberFrom;
169
- return isValidPhoneNumber(value) && (_parsePhoneNumberFrom = parsePhoneNumberFromString(value)) !== null && _parsePhoneNumberFrom !== void 0 && _parsePhoneNumberFrom.isValid() ? Promise.resolve() : Promise.reject(new Error(typeobj.message || getText('pisell-data-source-form-phone-message')));
181
+ return !otherProps.disabled || isValidPhoneNumber(value) && (_parsePhoneNumberFrom = parsePhoneNumberFromString(value)) !== null && _parsePhoneNumberFrom !== void 0 && _parsePhoneNumberFrom.isValid() ? Promise.resolve() : Promise.reject(new Error(typeobj.message || getText('pisell-data-source-form-phone-message')));
170
182
  }
171
183
  });
172
184
  }
185
+ if (typeobj.type === 'pattern' && typeobj.enabled) {
186
+ rules.push(_objectSpread(_objectSpread({}, typeobj), {}, {
187
+ message: typeobj.message
188
+ }));
189
+ }
173
190
  }
174
191
  if (maxLengthobj && maxLengthobj.enabled) {
175
192
  rules.push({
@@ -211,13 +228,13 @@ export var withFormItem = function withFormItem(WrappedComponent, overlayProps)
211
228
  }
212
229
  if (maxobj && maxobj.enabled) {
213
230
  rules.push(_objectSpread(_objectSpread({}, maxobj), {}, {
214
- type: "number",
231
+ type: 'number',
215
232
  message: maxobj.message || getText('pisell-data-source-form-max-value-message')(maxobj === null || maxobj === void 0 ? void 0 : maxobj.max)
216
233
  }));
217
234
  }
218
235
  if (minobj && minobj.enabled) {
219
236
  rules.push(_objectSpread(_objectSpread({}, minobj), {}, {
220
- type: "number",
237
+ type: 'number',
221
238
  message: minobj.message || getText('pisell-data-source-form-min-value-message')(minobj === null || minobj === void 0 ? void 0 : minobj.min)
222
239
  }));
223
240
  }
@@ -290,18 +307,18 @@ export var withOptions = function withOptions(WrappedComponent) {
290
307
  }
291
308
  }, []);
292
309
  var options = useMemo(function () {
293
- var _list$data, _list$data$data;
310
+ var _list$data, _list$data$data, _list$data$data$filte;
294
311
  if (optionSourceType !== 'api') {
295
312
  return propsOptions;
296
313
  }
297
- return (((_list$data = list.data) === null || _list$data === void 0 ? void 0 : (_list$data$data = _list$data.data) === null || _list$data$data === void 0 ? void 0 : _list$data$data.map(function (item) {
314
+ return (((_list$data = list.data) === null || _list$data === void 0 ? void 0 : (_list$data$data = _list$data.data) === null || _list$data$data === void 0 ? void 0 : (_list$data$data$filte = _list$data$data.filter) === null || _list$data$data$filte === void 0 ? void 0 : _list$data$data$filte.call(_list$data$data, function (item) {
315
+ return !['draft', 'inactive', 'disabled'].includes(item === null || item === void 0 ? void 0 : item.status);
316
+ })) || []).map(function (item) {
298
317
  return {
299
318
  label: translationOriginal(item[labelField]),
300
319
  value: item[valueField]
301
320
  };
302
- })) || []).sort(function (a, b) {
303
- return a.label.localeCompare(b.label);
304
- });
321
+ }) || [];
305
322
  }, [propsOptions, optionSourceType, list === null || list === void 0 ? void 0 : (_list$data2 = list.data) === null || _list$data2 === void 0 ? void 0 : _list$data2.data]);
306
323
  return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
307
324
  options: options
@@ -343,7 +360,7 @@ export var renderValueWithMap = function renderValueWithMap(value, valueMap, ren
343
360
  key: item,
344
361
  className: "pisell-form-read-pretty-value",
345
362
  style: textStyle
346
- }, valueMap === null || valueMap === void 0 ? void 0 : valueMap[item]), index < value.length - 1 && ',');
363
+ }, valueMap === null || valueMap === void 0 ? void 0 : valueMap[item]), index < value.length - 1 && ', ');
347
364
  }));
348
365
  } else if (isString(value)) {
349
366
  return /*#__PURE__*/React.createElement("span", {
@@ -357,4 +374,15 @@ export var renderValueWithMap = function renderValueWithMap(value, valueMap, ren
357
374
  };
358
375
  export function toArr(str) {
359
376
  return Array.isArray(str) ? str : [str];
360
- }
377
+ }
378
+ var systemFields = ['createdAt', 'updatedAt', 'createdBy', 'created_at', 'updated_at', 'deleted_at'];
379
+
380
+ // 提交时过滤系统字段
381
+ export var filterSystemFields = function filterSystemFields(params) {
382
+ return Object.keys(params).reduce(function (acc, key) {
383
+ if (!systemFields.includes(key)) {
384
+ acc[key] = params[key];
385
+ }
386
+ return acc;
387
+ }, {});
388
+ };
@@ -158,7 +158,7 @@ var Filter = function Filter(props) {
158
158
  layout: "inline",
159
159
  className: "filter-form-wrapper",
160
160
  onValuesChange: onValuesChange
161
- }, searchDom, filterDom, show && /*#__PURE__*/React.createElement(FilterButton, {
161
+ }, searchDom, filterDom, show && sortButtonShow && /*#__PURE__*/React.createElement(FilterButton, {
162
162
  value: list,
163
163
  quickFilterMaxLength: quickFilterMaxLength,
164
164
  formFiltersPrefix: '',
@@ -46,7 +46,10 @@ var useColumns = function useColumns(_ref) {
46
46
  var fieldProps = genFieldProps(field, (_other = column.other) === null || _other === void 0 ? void 0 : _other.fieldProps);
47
47
  return _objectSpread(_objectSpread({}, column), {}, {
48
48
  title: title,
49
- render: function render(text) {
49
+ render: function render(text, record, index) {
50
+ if (column !== null && column !== void 0 && column.render) {
51
+ return column.render(text, record, index);
52
+ }
50
53
  return /*#__PURE__*/React.createElement(FieldComponent, _extends({}, fieldProps, {
51
54
  value: text
52
55
  }));
@@ -81,5 +81,12 @@ declare const useTableProps: (props: UseTablePropsProps) => {
81
81
  }[];
82
82
  } | undefined;
83
83
  onValuesChange?: ((changedValues: any, values: any) => void) | undefined;
84
+ extraParams?: {
85
+ list?: Record<string, any> | undefined;
86
+ get?: Record<string, any> | undefined;
87
+ update?: Record<string, any> | undefined;
88
+ create?: Record<string, any> | undefined;
89
+ destroy?: Record<string, any> | undefined;
90
+ } | undefined;
84
91
  };
85
92
  export default useTableProps;
@@ -10,7 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
10
10
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
11
  import React, { useMemo, useEffect } from 'react';
12
12
  import { Button, Space } from 'antd';
13
- import { isString } from '@pisell/utils';
13
+ import { isBoolean, isFunction, isString } from '@pisell/utils';
14
14
  import { useMemoizedFn } from 'ahooks';
15
15
  import Filter from "../filter";
16
16
  import usePagination from "./usePagination";
@@ -94,6 +94,11 @@ var useTableProps = function useTableProps(props) {
94
94
 
95
95
  // 打开抽屉
96
96
  var handleOpenDrawer = useMemoizedFn(function (record, item) {
97
+ var _item$onClick;
98
+ item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, record);
99
+ if (item.openMode === 'custom') {
100
+ return;
101
+ }
97
102
  registerValueVariable === null || registerValueVariable === void 0 ? void 0 : registerValueVariable(componentId, {
98
103
  currentRecord: record
99
104
  });
@@ -159,7 +164,8 @@ var useTableProps = function useTableProps(props) {
159
164
  render: function render(_, record) {
160
165
  return /*#__PURE__*/React.createElement(Space, null, items === null || items === void 0 ? void 0 : items.map(function (item) {
161
166
  var label = item.label,
162
- actionType = item.actionType;
167
+ actionType = item.actionType,
168
+ show = item.show;
163
169
  var handleClick = function handleClick() {
164
170
  if (actionType === 'delete') {
165
171
  PisellModal.confirm({
@@ -176,6 +182,16 @@ var useTableProps = function useTableProps(props) {
176
182
  handleOpenDrawer(record, item);
177
183
  }
178
184
  };
185
+ if (isBoolean(show)) {
186
+ if (!show) {
187
+ return null;
188
+ }
189
+ } else if (isFunction(show)) {
190
+ var result = show(record);
191
+ if (!result) {
192
+ return null;
193
+ }
194
+ }
179
195
  return /*#__PURE__*/React.createElement(Button, {
180
196
  onClick: handleClick,
181
197
  type: type === 'link' ? 'link' : 'default',
@@ -200,11 +216,18 @@ var useTableProps = function useTableProps(props) {
200
216
  }
201
217
  return titleButtons === null || titleButtons === void 0 ? void 0 : (_titleButtons$items = titleButtons.items) === null || _titleButtons$items === void 0 ? void 0 : _titleButtons$items.map(function (button) {
202
218
  var actionType = button.actionType,
203
- buttonProps = button.buttonProps;
219
+ buttonProps = button.buttonProps,
220
+ beforeOpen = button.beforeOpen;
204
221
  return _objectSpread(_objectSpread(_objectSpread({}, button), buttonProps), {}, {
205
222
  onClick: function onClick() {
206
223
  if (actionType === 'add') {
207
- handleOpenDrawer(null, button);
224
+ var result = true;
225
+ if (beforeOpen) {
226
+ result = beforeOpen();
227
+ }
228
+ if (result) {
229
+ handleOpenDrawer(null, button);
230
+ }
208
231
  }
209
232
  }
210
233
  });
@@ -219,7 +242,7 @@ var useTableProps = function useTableProps(props) {
219
242
  var actionType = button.actionType,
220
243
  buttonProps = button.buttonProps;
221
244
  return _objectSpread(_objectSpread(_objectSpread({}, button), buttonProps), {}, {
222
- size: "large",
245
+ size: 'large',
223
246
  title: button.label,
224
247
  onClick: function onClick() {
225
248
  if (actionType === 'add') {
@@ -4,10 +4,12 @@ import DataSourceProvider from "../provider/dataSource/DataSourceProvider";
4
4
  import "./index.less";
5
5
  var DataSourceTable = function DataSourceTable(props) {
6
6
  var dataSource = props.dataSource,
7
- __designMode = props.__designMode;
7
+ __designMode = props.__designMode,
8
+ extraParams = props.extraParams;
8
9
  return /*#__PURE__*/React.createElement(DataSourceProvider, {
9
10
  dataSource: dataSource,
10
- __designMode: __designMode
11
+ __designMode: __designMode,
12
+ extraParams: extraParams
11
13
  }, /*#__PURE__*/React.createElement(BaseTable, props));
12
14
  };
13
15
  export default DataSourceTable;
@@ -3,12 +3,13 @@ import { ColumnType } from 'antd/es/table';
3
3
  import { DataSourceType } from '../provider/dataSource/DataSourceContext';
4
4
  export declare type OperationItem = {
5
5
  label?: string;
6
- openMode: 'modal' | 'drawer';
6
+ openMode: 'modal' | 'drawer' | 'custom';
7
7
  openContentSize: 'small' | 'middle' | 'large';
8
8
  openTitle: string;
9
9
  actionType: 'detail' | 'edit' | 'delete' | 'custom';
10
10
  key: string;
11
11
  buttonProps?: any;
12
+ onClick?: (record: any) => void;
12
13
  };
13
14
  export interface DataSourceTableProps {
14
15
  title?: string | React.ReactNode | (() => React.ReactNode);
@@ -67,4 +68,11 @@ export interface DataSourceTableProps {
67
68
  }[];
68
69
  };
69
70
  onValuesChange?: (changedValues: any, values: any) => void;
71
+ extraParams?: {
72
+ list?: Record<string, any>;
73
+ get?: Record<string, any>;
74
+ update?: Record<string, any>;
75
+ create?: Record<string, any>;
76
+ destroy?: Record<string, any>;
77
+ };
70
78
  }
@@ -1,4 +1,4 @@
1
- var _excluded = ["value", "onChange", "isVerification"];
1
+ var _excluded = ["value", "onChange", "isVerification", "disabled"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -22,6 +22,7 @@ var PhoneInput = function PhoneInput(_ref) {
22
22
  var propsValue = _ref.value,
23
23
  onChange = _ref.onChange,
24
24
  isVerification = _ref.isVerification,
25
+ disabled = _ref.disabled,
25
26
  props = _objectWithoutProperties(_ref, _excluded);
26
27
  var _useCountries = useCountries(),
27
28
  _useCountries$data = _useCountries.data,
@@ -86,6 +87,9 @@ var PhoneInput = function PhoneInput(_ref) {
86
87
  var selectedCountry = countries.find(function (c) {
87
88
  return c.code === countryCode;
88
89
  });
90
+ if (phoneNumber.length === 0) {
91
+ return "";
92
+ }
89
93
  var prefix = (selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.prefix) || "";
90
94
  return "".concat(prefix).concat(phoneNumber);
91
95
  }, [countryCode, phoneNumber, countries]);
@@ -102,6 +106,7 @@ var PhoneInput = function PhoneInput(_ref) {
102
106
  return /*#__PURE__*/React.createElement(Space.Compact, {
103
107
  block: true
104
108
  }, /*#__PURE__*/React.createElement(Select, {
109
+ disabled: disabled,
105
110
  value: countryCode,
106
111
  onChange: handleCountryChange,
107
112
  style: {
@@ -120,6 +125,7 @@ var PhoneInput = function PhoneInput(_ref) {
120
125
  };
121
126
  })
122
127
  }), /*#__PURE__*/React.createElement(Input, _extends({}, props, {
128
+ disabled: disabled,
123
129
  status: status,
124
130
  type: "tel",
125
131
  value: phoneNumber,
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UrlProps } from './type';
3
3
  import './ReadPretty.less';
4
+ export declare const formatUrl: (url: string) => string;
4
5
  declare const UrlReadPretty: (props: UrlProps) => React.JSX.Element;
5
6
  export default UrlReadPretty;
@@ -3,14 +3,29 @@ import { Typography } from 'antd';
3
3
  import classNames from 'classnames';
4
4
  import "./ReadPretty.less";
5
5
  var Link = Typography.Link;
6
+
7
+ // 格式化 url 确保包含协议前缀
8
+ export var formatUrl = function formatUrl(url) {
9
+ if (!url) return '';
10
+
11
+ // 如果已经包含协议前缀,直接返回
12
+ if (url.startsWith('http://') || url.startsWith('https://')) {
13
+ return url;
14
+ }
15
+
16
+ // 默认添加 https:// 前缀
17
+ return "https://".concat(url);
18
+ };
6
19
  var UrlReadPretty = function UrlReadPretty(props) {
7
20
  var value = props.value,
8
21
  renderMode = props.renderMode;
22
+ var formattedUrl = formatUrl(value);
9
23
  return /*#__PURE__*/React.createElement(Link, {
10
24
  className: classNames('pisell-url-read-pretty', {
11
25
  'pisell-url-read-pretty-table-view': renderMode === 'tableView'
12
26
  }),
13
- href: value
27
+ href: formattedUrl,
28
+ target: "_blank"
14
29
  }, value);
15
30
  };
16
31
  export default UrlReadPretty;
@@ -1,5 +1,5 @@
1
1
  .pisell-url-read-pretty {
2
- color: var(--Gray-900, #101828);
2
+ //color: var(--Gray-900, #101828);
3
3
  font-size: 16px;
4
4
  font-weight: 600;
5
5
  line-height: 24px; /* 150% */
@@ -2,7 +2,13 @@ import { withFormItem, withDataSource, withOptions } from "../../dataSourceForm/
2
2
  import SelectWithMode from "./WithMode";
3
3
 
4
4
  // 包装formItem层
5
- var SelectWithFormItem = withFormItem(SelectWithMode);
5
+ var SelectWithFormItem = withFormItem(SelectWithMode, {
6
+ innerProps: {
7
+ getPopupContainer: function getPopupContainer(triggerNode) {
8
+ return triggerNode.parentElement;
9
+ }
10
+ }
11
+ });
6
12
 
7
13
  // 包装Options层
8
14
  var SelectWithOptions = withOptions(SelectWithFormItem);
@@ -8,7 +8,10 @@ export interface MediaType {
8
8
  maxsize: number;
9
9
  }
10
10
  export declare const useMediaConfig: () => {
11
- data: any;
11
+ data: {
12
+ upload_onetime_limit: any;
13
+ upload_maxsize: any;
14
+ };
12
15
  };
13
16
  export declare const useMediaTypes: () => {
14
17
  data: MediaType[];
@@ -11,6 +11,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
11
11
  import { useRequest } from 'ahooks';
12
12
  import { getPointSuffix } from "./utils";
13
13
  import { request } from "../../../table/utils";
14
+ import useEngineContext from "../../../../hooks/useEngineContext";
14
15
 
15
16
  /**
16
17
  * 获取nocobase媒体数据列表
@@ -43,47 +44,25 @@ export var getMediaTypeList = /*#__PURE__*/function () {
43
44
  return _ref.apply(this, arguments);
44
45
  };
45
46
  }();
46
- var getMediaConfig = /*#__PURE__*/function () {
47
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
48
- var data;
49
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
50
- while (1) switch (_context2.prev = _context2.next) {
51
- case 0:
52
- _context2.next = 2;
53
- return request.getRequest().get("/core/module/media/config", {});
54
- case 2:
55
- data = _context2.sent;
56
- return _context2.abrupt("return", data);
57
- case 4:
58
- case "end":
59
- return _context2.stop();
60
- }
61
- }, _callee2);
62
- }));
63
- return function getMediaConfig() {
64
- return _ref2.apply(this, arguments);
65
- };
66
- }();
67
47
  export var useMediaConfig = function useMediaConfig() {
68
- var _useRequest = useRequest(getMediaConfig, {
69
- cacheKey: 'media-config',
70
- staleTime: 1000 * 60 * 5,
71
- // 5分钟后数据过期
72
- cacheTime: 1000 * 60 * 60 // 1小时后清除缓存
73
- }),
74
- data = _useRequest.data;
48
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _context$appHelper$ut7, _context$appHelper$ut8;
49
+ var context = useEngineContext();
50
+ var data = (_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.data) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.store) === null || _context$appHelper$ut5 === void 0 ? void 0 : (_context$appHelper$ut6 = _context$appHelper$ut5.getStore) === null || _context$appHelper$ut6 === void 0 ? void 0 : (_context$appHelper$ut7 = _context$appHelper$ut6.call(_context$appHelper$ut5)) === null || _context$appHelper$ut7 === void 0 ? void 0 : (_context$appHelper$ut8 = _context$appHelper$ut7.getDataByModel) === null || _context$appHelper$ut8 === void 0 ? void 0 : _context$appHelper$ut8.call(_context$appHelper$ut7, 'core', 'core');
75
51
  return {
76
- data: data
52
+ data: {
53
+ upload_onetime_limit: data === null || data === void 0 ? void 0 : data.media_upload_onetime_limit,
54
+ upload_maxsize: data === null || data === void 0 ? void 0 : data.media_upload_maxsize
55
+ }
77
56
  };
78
57
  };
79
58
  export var useMediaTypes = function useMediaTypes() {
80
- var _useRequest2 = useRequest(getMediaTypeList, {
59
+ var _useRequest = useRequest(getMediaTypeList, {
81
60
  cacheKey: 'media-type',
82
61
  staleTime: 1000 * 60 * 5,
83
62
  // 5分钟后数据过期
84
63
  cacheTime: 1000 * 60 * 60 // 1小时后清除缓存
85
64
  }),
86
- data = _useRequest2.data;
65
+ data = _useRequest.data;
87
66
  var getExtensionsByIds = function getExtensionsByIds(ids) {
88
67
  var extensions = [];
89
68
  (data || []).forEach(function (item) {
@@ -3,8 +3,9 @@ export interface UseActionsParams {
3
3
  dataSource?: DataSourceType;
4
4
  currentValue?: 'server' | 'local';
5
5
  __designMode?: string;
6
+ extraParams?: Record<string, any>;
6
7
  }
7
- declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, }?: UseActionsParams) => {
8
+ declare const useActions: ({ dataSource: propsDataSource, currentValue: propsCurrentValue, __designMode, extraParams: propsExtraParams, }?: UseActionsParams) => {
8
9
  create: (values: Record<string, any>) => Promise<any>;
9
10
  get: () => Promise<any>;
10
11
  update: (values: Record<string, any>) => Promise<any>;