@next-core/brick-kit 2.198.0 → 2.199.0

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.
package/dist/index.esm.js CHANGED
@@ -15,6 +15,8 @@ import { Modal, message, Empty, ConfigProvider } from 'antd';
15
15
  import { ExclamationCircleOutlined } from '@ant-design/icons';
16
16
  import yaml from 'js-yaml';
17
17
  import { loadBricksImperatively, loadProcessorsImperatively } from '@next-core/loader';
18
+ import _classPrivateMethodInitSpec from '@babel/runtime/helpers/classPrivateMethodInitSpec';
19
+ import _classPrivateMethodGet from '@babel/runtime/helpers/classPrivateMethodGet';
18
20
  import { withTranslation } from 'react-i18next';
19
21
  import _extends from '@babel/runtime/helpers/esm/extends';
20
22
  import { getIllustration } from '@next-core/illustrations';
@@ -10119,6 +10121,7 @@ function listenOnTrackingContext(brick, trackingContextList, context) {
10119
10121
  }
10120
10122
  }
10121
10123
 
10124
+ var formContainers = ["forms.general-form", "form.general-form", "eo-form"];
10122
10125
  function ExpandCustomForm(formData, brickConf, isPreview, context) {
10123
10126
  var formContext = new CustomFormContext();
10124
10127
  formData = initFormContext(formData, brickConf, isPreview);
@@ -10371,7 +10374,7 @@ function getStoryboard(dataSource, result, fields, isPreview, formContextId) {
10371
10374
  var resultItem = {};
10372
10375
  //数据初始化:根据id,字段类型获取默认属性
10373
10376
  var defaultProperties = getDefaultProperties(dataItem.id, fields);
10374
- if (dataItem.brick === "forms.general-form" && isPreview) {
10377
+ if (formContainers.includes(dataItem.brick) && isPreview) {
10375
10378
  dataItem.properties = _objectSpread(_objectSpread({}, dataItem.properties), {}, {
10376
10379
  className: "form-preview"
10377
10380
  });
@@ -10421,7 +10424,7 @@ function getStoryboard(dataSource, result, fields, isPreview, formContextId) {
10421
10424
  return result;
10422
10425
  }
10423
10426
  function initFormContext(formData, brickConf, isPreview) {
10424
- if (isPreview && formData.formSchema && formData.formSchema.brick === "forms.general-form") {
10427
+ if (isPreview && formData.formSchema && formContainers.includes(formData.formSchema.brick)) {
10425
10428
  var _formData$formSchema$;
10426
10429
  brickConf["properties"] = _objectSpread(_objectSpread({}, brickConf.properties), (_formData$formSchema$ = formData.formSchema.properties) === null || _formData$formSchema$ === void 0 ? void 0 : _formData$formSchema$.previewConf);
10427
10430
  }
@@ -10458,7 +10461,7 @@ function getFinalStoryBoard(formData, brickConf, isPreview, formContext) {
10458
10461
  try {
10459
10462
  var formStoryboard = getStoryboard([formData.formSchema], [], formData.fields, isPreview, formContext.id);
10460
10463
  formStoryboard[0] = _.isEmpty(formStoryboard[0]) ? errorBrick : formStoryboard[0];
10461
- if (formStoryboard[0].brick === "forms.general-form" && brickConf.events) {
10464
+ if (formContainers.includes(formStoryboard[0].brick) && brickConf.events) {
10462
10465
  var _formStoryboard$0$eve;
10463
10466
  var brickConfEvents = brickConf.events;
10464
10467
  var events = (_formStoryboard$0$eve = formStoryboard[0].events) !== null && _formStoryboard$0$eve !== void 0 ? _formStoryboard$0$eve : {};
@@ -11695,12 +11698,47 @@ var getMockInfo = (requestUrl, method) => {
11695
11698
  return;
11696
11699
  };
11697
11700
 
11698
- function registerFormRenderer() {
11699
- customElements.get(formRenderer) || customElements.define(formRenderer, class FormElement extends HTMLElement {
11700
- get $$typeof() {
11701
- return "formRenderer";
11701
+ var _proxyFormMethod = /*#__PURE__*/new WeakSet();
11702
+ class FormElement extends HTMLElement {
11703
+ constructor() {
11704
+ super(...arguments);
11705
+ _classPrivateMethodInitSpec(this, _proxyFormMethod);
11706
+ }
11707
+ get $$typeof() {
11708
+ return "formRenderer";
11709
+ }
11710
+ validate() {
11711
+ _classPrivateMethodGet(this, _proxyFormMethod, _proxyFormMethod2).call(this, "validate");
11712
+ }
11713
+ setInitValue() {
11714
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11715
+ args[_key] = arguments[_key];
11702
11716
  }
11703
- });
11717
+ _classPrivateMethodGet(this, _proxyFormMethod, _proxyFormMethod2).call(this, "setInitValue", args);
11718
+ }
11719
+ resetFields() {
11720
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
11721
+ args[_key2] = arguments[_key2];
11722
+ }
11723
+ _classPrivateMethodGet(this, _proxyFormMethod, _proxyFormMethod2).call(this, "resetFields", args);
11724
+ }
11725
+ }
11726
+ function _proxyFormMethod2(method) {
11727
+ var _containerElement$tag;
11728
+ var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
11729
+ var containerElement = this.firstElementChild;
11730
+ var tagName = containerElement === null || containerElement === void 0 ? void 0 : (_containerElement$tag = containerElement.tagName) === null || _containerElement$tag === void 0 ? void 0 : _containerElement$tag.toLowerCase();
11731
+ if (formContainers.includes(tagName)) {
11732
+ containerElement[method](...args);
11733
+ } else {
11734
+ // eslint-disable-next-line no-console
11735
+ console.error("no ".concat(method, " method in the container element"), {
11736
+ container: tagName
11737
+ });
11738
+ }
11739
+ }
11740
+ function registerFormRenderer() {
11741
+ customElements.get(formRenderer) || customElements.define(formRenderer, FormElement);
11704
11742
  }
11705
11743
 
11706
11744
  var standaloneApps = [];