@pisell/materials 6.0.5 → 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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +7 -7
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +21 -53
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +18 -50
- package/es/components/config-provider/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -11
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +11 -3
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +10 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +36 -20
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +50 -35
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +38 -10
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +48 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/index.js +4 -2
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +7 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +16 -1
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.js +7 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/es/components/dataSourceComponents/fields/Upload/serve.js +10 -31
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/es/components/dataSourceComponents/hooks/useActions.js +73 -36
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +53 -6
- package/es/components/login-and-register/index.d.ts +82 -0
- package/es/components/login-and-register/index.js +360 -0
- package/es/components/login-and-register/index.less +211 -0
- package/es/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/es/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/es/components/organizationTenantSwitcher/index.js +96 -0
- package/es/components/organizationTenantSwitcher/index.less +88 -0
- package/es/components/page/index.js +8 -6
- package/es/components/page-header/index.d.ts +14 -0
- package/es/components/page-header/index.js +36 -0
- package/es/components/page-header/index.less +45 -0
- package/es/components/pisellAvatar/index.d.ts +19 -0
- package/es/components/pisellAvatar/index.js +89 -0
- package/es/components/pisellAvatar/index.less +26 -0
- package/es/components/pisellModal/components/PcModal/index.js +1 -1
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/pisellText/components/Amount/index.js +1 -1
- package/es/components/profileMenu/index.d.ts +26 -0
- package/es/components/profileMenu/index.js +115 -0
- package/es/components/profileMenu/index.less +135 -0
- package/es/components/select/index.js +3 -2
- package/es/components/table/Header/index.js +8 -11
- package/es/index.d.ts +6 -0
- package/es/index.js +7 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +1 -0
- package/lib/components/config-provider/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +22 -4
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/group/index.less +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +4 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +17 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +16 -6
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +3 -2
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +9 -5
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +19 -9
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +5 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +3 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +51 -5
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +6 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +14 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +46 -3
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +15 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +17 -2
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +4 -1
- package/lib/components/dataSourceComponents/fields/Upload/serve.js +20 -12
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +2 -1
- package/lib/components/dataSourceComponents/hooks/useActions.js +25 -7
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +7 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +3 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +48 -7
- package/lib/components/login-and-register/index.d.ts +82 -0
- package/lib/components/login-and-register/index.js +261 -0
- package/lib/components/login-and-register/index.less +211 -0
- package/lib/components/organizationTenantSwitcher/defaultLogo.png +0 -0
- package/lib/components/organizationTenantSwitcher/index.d.ts +17 -0
- package/lib/components/organizationTenantSwitcher/index.js +119 -0
- package/lib/components/organizationTenantSwitcher/index.less +88 -0
- package/lib/components/page/index.js +6 -6
- package/lib/components/page-header/index.d.ts +14 -0
- package/lib/components/page-header/index.js +63 -0
- package/lib/components/page-header/index.less +45 -0
- package/lib/components/pisellAvatar/index.d.ts +19 -0
- package/lib/components/pisellAvatar/index.js +108 -0
- package/lib/components/pisellAvatar/index.less +26 -0
- package/lib/components/pisellModal/components/PcModal/index.js +1 -1
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/pisellText/components/Amount/index.js +2 -2
- package/lib/components/profileMenu/index.d.ts +26 -0
- package/lib/components/profileMenu/index.js +113 -0
- package/lib/components/profileMenu/index.less +135 -0
- package/lib/components/select/index.js +2 -1
- package/lib/components/table/Header/index.js +11 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.js +18 -0
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +1 -0
- package/lowcode/_utils/defaultSchema.ts +64 -0
- package/lowcode/data-source-form/meta.ts +130 -0
- package/lowcode/data-source-form/utils.ts +33 -3
- package/lowcode/data-source-table/meta.ts +420 -3
- package/lowcode/data-source-table/utils.tsx +6 -0
- package/lowcode/form-item-date-picker/snippets.ts +3 -0
- package/lowcode/form-item-input/snippets.ts +3 -1
- package/lowcode/form-item-input-number/snippets.ts +4 -0
- package/lowcode/form-item-input.email/snippets.ts +3 -0
- package/lowcode/form-item-input.json/snippets.ts +4 -1
- package/lowcode/form-item-input.password/snippets.ts +3 -0
- package/lowcode/form-item-input.phone/snippets.ts +3 -0
- package/lowcode/form-item-input.text-area/snippets.ts +3 -1
- package/lowcode/form-item-input.url/snippets.ts +3 -0
- package/lowcode/form-item-select/meta.ts +2 -1
- package/lowcode/form-item-select/snippets.ts +6 -0
- package/lowcode/form-item-time-picker/snippets.ts +3 -0
- package/lowcode/form-item-translation/snippets.ts +3 -1
- package/lowcode/login-and-register/meta.ts +541 -0
- package/lowcode/login-and-register/snippets.ts +38 -0
- package/lowcode/organization-tenant-switch/meta.ts +127 -0
- package/lowcode/page-header/meta.ts +68 -124
- package/lowcode/page-header/snippets.ts +1 -1
- package/lowcode/pisell-avatar/__screenshots__/avatar-1.jpg +0 -0
- package/lowcode/pisell-avatar/meta.ts +111 -0
- package/lowcode/pisell-avatar/snippets.ts +14 -0
- package/lowcode/pisell-tags/__screenshots__/tag-1.png +0 -0
- package/lowcode/pisell-tags/meta.ts +123 -0
- package/lowcode/pisell-tags/snippets.ts +14 -0
- package/lowcode/profile-menu/meta.ts +175 -0
- package/lowcode/profile-menu/snippets.ts +71 -0
- package/lowcode/submit-button/meta.ts +6 -0
- package/package.json +3 -3
|
@@ -1,12 +1,23 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
2
7
|
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; }
|
|
3
8
|
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); } }
|
|
4
9
|
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); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
16
|
import { useMemo } from 'react';
|
|
6
17
|
import { useMemoizedFn } from 'ahooks';
|
|
7
18
|
import PisellToast from "../../pisellToast";
|
|
8
19
|
import useFormat from "../dataSourceTable/hooks/useFormat";
|
|
9
|
-
import { createNocobaseData, customApi, updateNocobaseData, getNocobaseDataList, deleteNocobaseData } from "../dataSourceForm/serve";
|
|
20
|
+
import { createNocobaseData, customApi, getNocobaseData, updateNocobaseData, getNocobaseDataList, deleteNocobaseData } from "../dataSourceForm/serve";
|
|
10
21
|
import useParseActionsVariable from "./useParseActionsVariable";
|
|
11
22
|
import useVariables from "./useVariables";
|
|
12
23
|
import useDataSource from "./useDataSource";
|
|
@@ -15,7 +26,8 @@ var useActions = function useActions() {
|
|
|
15
26
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
16
27
|
propsDataSource = _ref.dataSource,
|
|
17
28
|
propsCurrentValue = _ref.currentValue,
|
|
18
|
-
__designMode = _ref.__designMode
|
|
29
|
+
__designMode = _ref.__designMode,
|
|
30
|
+
propsExtraParams = _ref.extraParams;
|
|
19
31
|
// const { currentValue: ctxCurrentValue } = useFormSetting();
|
|
20
32
|
var _useDataSource = useDataSource(),
|
|
21
33
|
ctxDataSource = _useDataSource.dataSource,
|
|
@@ -47,6 +59,21 @@ var useActions = function useActions() {
|
|
|
47
59
|
var currentRecord = useMemo(function () {
|
|
48
60
|
return parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(currentValue, {});
|
|
49
61
|
}, [currentValue, parseVariable]);
|
|
62
|
+
var extraParams = useMemo(function () {
|
|
63
|
+
return Object.entries(propsExtraParams || {}).reduce(function (acc, _ref3) {
|
|
64
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
65
|
+
key = _ref4[0],
|
|
66
|
+
value = _ref4[1];
|
|
67
|
+
acc[key] = Object.entries(value || {}).reduce(function (acc, _ref5) {
|
|
68
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
69
|
+
k = _ref6[0],
|
|
70
|
+
v = _ref6[1];
|
|
71
|
+
acc[k] = parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(v, {});
|
|
72
|
+
return acc;
|
|
73
|
+
}, {});
|
|
74
|
+
return acc;
|
|
75
|
+
}, {});
|
|
76
|
+
}, [propsExtraParams, parseVariable]);
|
|
50
77
|
var getParsedActions = useMemoizedFn(function () {
|
|
51
78
|
// 目前接口使用变量还无法在界面配置 所以这里默认追加currentRecord
|
|
52
79
|
return parseActions(originalActions, {
|
|
@@ -55,15 +82,15 @@ var useActions = function useActions() {
|
|
|
55
82
|
});
|
|
56
83
|
|
|
57
84
|
// 生成自定义 API 请求函数
|
|
58
|
-
var genCustomApi = useMemoizedFn(function (
|
|
59
|
-
var method =
|
|
60
|
-
path =
|
|
61
|
-
parsedPath =
|
|
62
|
-
params =
|
|
63
|
-
headers =
|
|
64
|
-
body =
|
|
85
|
+
var genCustomApi = useMemoizedFn(function (_ref7) {
|
|
86
|
+
var method = _ref7.method,
|
|
87
|
+
path = _ref7.path,
|
|
88
|
+
parsedPath = _ref7.parsedPath,
|
|
89
|
+
params = _ref7.params,
|
|
90
|
+
headers = _ref7.headers,
|
|
91
|
+
body = _ref7.body;
|
|
65
92
|
return /*#__PURE__*/function () {
|
|
66
|
-
var
|
|
93
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
67
94
|
var result;
|
|
68
95
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
69
96
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -78,7 +105,7 @@ var useActions = function useActions() {
|
|
|
78
105
|
});
|
|
79
106
|
case 2:
|
|
80
107
|
result = _context.sent;
|
|
81
|
-
if (!
|
|
108
|
+
if (!['pisell2-api', 'mypisell-api'].includes(dataSourceKey)) {
|
|
82
109
|
_context.next = 5;
|
|
83
110
|
break;
|
|
84
111
|
}
|
|
@@ -91,8 +118,8 @@ var useActions = function useActions() {
|
|
|
91
118
|
}
|
|
92
119
|
}, _callee);
|
|
93
120
|
}));
|
|
94
|
-
return function (
|
|
95
|
-
return
|
|
121
|
+
return function (_x2) {
|
|
122
|
+
return _ref8.apply(this, arguments);
|
|
96
123
|
};
|
|
97
124
|
}();
|
|
98
125
|
});
|
|
@@ -111,7 +138,7 @@ var useActions = function useActions() {
|
|
|
111
138
|
|
|
112
139
|
// 创建数据
|
|
113
140
|
var create = useMemoizedFn( /*#__PURE__*/function () {
|
|
114
|
-
var
|
|
141
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
|
115
142
|
var actions, createApi;
|
|
116
143
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
117
144
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -148,19 +175,19 @@ var useActions = function useActions() {
|
|
|
148
175
|
}
|
|
149
176
|
}, _callee2);
|
|
150
177
|
}));
|
|
151
|
-
return function (
|
|
152
|
-
return
|
|
178
|
+
return function (_x3) {
|
|
179
|
+
return _ref9.apply(this, arguments);
|
|
153
180
|
};
|
|
154
181
|
}());
|
|
155
182
|
|
|
156
183
|
// 获取数据
|
|
157
184
|
var get = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
158
|
-
var actions, getApi;
|
|
185
|
+
var actions, getApi, res;
|
|
159
186
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
160
187
|
while (1) switch (_context3.prev = _context3.next) {
|
|
161
188
|
case 0:
|
|
162
189
|
if (!(currentValue === 'server')) {
|
|
163
|
-
_context3.next =
|
|
190
|
+
_context3.next = 13;
|
|
164
191
|
break;
|
|
165
192
|
}
|
|
166
193
|
if (!isCustomApi) {
|
|
@@ -177,16 +204,24 @@ var useActions = function useActions() {
|
|
|
177
204
|
getApi = genCustomApi(actions === null || actions === void 0 ? void 0 : actions.get);
|
|
178
205
|
return _context3.abrupt("return", getApi({}));
|
|
179
206
|
case 7:
|
|
180
|
-
|
|
181
|
-
|
|
207
|
+
_context3.next = 9;
|
|
208
|
+
return getNocobaseData({
|
|
209
|
+
key: name || '',
|
|
210
|
+
query: extraParams === null || extraParams === void 0 ? void 0 : extraParams.get,
|
|
211
|
+
headers: getHeaders()
|
|
212
|
+
});
|
|
213
|
+
case 9:
|
|
214
|
+
res = _context3.sent;
|
|
215
|
+
return _context3.abrupt("return", (res === null || res === void 0 ? void 0 : res.data) || {});
|
|
216
|
+
case 13:
|
|
182
217
|
if (!currentValue) {
|
|
183
|
-
_context3.next =
|
|
218
|
+
_context3.next = 15;
|
|
184
219
|
break;
|
|
185
220
|
}
|
|
186
221
|
return _context3.abrupt("return", parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(currentValue, {}));
|
|
187
|
-
case
|
|
222
|
+
case 15:
|
|
188
223
|
return _context3.abrupt("return", {});
|
|
189
|
-
case
|
|
224
|
+
case 16:
|
|
190
225
|
case "end":
|
|
191
226
|
return _context3.stop();
|
|
192
227
|
}
|
|
@@ -195,7 +230,7 @@ var useActions = function useActions() {
|
|
|
195
230
|
|
|
196
231
|
// 更新数据
|
|
197
232
|
var update = useMemoizedFn( /*#__PURE__*/function () {
|
|
198
|
-
var
|
|
233
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(values) {
|
|
199
234
|
var actions, updateApi, id;
|
|
200
235
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
201
236
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -221,7 +256,7 @@ var useActions = function useActions() {
|
|
|
221
256
|
updateApi = genCustomApi(actions === null || actions === void 0 ? void 0 : actions.update);
|
|
222
257
|
return _context4.abrupt("return", updateApi(formatCreateUpdateParams(values)));
|
|
223
258
|
case 11:
|
|
224
|
-
id = values === null || values === void 0 ? void 0 : values.id;
|
|
259
|
+
id = (extraParams === null || extraParams === void 0 ? void 0 : extraParams.filterByTk) || (values === null || values === void 0 ? void 0 : values.id);
|
|
225
260
|
if (!(!id || !name)) {
|
|
226
261
|
_context4.next = 15;
|
|
227
262
|
break;
|
|
@@ -233,9 +268,11 @@ var useActions = function useActions() {
|
|
|
233
268
|
case 15:
|
|
234
269
|
return _context4.abrupt("return", updateNocobaseData({
|
|
235
270
|
key: name,
|
|
236
|
-
id: id,
|
|
237
271
|
data: formatCreateUpdateParams(values),
|
|
238
|
-
headers: getHeaders()
|
|
272
|
+
headers: getHeaders(),
|
|
273
|
+
query: _objectSpread({
|
|
274
|
+
filterByTk: id
|
|
275
|
+
}, extraParams === null || extraParams === void 0 ? void 0 : extraParams.update)
|
|
239
276
|
}));
|
|
240
277
|
case 16:
|
|
241
278
|
case "end":
|
|
@@ -243,14 +280,14 @@ var useActions = function useActions() {
|
|
|
243
280
|
}
|
|
244
281
|
}, _callee4);
|
|
245
282
|
}));
|
|
246
|
-
return function (
|
|
247
|
-
return
|
|
283
|
+
return function (_x4) {
|
|
284
|
+
return _ref11.apply(this, arguments);
|
|
248
285
|
};
|
|
249
286
|
}());
|
|
250
287
|
|
|
251
288
|
// 获取数据列表
|
|
252
289
|
var list = useMemoizedFn( /*#__PURE__*/function () {
|
|
253
|
-
var
|
|
290
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
254
291
|
var formatParams, actions, listApi;
|
|
255
292
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
256
293
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -285,7 +322,7 @@ var useActions = function useActions() {
|
|
|
285
322
|
_context5.next = 16;
|
|
286
323
|
return getNocobaseDataList({
|
|
287
324
|
key: name,
|
|
288
|
-
params: formatParams,
|
|
325
|
+
params: _objectSpread(_objectSpread({}, formatParams), (extraParams === null || extraParams === void 0 ? void 0 : extraParams.list) || {}),
|
|
289
326
|
headers: getHeaders()
|
|
290
327
|
});
|
|
291
328
|
case 16:
|
|
@@ -297,12 +334,12 @@ var useActions = function useActions() {
|
|
|
297
334
|
}
|
|
298
335
|
}, _callee5);
|
|
299
336
|
}));
|
|
300
|
-
return function (
|
|
301
|
-
return
|
|
337
|
+
return function (_x5) {
|
|
338
|
+
return _ref12.apply(this, arguments);
|
|
302
339
|
};
|
|
303
340
|
}());
|
|
304
341
|
var destroy = useMemoizedFn( /*#__PURE__*/function () {
|
|
305
|
-
var
|
|
342
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
|
|
306
343
|
var actions, deleteApi;
|
|
307
344
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
308
345
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -341,8 +378,8 @@ var useActions = function useActions() {
|
|
|
341
378
|
}
|
|
342
379
|
}, _callee6);
|
|
343
380
|
}));
|
|
344
|
-
return function (
|
|
345
|
-
return
|
|
381
|
+
return function (_x6) {
|
|
382
|
+
return _ref13.apply(this, arguments);
|
|
346
383
|
};
|
|
347
384
|
}());
|
|
348
385
|
return {
|
|
@@ -88,6 +88,13 @@ export declare type DataSourceContextProps = {
|
|
|
88
88
|
list?: boolean;
|
|
89
89
|
get?: boolean;
|
|
90
90
|
};
|
|
91
|
+
extraParams?: {
|
|
92
|
+
list?: Record<string, any>;
|
|
93
|
+
get?: Record<string, any>;
|
|
94
|
+
update?: Record<string, any>;
|
|
95
|
+
create?: Record<string, any>;
|
|
96
|
+
destroy?: Record<string, any>;
|
|
97
|
+
};
|
|
91
98
|
__id?: string;
|
|
92
99
|
__designMode?: string;
|
|
93
100
|
};
|
|
@@ -20,6 +20,7 @@ var DataSourceProvider = function DataSourceProvider(props) {
|
|
|
20
20
|
var children = props.children,
|
|
21
21
|
propsDataSource = props.dataSource,
|
|
22
22
|
currentValue = props.currentValue,
|
|
23
|
+
extraParams = props.extraParams,
|
|
23
24
|
externalActions = props.actions,
|
|
24
25
|
overrideData = props.overrideData,
|
|
25
26
|
autoRun = props.autoRun,
|
|
@@ -33,7 +34,8 @@ var DataSourceProvider = function DataSourceProvider(props) {
|
|
|
33
34
|
var standardActions = useActions({
|
|
34
35
|
dataSource: dataSource,
|
|
35
36
|
currentValue: currentValue,
|
|
36
|
-
__designMode: __designMode
|
|
37
|
+
__designMode: __designMode,
|
|
38
|
+
extraParams: extraParams
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
// 使用外部Promise或标准actions
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useEffect } from 'react';
|
|
2
2
|
import { isArr, isString, isUndefined } from '@pisell/utils';
|
|
3
3
|
import { useMemoizedFn } from 'ahooks';
|
|
4
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
4
5
|
import VariablesContext from "./VariablesContext";
|
|
5
6
|
import { getNestedValue } from "../../dataSourceForm/utils";
|
|
6
7
|
import { mergeWith } from "../../../../utils";
|
|
@@ -14,18 +15,64 @@ var defaultCustomizer = function defaultCustomizer(objValue, srcValue) {
|
|
|
14
15
|
};
|
|
15
16
|
var VARIABLE_PATTERN = /{{([^}]+)}}/g;
|
|
16
17
|
var VariablesProvider = function VariablesProvider(props) {
|
|
18
|
+
var _context$appHelper;
|
|
17
19
|
var children = props.children,
|
|
18
20
|
variables = props.variables;
|
|
21
|
+
var context = useEngineContext();
|
|
22
|
+
var _ref = (context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
23
|
+
getApp = _ref.getApp;
|
|
24
|
+
|
|
25
|
+
// 在组件创建时就初始化 URL 参数
|
|
26
|
+
var initialQuery = useMemo(function () {
|
|
27
|
+
var _getApp, _getApp$history, _getApp$history$insta;
|
|
28
|
+
var currentLocation = getApp === null || getApp === void 0 ? void 0 : (_getApp = getApp()) === null || _getApp === void 0 ? void 0 : (_getApp$history = _getApp.history) === null || _getApp$history === void 0 ? void 0 : (_getApp$history$insta = _getApp$history.instance) === null || _getApp$history$insta === void 0 ? void 0 : _getApp$history$insta.location;
|
|
29
|
+
if (currentLocation !== null && currentLocation !== void 0 && currentLocation.search) {
|
|
30
|
+
var searchParams = new URLSearchParams(currentLocation.search);
|
|
31
|
+
var query = {};
|
|
32
|
+
searchParams.forEach(function (value, key) {
|
|
33
|
+
query[key] = value;
|
|
34
|
+
});
|
|
35
|
+
return query;
|
|
36
|
+
}
|
|
37
|
+
return {};
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
// 初始变量中包含 URL 参数
|
|
41
|
+
var variablesRef = useRef(mergeWith(variables, {
|
|
42
|
+
global: {
|
|
43
|
+
query: initialQuery
|
|
44
|
+
}
|
|
45
|
+
}, defaultCustomizer));
|
|
19
46
|
|
|
20
|
-
// 变量存储
|
|
21
|
-
var variablesRef = useRef({});
|
|
22
47
|
// 添加变量变化监听器存储
|
|
23
48
|
var listenersRef = useRef(new Set());
|
|
49
|
+
|
|
50
|
+
// 解析并设置 query 参数
|
|
51
|
+
var setQueryVariable = useMemoizedFn(function (search) {
|
|
52
|
+
var searchParams = new URLSearchParams(search);
|
|
53
|
+
var query = {};
|
|
54
|
+
searchParams.forEach(function (value, key) {
|
|
55
|
+
query[key] = value;
|
|
56
|
+
});
|
|
57
|
+
registerVariable({
|
|
58
|
+
global: query
|
|
59
|
+
});
|
|
60
|
+
});
|
|
24
61
|
useEffect(function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
62
|
+
var _getApp2, _getApp2$history, _getApp2$history$inst;
|
|
63
|
+
var unlisten = getApp === null || getApp === void 0 ? void 0 : (_getApp2 = getApp()) === null || _getApp2 === void 0 ? void 0 : (_getApp2$history = _getApp2.history) === null || _getApp2$history === void 0 ? void 0 : (_getApp2$history$inst = _getApp2$history.instance) === null || _getApp2$history$inst === void 0 ? void 0 : _getApp2$history$inst.listen(function (location) {
|
|
64
|
+
setQueryVariable(location.search);
|
|
65
|
+
});
|
|
66
|
+
return function () {
|
|
67
|
+
unlisten === null || unlisten === void 0 ? void 0 : unlisten();
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
// useEffect(() => {
|
|
72
|
+
// if (variables) {
|
|
73
|
+
// variablesRef.current = variables;
|
|
74
|
+
// }
|
|
75
|
+
// }, [variables]);
|
|
29
76
|
|
|
30
77
|
// 注册变量
|
|
31
78
|
var registerVariable = useMemoizedFn(function (value) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
/**
|
|
4
|
+
* loginAndRegister组件的属性接口
|
|
5
|
+
*/
|
|
6
|
+
export interface loginAndRegisterProps {
|
|
7
|
+
/** Logo相关配置 */
|
|
8
|
+
showLogo?: boolean;
|
|
9
|
+
logo?: string;
|
|
10
|
+
logoPosition?: 'left' | 'center' | 'right';
|
|
11
|
+
logoSize?: {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
};
|
|
15
|
+
/** 标题相关配置 */
|
|
16
|
+
title?: string;
|
|
17
|
+
showTitle?: boolean;
|
|
18
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
19
|
+
/** 副标题相关配置 */
|
|
20
|
+
subtitle?: string;
|
|
21
|
+
showSubtitle?: boolean;
|
|
22
|
+
subtitleAlign?: 'left' | 'center' | 'right';
|
|
23
|
+
/** 登录方式配置 */
|
|
24
|
+
loginMethods?: ('email' | 'google' | 'facebook' | 'apple')[];
|
|
25
|
+
defaultLoginMethod?: 'email' | 'google' | 'facebook' | 'apple';
|
|
26
|
+
/** 表单配置 */
|
|
27
|
+
emailLabel?: string;
|
|
28
|
+
passwordLabel?: string;
|
|
29
|
+
emailPlaceholder?: string;
|
|
30
|
+
passwordPlaceholder?: string;
|
|
31
|
+
emailRules?: any[];
|
|
32
|
+
buttonText?: string;
|
|
33
|
+
rememberMeText?: string;
|
|
34
|
+
forgotPasswordText?: string;
|
|
35
|
+
showRememberMe?: boolean;
|
|
36
|
+
showForgotPassword?: boolean;
|
|
37
|
+
/** 社交登录配置 */
|
|
38
|
+
socialLoginTexts?: {
|
|
39
|
+
google?: string;
|
|
40
|
+
facebook?: string;
|
|
41
|
+
apple?: string;
|
|
42
|
+
};
|
|
43
|
+
/** 底部配置 */
|
|
44
|
+
showFooter?: boolean;
|
|
45
|
+
showSignUp?: boolean;
|
|
46
|
+
signUpText?: string;
|
|
47
|
+
signUpLink?: string;
|
|
48
|
+
signUpPosition?: 'left' | 'center' | 'right';
|
|
49
|
+
otherLinks?: Array<{
|
|
50
|
+
text: string;
|
|
51
|
+
url: string;
|
|
52
|
+
}>;
|
|
53
|
+
otherLinksPosition?: 'left' | 'center' | 'right';
|
|
54
|
+
/** 登录/注册切换配置 */
|
|
55
|
+
showTabs?: boolean;
|
|
56
|
+
loginTabText?: string;
|
|
57
|
+
registerTabText?: string;
|
|
58
|
+
/** 注册表单配置 */
|
|
59
|
+
registerEmailPlaceholder?: string;
|
|
60
|
+
registerPasswordPlaceholder?: string;
|
|
61
|
+
registerButtonText?: string;
|
|
62
|
+
/** 事件回调 */
|
|
63
|
+
onLogin?: (values: {
|
|
64
|
+
email: string;
|
|
65
|
+
loginMethod: string;
|
|
66
|
+
}) => void;
|
|
67
|
+
onSocialLogin?: (type: 'google' | 'facebook' | 'apple') => void;
|
|
68
|
+
onSignUp?: () => void;
|
|
69
|
+
onRegister?: (values: {
|
|
70
|
+
email: string;
|
|
71
|
+
password: string;
|
|
72
|
+
}) => void;
|
|
73
|
+
/** 新增背景图片属性 */
|
|
74
|
+
backgroundImage?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Saas登录组件
|
|
78
|
+
* @param props - 组件属性
|
|
79
|
+
* @returns React组件
|
|
80
|
+
*/
|
|
81
|
+
declare const loginAndRegister: React.FC<loginAndRegisterProps>;
|
|
82
|
+
export default loginAndRegister;
|