@pisell/materials 1.0.570 → 1.0.572
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 +2 -2
- package/build/lowcode/preview.js +6 -6
- package/build/lowcode/render/default/view.js +17 -17
- package/build/lowcode/view.js +16 -16
- package/es/components/cardPro/index.d.ts +1 -1
- package/es/components/cardPro/index.less +44 -47
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +94 -3
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +11 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +46 -8
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/es/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
- package/es/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
- package/es/components/dataSourceComponents/provider/actions/ActionsProvider.js +0 -1
- package/lib/components/cardPro/index.d.ts +1 -1
- package/lib/components/cardPro/index.js +41 -3
- package/lib/components/cardPro/index.less +44 -47
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +77 -4
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +8 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +14 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
- package/lib/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
- package/lib/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
- package/lowcode/data-source-form/meta.ts +131 -0
- package/lowcode/data-source-form/snippets.ts +54 -0
- package/lowcode/data-source-table/utils.tsx +28 -0
- package/package.json +2 -2
|
@@ -1,58 +1,55 @@
|
|
|
1
1
|
.pisell-cardPro-wrap {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.pisell-cardPro-head, .pisell-cardPro-content {
|
|
13
|
-
padding: 0 24px;
|
|
14
|
-
}
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
|
|
4
|
+
&.pisell-cardPro-wrap-with-cover {
|
|
5
|
+
.pisell-lowcode-card-body {
|
|
6
|
+
padding-top: 0;
|
|
7
|
+
padding-left: 0;
|
|
8
|
+
padding-right: 0;
|
|
9
|
+
padding-bottom: 24px;
|
|
15
10
|
}
|
|
16
11
|
|
|
12
|
+
.pisell-cardPro-head,
|
|
13
|
+
.pisell-cardPro-content {
|
|
14
|
+
padding: 0 24px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.pisell-cardPro-badge {
|
|
22
|
-
position: absolute;
|
|
23
|
-
right: 0;
|
|
24
|
-
top: 0;
|
|
25
|
-
}
|
|
18
|
+
.pisell-cardPro-cover {
|
|
19
|
+
position: relative;
|
|
26
20
|
|
|
21
|
+
.pisell-cardPro-badge {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 0;
|
|
24
|
+
top: 0;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.pisell-cardPro-head-subtitle {
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
color: #6e8098;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.pisell-cardPro-head-extra {
|
|
43
|
-
width: 150px;
|
|
44
|
-
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pisell-cardPro-head {
|
|
29
|
+
padding: 0;
|
|
30
|
+
.pisell-cardPro-head-title {
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: #1a2029;
|
|
45
34
|
}
|
|
46
35
|
|
|
47
|
-
.pisell-cardPro-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
.pisell-cardPro-head-subtitle {
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
color: #6e8098;
|
|
50
39
|
}
|
|
51
40
|
|
|
52
|
-
.pisell-cardPro-
|
|
53
|
-
|
|
54
|
-
margin-top: 20px;
|
|
41
|
+
.pisell-cardPro-head-extra {
|
|
42
|
+
width: 150px;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pisell-cardPro-content {
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
margin-top: 20px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pisell-cardPro-content {
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
margin-top: 20px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,20 +1,29 @@
|
|
|
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 _excluded = ["title", "description", "dataSource", "showTitle", "showDescription", "groupInfoPosition", "variables", "renderMode", "children", "currentValue", "className", "onDataSourceFinish", "formatSubmitValues", "formatInitialValues", "customSubmit", "leaveConfirmConfig"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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; }
|
|
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); } }
|
|
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); }); }; }
|
|
3
7
|
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; }
|
|
4
8
|
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; }
|
|
5
9
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
6
10
|
import classNames from 'classnames';
|
|
11
|
+
import { useMemoizedFn } from 'ahooks';
|
|
12
|
+
import PisellModal from "../../../components/pisellModal";
|
|
13
|
+
import useCtxActions from "../hooks/useCtxActions";
|
|
7
14
|
import useDataSource from "../hooks/useDataSource";
|
|
15
|
+
import useEngineContext from "../../../hooks/useEngineContext";
|
|
8
16
|
import Form from "../../form";
|
|
9
17
|
import FormSettingProvider from "./provider/formSetting/FormSettingProvider";
|
|
10
18
|
import PageHeader from "../../page-header";
|
|
19
|
+
import { formObjValueToArray } from "./utils";
|
|
11
20
|
import "./index.less";
|
|
12
|
-
|
|
13
21
|
/**
|
|
14
22
|
* @title: 数据源表单组件
|
|
15
23
|
* @description: 基于数据源动态生成表单,支持编辑、查看、禁用三种模式
|
|
16
24
|
*/
|
|
17
25
|
var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
26
|
+
var _context$appHelper;
|
|
18
27
|
var title = props.title,
|
|
19
28
|
description = props.description,
|
|
20
29
|
dataSource = props.dataSource,
|
|
@@ -30,7 +39,13 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
30
39
|
formatSubmitValues = props.formatSubmitValues,
|
|
31
40
|
formatInitialValues = props.formatInitialValues,
|
|
32
41
|
customSubmit = props.customSubmit,
|
|
42
|
+
leaveConfirmConfig = props.leaveConfirmConfig,
|
|
33
43
|
others = _objectWithoutProperties(props, _excluded);
|
|
44
|
+
var context = useEngineContext();
|
|
45
|
+
var _useCtxActions = useCtxActions(),
|
|
46
|
+
setBeforeClose = _useCtxActions.setBeforeClose;
|
|
47
|
+
var _context$appHelper$ut = (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils,
|
|
48
|
+
getApp = _context$appHelper$ut.getApp;
|
|
34
49
|
var formRef = useRef(null);
|
|
35
50
|
var _useDataSource = useDataSource(),
|
|
36
51
|
get = _useDataSource.get;
|
|
@@ -49,10 +64,86 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
49
64
|
get === null || get === void 0 ? void 0 : get.runAsync().then(function (res) {
|
|
50
65
|
var _formRef$current2;
|
|
51
66
|
var formattedValues = formatInitialValues ? formatInitialValues(res) : res;
|
|
52
|
-
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.
|
|
67
|
+
(_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.setFields(formObjValueToArray(formattedValues));
|
|
53
68
|
});
|
|
54
69
|
}
|
|
55
70
|
}, [renderMode, dataSource, formatInitialValues]);
|
|
71
|
+
|
|
72
|
+
// 检查表单是否可以关闭
|
|
73
|
+
var checkFormClose = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
74
|
+
var _formRef$current3;
|
|
75
|
+
var isFormChanged;
|
|
76
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
77
|
+
while (1) switch (_context.prev = _context.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
isFormChanged = (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.isFieldsTouched();
|
|
80
|
+
if (!isFormChanged) {
|
|
81
|
+
_context.next = 3;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
85
|
+
PisellModal.confirm({
|
|
86
|
+
title: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.title,
|
|
87
|
+
content: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.content,
|
|
88
|
+
okText: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.okText,
|
|
89
|
+
cancelText: leaveConfirmConfig === null || leaveConfirmConfig === void 0 ? void 0 : leaveConfirmConfig.cancelText,
|
|
90
|
+
onOk: function onOk() {
|
|
91
|
+
var _formRef$current4;
|
|
92
|
+
(_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.resetFields();
|
|
93
|
+
resolve(true);
|
|
94
|
+
},
|
|
95
|
+
onCancel: function onCancel() {
|
|
96
|
+
resolve(false);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}));
|
|
100
|
+
case 3:
|
|
101
|
+
return _context.abrupt("return", true);
|
|
102
|
+
case 4:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}, _callee);
|
|
107
|
+
})));
|
|
108
|
+
useEffect(function () {
|
|
109
|
+
if (leaveConfirmConfig !== null && leaveConfirmConfig !== void 0 && leaveConfirmConfig.enable) {
|
|
110
|
+
setBeforeClose === null || setBeforeClose === void 0 ? void 0 : setBeforeClose(checkFormClose);
|
|
111
|
+
}
|
|
112
|
+
}, [leaveConfirmConfig]);
|
|
113
|
+
useEffect(function () {
|
|
114
|
+
if (leaveConfirmConfig !== null && leaveConfirmConfig !== void 0 && leaveConfirmConfig.enable) {
|
|
115
|
+
var _getApp, _getApp$history;
|
|
116
|
+
var history = 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.instance;
|
|
117
|
+
var unblock = history === null || history === void 0 ? void 0 : history.block(function (location, action) {
|
|
118
|
+
var _formRef$current5;
|
|
119
|
+
var isFormChanged = (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.isFieldsTouched();
|
|
120
|
+
if (isFormChanged) {
|
|
121
|
+
PisellModal.confirm({
|
|
122
|
+
title: leaveConfirmConfig.title,
|
|
123
|
+
content: leaveConfirmConfig.content,
|
|
124
|
+
okText: leaveConfirmConfig.okText,
|
|
125
|
+
cancelText: leaveConfirmConfig.cancelText,
|
|
126
|
+
onOk: function onOk() {
|
|
127
|
+
unblock === null || unblock === void 0 ? void 0 : unblock();
|
|
128
|
+
if (action === 'PUSH') {
|
|
129
|
+
history.push(location);
|
|
130
|
+
} else if (action === 'POP') {
|
|
131
|
+
history.go(-1);
|
|
132
|
+
} else if (action === 'REPLACE') {
|
|
133
|
+
history.replace(location);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
onCancel: function onCancel() {}
|
|
137
|
+
});
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
});
|
|
142
|
+
return function () {
|
|
143
|
+
unblock === null || unblock === void 0 ? void 0 : unblock();
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, []);
|
|
56
147
|
return /*#__PURE__*/React.createElement(FormSettingProvider, {
|
|
57
148
|
renderMode: renderMode,
|
|
58
149
|
groupInfoPosition: groupInfoPosition,
|
|
@@ -20,4 +20,12 @@ export interface DataSourceFormProps {
|
|
|
20
20
|
formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
|
|
21
21
|
formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
|
|
22
22
|
customSubmit?: (values: Record<string, any>) => Promise<any>;
|
|
23
|
+
leaveConfirmConfig?: {
|
|
24
|
+
enable: boolean;
|
|
25
|
+
title: string;
|
|
26
|
+
content: string;
|
|
27
|
+
icon: React.ReactNode;
|
|
28
|
+
okText: string;
|
|
29
|
+
cancelText: string;
|
|
30
|
+
};
|
|
23
31
|
}
|
|
@@ -50,3 +50,4 @@ export declare const getNestedValue: (obj: Record<string, any>, path: string) =>
|
|
|
50
50
|
export declare const renderValueWithMap: (value: any, valueMap?: Record<string, string>, renderMode?: ModeType) => React.JSX.Element | null;
|
|
51
51
|
export declare function toArr(str: string | number | (string | number)[]): (string | number)[];
|
|
52
52
|
export declare const filterSystemFields: (params: Record<string, any>) => Record<string, any>;
|
|
53
|
+
export declare const formObjValueToArray: (obj: Record<string, any>) => any[];
|
|
@@ -385,4 +385,15 @@ export var filterSystemFields = function filterSystemFields(params) {
|
|
|
385
385
|
}
|
|
386
386
|
return acc;
|
|
387
387
|
}, {});
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
// 表单objvalue转换为数组
|
|
391
|
+
export var formObjValueToArray = function formObjValueToArray(obj) {
|
|
392
|
+
return Object.keys(obj).reduce(function (acc, key) {
|
|
393
|
+
acc.push({
|
|
394
|
+
name: key,
|
|
395
|
+
value: obj[key]
|
|
396
|
+
});
|
|
397
|
+
return acc;
|
|
398
|
+
}, []);
|
|
388
399
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
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); }
|
|
1
2
|
var _excluded = ["columns", "dataSource", "operationContent"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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; }
|
|
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); } }
|
|
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); }); }; }
|
|
3
7
|
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; }
|
|
4
8
|
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; }
|
|
5
|
-
import React, { useEffect, useRef } from 'react';
|
|
9
|
+
import React, { useCallback, useEffect, useRef } from 'react';
|
|
6
10
|
import { useUpdateEffect } from 'ahooks';
|
|
7
11
|
import Table from "../../table";
|
|
8
12
|
import useVariables from "../hooks/useVariables";
|
|
@@ -30,6 +34,10 @@ var BaseTable = function BaseTable(props) {
|
|
|
30
34
|
var _useDataSourceKey = useDataSourceKey(),
|
|
31
35
|
dataSourceKey = _useDataSourceKey.dataSourceKey,
|
|
32
36
|
dataSourceKeyRef = _useDataSourceKey.dataSourceKeyRef;
|
|
37
|
+
var beforeClose = useRef();
|
|
38
|
+
var setBeforeClose = useCallback(function (fn) {
|
|
39
|
+
beforeClose.current = fn;
|
|
40
|
+
}, []);
|
|
33
41
|
var _useDrawerState = useDrawerState(operationContent),
|
|
34
42
|
drawerVisible = _useDrawerState.drawerVisible,
|
|
35
43
|
setDrawerVisible = _useDrawerState.setDrawerVisible,
|
|
@@ -73,12 +81,40 @@ var BaseTable = function BaseTable(props) {
|
|
|
73
81
|
}, [dataSource]);
|
|
74
82
|
|
|
75
83
|
// 关闭抽屉
|
|
76
|
-
var handleCloseDrawer = function
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
var handleCloseDrawer = /*#__PURE__*/function () {
|
|
85
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
86
|
+
var canClose;
|
|
87
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
if (!beforeClose.current) {
|
|
91
|
+
_context.next = 6;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
_context.next = 3;
|
|
95
|
+
return beforeClose.current();
|
|
96
|
+
case 3:
|
|
97
|
+
canClose = _context.sent;
|
|
98
|
+
if (canClose) {
|
|
99
|
+
_context.next = 6;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return _context.abrupt("return");
|
|
103
|
+
case 6:
|
|
104
|
+
closeDrawer();
|
|
105
|
+
registerValueVariable === null || registerValueVariable === void 0 ? void 0 : registerValueVariable(componentId, {
|
|
106
|
+
currentRecord: null
|
|
107
|
+
});
|
|
108
|
+
case 8:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context.stop();
|
|
111
|
+
}
|
|
112
|
+
}, _callee);
|
|
113
|
+
}));
|
|
114
|
+
return function handleCloseDrawer() {
|
|
115
|
+
return _ref.apply(this, arguments);
|
|
116
|
+
};
|
|
117
|
+
}();
|
|
82
118
|
var transformProps = useTableProps({
|
|
83
119
|
data: data,
|
|
84
120
|
originProps: props,
|
|
@@ -97,7 +133,9 @@ var BaseTable = function BaseTable(props) {
|
|
|
97
133
|
})), /*#__PURE__*/React.createElement(ActionsProvider, {
|
|
98
134
|
visible: drawerVisible,
|
|
99
135
|
setVisible: setDrawerVisible,
|
|
100
|
-
refreshTableData: refreshData
|
|
136
|
+
refreshTableData: refreshData,
|
|
137
|
+
setBeforeClose: setBeforeClose,
|
|
138
|
+
beforeClose: beforeClose.current
|
|
101
139
|
}, /*#__PURE__*/React.createElement(Container, _extends({}, containerProps, {
|
|
102
140
|
// title={DRAWER_TITLES[drawerType]}
|
|
103
141
|
open: drawerVisible,
|
|
@@ -9,7 +9,7 @@ declare const useDrawerState: (operationContent?: {
|
|
|
9
9
|
openDrawer: (item: OperationItem) => void;
|
|
10
10
|
closeDrawer: () => void;
|
|
11
11
|
drawerContent: import("react").ReactNode;
|
|
12
|
-
Container:
|
|
12
|
+
Container: {
|
|
13
13
|
(props: import("../../../pisellModal").PisellModalProps): import("react").JSX.Element;
|
|
14
14
|
confirm: (props: import("../../../pisellModal/components/functions").PisellModalFuncProps) => {
|
|
15
15
|
destroy: () => void;
|
|
@@ -33,7 +33,7 @@ declare const useDrawerState: (operationContent?: {
|
|
|
33
33
|
update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
|
|
34
34
|
};
|
|
35
35
|
Information: (props: import("../../../pisellModal/components/Information").InformationProps) => import("react").JSX.Element;
|
|
36
|
-
};
|
|
36
|
+
} | typeof Drawer;
|
|
37
37
|
containerProps: {};
|
|
38
38
|
};
|
|
39
39
|
export default useDrawerState;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface ActionsContextType {
|
|
3
|
-
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
setVisible?: (visible: boolean) => void;
|
|
5
|
+
refreshTableData?: () => void;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
beforeClose?: () => boolean | Promise<boolean>;
|
|
8
|
+
setBeforeClose?: (beforeClose: () => boolean | Promise<boolean>) => void;
|
|
4
9
|
}
|
|
5
10
|
declare const ActionsContext: import("react").Context<ActionsContextType>;
|
|
6
11
|
export default ActionsContext;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ActionsContextType } from './ActionsContext';
|
|
3
|
+
interface ActionsProviderProps extends ActionsContextType {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
3
6
|
/**
|
|
4
7
|
* 自定义请求的provider
|
|
5
8
|
* @param props
|
|
6
9
|
* @constructor
|
|
7
10
|
*/
|
|
8
|
-
declare const ActionsProvider: React.FC<
|
|
11
|
+
declare const ActionsProvider: React.FC<ActionsProviderProps>;
|
|
9
12
|
export default ActionsProvider;
|
|
@@ -9,7 +9,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
9
9
|
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; }
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import ActionsContext from "./ActionsContext";
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* 自定义请求的provider
|
|
15
14
|
* @param props
|
|
@@ -53,8 +53,46 @@ var CardPro = (props) => {
|
|
|
53
53
|
coverHeight,
|
|
54
54
|
badge
|
|
55
55
|
} = props;
|
|
56
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
57
|
+
import_antd.Card,
|
|
58
|
+
{
|
|
59
|
+
title: null,
|
|
60
|
+
style: { padding: 0 },
|
|
61
|
+
className: (0, import_classnames.default)(
|
|
62
|
+
"pisell-cardPro-wrap",
|
|
63
|
+
className,
|
|
64
|
+
cover && "pisell-cardPro-wrap-with-cover"
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
!!cover && /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: (0, import_classnames.default)("pisell-cardPro-cover"),
|
|
71
|
+
style: { height: coverHeight }
|
|
72
|
+
},
|
|
73
|
+
cover,
|
|
74
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-cardPro-badge") }, badge)
|
|
75
|
+
),
|
|
76
|
+
isShowHead && /* @__PURE__ */ import_react.default.createElement(
|
|
77
|
+
import_antd.Flex,
|
|
78
|
+
{
|
|
79
|
+
className: (0, import_classnames.default)("pisell-cardPro-head"),
|
|
80
|
+
justify: "space-between"
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { style: { flex: 1 }, vertical: true, gap: "middle" }, /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-cardPro-head-title") }, headTitle), /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-cardPro-head-subTitle") }, headSubTitle)),
|
|
83
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-cardPro-head-extra") }, extra)
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
86
|
+
import_antd.Flex,
|
|
87
|
+
{
|
|
88
|
+
style: { height: contentHeight },
|
|
89
|
+
className: (0, import_classnames.default)("pisell-cardPro-content")
|
|
90
|
+
},
|
|
91
|
+
children
|
|
92
|
+
),
|
|
93
|
+
isShowFooter && /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { gap: 20, justify: buttonPosition, style: { marginTop: 20 } }, actionButtons.map((item, index) => {
|
|
94
|
+
return item.button;
|
|
95
|
+
}))
|
|
96
|
+
);
|
|
59
97
|
};
|
|
60
98
|
var cardPro_default = (0, import_hoc.withWrap)(CardPro);
|
|
@@ -1,58 +1,55 @@
|
|
|
1
1
|
.pisell-cardPro-wrap {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.pisell-cardPro-head, .pisell-cardPro-content {
|
|
13
|
-
padding: 0 24px;
|
|
14
|
-
}
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
|
|
4
|
+
&.pisell-cardPro-wrap-with-cover {
|
|
5
|
+
.pisell-lowcode-card-body {
|
|
6
|
+
padding-top: 0;
|
|
7
|
+
padding-left: 0;
|
|
8
|
+
padding-right: 0;
|
|
9
|
+
padding-bottom: 24px;
|
|
15
10
|
}
|
|
16
11
|
|
|
12
|
+
.pisell-cardPro-head,
|
|
13
|
+
.pisell-cardPro-content {
|
|
14
|
+
padding: 0 24px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.pisell-cardPro-badge {
|
|
22
|
-
position: absolute;
|
|
23
|
-
right: 0;
|
|
24
|
-
top: 0;
|
|
25
|
-
}
|
|
18
|
+
.pisell-cardPro-cover {
|
|
19
|
+
position: relative;
|
|
26
20
|
|
|
21
|
+
.pisell-cardPro-badge {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 0;
|
|
24
|
+
top: 0;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.pisell-cardPro-head-subtitle {
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
color: #6e8098;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.pisell-cardPro-head-extra {
|
|
43
|
-
width: 150px;
|
|
44
|
-
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.pisell-cardPro-head {
|
|
29
|
+
padding: 0;
|
|
30
|
+
.pisell-cardPro-head-title {
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: #1a2029;
|
|
45
34
|
}
|
|
46
35
|
|
|
47
|
-
.pisell-cardPro-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
.pisell-cardPro-head-subtitle {
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
color: #6e8098;
|
|
50
39
|
}
|
|
51
40
|
|
|
52
|
-
.pisell-cardPro-
|
|
53
|
-
|
|
54
|
-
margin-top: 20px;
|
|
41
|
+
.pisell-cardPro-head-extra {
|
|
42
|
+
width: 150px;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.pisell-cardPro-content {
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
margin-top: 20px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pisell-cardPro-content {
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
margin-top: 20px;
|
|
54
|
+
}
|
|
55
|
+
}
|