iglooform 3.0.13 → 3.0.15
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/.dumi/tmp/dumi/theme/ContextWrapper.tsx +1 -1
- package/es/app/context.d.ts +9 -0
- package/es/app/context.js +6 -0
- package/es/app/index.d.ts +8 -0
- package/es/app/index.js +33 -0
- package/es/documents/index.d.ts +7 -2
- package/es/documents/index.js +30 -16
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/layout/defaultFooter.js +2 -2
- package/es/message/index.d.ts +3 -1
- package/es/message/index.js +2 -0
- package/es/message/useMessage.d.ts +6 -0
- package/es/message/useMessage.js +52 -0
- package/es/modal/index.d.ts +3 -1
- package/es/modal/index.js +2 -0
- package/es/modal/useModal.d.ts +12 -0
- package/es/modal/useModal.js +135 -0
- package/es/radio/index.js +1 -17
- package/es/radio/radio-group-with-other.js +5 -2
- package/lib/app/context.d.ts +9 -0
- package/lib/app/context.js +13 -0
- package/lib/app/index.d.ts +8 -0
- package/lib/app/index.js +41 -0
- package/lib/documents/index.d.ts +7 -2
- package/lib/documents/index.js +30 -16
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/layout/defaultFooter.js +2 -2
- package/lib/message/index.d.ts +3 -1
- package/lib/message/index.js +2 -0
- package/lib/message/useMessage.d.ts +6 -0
- package/lib/message/useMessage.js +60 -0
- package/lib/modal/index.d.ts +3 -1
- package/lib/modal/index.js +2 -0
- package/lib/modal/useModal.d.ts +12 -0
- package/lib/modal/useModal.js +142 -0
- package/lib/radio/index.js +0 -16
- package/lib/radio/radio-group-with-other.js +5 -2
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ export default function DumiContextWrapper() {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<SiteContext.Provider value={{
|
|
33
|
-
pkg: {"name":"iglooform","version":"3.0.
|
|
33
|
+
pkg: {"name":"iglooform","version":"3.0.15","license":"MIT"},
|
|
34
34
|
historyType: "browser",
|
|
35
35
|
entryExports,
|
|
36
36
|
demos,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HookAPI as ModalHookAPI } from '../modal/useModal';
|
|
3
|
+
import type { HookAPI as MessageHookAPI } from '../message/useMessage';
|
|
4
|
+
export type AppContextType = {
|
|
5
|
+
modal: ModalHookAPI;
|
|
6
|
+
message: MessageHookAPI;
|
|
7
|
+
};
|
|
8
|
+
declare const AppContext: import("react").Context<AppContextType>;
|
|
9
|
+
export default AppContext;
|
package/es/app/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useContext } from 'react';
|
|
8
|
+
import AppContext from "./context";
|
|
9
|
+
import useModal from "../modal/useModal";
|
|
10
|
+
import useMessage from "../message/useMessage";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var App = function App(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
var _useModal = useModal(),
|
|
15
|
+
_useModal2 = _slicedToArray(_useModal, 2),
|
|
16
|
+
modal = _useModal2[0],
|
|
17
|
+
modalContextHolder = _useModal2[1];
|
|
18
|
+
var _useMessage = useMessage(),
|
|
19
|
+
_useMessage2 = _slicedToArray(_useMessage, 2),
|
|
20
|
+
message = _useMessage2[0],
|
|
21
|
+
messageContextHolder = _useMessage2[1];
|
|
22
|
+
return /*#__PURE__*/_jsxs(AppContext.Provider, {
|
|
23
|
+
value: {
|
|
24
|
+
modal: modal,
|
|
25
|
+
message: message
|
|
26
|
+
},
|
|
27
|
+
children: [modalContextHolder, messageContextHolder, children]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
App.useApp = function () {
|
|
31
|
+
return useContext(AppContext);
|
|
32
|
+
};
|
|
33
|
+
export default App;
|
package/es/documents/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, CSSProperties } from 'react';
|
|
2
2
|
declare const Documents: FC<{
|
|
3
|
-
docList: string
|
|
3
|
+
docList: Array<string | {
|
|
4
|
+
src: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}>;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
4
9
|
docNames?: string[];
|
|
5
10
|
showAllPages?: boolean;
|
|
6
11
|
destroyOnClose?: boolean;
|
package/es/documents/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
1
|
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; }
|
|
2
|
+
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); }
|
|
3
3
|
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
4
|
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); }); }; }
|
|
5
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -10,6 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import React, { useState, useEffect } from 'react';
|
|
12
12
|
import { Space } from 'antd';
|
|
13
|
+
import invariant from 'invariant';
|
|
13
14
|
import MediaWithPreview from "../media";
|
|
14
15
|
import { classifyType } from "../utils/tools";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -18,6 +19,8 @@ var Documents = function Documents(_ref) {
|
|
|
18
19
|
docList = _ref$docList === void 0 ? [] : _ref$docList,
|
|
19
20
|
_ref$docNames = _ref.docNames,
|
|
20
21
|
docNames = _ref$docNames === void 0 ? [] : _ref$docNames,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
style = _ref.style,
|
|
21
24
|
_ref$showAllPages = _ref.showAllPages,
|
|
22
25
|
showAllPages = _ref$showAllPages === void 0 ? true : _ref$showAllPages,
|
|
23
26
|
_ref$destroyOnClose = _ref.destroyOnClose,
|
|
@@ -32,36 +35,45 @@ var Documents = function Documents(_ref) {
|
|
|
32
35
|
setList = _useState4[1];
|
|
33
36
|
useEffect(function () {
|
|
34
37
|
var typedList = docList.map( /*#__PURE__*/function () {
|
|
35
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(
|
|
36
|
-
var r, contentType,
|
|
38
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(srcConfig) {
|
|
39
|
+
var src, type, r, contentType, _type;
|
|
37
40
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
41
|
while (1) switch (_context.prev = _context.next) {
|
|
39
42
|
case 0:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
if (!(_typeof(srcConfig) === 'object')) {
|
|
44
|
+
_context.next = 5;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
src = srcConfig.src, type = srcConfig.type;
|
|
48
|
+
invariant(typeof src === 'string', 'When the item in docList is object, it must has a src attribute.');
|
|
49
|
+
invariant(typeof type === 'string', 'When the item in docList is object, it must has a type attribute.');
|
|
50
|
+
return _context.abrupt("return", srcConfig);
|
|
51
|
+
case 5:
|
|
52
|
+
_context.prev = 5;
|
|
53
|
+
_context.next = 8;
|
|
54
|
+
return fetch(srcConfig, {
|
|
43
55
|
cache: 'force-cache'
|
|
44
56
|
});
|
|
45
|
-
case
|
|
57
|
+
case 8:
|
|
46
58
|
r = _context.sent;
|
|
47
59
|
contentType = r.headers.get('content-type');
|
|
48
|
-
|
|
60
|
+
_type = classifyType(contentType);
|
|
49
61
|
return _context.abrupt("return", {
|
|
50
|
-
type:
|
|
51
|
-
src:
|
|
62
|
+
type: _type,
|
|
63
|
+
src: srcConfig
|
|
52
64
|
});
|
|
53
|
-
case
|
|
54
|
-
_context.prev =
|
|
55
|
-
_context.t0 = _context["catch"](
|
|
65
|
+
case 14:
|
|
66
|
+
_context.prev = 14;
|
|
67
|
+
_context.t0 = _context["catch"](5);
|
|
56
68
|
return _context.abrupt("return", {
|
|
57
69
|
type: 'unknown',
|
|
58
|
-
src:
|
|
70
|
+
src: srcConfig
|
|
59
71
|
});
|
|
60
|
-
case
|
|
72
|
+
case 17:
|
|
61
73
|
case "end":
|
|
62
74
|
return _context.stop();
|
|
63
75
|
}
|
|
64
|
-
}, _callee, null, [[
|
|
76
|
+
}, _callee, null, [[5, 14]]);
|
|
65
77
|
}));
|
|
66
78
|
return function (_x2) {
|
|
67
79
|
return _ref2.apply(this, arguments);
|
|
@@ -96,6 +108,8 @@ var Documents = function Documents(_ref) {
|
|
|
96
108
|
src: src,
|
|
97
109
|
type: type,
|
|
98
110
|
docNames: docNames,
|
|
111
|
+
className: className,
|
|
112
|
+
style: style,
|
|
99
113
|
name: docNames[index],
|
|
100
114
|
showAllPages: showAllPages,
|
|
101
115
|
destroyOnClose: destroyOnClose
|
package/es/index.d.ts
CHANGED
|
@@ -45,3 +45,4 @@ export { default as FormSteps } from './free-form/steps';
|
|
|
45
45
|
export { default as FormStep } from './free-form/step';
|
|
46
46
|
export { default as FormSection } from './free-form/section';
|
|
47
47
|
export { default as FormAddableSection } from './free-form/addable-section';
|
|
48
|
+
export { default as App } from './app';
|
package/es/index.js
CHANGED
|
@@ -44,4 +44,5 @@ export { default as FormPage } from "./free-form/page";
|
|
|
44
44
|
export { default as FormSteps } from "./free-form/steps";
|
|
45
45
|
export { default as FormStep } from "./free-form/step";
|
|
46
46
|
export { default as FormSection } from "./free-form/section";
|
|
47
|
-
export { default as FormAddableSection } from "./free-form/addable-section";
|
|
47
|
+
export { default as FormAddableSection } from "./free-form/addable-section";
|
|
48
|
+
export { default as App } from "./app";
|
|
@@ -32,7 +32,7 @@ var DefaultFooter = function DefaultFooter(props) {
|
|
|
32
32
|
className: "footer-bottom",
|
|
33
33
|
children: [/*#__PURE__*/_jsx(Typography, {
|
|
34
34
|
level: "body3",
|
|
35
|
-
children: "\xA9 ".concat(new Date().getFullYear(), " Powered by
|
|
35
|
+
children: "\xA9 ".concat(new Date().getFullYear(), " Powered by Axinan Pte Ltd. All Rights Reserved.")
|
|
36
36
|
}), /*#__PURE__*/_jsxs(Typography, {
|
|
37
37
|
level: "body3",
|
|
38
38
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
@@ -73,7 +73,7 @@ var DefaultFooter = function DefaultFooter(props) {
|
|
|
73
73
|
children: [/*#__PURE__*/_jsx("div", {
|
|
74
74
|
children: /*#__PURE__*/_jsxs(Typography, {
|
|
75
75
|
level: "body3",
|
|
76
|
-
children: ["\xA9 ".concat(new Date().getFullYear(), " Powered by
|
|
76
|
+
children: ["\xA9 ".concat(new Date().getFullYear(), " Powered by Axinan Pte Ltd."), /*#__PURE__*/_jsx("div", {
|
|
77
77
|
children: "All Rights Reserved."
|
|
78
78
|
})]
|
|
79
79
|
})
|
package/es/message/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import useMessage from './useMessage';
|
|
2
3
|
import './style';
|
|
3
4
|
type ConfigContent = React.ReactNode | string;
|
|
4
5
|
type ConfigDuration = number;
|
|
5
|
-
interface IglooGlobalMessage {
|
|
6
|
+
export interface IglooGlobalMessage {
|
|
6
7
|
info(content: ConfigContent, duration?: ConfigDuration): any;
|
|
7
8
|
success(content: ConfigContent, duration?: ConfigDuration): any;
|
|
8
9
|
error(content: ConfigContent, duration?: ConfigDuration): any;
|
|
9
10
|
warning(content: ConfigContent, duration?: ConfigDuration): any;
|
|
11
|
+
useMessage: typeof useMessage;
|
|
10
12
|
}
|
|
11
13
|
declare const IglooMessage: IglooGlobalMessage;
|
|
12
14
|
export default IglooMessage;
|
package/es/message/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
2
|
import { message } from 'antd';
|
|
3
3
|
import AlertMessage from "../alert-message";
|
|
4
|
+
import useMessage from "./useMessage";
|
|
4
5
|
import "./style";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
var IglooMessage = {};
|
|
@@ -88,4 +89,5 @@ IglooMessage.info = function (content, duration) {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
};
|
|
92
|
+
IglooMessage.useMessage = useMessage;
|
|
91
93
|
export default IglooMessage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { IglooGlobalMessage } from './';
|
|
3
|
+
import './style';
|
|
4
|
+
export type HookAPI = Omit<IglooGlobalMessage, 'useMessage'>;
|
|
5
|
+
declare const useMessage: () => readonly [HookAPI, ReactElement];
|
|
6
|
+
export default useMessage;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
import { useCallback, useMemo } from 'react';
|
|
9
|
+
import { message } from 'antd';
|
|
10
|
+
import AlertMessage from "../alert-message";
|
|
11
|
+
import "./style";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
var useMessage = function useMessage() {
|
|
14
|
+
var _message$useMessage = message.useMessage(),
|
|
15
|
+
_message$useMessage2 = _slicedToArray(_message$useMessage, 2),
|
|
16
|
+
api = _message$useMessage2[0],
|
|
17
|
+
contextHolder = _message$useMessage2[1];
|
|
18
|
+
var getStaticFunc = useCallback(function (type) {
|
|
19
|
+
return function (content, duration) {
|
|
20
|
+
var func = api[type];
|
|
21
|
+
switch (_typeof(content)) {
|
|
22
|
+
case 'string':
|
|
23
|
+
return func({
|
|
24
|
+
className: 'iglooform-global-message',
|
|
25
|
+
content: /*#__PURE__*/_jsx(AlertMessage, {
|
|
26
|
+
type: type,
|
|
27
|
+
message: content
|
|
28
|
+
}),
|
|
29
|
+
icon: /*#__PURE__*/_jsx("div", {}),
|
|
30
|
+
duration: duration === undefined ? 3 : duration
|
|
31
|
+
});
|
|
32
|
+
default:
|
|
33
|
+
return func({
|
|
34
|
+
className: 'iglooform-global-message',
|
|
35
|
+
content: content,
|
|
36
|
+
icon: /*#__PURE__*/_jsx("div", {}),
|
|
37
|
+
duration: duration === undefined ? 3 : duration
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
var fns = useMemo(function () {
|
|
43
|
+
return {
|
|
44
|
+
info: getStaticFunc('info'),
|
|
45
|
+
success: getStaticFunc('success'),
|
|
46
|
+
error: getStaticFunc('error'),
|
|
47
|
+
warning: getStaticFunc('warning')
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
return [fns, contextHolder];
|
|
51
|
+
};
|
|
52
|
+
export default useMessage;
|
package/es/modal/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ModalFuncProps, ModalProps } from 'antd/lib/modal';
|
|
3
3
|
import { FormBasicConfig, FormItemConfig } from '../types';
|
|
4
|
+
import useModal from './useModal';
|
|
4
5
|
import './style';
|
|
5
6
|
interface FormModalProps {
|
|
6
7
|
mode?: 'form' | 'normal';
|
|
@@ -17,7 +18,7 @@ interface ModalFuncReturn {
|
|
|
17
18
|
destroy: Function;
|
|
18
19
|
update: (props: ModalProps & ModalFuncProps & FormModalProps) => any;
|
|
19
20
|
}
|
|
20
|
-
type ModalFunction = (props: ModalProps & ModalFuncProps & FormModalProps) => ModalFuncReturn;
|
|
21
|
+
export type ModalFunction = (props: ModalProps & ModalFuncProps & FormModalProps) => ModalFuncReturn;
|
|
21
22
|
interface ModalType extends FC<ModalProps & ModalFuncProps & FormModalProps> {
|
|
22
23
|
confirm: ModalFunction;
|
|
23
24
|
info: ModalFunction;
|
|
@@ -26,6 +27,7 @@ interface ModalType extends FC<ModalProps & ModalFuncProps & FormModalProps> {
|
|
|
26
27
|
success: ModalFunction;
|
|
27
28
|
noFooter: ModalFunction;
|
|
28
29
|
destroyAll: Function;
|
|
30
|
+
useModal: typeof useModal;
|
|
29
31
|
}
|
|
30
32
|
declare const IglooModal: ModalType;
|
|
31
33
|
export default IglooModal;
|
package/es/modal/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import Button from "../button";
|
|
|
21
21
|
import Form from "../form";
|
|
22
22
|
import { LocaleContext, LocaleProvider } from "../locale";
|
|
23
23
|
import { staticLang } from "../locale/format-message";
|
|
24
|
+
import useModal from "./useModal";
|
|
24
25
|
import "./style";
|
|
25
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -241,4 +242,5 @@ IglooModal.destroyAll = function () {
|
|
|
241
242
|
return destroy();
|
|
242
243
|
});
|
|
243
244
|
};
|
|
245
|
+
IglooModal.useModal = useModal;
|
|
244
246
|
export default IglooModal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type ModalFunction } from './';
|
|
3
|
+
export interface HookAPI {
|
|
4
|
+
confirm: ModalFunction;
|
|
5
|
+
info: ModalFunction;
|
|
6
|
+
warning: ModalFunction;
|
|
7
|
+
error: ModalFunction;
|
|
8
|
+
success: ModalFunction;
|
|
9
|
+
noFooter: ModalFunction;
|
|
10
|
+
}
|
|
11
|
+
declare const useModal: () => readonly [HookAPI, ReactElement];
|
|
12
|
+
export default useModal;
|
|
@@ -0,0 +1,135 @@
|
|
|
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 = ["content", "onOk", "onCancel"];
|
|
3
|
+
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
|
+
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
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
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; }
|
|
16
|
+
import { createRef, forwardRef, memo, useCallback, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
17
|
+
import usePatchElement from 'antd/es/_util/hooks/usePatchElement';
|
|
18
|
+
import classnames from 'classnames';
|
|
19
|
+
import IglooModal from "./";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
var ElementsHolder = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_, ref) {
|
|
23
|
+
var _usePatchElement = usePatchElement(),
|
|
24
|
+
_usePatchElement2 = _slicedToArray(_usePatchElement, 2),
|
|
25
|
+
elements = _usePatchElement2[0],
|
|
26
|
+
patchElement = _usePatchElement2[1];
|
|
27
|
+
useImperativeHandle(ref, function () {
|
|
28
|
+
return {
|
|
29
|
+
patchElement: patchElement
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
33
|
+
children: elements
|
|
34
|
+
});
|
|
35
|
+
}));
|
|
36
|
+
var HookModal = /*#__PURE__*/forwardRef(function (config, ref) {
|
|
37
|
+
var _useState = useState(true),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
open = _useState2[0],
|
|
40
|
+
setOpen = _useState2[1];
|
|
41
|
+
var _useState3 = useState(config),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
modalConfig = _useState4[0],
|
|
44
|
+
setModalConfig = _useState4[1];
|
|
45
|
+
var destroy = useCallback(function () {
|
|
46
|
+
return setOpen(false);
|
|
47
|
+
}, []);
|
|
48
|
+
useImperativeHandle(ref, function () {
|
|
49
|
+
return {
|
|
50
|
+
destroy: destroy,
|
|
51
|
+
update: function update(newConfig) {
|
|
52
|
+
return setModalConfig(function (oldConfig) {
|
|
53
|
+
return _objectSpread(_objectSpread({}, oldConfig), newConfig);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
58
|
+
var content = modalConfig.content,
|
|
59
|
+
_onOk = modalConfig.onOk,
|
|
60
|
+
_onCancel = modalConfig.onCancel,
|
|
61
|
+
rest = _objectWithoutProperties(modalConfig, _excluded);
|
|
62
|
+
return /*#__PURE__*/_jsx(IglooModal, _objectSpread(_objectSpread({}, rest), {}, {
|
|
63
|
+
open: open,
|
|
64
|
+
onCancel: function onCancel() {
|
|
65
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
66
|
+
args[_key] = arguments[_key];
|
|
67
|
+
}
|
|
68
|
+
_onCancel === null || _onCancel === void 0 ? void 0 : _onCancel.apply(void 0, args);
|
|
69
|
+
destroy();
|
|
70
|
+
},
|
|
71
|
+
onOk: function onOk() {
|
|
72
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
73
|
+
args[_key2] = arguments[_key2];
|
|
74
|
+
}
|
|
75
|
+
var rst = _onOk === null || _onOk === void 0 ? void 0 : _onOk.apply(void 0, args);
|
|
76
|
+
if (rst instanceof Promise) {
|
|
77
|
+
rst.then(function () {
|
|
78
|
+
destroy();
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
destroy();
|
|
82
|
+
}
|
|
83
|
+
return rst;
|
|
84
|
+
},
|
|
85
|
+
children: content
|
|
86
|
+
}));
|
|
87
|
+
});
|
|
88
|
+
var uuid = 0;
|
|
89
|
+
var useModal = function useModal() {
|
|
90
|
+
var holderRef = useRef(null);
|
|
91
|
+
var staticFunc = useCallback(function (config) {
|
|
92
|
+
var _holderRef$current;
|
|
93
|
+
uuid++;
|
|
94
|
+
var modalRef = /*#__PURE__*/createRef();
|
|
95
|
+
var close;
|
|
96
|
+
var modal = /*#__PURE__*/_jsx(HookModal, _objectSpread(_objectSpread({}, config), {}, {
|
|
97
|
+
ref: modalRef,
|
|
98
|
+
afterClose: function afterClose() {
|
|
99
|
+
var _config$afterClose, _close;
|
|
100
|
+
(_config$afterClose = config.afterClose) === null || _config$afterClose === void 0 ? void 0 : _config$afterClose.call(config);
|
|
101
|
+
(_close = close) === null || _close === void 0 ? void 0 : _close();
|
|
102
|
+
}
|
|
103
|
+
}), 'modal-' + uuid);
|
|
104
|
+
close = (_holderRef$current = holderRef.current) === null || _holderRef$current === void 0 ? void 0 : _holderRef$current.patchElement(modal);
|
|
105
|
+
return {
|
|
106
|
+
destroy: function destroy() {
|
|
107
|
+
var _modalRef$current;
|
|
108
|
+
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.destroy();
|
|
109
|
+
},
|
|
110
|
+
update: function update(newConfig) {
|
|
111
|
+
var _modalRef$current2;
|
|
112
|
+
(_modalRef$current2 = modalRef.current) === null || _modalRef$current2 === void 0 ? void 0 : _modalRef$current2.update(newConfig);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
116
|
+
var fns = useMemo(function () {
|
|
117
|
+
return {
|
|
118
|
+
confirm: staticFunc,
|
|
119
|
+
info: staticFunc,
|
|
120
|
+
warning: staticFunc,
|
|
121
|
+
error: staticFunc,
|
|
122
|
+
success: staticFunc,
|
|
123
|
+
noFooter: function noFooter(config) {
|
|
124
|
+
return staticFunc(_objectSpread(_objectSpread({}, config), {}, {
|
|
125
|
+
footer: null,
|
|
126
|
+
className: classnames('igloo-modal-no-footer', config.className)
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
return [fns, /*#__PURE__*/_jsx(ElementsHolder, {
|
|
132
|
+
ref: holderRef
|
|
133
|
+
})];
|
|
134
|
+
};
|
|
135
|
+
export default useModal;
|
package/es/radio/index.js
CHANGED
|
@@ -2,12 +2,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
var _excluded = ["className"],
|
|
3
3
|
_excluded2 = ["className", "options", "radioType", "value", "clearWhenOptionsUpdated", "preview"],
|
|
4
4
|
_excluded3 = ["label", "value", "extraInfo"];
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
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."); }
|
|
7
|
-
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); }
|
|
8
|
-
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; }
|
|
9
|
-
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; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
5
|
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; }
|
|
12
6
|
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; }
|
|
13
7
|
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; }
|
|
@@ -15,7 +9,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
15
9
|
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); }
|
|
16
10
|
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; }
|
|
17
11
|
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; }
|
|
18
|
-
import React, { useEffect,
|
|
12
|
+
import React, { useEffect, useRef, useContext } from 'react';
|
|
19
13
|
import { Radio, Row, Col } from 'antd';
|
|
20
14
|
import omit from 'omit.js';
|
|
21
15
|
import classnames from 'classnames';
|
|
@@ -48,19 +42,9 @@ export var InnerRadioGroup = function InnerRadioGroup(_ref) {
|
|
|
48
42
|
clearWhenOptionsUpdated = _ref$clearWhenOptions === void 0 ? false : _ref$clearWhenOptions,
|
|
49
43
|
preview = _ref.preview,
|
|
50
44
|
rest = _objectWithoutProperties(_ref, _excluded2);
|
|
51
|
-
var _useState = useState(value),
|
|
52
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
-
selected = _useState2[0],
|
|
54
|
-
setSelected = _useState2[1];
|
|
55
45
|
var originOptions = useRef(options);
|
|
56
46
|
var _useContext = useContext(LocaleContext),
|
|
57
47
|
formatMessage = _useContext.formatMessage;
|
|
58
|
-
useEffect(function () {
|
|
59
|
-
typeof rest.onChange === 'function' && value !== selected && rest.onChange(selected);
|
|
60
|
-
}, [selected]);
|
|
61
|
-
useEffect(function () {
|
|
62
|
-
setSelected(value);
|
|
63
|
-
}, [value]);
|
|
64
48
|
useEffect(function () {
|
|
65
49
|
var setFieldValue = rest.setFieldValue;
|
|
66
50
|
if (compareOptions(options, originOptions.current)) {
|
|
@@ -52,13 +52,16 @@ var InnerRadioGroupWithOther = function InnerRadioGroupWithOther(_ref) {
|
|
|
52
52
|
var setFieldValue = rest.setFieldValue;
|
|
53
53
|
if (compareOptions(options, originOptions.current)) {
|
|
54
54
|
if (clearWhenOptionsUpdated) {
|
|
55
|
-
typeof setFieldValue === 'function'
|
|
55
|
+
if (typeof setFieldValue === 'function') {
|
|
56
|
+
setFieldValue();
|
|
57
|
+
enableOther(false);
|
|
58
|
+
}
|
|
56
59
|
} else {
|
|
57
60
|
var foundValue = options.find(function (option) {
|
|
58
61
|
return Array.isArray(value) ? value.includes(option.value) : option.value === value;
|
|
59
62
|
});
|
|
60
63
|
if (!foundValue && value !== undefined) {
|
|
61
|
-
typeof setFieldValue === 'function' && setFieldValue();
|
|
64
|
+
typeof setFieldValue === 'function' && setFieldValue(otherEnabled ? value : undefined);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
originOptions.current = options;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { HookAPI as ModalHookAPI } from '../modal/useModal';
|
|
3
|
+
import type { HookAPI as MessageHookAPI } from '../message/useMessage';
|
|
4
|
+
export type AppContextType = {
|
|
5
|
+
modal: ModalHookAPI;
|
|
6
|
+
message: MessageHookAPI;
|
|
7
|
+
};
|
|
8
|
+
declare const AppContext: import("react").Context<AppContextType>;
|
|
9
|
+
export default AppContext;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var AppContext = /*#__PURE__*/(0, _react.createContext)({
|
|
9
|
+
modal: {},
|
|
10
|
+
message: {}
|
|
11
|
+
});
|
|
12
|
+
var _default = AppContext;
|
|
13
|
+
exports.default = _default;
|