@nocobase/client 0.10.0-alpha.2 → 0.10.0-alpha.4
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/es/acl/Configuration/MenuItemsProvider.js +3 -3
- package/es/application/Application.js +2 -2
- package/es/auth/SigninPage.js +12 -9
- package/es/block-provider/GanttBlockProvider.js +5 -4
- package/es/block-provider/TableBlockProvider.d.ts +1 -0
- package/es/block-provider/TableBlockProvider.js +51 -17
- package/es/collection-manager/Configuration/AddCollectionAction.js +31 -25
- package/es/collection-manager/Configuration/AddFieldAction.js +45 -32
- package/es/collection-manager/Configuration/AddSubFieldAction.js +24 -19
- package/es/collection-manager/Configuration/ConfigurationTabs.js +57 -50
- package/es/collection-manager/hooks/useOptions.js +39 -36
- package/es/collection-manager/interfaces/integer.js +1 -1
- package/es/collection-manager/interfaces/number.js +3 -3
- package/es/collection-manager/interfaces/percent.js +3 -3
- package/es/formula/Expression.js +66 -46
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useAdminSchemaUid.d.ts +1 -0
- package/es/hooks/useAdminSchemaUid.js +6 -0
- package/es/hooks/useMenuItem.d.ts +37 -0
- package/es/hooks/useMenuItem.js +93 -0
- package/es/index.d.ts +2 -3
- package/es/index.js +3 -4
- package/es/locale/en_US.d.ts +3 -1
- package/es/locale/en_US.js +4 -2
- package/es/locale/es_ES.d.ts +1 -1
- package/es/locale/es_ES.js +1 -1
- package/es/locale/ja_JP.d.ts +3 -1
- package/es/locale/ja_JP.js +4 -2
- package/es/locale/pt_BR.d.ts +1 -1
- package/es/locale/pt_BR.js +1 -1
- package/es/locale/ru_RU.d.ts +1 -1
- package/es/locale/ru_RU.js +1 -1
- package/es/locale/zh_CN.d.ts +3 -1
- package/es/locale/zh_CN.js +3 -1
- package/es/pm/Card.js +5 -5
- package/es/pm/PluginManagerLink.js +16 -12
- package/es/pm/index.d.ts +2 -1
- package/es/pm/index.js +36 -22
- package/es/route-switch/antd/admin-layout/index.js +5 -5
- package/es/schema-component/antd/action/Action.Designer.js +3 -5
- package/es/schema-component/antd/action/Action.Drawer.js +1 -1
- package/es/schema-component/antd/action/ActionBar.js +1 -1
- package/es/schema-component/antd/association-field/Editable.js +1 -2
- package/es/schema-component/antd/association-field/Nester.js +7 -1
- package/es/schema-component/antd/association-field/SubTable.js +1 -1
- package/es/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/es/schema-component/antd/cascader/Cascader.js +1 -1
- package/es/schema-component/antd/form-item/FormItem.js +10 -3
- package/es/schema-component/antd/form-v2/Form.js +2 -2
- package/es/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/es/schema-component/antd/gantt/components/grid/grid-body.js +3 -3
- package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/es/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/es/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/es/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/es/schema-component/antd/grid/Grid.js +2 -2
- package/es/schema-component/antd/grid-card/GridCard.Designer.js +3 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.js +3 -3
- package/es/schema-component/antd/index.less +1 -3
- package/es/schema-component/antd/list/List.Decorator.js +3 -3
- package/es/schema-component/antd/list/List.Item.js +2 -2
- package/es/schema-component/antd/list/List.d.ts +2 -2
- package/es/schema-component/antd/list/List.js +6 -6
- package/es/schema-component/antd/menu/Menu.js +306 -156
- package/es/schema-component/antd/page/Page.js +29 -23
- package/es/schema-component/antd/remote-select/RemoteSelect.js +60 -10
- package/es/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/es/schema-component/antd/remote-select/utils.js +31 -0
- package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +51 -12
- package/es/schema-component/antd/table-v2/Table.js +28 -47
- package/es/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/es/schema-component/antd/table-v2/utils.js +0 -28
- package/es/schema-component/antd/tabs/Tabs.js +35 -22
- package/es/schema-component/antd/tabs/context.d.ts +1 -1
- package/es/schema-component/antd/upload/ReadPretty.js +7 -3
- package/es/schema-component/antd/variable/VariableSelect.js +1 -1
- package/es/schema-component/common/utils/uitls.d.ts +1 -0
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/es/schema-initializer/SchemaInitializer.js +158 -103
- package/es/schema-initializer/SelectCollection.d.ts +1 -2
- package/es/schema-initializer/SelectCollection.js +19 -16
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/es/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/es/schema-initializer/buttons/TableColumnInitializers.js +3 -2
- package/es/schema-initializer/components/CreateRecordAction.js +37 -27
- package/es/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/es/schema-initializer/items/CalendarBlockInitializer.js +2 -2
- package/es/schema-initializer/utils.d.ts +0 -1
- package/es/schema-initializer/utils.js +40 -25
- package/es/schema-settings/SchemaSettings.js +110 -29
- package/es/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/es/schema-settings/VariableInput/hooks/useFormVariable.js +89 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/es/schema-settings/VariableInput/hooks/useIterationVariable.js +77 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/es/schema-templates/BlockTemplateDetails.js +5 -1
- package/es/schema-templates/BlockTemplatePage.js +4 -1
- package/es/user/ChangePassword.d.ts +1 -2
- package/es/user/ChangePassword.js +30 -26
- package/es/user/CurrentUser.js +172 -141
- package/es/user/EditProfile.d.ts +1 -2
- package/es/user/EditProfile.js +30 -24
- package/es/user/LanguageSettings.d.ts +1 -2
- package/es/user/LanguageSettings.js +67 -64
- package/es/user/SigninPage.js +25 -22
- package/es/user/SwitchRole.d.ts +1 -2
- package/es/user/SwitchRole.js +54 -49
- package/es/user/ThemeSettings.d.ts +1 -2
- package/es/user/ThemeSettings.js +56 -52
- package/lib/acl/Configuration/MenuItemsProvider.js +3 -3
- package/lib/application/Application.js +2 -2
- package/lib/auth/SigninPage.js +25 -22
- package/lib/block-provider/GanttBlockProvider.js +5 -4
- package/lib/block-provider/TableBlockProvider.d.ts +1 -0
- package/lib/block-provider/TableBlockProvider.js +53 -17
- package/lib/collection-manager/Configuration/AddCollectionAction.js +29 -23
- package/lib/collection-manager/Configuration/AddFieldAction.js +43 -30
- package/lib/collection-manager/Configuration/AddSubFieldAction.js +22 -17
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +57 -49
- package/lib/collection-manager/hooks/useOptions.js +39 -36
- package/lib/collection-manager/interfaces/integer.js +1 -1
- package/lib/collection-manager/interfaces/number.js +3 -3
- package/lib/collection-manager/interfaces/percent.js +3 -3
- package/lib/formula/Expression.js +64 -44
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +11 -0
- package/lib/hooks/useAdminSchemaUid.d.ts +1 -0
- package/lib/hooks/useAdminSchemaUid.js +13 -0
- package/lib/hooks/useMenuItem.d.ts +37 -0
- package/lib/hooks/useMenuItem.js +108 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +22 -33
- package/lib/locale/en_US.d.ts +3 -1
- package/lib/locale/en_US.js +4 -2
- package/lib/locale/es_ES.d.ts +1 -1
- package/lib/locale/es_ES.js +1 -1
- package/lib/locale/ja_JP.d.ts +3 -1
- package/lib/locale/ja_JP.js +4 -2
- package/lib/locale/pt_BR.d.ts +1 -1
- package/lib/locale/pt_BR.js +1 -1
- package/lib/locale/ru_RU.d.ts +1 -1
- package/lib/locale/ru_RU.js +1 -1
- package/lib/locale/zh_CN.d.ts +3 -1
- package/lib/locale/zh_CN.js +3 -1
- package/lib/pm/Card.js +6 -6
- package/lib/pm/PluginManagerLink.js +15 -10
- package/lib/pm/index.d.ts +2 -1
- package/lib/pm/index.js +37 -23
- package/lib/route-switch/antd/admin-layout/index.js +4 -4
- package/lib/schema-component/antd/action/Action.Designer.js +2 -4
- package/lib/schema-component/antd/action/Action.Drawer.js +1 -1
- package/lib/schema-component/antd/association-field/Editable.js +0 -1
- package/lib/schema-component/antd/association-field/Nester.js +6 -0
- package/lib/schema-component/antd/association-field/SubTable.js +1 -1
- package/lib/schema-component/antd/calendar/DeleteEvent.js +1 -1
- package/lib/schema-component/antd/cascader/Cascader.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.js +10 -3
- package/lib/schema-component/antd/form-v2/Form.js +2 -2
- package/lib/schema-component/antd/gantt/components/gantt/gantt.js +0 -1
- package/lib/schema-component/antd/gantt/components/grid/grid-body.js +2 -2
- package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.js +1 -1
- package/lib/schema-component/antd/gantt/components/task-item/task-item.js +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.d.ts +1 -1
- package/lib/schema-component/antd/gantt/helpers/bar-helper.js +4 -4
- package/lib/schema-component/antd/gantt/helpers/other-helper.js +3 -1
- package/lib/schema-component/antd/grid/Grid.js +1 -1
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +4 -5
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +8 -8
- package/lib/schema-component/antd/index.less +1 -3
- package/lib/schema-component/antd/list/List.Decorator.js +3 -3
- package/lib/schema-component/antd/list/List.Item.js +6 -6
- package/lib/schema-component/antd/list/List.d.ts +2 -2
- package/lib/schema-component/antd/list/List.js +24 -24
- package/lib/schema-component/antd/menu/Menu.js +304 -154
- package/lib/schema-component/antd/page/Page.js +29 -23
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +57 -7
- package/lib/schema-component/antd/remote-select/utils.d.ts +4 -0
- package/lib/schema-component/antd/remote-select/utils.js +41 -0
- package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +17 -2
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +50 -11
- package/lib/schema-component/antd/table-v2/Table.js +26 -45
- package/lib/schema-component/antd/table-v2/utils.d.ts +0 -1
- package/lib/schema-component/antd/table-v2/utils.js +0 -29
- package/lib/schema-component/antd/tabs/Tabs.js +34 -21
- package/lib/schema-component/antd/tabs/context.d.ts +1 -1
- package/lib/schema-component/antd/upload/ReadPretty.js +7 -3
- package/lib/schema-component/antd/variable/VariableSelect.js +1 -1
- package/lib/schema-component/common/utils/uitls.d.ts +1 -0
- package/lib/schema-component/common/utils/uitls.js +3 -1
- package/lib/schema-initializer/SchemaInitializer.d.ts +7 -2
- package/lib/schema-initializer/SchemaInitializer.js +155 -101
- package/lib/schema-initializer/SelectCollection.d.ts +1 -2
- package/lib/schema-initializer/SelectCollection.js +22 -17
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
- package/lib/schema-initializer/buttons/TableActionInitializers.js +5 -5
- package/lib/schema-initializer/buttons/TableColumnInitializers.js +2 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +35 -25
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +2 -1
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +9 -9
- package/lib/schema-initializer/utils.d.ts +0 -1
- package/lib/schema-initializer/utils.js +41 -25
- package/lib/schema-settings/SchemaSettings.js +106 -27
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.d.ts +19 -0
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +96 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.d.ts +8 -0
- package/lib/schema-settings/VariableInput/hooks/useIterationVariable.js +84 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +5 -12
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +19 -3
- package/lib/schema-templates/BlockTemplateDetails.js +5 -1
- package/lib/schema-templates/BlockTemplatePage.js +5 -2
- package/lib/user/ChangePassword.d.ts +1 -2
- package/lib/user/ChangePassword.js +30 -26
- package/lib/user/CurrentUser.js +166 -135
- package/lib/user/EditProfile.d.ts +1 -2
- package/lib/user/EditProfile.js +31 -25
- package/lib/user/LanguageSettings.d.ts +1 -2
- package/lib/user/LanguageSettings.js +66 -63
- package/lib/user/SigninPage.js +25 -22
- package/lib/user/SwitchRole.d.ts +1 -2
- package/lib/user/SwitchRole.js +57 -51
- package/lib/user/ThemeSettings.d.ts +1 -2
- package/lib/user/ThemeSettings.js +59 -54
- package/package.json +9 -8
- package/es/settings-form/SettingsForm.d.ts +0 -13
- package/es/settings-form/SettingsForm.js +0 -309
- package/es/settings-form/index.d.ts +0 -1
- package/es/settings-form/index.js +0 -1
- package/lib/settings-form/SettingsForm.d.ts +0 -13
- package/lib/settings-form/SettingsForm.js +0 -320
- package/lib/settings-form/index.d.ts +0 -1
- package/lib/settings-form/index.js +0 -16
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
_excluded2 = ["eventKey", "items", "children", "icon", "onClick"];
|
|
2
|
+
var _excluded = ["title", "insert", "wrap", "items", "insertPosition", "dropdown", "component", "style", "icon", "onSuccess"];
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
5
4
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
6
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
6
|
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); }); }; }
|
|
8
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
9
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
9
|
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; }
|
|
@@ -19,15 +17,24 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
19
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
18
|
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; }
|
|
21
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
22
21
|
import { css } from '@emotion/css';
|
|
23
22
|
import { observer, useForm } from '@formily/react';
|
|
24
|
-
import {
|
|
23
|
+
import { error, isString } from '@nocobase/utils/client';
|
|
24
|
+
import { Button, Dropdown, Switch } from 'antd';
|
|
25
25
|
import classNames from 'classnames';
|
|
26
|
-
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
import React, { createContext, useCallback, useContext, useMemo, useRef, useState, useTransition } from 'react';
|
|
28
|
+
import { useCollectMenuItem, useMenuItem } from '../hooks/useMenuItem';
|
|
27
29
|
import { Icon } from '../icon';
|
|
28
30
|
import { SchemaComponent, useActionContext } from '../schema-component';
|
|
29
31
|
import { useCompile, useDesignable } from '../schema-component/hooks';
|
|
30
32
|
import './style.less';
|
|
33
|
+
var overlayClassName = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-dropdown-menu-item-group-list {\n max-height: 40vh;\n overflow: auto;\n }\n"])));
|
|
34
|
+
/**
|
|
35
|
+
* 用于去除菜单的消失动画,优化操作体验
|
|
36
|
+
*/
|
|
37
|
+
var hidden = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: none;\n"])));
|
|
31
38
|
var defaultWrap = function defaultWrap(s) {
|
|
32
39
|
return s;
|
|
33
40
|
};
|
|
@@ -61,9 +68,41 @@ SchemaInitializer.Button = observer(function (props) {
|
|
|
61
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
69
|
visible = _useState2[0],
|
|
63
70
|
setVisible = _useState2[1];
|
|
71
|
+
var _useMenuItem = useMenuItem(),
|
|
72
|
+
CollectionComponent = _useMenuItem.Component,
|
|
73
|
+
getMenuItem = _useMenuItem.getMenuItem,
|
|
74
|
+
clean = _useMenuItem.clean;
|
|
75
|
+
var _useState3 = useState(''),
|
|
76
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
+
searchValue = _useState4[0],
|
|
78
|
+
setSearchValue = _useState4[1];
|
|
79
|
+
var _useTransition = useTransition(),
|
|
80
|
+
_useTransition2 = _slicedToArray(_useTransition, 2),
|
|
81
|
+
isPending = _useTransition2[0],
|
|
82
|
+
startTransition = _useTransition2[1];
|
|
83
|
+
var menuItems = useRef([]);
|
|
84
|
+
var changeMenu = function changeMenu(v) {
|
|
85
|
+
startTransition(function () {
|
|
86
|
+
setVisible(v);
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
if (!designable && props.designable !== true) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
var buttonDom = component ? component : /*#__PURE__*/React.createElement(Button, _objectSpread(_objectSpread({
|
|
93
|
+
type: 'dashed',
|
|
94
|
+
style: _objectSpread({
|
|
95
|
+
borderColor: '#f18b62',
|
|
96
|
+
color: '#f18b62'
|
|
97
|
+
}, style)
|
|
98
|
+
}, others), {}, {
|
|
99
|
+
icon: typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
100
|
+
type: icon
|
|
101
|
+
}) : icon
|
|
102
|
+
}), compile(props.children || props.title));
|
|
64
103
|
var insertSchema = function insertSchema(schema) {
|
|
65
|
-
if (
|
|
66
|
-
|
|
104
|
+
if (insert) {
|
|
105
|
+
insert(wrap(schema));
|
|
67
106
|
} else {
|
|
68
107
|
insertAdjacent(insertPosition, wrap(schema), {
|
|
69
108
|
onSuccess: onSuccess
|
|
@@ -76,100 +115,110 @@ SchemaInitializer.Button = observer(function (props) {
|
|
|
76
115
|
return v && ((v === null || v === void 0 ? void 0 : v.visible) ? v.visible() : true);
|
|
77
116
|
})) === null || _items$filter === void 0 ? void 0 : _items$filter.map(function (item, indexA) {
|
|
78
117
|
if (item.type === 'divider') {
|
|
79
|
-
return
|
|
118
|
+
return {
|
|
119
|
+
type: 'divider',
|
|
80
120
|
key: item.key || "item-".concat(indexA)
|
|
81
|
-
}
|
|
121
|
+
};
|
|
82
122
|
}
|
|
83
123
|
if (item.type === 'item' && item.component) {
|
|
84
124
|
var Component = findComponent(item.component);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
125
|
+
if (!Component) {
|
|
126
|
+
error("SchemaInitializer: component \"".concat(item.component, "\" not found"));
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
if (!item.key) {
|
|
130
|
+
item.key = "".concat(item.title, "-").concat(indexA);
|
|
131
|
+
}
|
|
132
|
+
return getMenuItem(function () {
|
|
133
|
+
return /*#__PURE__*/React.createElement(SchemaInitializerItemContext.Provider, {
|
|
134
|
+
key: item.key,
|
|
135
|
+
value: {
|
|
136
|
+
index: indexA,
|
|
137
|
+
item: item,
|
|
138
|
+
info: item,
|
|
139
|
+
insert: insertSchema
|
|
140
|
+
}
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Component, _objectSpread(_objectSpread({}, item), {}, {
|
|
142
|
+
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
143
|
+
title: compile(item.title)
|
|
144
|
+
}),
|
|
92
145
|
insert: insertSchema
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
item: _objectSpread(_objectSpread({}, item), {}, {
|
|
96
|
-
title: compile(item.title)
|
|
97
|
-
}),
|
|
98
|
-
insert: insertSchema
|
|
99
|
-
})));
|
|
146
|
+
})));
|
|
147
|
+
});
|
|
100
148
|
}
|
|
101
149
|
if (item.type === 'itemGroup') {
|
|
102
150
|
var _item$children;
|
|
103
|
-
|
|
151
|
+
var label = compile(item.title);
|
|
152
|
+
return !!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) && {
|
|
153
|
+
type: 'group',
|
|
104
154
|
key: item.key || "item-group-".concat(indexA),
|
|
105
|
-
|
|
106
|
-
|
|
155
|
+
label: label,
|
|
156
|
+
title: label,
|
|
157
|
+
children: renderItems(item.children)
|
|
158
|
+
};
|
|
107
159
|
}
|
|
108
160
|
if (item.type === 'subMenu') {
|
|
109
161
|
var _item$children2;
|
|
110
|
-
|
|
162
|
+
var _label = compile(item.title);
|
|
163
|
+
return !!((_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) && {
|
|
111
164
|
key: item.key || "item-group-".concat(indexA),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
165
|
+
label: _label,
|
|
166
|
+
title: _label,
|
|
167
|
+
popupClassName: menuItemGroupCss,
|
|
168
|
+
children: renderItems(item.children)
|
|
169
|
+
};
|
|
115
170
|
}
|
|
116
171
|
});
|
|
117
172
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
borderColor: '#f18b62',
|
|
122
|
-
color: '#f18b62'
|
|
123
|
-
}, style)
|
|
124
|
-
}, others), {}, {
|
|
125
|
-
icon: typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
126
|
-
type: icon
|
|
127
|
-
}) : icon
|
|
128
|
-
}), compile(props.children || props.title));
|
|
129
|
-
if (!items.length) {
|
|
130
|
-
return buttonDom;
|
|
131
|
-
}
|
|
132
|
-
var menu = /*#__PURE__*/React.createElement(Menu, {
|
|
133
|
-
style: {
|
|
134
|
-
maxHeight: '60vh',
|
|
135
|
-
overflowY: 'auto'
|
|
136
|
-
}
|
|
137
|
-
}, renderItems(items));
|
|
138
|
-
if (!designable && props.designable !== true) {
|
|
139
|
-
return null;
|
|
173
|
+
if (visible) {
|
|
174
|
+
clean();
|
|
175
|
+
menuItems.current = renderItems(items);
|
|
140
176
|
}
|
|
141
177
|
return /*#__PURE__*/React.createElement(SchemaInitializerButtonContext.Provider, {
|
|
142
178
|
value: {
|
|
143
179
|
visible: visible,
|
|
144
|
-
setVisible: setVisible
|
|
180
|
+
setVisible: setVisible,
|
|
181
|
+
searchValue: searchValue,
|
|
182
|
+
setSearchValue: setSearchValue
|
|
145
183
|
}
|
|
146
|
-
}, /*#__PURE__*/React.createElement(Dropdown, _objectSpread(
|
|
184
|
+
}, visible ? /*#__PURE__*/React.createElement(CollectionComponent, null) : null, /*#__PURE__*/React.createElement(Dropdown, _objectSpread({
|
|
147
185
|
className: classNames('nb-schema-initializer-button'),
|
|
148
186
|
openClassName: "nb-schema-initializer-button-open",
|
|
149
|
-
overlayClassName: classNames('nb-schema-initializer-button-overlay',
|
|
187
|
+
overlayClassName: classNames('nb-schema-initializer-button-overlay', overlayClassName),
|
|
150
188
|
open: visible,
|
|
151
|
-
onOpenChange: function onOpenChange(
|
|
152
|
-
|
|
189
|
+
onOpenChange: function onOpenChange() {
|
|
190
|
+
// 如果不清空输入框的值,那么下次打开的时候会出现上次输入的值
|
|
191
|
+
setSearchValue('');
|
|
192
|
+
changeMenu(!visible);
|
|
193
|
+
},
|
|
194
|
+
menu: {
|
|
195
|
+
style: {
|
|
196
|
+
maxHeight: '60vh',
|
|
197
|
+
overflowY: 'auto'
|
|
198
|
+
},
|
|
199
|
+
className: classNames(_defineProperty({}, hidden, !visible)),
|
|
200
|
+
items: menuItems.current
|
|
153
201
|
}
|
|
154
|
-
}, dropdown),
|
|
155
|
-
overlay: menu
|
|
156
|
-
}), component ? component : buttonDom));
|
|
202
|
+
}, dropdown), component ? component : buttonDom));
|
|
157
203
|
}, {
|
|
158
204
|
displayName: 'SchemaInitializer.Button'
|
|
159
205
|
});
|
|
160
|
-
SchemaInitializer.Item = function (props) {
|
|
206
|
+
SchemaInitializer.Item = function Item(props) {
|
|
161
207
|
var _useContext = useContext(SchemaInitializerItemContext),
|
|
162
|
-
index = _useContext.index,
|
|
163
208
|
info = _useContext.info;
|
|
164
209
|
var compile = useCompile();
|
|
165
|
-
var
|
|
166
|
-
_props$items2 = props.items,
|
|
210
|
+
var _props$items2 = props.items,
|
|
167
211
|
items = _props$items2 === void 0 ? [] : _props$items2,
|
|
168
212
|
_props$children = props.children,
|
|
169
213
|
children = _props$children === void 0 ? info === null || info === void 0 ? void 0 : info.title : _props$children,
|
|
170
214
|
icon = props.icon,
|
|
171
|
-
_onClick = props.onClick
|
|
172
|
-
|
|
215
|
+
_onClick = props.onClick;
|
|
216
|
+
var _useCollectMenuItem = useCollectMenuItem(),
|
|
217
|
+
collectMenuItem = _useCollectMenuItem.collectMenuItem;
|
|
218
|
+
if (!collectMenuItem) {
|
|
219
|
+
error('SchemaInitializer.Item: collectMenuItem is undefined, please check the context');
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
173
222
|
if ((items === null || items === void 0 ? void 0 : items.length) > 0) {
|
|
174
223
|
var renderMenuItem = function renderMenuItem(items) {
|
|
175
224
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
@@ -177,34 +226,36 @@ SchemaInitializer.Item = function (props) {
|
|
|
177
226
|
}
|
|
178
227
|
return items.map(function (item, indexA) {
|
|
179
228
|
if (item.type === 'divider') {
|
|
180
|
-
return
|
|
229
|
+
return {
|
|
230
|
+
type: 'divider',
|
|
181
231
|
key: "divider-".concat(indexA)
|
|
182
|
-
}
|
|
232
|
+
};
|
|
183
233
|
}
|
|
184
234
|
if (item.type === 'itemGroup') {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
eventKey: item.key || "item-group-".concat(indexA),
|
|
235
|
+
var _label2 = compile(item.title);
|
|
236
|
+
return {
|
|
237
|
+
type: 'group',
|
|
190
238
|
key: item.key || "item-group-".concat(indexA),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
239
|
+
label: _label2,
|
|
240
|
+
title: _label2,
|
|
241
|
+
className: menuItemGroupCss,
|
|
242
|
+
children: renderMenuItem(item.children)
|
|
243
|
+
};
|
|
194
244
|
}
|
|
195
245
|
if (item.type === 'subMenu') {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
, {
|
|
199
|
-
// @ts-ignore
|
|
200
|
-
eventKey: item.key || "sub-menu-".concat(indexA),
|
|
246
|
+
var _label3 = compile(item.title);
|
|
247
|
+
return {
|
|
201
248
|
key: item.key || "sub-menu-".concat(indexA),
|
|
202
|
-
|
|
203
|
-
|
|
249
|
+
label: _label3,
|
|
250
|
+
title: _label3,
|
|
251
|
+
children: renderMenuItem(item.children)
|
|
252
|
+
};
|
|
204
253
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
key: item.key,
|
|
254
|
+
var label = compile(item.title);
|
|
255
|
+
return {
|
|
256
|
+
key: item.key || "".concat(info.key, "-").concat(item.title, "-").concat(indexA),
|
|
257
|
+
label: label,
|
|
258
|
+
title: label,
|
|
208
259
|
onClick: function onClick(info) {
|
|
209
260
|
var _item$clearKeywords;
|
|
210
261
|
item === null || item === void 0 ? void 0 : (_item$clearKeywords = item.clearKeywords) === null || _item$clearKeywords === void 0 ? void 0 : _item$clearKeywords.call(item);
|
|
@@ -218,27 +269,25 @@ SchemaInitializer.Item = function (props) {
|
|
|
218
269
|
}));
|
|
219
270
|
}
|
|
220
271
|
}
|
|
221
|
-
}
|
|
272
|
+
};
|
|
222
273
|
});
|
|
223
274
|
};
|
|
224
|
-
|
|
225
|
-
// @ts-ignore
|
|
226
|
-
, {
|
|
227
|
-
// @ts-ignore
|
|
228
|
-
eventKey: eventKey ? "".concat(eventKey, "-").concat(index) : info.key,
|
|
275
|
+
var _item = {
|
|
229
276
|
key: info.key,
|
|
230
|
-
|
|
277
|
+
label: isString(children) ? compile(children) : children,
|
|
231
278
|
icon: typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
232
279
|
type: icon
|
|
233
|
-
}) : icon
|
|
234
|
-
|
|
280
|
+
}) : icon,
|
|
281
|
+
children: renderMenuItem(items)
|
|
282
|
+
};
|
|
283
|
+
collectMenuItem(_item);
|
|
284
|
+
return null;
|
|
235
285
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
, {
|
|
239
|
-
// {...others}
|
|
286
|
+
var label = isString(children) ? compile(children) : children;
|
|
287
|
+
var item = {
|
|
240
288
|
key: info.key,
|
|
241
|
-
|
|
289
|
+
label: label,
|
|
290
|
+
title: label,
|
|
242
291
|
icon: typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
243
292
|
type: icon
|
|
244
293
|
}) : icon,
|
|
@@ -249,19 +298,23 @@ SchemaInitializer.Item = function (props) {
|
|
|
249
298
|
item: info
|
|
250
299
|
}));
|
|
251
300
|
}
|
|
252
|
-
}
|
|
301
|
+
};
|
|
302
|
+
collectMenuItem(item);
|
|
303
|
+
return null;
|
|
253
304
|
};
|
|
254
305
|
SchemaInitializer.itemWrap = function (component) {
|
|
255
306
|
return component;
|
|
256
307
|
};
|
|
257
|
-
SchemaInitializer.ActionModal = function (props) {
|
|
308
|
+
SchemaInitializer.ActionModal = function ActionModal(props) {
|
|
258
309
|
var title = props.title,
|
|
259
310
|
schema = props.schema,
|
|
260
311
|
buttonText = props.buttonText,
|
|
261
312
|
onCancel = props.onCancel,
|
|
262
313
|
onSubmit = props.onSubmit;
|
|
263
314
|
var useCancelAction = useCallback(function () {
|
|
315
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
264
316
|
var form = useForm();
|
|
317
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
265
318
|
var ctx = useActionContext();
|
|
266
319
|
return {
|
|
267
320
|
run: function run() {
|
|
@@ -284,7 +337,9 @@ SchemaInitializer.ActionModal = function (props) {
|
|
|
284
337
|
};
|
|
285
338
|
}, [onCancel]);
|
|
286
339
|
var useSubmitAction = useCallback(function () {
|
|
340
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
287
341
|
var form = useForm();
|
|
342
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
288
343
|
var ctx = useActionContext();
|
|
289
344
|
return {
|
|
290
345
|
run: function run() {
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
7
|
import { Divider, Input } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
3
9
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { useCollectionManager } from '../collection-manager';
|
|
5
10
|
export var SelectCollection = function SelectCollection(_ref) {
|
|
6
|
-
var
|
|
7
|
-
_onChange = _ref.onChange
|
|
8
|
-
setSelected = _ref.setSelected;
|
|
11
|
+
var outValue = _ref.value,
|
|
12
|
+
_onChange = _ref.onChange;
|
|
9
13
|
var _useTranslation = useTranslation(),
|
|
10
14
|
t = _useTranslation.t;
|
|
11
|
-
var
|
|
12
|
-
|
|
15
|
+
var _useState = useState(outValue),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
value = _useState2[0],
|
|
18
|
+
setValue = _useState2[1];
|
|
19
|
+
// 之所以要增加个内部的 value 是为了防止用户输入过快时造成卡顿的问题
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
setValue(outValue);
|
|
22
|
+
}, [outValue]);
|
|
13
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
24
|
style: {
|
|
15
25
|
width: 210
|
|
16
26
|
}
|
|
17
27
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
28
|
+
autoFocus: true,
|
|
18
29
|
allowClear: true,
|
|
19
30
|
style: {
|
|
20
31
|
padding: '0 4px 6px'
|
|
@@ -23,16 +34,8 @@ export var SelectCollection = function SelectCollection(_ref) {
|
|
|
23
34
|
placeholder: t('Search and select collection'),
|
|
24
35
|
value: value,
|
|
25
36
|
onChange: function onChange(e) {
|
|
26
|
-
var names = collections.filter(function (collection) {
|
|
27
|
-
if (!collection.title) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
return collection.title.toUpperCase().includes(e.target.value.toUpperCase());
|
|
31
|
-
}).map(function (item) {
|
|
32
|
-
return item.name;
|
|
33
|
-
});
|
|
34
|
-
setSelected(names);
|
|
35
37
|
_onChange(e.target.value);
|
|
38
|
+
setValue(e.target.value);
|
|
36
39
|
}
|
|
37
40
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
38
41
|
style: {
|
|
@@ -4,13 +4,13 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
4
4
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
5
|
import { MenuOutlined } from '@ant-design/icons';
|
|
6
6
|
import { useFieldSchema } from '@formily/react';
|
|
7
|
+
import _ from 'lodash';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
import { useTranslation } from 'react-i18next';
|
|
9
10
|
import { SchemaInitializer, SchemaSettings } from '../..';
|
|
10
11
|
import { useAPIClient } from '../../api-client';
|
|
11
12
|
import { useCollection } from '../../collection-manager';
|
|
12
13
|
import { createDesignable, useDesignable } from '../../schema-component';
|
|
13
|
-
import _ from 'lodash';
|
|
14
14
|
export var Resizable = function Resizable(props) {
|
|
15
15
|
var _fieldSchema$xCompon;
|
|
16
16
|
var _useTranslation = useTranslation(),
|
|
@@ -28,7 +28,7 @@ export var TableActionInitializers = {
|
|
|
28
28
|
skipScopeCheck: true
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
visible: function
|
|
31
|
+
visible: function useVisible() {
|
|
32
32
|
var collection = useCollection();
|
|
33
33
|
return collection.template !== 'view' && collection.template !== 'file';
|
|
34
34
|
}
|
|
@@ -40,7 +40,7 @@ export var TableActionInitializers = {
|
|
|
40
40
|
'x-align': 'right',
|
|
41
41
|
'x-decorator': 'ACLActionProvider'
|
|
42
42
|
},
|
|
43
|
-
visible: function
|
|
43
|
+
visible: function useVisible() {
|
|
44
44
|
var collection = useCollection();
|
|
45
45
|
return collection.template !== 'view';
|
|
46
46
|
}
|
|
@@ -58,7 +58,7 @@ export var TableActionInitializers = {
|
|
|
58
58
|
schema: {
|
|
59
59
|
'x-align': 'right'
|
|
60
60
|
},
|
|
61
|
-
visible: function
|
|
61
|
+
visible: function useVisible() {
|
|
62
62
|
var _schema$parent;
|
|
63
63
|
var schema = useFieldSchema();
|
|
64
64
|
var collection = useCollection();
|
|
@@ -69,7 +69,7 @@ export var TableActionInitializers = {
|
|
|
69
69
|
}]
|
|
70
70
|
}, {
|
|
71
71
|
type: 'divider',
|
|
72
|
-
visible: function
|
|
72
|
+
visible: function useVisible() {
|
|
73
73
|
var collection = useCollection();
|
|
74
74
|
return collection.template !== 'view';
|
|
75
75
|
}
|
|
@@ -147,7 +147,7 @@ export var TableActionInitializers = {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
}],
|
|
150
|
-
visible: function
|
|
150
|
+
visible: function useVisible() {
|
|
151
151
|
var collection = useCollection();
|
|
152
152
|
return collection.template !== 'view';
|
|
153
153
|
}
|
|
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { SchemaInitializer } from '../SchemaInitializer';
|
|
10
10
|
import { itemsMerge, useAssociatedTableColumnInitializerFields, useTableColumnInitializerFields, useInheritsTableColumnInitializerFields } from '../utils';
|
|
11
11
|
import { useCompile } from '../../schema-component';
|
|
12
|
-
import { useFieldSchema } from '@formily/react';
|
|
12
|
+
import { useField, useFieldSchema } from '@formily/react';
|
|
13
13
|
// 表格列配置
|
|
14
14
|
export var TableColumnInitializers = function TableColumnInitializers(props) {
|
|
15
15
|
var _props$items = props.items,
|
|
@@ -18,6 +18,7 @@ export var TableColumnInitializers = function TableColumnInitializers(props) {
|
|
|
18
18
|
action = _props$action === void 0 ? true : _props$action;
|
|
19
19
|
var _useTranslation = useTranslation(),
|
|
20
20
|
t = _useTranslation.t;
|
|
21
|
+
var field = useField();
|
|
21
22
|
var fieldSchema = useFieldSchema();
|
|
22
23
|
var associatedFields = useAssociatedTableColumnInitializerFields();
|
|
23
24
|
var inheritFields = useInheritsTableColumnInitializerFields();
|
|
@@ -42,7 +43,7 @@ export var TableColumnInitializers = function TableColumnInitializers(props) {
|
|
|
42
43
|
});
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
if ((associatedFields === null || associatedFields === void 0 ? void 0 : associatedFields.length) > 0 &&
|
|
46
|
+
if ((associatedFields === null || associatedFields === void 0 ? void 0 : associatedFields.length) > 0 && field.readPretty) {
|
|
46
47
|
fieldItems.push({
|
|
47
48
|
type: 'divider'
|
|
48
49
|
}, {
|