@rainte/ant 0.0.1 → 0.0.2

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.
Files changed (108) hide show
  1. package/README.md +8 -27
  2. package/dist/browser-ponyfill-OJMhVqoI.js +341 -0
  3. package/dist/index-BQuHWRGH.js +95052 -0
  4. package/dist/index.css +7 -0
  5. package/dist/index.js +9 -0
  6. package/dist/index.umd.cjs +600 -0
  7. package/dist/types/lib/index.d.ts +10 -0
  8. package/dist/types/src/App.d.ts +1 -0
  9. package/dist/types/src/components/Editor/index.d.ts +9 -0
  10. package/dist/types/src/components/Form/index.d.ts +11 -0
  11. package/dist/types/src/components/Provider/index.d.ts +2 -0
  12. package/dist/types/src/components/Table/index.d.ts +4 -0
  13. package/dist/types/src/components/Upload/index.d.ts +7 -0
  14. package/dist/types/src/main.d.ts +1 -0
  15. package/dist/types/src/router/index.d.ts +7 -0
  16. package/dist/types/src/utils/i18n.d.ts +70 -0
  17. package/dist/types/src/views/form/index.d.ts +1 -0
  18. package/dist/types/src/views/layout/blank/index.d.ts +1 -0
  19. package/dist/types/src/views/layout/menu/index.d.ts +1 -0
  20. package/dist/types/src/views/table/index.d.ts +1 -0
  21. package/dist/types/vite.config.d.ts +2 -0
  22. package/dist/vite.svg +1 -0
  23. package/package.json +41 -43
  24. package/.editorconfig +0 -9
  25. package/.fatherrc.ts +0 -15
  26. package/.gitattributes +0 -1
  27. package/.prettierignore +0 -7
  28. package/.prettierrc +0 -13
  29. package/.umirc.ts +0 -24
  30. package/LICENSE +0 -21
  31. package/docs/index.md +0 -9
  32. package/es/components/Editor/index.d.ts +0 -8
  33. package/es/components/Editor/index.js +0 -35
  34. package/es/components/Editor/props.d.ts +0 -13
  35. package/es/components/Editor/props.js +0 -12
  36. package/es/components/Form/index.d.ts +0 -8
  37. package/es/components/Form/index.js +0 -53
  38. package/es/components/Image/index.d.ts +0 -5
  39. package/es/components/Image/index.js +0 -14
  40. package/es/components/Table/index.d.ts +0 -9
  41. package/es/components/Table/index.js +0 -35
  42. package/es/components/Tabs/index.d.ts +0 -9
  43. package/es/components/Tabs/index.js +0 -22
  44. package/es/components/ValueType/components/Cascader.d.ts +0 -3
  45. package/es/components/ValueType/components/Cascader.js +0 -89
  46. package/es/components/ValueType/components/Editor.d.ts +0 -3
  47. package/es/components/ValueType/components/Editor.js +0 -18
  48. package/es/components/ValueType/components/TreeSelect.d.ts +0 -3
  49. package/es/components/ValueType/components/TreeSelect.js +0 -87
  50. package/es/components/ValueType/components/Upload.d.ts +0 -4
  51. package/es/components/ValueType/components/Upload.js +0 -73
  52. package/es/components/ValueType/index.d.ts +0 -15
  53. package/es/components/ValueType/index.js +0 -10
  54. package/es/index.d.ts +0 -11
  55. package/es/index.js +0 -6
  56. package/es/utils/Swr.d.ts +0 -1
  57. package/es/utils/Swr.js +0 -58
  58. package/es/utils/Tree.d.ts +0 -2
  59. package/es/utils/Tree.js +0 -65
  60. package/lib/components/Editor/index.d.ts +0 -8
  61. package/lib/components/Editor/index.js +0 -43
  62. package/lib/components/Editor/props.d.ts +0 -13
  63. package/lib/components/Editor/props.js +0 -19
  64. package/lib/components/Form/index.d.ts +0 -8
  65. package/lib/components/Form/index.js +0 -64
  66. package/lib/components/Image/index.d.ts +0 -5
  67. package/lib/components/Image/index.js +0 -22
  68. package/lib/components/Table/index.d.ts +0 -9
  69. package/lib/components/Table/index.js +0 -46
  70. package/lib/components/Tabs/index.d.ts +0 -9
  71. package/lib/components/Tabs/index.js +0 -30
  72. package/lib/components/ValueType/components/Cascader.d.ts +0 -3
  73. package/lib/components/ValueType/components/Cascader.js +0 -97
  74. package/lib/components/ValueType/components/Editor.d.ts +0 -3
  75. package/lib/components/ValueType/components/Editor.js +0 -26
  76. package/lib/components/ValueType/components/TreeSelect.d.ts +0 -3
  77. package/lib/components/ValueType/components/TreeSelect.js +0 -95
  78. package/lib/components/ValueType/components/Upload.d.ts +0 -4
  79. package/lib/components/ValueType/components/Upload.js +0 -82
  80. package/lib/components/ValueType/index.d.ts +0 -15
  81. package/lib/components/ValueType/index.js +0 -18
  82. package/lib/index.d.ts +0 -11
  83. package/lib/index.js +0 -41
  84. package/lib/utils/Swr.d.ts +0 -1
  85. package/lib/utils/Swr.js +0 -66
  86. package/lib/utils/Tree.d.ts +0 -2
  87. package/lib/utils/Tree.js +0 -73
  88. package/src/components/Editor/index.md +0 -8
  89. package/src/components/Editor/index.tsx +0 -20
  90. package/src/components/Editor/props.ts +0 -50
  91. package/src/components/Form/index.md +0 -132
  92. package/src/components/Form/index.tsx +0 -48
  93. package/src/components/Image/index.md +0 -8
  94. package/src/components/Image/index.tsx +0 -16
  95. package/src/components/Table/index.md +0 -80
  96. package/src/components/Table/index.tsx +0 -45
  97. package/src/components/Tabs/index.md +0 -24
  98. package/src/components/Tabs/index.tsx +0 -21
  99. package/src/components/ValueType/components/Cascader.tsx +0 -79
  100. package/src/components/ValueType/components/Editor.tsx +0 -18
  101. package/src/components/ValueType/components/TreeSelect.tsx +0 -74
  102. package/src/components/ValueType/components/Upload.tsx +0 -74
  103. package/src/components/ValueType/index.ts +0 -33
  104. package/src/index.ts +0 -12
  105. package/src/utils/Swr.ts +0 -29
  106. package/src/utils/Tree.ts +0 -51
  107. package/tsconfig.json +0 -31
  108. package/typings.d.ts +0 -4
