@next-core/brick-kit 2.197.3 → 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.bundle.js +54 -13
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +50 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts +1 -0
- package/dist/types/core/CustomForms/ExpandCustomForm.d.ts.map +1 -1
- package/dist/types/core/CustomForms/registerFormRenderer.d.ts.map +1 -1
- package/dist/types/core/Runtime.d.ts.map +1 -1
- package/dist/types/core/setAppLocales.d.ts.map +1 -1
- package/package.json +6 -6
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';
|
|
@@ -3956,8 +3958,9 @@ class Runtime {
|
|
|
3956
3958
|
// deprecated
|
|
3957
3959
|
}
|
|
3958
3960
|
applyPageTitle(pageTitle) {
|
|
3961
|
+
var _kernel$currentApp;
|
|
3959
3962
|
var baseTitle = this.getBrandSettings().base_title;
|
|
3960
|
-
document.title = pageTitle ? "".concat(pageTitle, " - ").concat(baseTitle) : baseTitle;
|
|
3963
|
+
document.title = pageTitle ? ((_kernel$currentApp = kernel.currentApp) === null || _kernel$currentApp === void 0 ? void 0 : _kernel$currentApp.localeTitle) || "".concat(pageTitle, " - ").concat(baseTitle) : baseTitle;
|
|
3961
3964
|
}
|
|
3962
3965
|
}
|
|
3963
3966
|
|
|
@@ -7110,12 +7113,14 @@ function setAppLocales(app) {
|
|
|
7110
7113
|
});
|
|
7111
7114
|
// Use `app.name` as the fallback `app.localeName`.
|
|
7112
7115
|
app.localeName = i18next.getFixedT(null, ns)("name", app.name);
|
|
7116
|
+
app.localeTitle = i18next.getFixedT(null, ns)("title", "");
|
|
7113
7117
|
// Remove the temporary i18n resource bundles.
|
|
7114
7118
|
Object.keys(locales).forEach(lang => {
|
|
7115
7119
|
i18next.removeResourceBundle(lang, ns);
|
|
7116
7120
|
});
|
|
7117
7121
|
} else {
|
|
7118
7122
|
app.localeName = app.name;
|
|
7123
|
+
app.localeTitle = "";
|
|
7119
7124
|
}
|
|
7120
7125
|
}
|
|
7121
7126
|
|
|
@@ -10116,6 +10121,7 @@ function listenOnTrackingContext(brick, trackingContextList, context) {
|
|
|
10116
10121
|
}
|
|
10117
10122
|
}
|
|
10118
10123
|
|
|
10124
|
+
var formContainers = ["forms.general-form", "form.general-form", "eo-form"];
|
|
10119
10125
|
function ExpandCustomForm(formData, brickConf, isPreview, context) {
|
|
10120
10126
|
var formContext = new CustomFormContext();
|
|
10121
10127
|
formData = initFormContext(formData, brickConf, isPreview);
|
|
@@ -10368,7 +10374,7 @@ function getStoryboard(dataSource, result, fields, isPreview, formContextId) {
|
|
|
10368
10374
|
var resultItem = {};
|
|
10369
10375
|
//数据初始化:根据id,字段类型获取默认属性
|
|
10370
10376
|
var defaultProperties = getDefaultProperties(dataItem.id, fields);
|
|
10371
|
-
if (dataItem.brick
|
|
10377
|
+
if (formContainers.includes(dataItem.brick) && isPreview) {
|
|
10372
10378
|
dataItem.properties = _objectSpread(_objectSpread({}, dataItem.properties), {}, {
|
|
10373
10379
|
className: "form-preview"
|
|
10374
10380
|
});
|
|
@@ -10418,7 +10424,7 @@ function getStoryboard(dataSource, result, fields, isPreview, formContextId) {
|
|
|
10418
10424
|
return result;
|
|
10419
10425
|
}
|
|
10420
10426
|
function initFormContext(formData, brickConf, isPreview) {
|
|
10421
|
-
if (isPreview && formData.formSchema && formData.formSchema.brick
|
|
10427
|
+
if (isPreview && formData.formSchema && formContainers.includes(formData.formSchema.brick)) {
|
|
10422
10428
|
var _formData$formSchema$;
|
|
10423
10429
|
brickConf["properties"] = _objectSpread(_objectSpread({}, brickConf.properties), (_formData$formSchema$ = formData.formSchema.properties) === null || _formData$formSchema$ === void 0 ? void 0 : _formData$formSchema$.previewConf);
|
|
10424
10430
|
}
|
|
@@ -10455,7 +10461,7 @@ function getFinalStoryBoard(formData, brickConf, isPreview, formContext) {
|
|
|
10455
10461
|
try {
|
|
10456
10462
|
var formStoryboard = getStoryboard([formData.formSchema], [], formData.fields, isPreview, formContext.id);
|
|
10457
10463
|
formStoryboard[0] = _.isEmpty(formStoryboard[0]) ? errorBrick : formStoryboard[0];
|
|
10458
|
-
if (formStoryboard[0].brick
|
|
10464
|
+
if (formContainers.includes(formStoryboard[0].brick) && brickConf.events) {
|
|
10459
10465
|
var _formStoryboard$0$eve;
|
|
10460
10466
|
var brickConfEvents = brickConf.events;
|
|
10461
10467
|
var events = (_formStoryboard$0$eve = formStoryboard[0].events) !== null && _formStoryboard$0$eve !== void 0 ? _formStoryboard$0$eve : {};
|
|
@@ -11692,12 +11698,47 @@ var getMockInfo = (requestUrl, method) => {
|
|
|
11692
11698
|
return;
|
|
11693
11699
|
};
|
|
11694
11700
|
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
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];
|
|
11699
11716
|
}
|
|
11700
|
-
|
|
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);
|
|
11701
11742
|
}
|
|
11702
11743
|
|
|
11703
11744
|
var standaloneApps = [];
|