@nokecy/qc-ui 1.0.60 → 1.0.61

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.
@@ -16,9 +16,9 @@ import ImportModal from "./importModal";
16
16
  import FullScreenAlert from "./fullScreenAlert";
17
17
  import ConfirmPro from "./ConfirmPro";
18
18
  import { GeneratedListPage } from "./generatedListPage";
19
- import { StandardFormDialog } from "./standardFormDialog";
19
+ import { StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField } from "./standardFormDialog";
20
20
  import DeleteConfirm from "./deleteConfirm";
21
- export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, DeleteConfirm };
21
+ export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField, DeleteConfirm };
22
22
  export type * from "./generatedListPage";
23
23
  export type * from "./standardFormDialog";
24
24
  export type * from "./deleteConfirm";
package/dist/cjs/index.js CHANGED
@@ -75,6 +75,12 @@ Object.defineProperty(exports, "ExtensibleGrid", {
75
75
  return _extensibleGrid.default;
76
76
  }
77
77
  });
78
+ Object.defineProperty(exports, "FieldCreators", {
79
+ enumerable: true,
80
+ get: function get() {
81
+ return _standardFormDialog.FieldCreators;
82
+ }
83
+ });
78
84
  Object.defineProperty(exports, "FormDesigner", {
79
85
  enumerable: true,
80
86
  get: function get() {
@@ -135,12 +141,30 @@ Object.defineProperty(exports, "ToolBar", {
135
141
  return _toolBar.default;
136
142
  }
137
143
  });
144
+ Object.defineProperty(exports, "createCascaderField", {
145
+ enumerable: true,
146
+ get: function get() {
147
+ return _standardFormDialog.createCascaderField;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "createSelectField", {
151
+ enumerable: true,
152
+ get: function get() {
153
+ return _standardFormDialog.createSelectField;
154
+ }
155
+ });
138
156
  Object.defineProperty(exports, "flattenTreeDeep", {
139
157
  enumerable: true,
140
158
  get: function get() {
141
159
  return _agGridPlus.flattenTreeDeep;
142
160
  }
143
161
  });
162
+ Object.defineProperty(exports, "withStandardForm", {
163
+ enumerable: true,
164
+ get: function get() {
165
+ return _standardFormDialog.withStandardForm;
166
+ }
167
+ });
144
168
  var _agGridPlus = require("./ag-grid-plus");
145
169
  var _arrayTable = _interopRequireDefault(require("./array-table"));
146
170
  var _arrayTableIndex = _interopRequireDefault(require("./array-table-index"));
@@ -91,6 +91,8 @@ export interface WithStandardFormConfig {
91
91
  initializer?: (form: any, entityId?: string | number) => Promise<void>;
92
92
  submitHandler?: (values: any, isEdit: boolean) => Promise<void>;
93
93
  };
94
+ /** 自定义组件映射 */
95
+ customComponents?: Record<string, React.ComponentType<any>>;
94
96
  }
95
97
  /**
96
98
  * StandardFormDialog组件属性接口
@@ -4,10 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.withStandardForm = exports.default = exports.createSelectField = exports.createCascaderField = exports.FieldCreators = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _react2 = require("@formily/react");
9
+ var _antdV = require("@formily/antd-v5");
8
10
  var _StandardFormDialog = _interopRequireDefault(require("./StandardFormDialog"));
9
11
  var _excluded = ["entityId", "title", "width", "onAfterSubmit", "children", "buttonProps"];
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
15
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
16
  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); }
13
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -66,7 +70,9 @@ var withStandardForm = exports.withStandardForm = function withStandardForm(conf
66
70
  _config$defaultDialog = config.defaultDialogConfig,
67
71
  defaultDialogConfig = _config$defaultDialog === void 0 ? {} : _config$defaultDialog,
68
72
  _config$customHandler = config.customHandlers,
69
- customHandlers = _config$customHandler === void 0 ? {} : _config$customHandler;
73
+ customHandlers = _config$customHandler === void 0 ? {} : _config$customHandler,
74
+ _config$customCompone = config.customComponents,
75
+ customComponents = _config$customCompone === void 0 ? {} : _config$customCompone;
70
76
 
71
77
  // 验证配置
72
78
  if (!externalSchema && !businessFields) {
@@ -135,6 +141,23 @@ var withStandardForm = exports.withStandardForm = function withStandardForm(conf
135
141
  console.log("\u2705 withStandardForm: ".concat(formId, " \u4F7F\u7528\u5185\u90E8\u6784\u5EFASchema"));
136
142
  }
137
143
 
144
+ // 创建自定义的 useSchemaField hook
145
+ var useCustomSchemaField = function useCustomSchemaField() {
146
+ return (0, _react.useMemo)(function () {
147
+ // 合并默认组件和自定义组件
148
+ var components = _objectSpread({
149
+ Input: _antdV.Input,
150
+ Select: _antdV.Select,
151
+ DatePicker: _antdV.DatePicker,
152
+ NumberPicker: _antdV.NumberPicker,
153
+ Switch: _antdV.Switch
154
+ }, customComponents);
155
+ return (0, _react2.createSchemaField)({
156
+ components: components
157
+ });
158
+ }, []);
159
+ };
160
+
138
161
  // 创建标准表单组件
139
162
  var StandardFormComponent = function StandardFormComponent(props) {
140
163
  var entityId = props.entityId,
@@ -159,7 +182,8 @@ var withStandardForm = exports.withStandardForm = function withStandardForm(conf
159
182
  onAfterSubmit: onAfterSubmit,
160
183
  buttonProps: buttonProps,
161
184
  customInitializer: customHandlers.initializer,
162
- customSubmitHandler: customHandlers.submitHandler
185
+ customSubmitHandler: customHandlers.submitHandler,
186
+ useSchemaField: useCustomSchemaField
163
187
  }, restProps), children);
164
188
  };
165
189
 
@@ -16,9 +16,9 @@ import ImportModal from "./importModal";
16
16
  import FullScreenAlert from "./fullScreenAlert";
17
17
  import ConfirmPro from "./ConfirmPro";
18
18
  import { GeneratedListPage } from "./generatedListPage";
19
- import { StandardFormDialog } from "./standardFormDialog";
19
+ import { StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField } from "./standardFormDialog";
20
20
  import DeleteConfirm from "./deleteConfirm";
21
- export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, DeleteConfirm };
21
+ export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField, DeleteConfirm };
22
22
  export type * from "./generatedListPage";
23
23
  export type * from "./standardFormDialog";
24
24
  export type * from "./deleteConfirm";
package/dist/esm/index.js CHANGED
@@ -16,8 +16,8 @@ import ImportModal from "./importModal";
16
16
  import FullScreenAlert from "./fullScreenAlert";
17
17
  import ConfirmPro from "./ConfirmPro";
18
18
  import { GeneratedListPage } from "./generatedListPage";
19
- import { StandardFormDialog } from "./standardFormDialog";
19
+ import { StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField } from "./standardFormDialog";
20
20
  import DeleteConfirm from "./deleteConfirm";
21
- export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, DeleteConfirm };
21
+ export { AgGridColumn, AgGridPlus, ArrayTable, ArrayTableIndex, Card, Dashboard, DialogSelect, DraggableModal, Editable, ExtensibleGrid, flattenTreeDeep, FormDesigner, FormProContext, FormProLayout, GridPlusContext, ImportModal, QueryBuilder, ToolBar, FullScreenAlert, ConfirmPro, GeneratedListPage, StandardFormDialog, withStandardForm, FieldCreators, createSelectField, createCascaderField, DeleteConfirm };
22
22
 
23
23
  // 导出类型定义
@@ -91,6 +91,8 @@ export interface WithStandardFormConfig {
91
91
  initializer?: (form: any, entityId?: string | number) => Promise<void>;
92
92
  submitHandler?: (values: any, isEdit: boolean) => Promise<void>;
93
93
  };
94
+ /** 自定义组件映射 */
95
+ customComponents?: Record<string, React.ComponentType<any>>;
94
96
  }
95
97
  /**
96
98
  * StandardFormDialog组件属性接口
@@ -8,7 +8,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
8
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
10
10
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
- import React from 'react';
11
+ import React, { useMemo } from 'react';
12
+ import { createSchemaField } from '@formily/react';
13
+ import { Input, Select, DatePicker, NumberPicker, Switch } from '@formily/antd-v5';
12
14
  import StandardFormDialog from "./StandardFormDialog";
13
15
 
14
16
  /**
@@ -60,7 +62,9 @@ export var withStandardForm = function withStandardForm(config) {
60
62
  _config$defaultDialog = config.defaultDialogConfig,
61
63
  defaultDialogConfig = _config$defaultDialog === void 0 ? {} : _config$defaultDialog,
62
64
  _config$customHandler = config.customHandlers,
63
- customHandlers = _config$customHandler === void 0 ? {} : _config$customHandler;
65
+ customHandlers = _config$customHandler === void 0 ? {} : _config$customHandler,
66
+ _config$customCompone = config.customComponents,
67
+ customComponents = _config$customCompone === void 0 ? {} : _config$customCompone;
64
68
 
65
69
  // 验证配置
66
70
  if (!externalSchema && !businessFields) {
@@ -129,6 +133,23 @@ export var withStandardForm = function withStandardForm(config) {
129
133
  console.log("\u2705 withStandardForm: ".concat(formId, " \u4F7F\u7528\u5185\u90E8\u6784\u5EFASchema"));
130
134
  }
131
135
 
136
+ // 创建自定义的 useSchemaField hook
137
+ var useCustomSchemaField = function useCustomSchemaField() {
138
+ return useMemo(function () {
139
+ // 合并默认组件和自定义组件
140
+ var components = _objectSpread({
141
+ Input: Input,
142
+ Select: Select,
143
+ DatePicker: DatePicker,
144
+ NumberPicker: NumberPicker,
145
+ Switch: Switch
146
+ }, customComponents);
147
+ return createSchemaField({
148
+ components: components
149
+ });
150
+ }, []);
151
+ };
152
+
132
153
  // 创建标准表单组件
133
154
  var StandardFormComponent = function StandardFormComponent(props) {
134
155
  var entityId = props.entityId,
@@ -153,7 +174,8 @@ export var withStandardForm = function withStandardForm(config) {
153
174
  onAfterSubmit: onAfterSubmit,
154
175
  buttonProps: buttonProps,
155
176
  customInitializer: customHandlers.initializer,
156
- customSubmitHandler: customHandlers.submitHandler
177
+ customSubmitHandler: customHandlers.submitHandler,
178
+ useSchemaField: useCustomSchemaField
157
179
  }, restProps), children);
158
180
  };
159
181