package/lib/utils/Swr.js DELETED
@@ -1,66 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.fetch = void 0;
8
- var _react = require("react");
9
- var _uuid = require("uuid");
10
- var _swr = _interopRequireDefault(require("swr"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- 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 method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return 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; }
13
- 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); } }
14
- 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); }); }; }
15
- var key = function key(request, params) {
16
- return (0, _react.useMemo)(function () {
17
- if (!request) {
18
- return 'no-fetch';
19
- }
20
- if (!params) {
21
- return (0, _uuid.v4)();
22
- }
23
- return JSON.stringify(params);
24
- }, [params, request]);
25
- };
26
- var fetch = function fetch(request, params, props) {
27
- var fetcher = /*#__PURE__*/function () {
28
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
29
- return _regeneratorRuntime().wrap(function _callee$(_context) {
30
- while (1) {
31
- switch (_context.prev = _context.next) {
32
- case 0:
33
- if (!request) {
34
- _context.next = 6;
35
- break;
36
- }
37
- _context.next = 3;
38
- return request(params, props);
39
- case 3:
40
- _context.t0 = _context.sent;
41
- _context.next = 7;
42
- break;
43
- case 6:
44
- _context.t0 = [];
45
- case 7:
46
- return _context.abrupt("return", _context.t0);
47
- case 8:
48
- case "end":
49
- return _context.stop();
50
- }
51
- }
52
- }, _callee);
53
- }));
54
- return function fetcher() {
55
- return _ref.apply(this, arguments);
56
- };
57
- }();
58
- var _useSWR = (0, _swr.default)(key(request, params), fetcher, {
59
- revalidateOnFocus: false,
60
- shouldRetryOnError: false,
61
- revalidateOnReconnect: false
62
- }),
63
- data = _useSWR.data;
64
- return data;
65
- };
66
- exports.fetch = fetch;
@@ -1,2 +0,0 @@
1
- export declare const equal: any;
2
- export declare const intact: (rows: any[], equal: Record<string, any>, prop: string) => any[] | undefined;
package/lib/utils/Tree.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.intact = exports.equal = void 0;
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
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
- var equal = function equal(rows, props) {
15
- var _iterator = _createForOfIteratorHelper(rows),
16
- _step;
17
- try {
18
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
19
- var row = _step.value;
20
- var flag = true;
21
- for (var key in props) {
22
- if (props[key] !== row[key]) {
23
- flag = false;
24
- break;
25
- }
26
- }
27
- if (flag) {
28
- return row;
29
- }
30
- if (row.children) {
31
- var node = equal(row.children, props);
32
- if (node) {
33
- return node;
34
- }
35
- }
36
- }
37
- } catch (err) {
38
- _iterator.e(err);
39
- } finally {
40
- _iterator.f();
41
- }
42
- };
43
- exports.equal = equal;
44
- var intact = function intact(rows, equal, prop) {
45
- var _iterator2 = _createForOfIteratorHelper(rows),
46
- _step2;
47
- try {
48
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
49
- var row = _step2.value;
50
- var flag = true;
51
- for (var key in equal) {
52
- if (equal[key] !== row[key]) {
53
- flag = false;
54
- break;
55
- }
56
- }
57
- if (!flag && row.children) {
58
- var sonids = intact(row.children, equal, prop);
59
- if (sonids && Array.isArray(sonids)) {
60
- return [row[prop]].concat(_toConsumableArray(sonids));
61
- }
62
- }
63
- if (flag) {
64
- return [row[prop]];
65
- }
66
- }
67
- } catch (err) {
68
- _iterator2.e(err);
69
- } finally {
70
- _iterator2.f();
71
- }
72
- };
73
- exports.intact = intact;
@@ -1,8 +0,0 @@
1
- ## Editor
2
-
3
- ```tsx
4
- import React from 'react'
5
- import { Editor } from '@rainte/ant'
6
-
7
- export default () => <Editor />
8
- ```
@@ -1,20 +0,0 @@
1
- import 'braft-editor/dist/index.css'
2
- import 'braft-extensions/dist/table.css'
3
- import BraftEditor, { BraftEditorProps } from 'braft-editor'
4
- import Table from 'braft-extensions/dist/table'
5
- import Props from './props'
6
-
7
- export type EditorProps = BraftEditorProps
8
-
9
- class Editor extends BraftEditor {
10
- static defaultProps: any
11
- }
12
-
13
- Editor.use(Table({ withDropdown: true, columnResizable: true }))
14
-
15
- export default Editor
16
-
17
- Editor.defaultProps = {
18
- ...(BraftEditor as any).defaultProps,
19
- ...Props,
20
- }
@@ -1,50 +0,0 @@
1
- export default {
2
- controls: [
3
- 'undo',
4
- 'redo',
5
- 'separator',
6
- 'headings',
7
- 'separator',
8
- 'font-family',
9
- 'font-size',
10
- 'line-height',
11
- 'letter-spacing',
12
- 'separator',
13
- 'text-indent',
14
- 'text-align',
15
- 'separator',
16
- 'text-color',
17
- 'bold',
18
- 'italic',
19
- 'underline',
20
- 'strike-through',
21
- 'separator',
22
- 'superscript',
23
- 'subscript',
24
- 'remove-styles',
25
- 'emoji',
26
- 'hr',
27
- 'separator',
28
- 'list-ul',
29
- 'list-ol',
30
- 'blockquote',
31
- 'code',
32
- 'separator',
33
- 'link',
34
- 'separator',
35
- 'media',
36
- 'table',
37
- 'clear',
38
- 'fullscreen',
39
- 'separator',
40
- ],
41
- controlBarStyle: {
42
- border: '1px solid #d9d9d9',
43
- borderBottom: '0',
44
- },
45
- contentStyle: {
46
- height: 300,
47
- border: '1px solid #d9d9d9',
48
- borderTop: '0',
49
- },
50
- }
@@ -1,132 +0,0 @@
1
- ## Form
2
-
3
- ```tsx
4
- import React, { useState } from 'react'
5
- import { Editor, Form } from '@rainte/ant'
6
- import { files } from '../ValueType/components/Upload'
7
-
8
- export default () => {
9
- const [readonly, setReadonly] = useState<boolean>(false)
10
-
11
- const cascader = [
12
- {
13
- value: 'zhejiang',
14
- label: '浙江',
15
- children: [
16
- {
17
- value: 'hangzhou',
18
- label: '杭州',
19
- children: [
20
- {
21
- value: 'xihu',
22
- label: '西湖',
23
- },
24
- ],
25
- },
26
- ],
27
- },
28
- {
29
- value: 'jiangsu',
30
- label: '江苏',
31
- children: [
32
- {
33
- value: 'nanjing',
34
- label: '南京',
35
- children: [
36
- {
37
- value: 'zhonghuamen',
38
- label: '中华门',
39
- },
40
- ],
41
- },
42
- ],
43
- },
44
- ]
45
-
46
- const treeSelect = [
47
- {
48
- title: 'Node1',
49
- value: '0-0',
50
- children: [
51
- {
52
- title: 'Child Node1',
53
- value: '0-0-1',
54
- },
55
- {
56
- title: 'Child Node2',
57
- value: '0-0-2',
58
- },
59
- ],
60
- },
61
- {
62
- title: 'Node2',
63
- value: '0-1',
64
- },
65
- ]
66
-
67
- const props = {
68
- request: () => {
69
- return {
70
- readonly: false,
71
- cascader: null,
72
- treeSelect: null,
73
- upload: null,
74
- editor: null,
75
- }
76
- },
77
- columns: [
78
- {
79
- title: '只读',
80
- dataIndex: 'readonly',
81
- valueType: 'radio',
82
- valueEnum: new Map([
83
- [false, { text: '编辑', status: 'Success' }],
84
- [true, { text: '只读', status: 'Error' }],
85
- ]),
86
- fieldProps: { onChange: (e: any) => setReadonly(e.target.value) },
87
- },
88
- {
89
- readonly,
90
- title: '级联选择',
91
- dataIndex: 'cascader',
92
- valueType: 'cascader',
93
- request: async (params: any) => cascader,
94
- },
95
- {
96
- readonly,
97
- title: '树选择',
98
- dataIndex: 'treeSelect',
99
- valueType: 'treeSelect',
100
- request: async (params: any) => treeSelect,
101
- },
102
- {
103
- readonly,
104
- title: '上传',
105
- dataIndex: 'upload',
106
- valueType: 'upload',
107
- formItemProps: { getValueFromEvent: files },
108
- fieldProps: {
109
- customRequest: ({ file, onSuccess }: any) => {
110
- console.log('upload.customRequest', file)
111
- file.url = URL.createObjectURL(file)
112
- file.status = 'done'
113
- onSuccess?.(file.url, file)
114
- },
115
- },
116
- },
117
- {
118
- readonly,
119
- title: '编辑器',
120
- dataIndex: 'editor',
121
- valueType: 'editor',
122
- formItemProps: { wrapperCol: { span: 16 } },
123
- },
124
- ],
125
- onFinish: (values: any) => {
126
- console.log('onFinish', values)
127
- },
128
- }
129
-
130
- return <Form {...props} />
131
- }
132
- ```
@@ -1,48 +0,0 @@
1
- import React, { Context, useContext } from 'react'
2
- import { Form as AntForm, Space } from 'antd'
3
- import ProForm, { BetaSchemaForm } from '@ant-design/pro-form'
4
- import AntContext from '@ant-design/pro-provider'
5
- import { FormSchema } from '@ant-design/pro-form/es/components/SchemaForm'
6
- import ValueTypeMap, { ValueTypeEnum } from '../ValueType'
7
-
8
- export type FormProps<
9
- T = Record<string, any>,
10
- ValueType = ValueTypeEnum,
11
- > = FormSchema<T, ValueType> & { context: Context<any> }
12
-
13
- const Form: React.FC<FormProps<any, any>> = props => {
14
- const { context, ...attrs } = props
15
- const values = useContext(context)
16
- const valueTypeMap = ValueTypeMap
17
-
18
- return (
19
- <context.Provider value={{ ...values, valueTypeMap }}>
20
- <BetaSchemaForm {...attrs} />
21
- </context.Provider>
22
- )
23
- }
24
-
25
- export default Form
26
-
27
- Form.defaultProps = {
28
- context: AntContext,
29
- layout: 'horizontal',
30
- labelCol: { span: 4 },
31
- wrapperCol: { span: 8 },
32
- submitter: {
33
- searchConfig: {
34
- resetText: '返回',
35
- submitText: '保存',
36
- },
37
- onReset: () => history.go(-1),
38
- render: (_: any, dom: JSX.Element[]) => {
39
- return (
40
- <AntForm.Item wrapperCol={{ offset: 4, span: 8 }}>
41
- <ProForm.Group>
42
- <Space>{dom}</Space>
43
- </ProForm.Group>
44
- </AntForm.Item>
45
- )
46
- },
47
- },
48
- }
@@ -1,8 +0,0 @@
1
- ## Image
2
-
3
- ```tsx
4
- import React from 'react'
5
- import { Image } from '@rainte/ant'
6
-
7
- export default () => <Image />
8
- ```
@@ -1,16 +0,0 @@
1
- import React from 'react'
2
- import { Image as AntImage, ImageProps } from 'antd'
3
-
4
- export type { ImageProps } from 'antd'
5
-
6
- const Image: React.FC<ImageProps> = props => {
7
- return <AntImage {...props} />
8
- }
9
-
10
- export default Image
11
-
12
- Image.defaultProps = {
13
- src: '',
14
- fallback:
15
- 'data:image/png;base64,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',
16
- }
@@ -1,80 +0,0 @@
1
- ## Table
2
-
3
- ```tsx
4
- import React from 'react'
5
- import { Table } from '@rainte/ant'
6
-
7
- const treeData = [
8
- {
9
- title: 'Node1',
10
- value: '0-0',
11
- children: [
12
- {
13
- title: 'Child Node1',
14
- value: '0-0-1',
15
- },
16
- {
17
- title: 'Child Node2',
18
- value: '0-0-2',
19
- },
20
- ],
21
- },
22
- {
23
- title: 'Node2',
24
- value: '0-1',
25
- },
26
- ]
27
-
28
- const props = {
29
- columns: [
30
- {
31
- title: '序号',
32
- valueType: 'index',
33
- },
34
- {
35
- title: '搜索',
36
- dataIndex: 'search',
37
- hideInTable: true,
38
- },
39
- {
40
- title: '名称',
41
- dataIndex: 'name',
42
- hideInSearch: true,
43
- },
44
- {
45
- title: '树选择',
46
- dataIndex: 'treeSelect',
47
- valueType: 'treeSelect',
48
- fieldProps: { treeData },
49
- },
50
- {
51
- title: '排序',
52
- dataIndex: 'sort',
53
- hideInSearch: true,
54
- },
55
- {
56
- title: '状态',
57
- dataIndex: 'status',
58
- valueEnum: new Map([
59
- [1, { text: '显示', status: 'Success' }],
60
- [0, { text: '隐藏', status: 'Error' }],
61
- ]),
62
- },
63
- {
64
- title: '创建时间',
65
- dataIndex: 'created_at',
66
- valueType: 'dateTime',
67
- sorter: true,
68
- hideInSearch: true,
69
- },
70
- {
71
- title: '操作',
72
- dataIndex: 'option',
73
- valueType: 'option',
74
- render: (_: any, row: any) => <a>查看</a>,
75
- },
76
- ],
77
- }
78
-
79
- export default () => <Table {...props} />
80
- ```
@@ -1,45 +0,0 @@
1
- import React, { Context, useContext } from 'react'
2
- import ProTable, { ProTableProps } from '@ant-design/pro-table'
3
- import AntContext from '@ant-design/pro-provider'
4
- import { FooterToolbar } from '@ant-design/pro-layout'
5
- import ValueTypeMap, { ValueTypeEnum } from '../ValueType'
6
-
7
- export type TableProps<
8
- T = any,
9
- U = Record<string, any>,
10
- ValueType = ValueTypeEnum,
11
- > = ProTableProps<T, U, ValueType> & {
12
- context: Context<any>
13
- selection?: any[]
14
- }
15
-
16
- const Table: React.FC<TableProps<any, any>> = props => {
17
- const { context, selection, ...attrs } = props
18
- const values = useContext(context)
19
- const valueTypeMap = ValueTypeMap
20
-
21
- return (
22
- <context.Provider value={{ ...values, valueTypeMap }}>
23
- <ProTable {...attrs} />
24
- {selection && selection.length > 0 && (
25
- <FooterToolbar
26
- extra={
27
- <div>
28
- 已选择 <a>{selection.length}</a> 项
29
- </div>
30
- }
31
- >
32
- {React.Children.map(props.children, item => item)}
33
- </FooterToolbar>
34
- )}
35
- </context.Provider>
36
- )
37
- }
38
-
39
- export default Table
40
-
41
- Table.defaultProps = {
42
- context: AntContext,
43
- rowKey: 'id',
44
- search: { labelWidth: 120 },
45
- }
@@ -1,24 +0,0 @@
1
- ## Tabs
2
-
3
- ```tsx
4
- import React from 'react'
5
- import { Tabs } from '@rainte/ant'
6
-
7
- const props = {
8
- accessKey: 'base',
9
- items: [
10
- {
11
- tab: '基本设置',
12
- key: 'base',
13
- children: <div>基本设置</div>,
14
- },
15
- {
16
- tab: '安全设置',
17
- key: 'security',
18
- children: <div>安全设置</div>,
19
- },
20
- ],
21
- }
22
-
23
- export default () => <Tabs {...props} />
24
- ```
@@ -1,21 +0,0 @@
1
- import React from 'react'
2
- import { Tabs as AntTabs, TabsProps as AntTabsProps, TabPaneProps } from 'antd'
3
-
4
- export type TabsProps = AntTabsProps & {
5
- items: (TabPaneProps & { key: any })[]
6
- }
7
-
8
- const Tabs: React.FC<TabsProps> = props => {
9
- const { items, ...attrs } = props
10
-
11
- const panes = items.map(item => <AntTabs.TabPane {...item} />)
12
-
13
- return <AntTabs {...attrs}>{panes}</AntTabs>
14
- }
15
-
16
- export default Tabs
17
-
18
- Tabs.defaultProps = {
19
- type: 'card',
20
- tabPosition: 'top',
21
- }