From 83c0b64afa28d6332765a3efc962c0e5ca238a74 Mon Sep 17 00:00:00 2001 From: dawnwinterLiu <1737801684@qq.com> Date: Sun, 28 Apr 2024 17:13:18 +0800 Subject: [PATCH] feat: import wmx --- .gitignore | 106 +- .husky/commit-msg | 8 +- .husky/pre-commit | 8 +- .husky/pre-push | 8 +- CHANGELOG.EN.md | 5 +- CHANGELOG.ZH.md | 5 +- CHANGELOG.md | 5 +- patches/rc-input-number+7.4.0.patch | 1184 ++++++++--------- src/api/Export/index.js | 22 + src/components/Device/info.vue | 32 +- src/config/setting.config.js | 1 + src/dgiot/components/DgiotHeader/index.vue | 4 +- src/dgiot/components/DgiotInput/input.vue | 1 + src/dgiot/components/DgiotNav/index.vue | 4 +- src/dgiot/plugins/permissions.js | 50 +- src/i18n/zh.js | 2 +- src/store/modules/routes.js | 12 +- src/store/modules/topo.js | 3 - src/store/modules/user.js | 33 +- src/utils/request/request.js | 4 +- src/utils/utilwen.js | 2 +- src/views/CloudFunction/engine/channel.vue | 27 +- src/views/CloudFunction/lowcode/index.vue | 2 +- src/views/CloudFunction/topo/js/evidence.js | 1 + src/views/CloudOT/maintenance/alert.vue | 2 +- src/views/CloudPressure/index.vue | 1 + src/views/CloudSystem/installation/log.vue | 2 +- src/views/CloudSystem/logs/device.vue | 2 +- src/views/Dashboard/index.vue | 41 +- src/views/DeviceCloud/manage/editdevices.vue | 1 + src/views/DeviceCloud/manage/home_index.vue | 29 +- .../DeviceCloud/manage/js/editdevices.js | 20 +- src/views/DeviceCloud/manage/js/proddetail.js | 79 +- .../DeviceCloud/manage/platform_overview.vue | 36 +- src/views/DeviceCloud/manage/proddetail.vue | 64 +- .../MultiTenant/roles/list/rolescontrol.vue | 16 +- src/views/MultiTenant/roles/structure.vue | 8 +- src/views/MultiTenant/user/login/index.vue | 2 +- 38 files changed, 1034 insertions(+), 798 deletions(-) diff --git a/.gitignore b/.gitignore index 0c56ce9697..a435c7c023 100644 --- a/.gitignore +++ b/.gitignore @@ -1,53 +1,53 @@ -.DS_Store -node_modules -/dist -/.vscode -*.zip -*.rar -release - -# local env files -.env.local -.env.*.local - -# Log files -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -pnpm-lock.yaml -*.idea -*-lock.json - -# Editor directories and files -.idea -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? -*.tar.gz - -# Lock files -pnpm-lock.yaml -pack-lock.json -# Yarn v2 -.pnp.* -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.yarnrc -yarn.lock -# config -/gitbit -/github -src/config/ignore -# files -swagger.json -lite.sh -/cli.config.js -/lite -/full -/dev +.DS_Store +node_modules +/dist +/.vscode +*.zip +*.rar +release + +# local env files +.env.local +.env.*.local + +# Log files +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +pnpm-lock.yaml +*.idea +*-lock.json + +# Editor directories and files +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +*.tar.gz + +# Lock files +pnpm-lock.yaml +pack-lock.json +# Yarn v2 +.pnp.* +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.yarnrc +yarn.lock +# config +/gitbit +/github +src/config/ignore +# files +swagger.json +lite.sh +/cli.config.js +/lite +/full +/dev diff --git a/.husky/commit-msg b/.husky/commit-msg index 0bd658f496..7e5cb34140 100644 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx --no-install commitlint --edit "$1" +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit index 20d0d06e58..42047e3157 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npm run lint +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run lint diff --git a/.husky/pre-push b/.husky/pre-push index b40a36072e..3274d30c37 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npm run release +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run release diff --git a/CHANGELOG.EN.md b/CHANGELOG.EN.md index 356aa9502e..8e4f1a11cb 100644 --- a/CHANGELOG.EN.md +++ b/CHANGELOG.EN.md @@ -1,4 +1,4 @@ -## [4.8.4](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.4) (2023-09-04) +## [4.8.6](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.6) (2023-11-03) ### Bug Fixes @@ -13,6 +13,9 @@ * add 数据配置” ([cf8d74b](https://github.com/dgiot/iotStudio/commit/cf8d74bfe2be2d6e193df4dd155b493bf06c405e)) * add sgmap ([a6f3bdd](https://github.com/dgiot/iotStudio/commit/a6f3bdd13cc1144a0eba9e1737afd67f7be9d333)) +* amis icon ([a44b599](https://github.com/dgiot/iotStudio/commit/a44b599a0ce3721693a46e4e5dfb75e3996a7a6d)) +* amisview ([a3311b8](https://github.com/dgiot/iotStudio/commit/a3311b8690cd42982bec01a20640deaad3cdb810)) +* other login ([006a560](https://github.com/dgiot/iotStudio/commit/006a5607f1df346eae57d1fc9fb69742790844aa)) * profile ([9475af3](https://github.com/dgiot/iotStudio/commit/9475af3af45b9f28280a06e4be0ee9718440c1d9)) * update 4.8.3 ([1371c77](https://github.com/dgiot/iotStudio/commit/1371c77fd502a79a7d2d5fb59688a3613b887cf8)) diff --git a/CHANGELOG.ZH.md b/CHANGELOG.ZH.md index 356aa9502e..8e4f1a11cb 100644 --- a/CHANGELOG.ZH.md +++ b/CHANGELOG.ZH.md @@ -1,4 +1,4 @@ -## [4.8.4](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.4) (2023-09-04) +## [4.8.6](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.6) (2023-11-03) ### Bug Fixes @@ -13,6 +13,9 @@ * add 数据配置” ([cf8d74b](https://github.com/dgiot/iotStudio/commit/cf8d74bfe2be2d6e193df4dd155b493bf06c405e)) * add sgmap ([a6f3bdd](https://github.com/dgiot/iotStudio/commit/a6f3bdd13cc1144a0eba9e1737afd67f7be9d333)) +* amis icon ([a44b599](https://github.com/dgiot/iotStudio/commit/a44b599a0ce3721693a46e4e5dfb75e3996a7a6d)) +* amisview ([a3311b8](https://github.com/dgiot/iotStudio/commit/a3311b8690cd42982bec01a20640deaad3cdb810)) +* other login ([006a560](https://github.com/dgiot/iotStudio/commit/006a5607f1df346eae57d1fc9fb69742790844aa)) * profile ([9475af3](https://github.com/dgiot/iotStudio/commit/9475af3af45b9f28280a06e4be0ee9718440c1d9)) * update 4.8.3 ([1371c77](https://github.com/dgiot/iotStudio/commit/1371c77fd502a79a7d2d5fb59688a3613b887cf8)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 356aa9502e..8e4f1a11cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [4.8.4](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.4) (2023-09-04) +## [4.8.6](https://github.com/dgiot/iotStudio/compare/v4.7.2...v4.8.6) (2023-11-03) ### Bug Fixes @@ -13,6 +13,9 @@ * add 数据配置” ([cf8d74b](https://github.com/dgiot/iotStudio/commit/cf8d74bfe2be2d6e193df4dd155b493bf06c405e)) * add sgmap ([a6f3bdd](https://github.com/dgiot/iotStudio/commit/a6f3bdd13cc1144a0eba9e1737afd67f7be9d333)) +* amis icon ([a44b599](https://github.com/dgiot/iotStudio/commit/a44b599a0ce3721693a46e4e5dfb75e3996a7a6d)) +* amisview ([a3311b8](https://github.com/dgiot/iotStudio/commit/a3311b8690cd42982bec01a20640deaad3cdb810)) +* other login ([006a560](https://github.com/dgiot/iotStudio/commit/006a5607f1df346eae57d1fc9fb69742790844aa)) * profile ([9475af3](https://github.com/dgiot/iotStudio/commit/9475af3af45b9f28280a06e4be0ee9718440c1d9)) * update 4.8.3 ([1371c77](https://github.com/dgiot/iotStudio/commit/1371c77fd502a79a7d2d5fb59688a3613b887cf8)) diff --git a/patches/rc-input-number+7.4.0.patch b/patches/rc-input-number+7.4.0.patch index d7dca3c99b..ec8ce270a9 100644 --- a/patches/rc-input-number+7.4.0.patch +++ b/patches/rc-input-number+7.4.0.patch @@ -1,592 +1,592 @@ -diff --git a/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts b/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts -new file mode 100644 -index 0000000..d038531 ---- /dev/null -+++ b/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts -@@ -0,0 +1,67 @@ -+export declare type ValueType = string | number; -+export interface DecimalClass { -+ add: (value: ValueType) => DecimalClass; -+ isEmpty: () => boolean; -+ isNaN: () => boolean; -+ isInvalidate: () => boolean; -+ toNumber: () => number; -+ /** -+ * Parse value as string. Will return empty string if `isInvalidate`. -+ * You can set `safe=false` to get origin string content. -+ */ -+ toString: (safe?: boolean) => string; -+ equals: (target: DecimalClass) => boolean; -+ lessEquals: (target: DecimalClass) => boolean; -+ negate: () => DecimalClass; -+} -+/** -+ * We can remove this when IE not support anymore -+ */ -+export declare class NumberDecimal implements DecimalClass { -+ origin: string; -+ number: number; -+ empty: boolean; -+ constructor(value: ValueType); -+ negate(): NumberDecimal; -+ add(value: ValueType): NumberDecimal; -+ isEmpty(): boolean; -+ isNaN(): boolean; -+ isInvalidate(): boolean; -+ equals(target: DecimalClass): boolean; -+ lessEquals(target: DecimalClass): boolean; -+ toNumber(): number; -+ toString(safe?: boolean): string; -+} -+export declare class BigIntDecimal implements DecimalClass { -+ origin: string; -+ negative: boolean; -+ integer: bigint; -+ decimal: bigint; -+ /** BigInt will convert `0009` to `9`. We need record the len of decimal */ -+ decimalLen: number; -+ empty: boolean; -+ nan: boolean; -+ constructor(value: string | number); -+ private getMark; -+ private getIntegerStr; -+ private getDecimalStr; -+ /** -+ * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000 -+ * This is used for add function only. -+ */ -+ private alignDecimal; -+ negate(): BigIntDecimal; -+ add(value: ValueType): BigIntDecimal; -+ isEmpty(): boolean; -+ isNaN(): boolean; -+ isInvalidate(): boolean; -+ equals(target: DecimalClass): boolean; -+ lessEquals(target: DecimalClass): boolean; -+ toNumber(): number; -+ toString(safe?: boolean): string; -+} -+export default function getMiniDecimal(value: ValueType): DecimalClass; -+/** -+ * Align the logic of toFixed to around like 1.5 => 2 -+ */ -+export declare function toFixed(numStr: string, separatorStr: string, precision?: number): any; -diff --git a/node_modules/rc-input-number/lib/utils/MiniDecimal.js b/node_modules/rc-input-number/lib/utils/MiniDecimal.js -new file mode 100644 -index 0000000..d17033c ---- /dev/null -+++ b/node_modules/rc-input-number/lib/utils/MiniDecimal.js -@@ -0,0 +1,329 @@ -+"use strict"; -+ -+var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); -+ -+Object.defineProperty(exports, "__esModule", { -+ value: true -+}); -+exports.NumberDecimal = exports.BigIntDecimal = void 0; -+exports.default = getMiniDecimal; -+exports.toFixed = toFixed; -+ -+var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); -+ -+var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); -+ -+var _numberUtil = require("./numberUtil"); -+ -+var _supportUtil = require("./supportUtil"); -+ -+/* eslint-disable max-classes-per-file */ -+ -+/** -+ * We can remove this when IE not support anymore -+ */ -+var NumberDecimal = /*#__PURE__*/function () { -+ function NumberDecimal(value) { -+ (0, _classCallCheck2.default)(this, NumberDecimal); -+ this.origin = ''; -+ this.number = void 0; -+ this.empty = void 0; -+ -+ if (!value && value !== 0 || !String(value).trim()) { -+ this.empty = true; -+ return; -+ } -+ -+ this.origin = String(value); -+ this.number = Number(value); -+ } -+ -+ (0, _createClass2.default)(NumberDecimal, [{ -+ key: "negate", -+ value: function negate() { -+ return new NumberDecimal(-this.toNumber()); -+ } -+ }, { -+ key: "add", -+ value: function add(value) { -+ if (this.isInvalidate()) { -+ return new NumberDecimal(value); -+ } -+ -+ var target = Number(value); -+ -+ if (Number.isNaN(target)) { -+ return this; -+ } -+ -+ var number = this.number + target; // [Legacy] Back to safe integer -+ -+ if (number > Number.MAX_SAFE_INTEGER) { -+ return new NumberDecimal(Number.MAX_SAFE_INTEGER); -+ } -+ -+ if (number < Number.MIN_SAFE_INTEGER) { -+ return new NumberDecimal(Number.MIN_SAFE_INTEGER); -+ } -+ -+ var maxPrecision = Math.max((0, _numberUtil.getNumberPrecision)(this.number), (0, _numberUtil.getNumberPrecision)(target)); -+ return new NumberDecimal(number.toFixed(maxPrecision)); -+ } -+ }, { -+ key: "isEmpty", -+ value: function isEmpty() { -+ return this.empty; -+ } -+ }, { -+ key: "isNaN", -+ value: function isNaN() { -+ return Number.isNaN(this.number); -+ } -+ }, { -+ key: "isInvalidate", -+ value: function isInvalidate() { -+ return this.isEmpty() || this.isNaN(); -+ } -+ }, { -+ key: "equals", -+ value: function equals(target) { -+ return this.toNumber() === (target === null || target === void 0 ? void 0 : target.toNumber()); -+ } -+ }, { -+ key: "lessEquals", -+ value: function lessEquals(target) { -+ return this.add(target.negate().toString()).toNumber() <= 0; -+ } -+ }, { -+ key: "toNumber", -+ value: function toNumber() { -+ return this.number; -+ } -+ }, { -+ key: "toString", -+ value: function toString() { -+ var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; -+ -+ if (!safe) { -+ return this.origin; -+ } -+ -+ if (this.isInvalidate()) { -+ return ''; -+ } -+ -+ return (0, _numberUtil.num2str)(this.number); -+ } -+ }]); -+ return NumberDecimal; -+}(); -+ -+exports.NumberDecimal = NumberDecimal; -+ -+var BigIntDecimal = /*#__PURE__*/function () { -+ /** BigInt will convert `0009` to `9`. We need record the len of decimal */ -+ function BigIntDecimal(value) { -+ (0, _classCallCheck2.default)(this, BigIntDecimal); -+ this.origin = ''; -+ this.negative = void 0; -+ this.integer = void 0; -+ this.decimal = void 0; -+ this.decimalLen = void 0; -+ this.empty = void 0; -+ this.nan = void 0; -+ -+ if (!value && value !== 0 || !String(value).trim()) { -+ this.empty = true; -+ return; -+ } -+ -+ this.origin = String(value); // Act like Number convert -+ -+ if (value === '-') { -+ this.nan = true; -+ return; -+ } -+ -+ var mergedValue = value; // We need convert back to Number since it require `toFixed` to handle this -+ -+ if ((0, _numberUtil.isE)(mergedValue)) { -+ mergedValue = Number(mergedValue); -+ } -+ -+ mergedValue = typeof mergedValue === 'string' ? mergedValue : (0, _numberUtil.num2str)(mergedValue); -+ -+ if ((0, _numberUtil.validateNumber)(mergedValue)) { -+ var trimRet = (0, _numberUtil.trimNumber)(mergedValue); -+ this.negative = trimRet.negative; -+ var numbers = trimRet.trimStr.split('.'); -+ this.integer = BigInt(numbers[0]); -+ var decimalStr = numbers[1] || '0'; -+ this.decimal = BigInt(decimalStr); -+ this.decimalLen = decimalStr.length; -+ } else { -+ this.nan = true; -+ } -+ } -+ -+ (0, _createClass2.default)(BigIntDecimal, [{ -+ key: "getMark", -+ value: function getMark() { -+ return this.negative ? '-' : ''; -+ } -+ }, { -+ key: "getIntegerStr", -+ value: function getIntegerStr() { -+ return this.integer.toString(); -+ } -+ }, { -+ key: "getDecimalStr", -+ value: function getDecimalStr() { -+ return this.decimal.toString().padStart(this.decimalLen, '0'); -+ } -+ /** -+ * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000 -+ * This is used for add function only. -+ */ -+ -+ }, { -+ key: "alignDecimal", -+ value: function alignDecimal(decimalLength) { -+ var str = "".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(decimalLength, '0')); -+ return BigInt(str); -+ } -+ }, { -+ key: "negate", -+ value: function negate() { -+ var clone = new BigIntDecimal(this.toString()); -+ clone.negative = !clone.negative; -+ return clone; -+ } -+ }, { -+ key: "add", -+ value: function add(value) { -+ if (this.isInvalidate()) { -+ return new BigIntDecimal(value); -+ } -+ -+ var offset = new BigIntDecimal(value); -+ -+ if (offset.isInvalidate()) { -+ return this; -+ } -+ -+ var maxDecimalLength = Math.max(this.getDecimalStr().length, offset.getDecimalStr().length); -+ var myAlignedDecimal = this.alignDecimal(maxDecimalLength); -+ var offsetAlignedDecimal = offset.alignDecimal(maxDecimalLength); -+ var valueStr = (myAlignedDecimal + offsetAlignedDecimal).toString(); // We need fill string length back to `maxDecimalLength` to avoid parser failed -+ -+ var _trimNumber = (0, _numberUtil.trimNumber)(valueStr), -+ negativeStr = _trimNumber.negativeStr, -+ trimStr = _trimNumber.trimStr; -+ -+ var hydrateValueStr = "".concat(negativeStr).concat(trimStr.padStart(maxDecimalLength + 1, '0')); -+ return new BigIntDecimal("".concat(hydrateValueStr.slice(0, -maxDecimalLength), ".").concat(hydrateValueStr.slice(-maxDecimalLength))); -+ } -+ }, { -+ key: "isEmpty", -+ value: function isEmpty() { -+ return this.empty; -+ } -+ }, { -+ key: "isNaN", -+ value: function isNaN() { -+ return this.nan; -+ } -+ }, { -+ key: "isInvalidate", -+ value: function isInvalidate() { -+ return this.isEmpty() || this.isNaN(); -+ } -+ }, { -+ key: "equals", -+ value: function equals(target) { -+ return this.toString() === (target === null || target === void 0 ? void 0 : target.toString()); -+ } -+ }, { -+ key: "lessEquals", -+ value: function lessEquals(target) { -+ return this.add(target.negate().toString()).toNumber() <= 0; -+ } -+ }, { -+ key: "toNumber", -+ value: function toNumber() { -+ if (this.isNaN()) { -+ return NaN; -+ } -+ -+ return Number(this.toString()); -+ } -+ }, { -+ key: "toString", -+ value: function toString() { -+ var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; -+ -+ if (!safe) { -+ return this.origin; -+ } -+ -+ if (this.isInvalidate()) { -+ return ''; -+ } -+ -+ return (0, _numberUtil.trimNumber)("".concat(this.getMark()).concat(this.getIntegerStr(), ".").concat(this.getDecimalStr())).fullStr; -+ } -+ }]); -+ return BigIntDecimal; -+}(); -+ -+exports.BigIntDecimal = BigIntDecimal; -+ -+function getMiniDecimal(value) { -+ // We use BigInt here. -+ // Will fallback to Number if not support. -+ if ((0, _supportUtil.supportBigInt)()) { -+ return new BigIntDecimal(value); -+ } -+ -+ return new NumberDecimal(value); -+} -+/** -+ * Align the logic of toFixed to around like 1.5 => 2 -+ */ -+ -+ -+function toFixed(numStr, separatorStr, precision) { -+ if (numStr === '') { -+ return ''; -+ } -+ -+ var _trimNumber2 = (0, _numberUtil.trimNumber)(numStr), -+ negativeStr = _trimNumber2.negativeStr, -+ integerStr = _trimNumber2.integerStr, -+ decimalStr = _trimNumber2.decimalStr; -+ -+ var precisionDecimalStr = "".concat(separatorStr).concat(decimalStr); -+ var numberWithoutDecimal = "".concat(negativeStr).concat(integerStr); -+ -+ if (precision >= 0) { -+ // We will get last + 1 number to check if need advanced number -+ var advancedNum = Number(decimalStr[precision]); -+ -+ if (advancedNum >= 5) { -+ var advancedDecimal = getMiniDecimal(numStr).add("".concat(negativeStr, "0.").concat('0'.repeat(precision)).concat(10 - advancedNum)); -+ return toFixed(advancedDecimal.toString(), separatorStr, precision); -+ } -+ -+ if (precision === 0) { -+ return numberWithoutDecimal; -+ } -+ -+ return "".concat(numberWithoutDecimal).concat(separatorStr).concat(decimalStr.padEnd(precision, '0').slice(0, precision)); -+ } -+ -+ if (precisionDecimalStr === '.0') { -+ return numberWithoutDecimal; -+ } -+ -+ return "".concat(numberWithoutDecimal).concat(precisionDecimalStr); -+} -\ No newline at end of file -diff --git a/node_modules/rc-input-number/lib/utils/numberUtil.d.ts b/node_modules/rc-input-number/lib/utils/numberUtil.d.ts -index c1e0948..34c94e2 100644 ---- a/node_modules/rc-input-number/lib/utils/numberUtil.d.ts -+++ b/node_modules/rc-input-number/lib/utils/numberUtil.d.ts -@@ -1 +1,22 @@ --export declare function getDecupleSteps(step: string | number): string; -+/** -+ * Format string number to readable number -+ */ -+export declare function trimNumber(numStr: string): { -+ negative: boolean; -+ negativeStr: string; -+ trimStr: string; -+ integerStr: string; -+ decimalStr: string; -+ fullStr: string; -+}; -+export declare function isE(number: string | number): boolean; -+/** -+ * [Legacy] Convert 1e-9 to 0.000000001. -+ * This may lose some precision if user really want 1e-9. -+ */ -+export declare function getNumberPrecision(number: string | number): number; -+/** -+ * Convert number (includes scientific notation) to -xxx.yyy format -+ */ -+export declare function num2str(number: number): string; -+export declare function validateNumber(num: string | number): boolean; -diff --git a/node_modules/rc-input-number/lib/utils/numberUtil.js b/node_modules/rc-input-number/lib/utils/numberUtil.js -index af511db..8b73bf4 100644 ---- a/node_modules/rc-input-number/lib/utils/numberUtil.js -+++ b/node_modules/rc-input-number/lib/utils/numberUtil.js -@@ -3,13 +3,116 @@ - Object.defineProperty(exports, "__esModule", { - value: true - }); --exports.getDecupleSteps = getDecupleSteps; --var _miniDecimal = require("@rc-component/mini-decimal"); --function getDecupleSteps(step) { -- var stepStr = typeof step === 'number' ? (0, _miniDecimal.num2str)(step) : (0, _miniDecimal.trimNumber)(step).fullStr; -- var hasPoint = stepStr.includes('.'); -- if (!hasPoint) { -- return step + '0'; -- } -- return (0, _miniDecimal.trimNumber)(stepStr.replace(/(\d)\.(\d)/g, '$1$2.')).fullStr; -+exports.getNumberPrecision = getNumberPrecision; -+exports.isE = isE; -+exports.num2str = num2str; -+exports.trimNumber = trimNumber; -+exports.validateNumber = validateNumber; -+ -+var _supportUtil = require("./supportUtil"); -+ -+/** -+ * Format string number to readable number -+ */ -+function trimNumber(numStr) { -+ var str = numStr.trim(); -+ var negative = str.startsWith('-'); -+ -+ if (negative) { -+ str = str.slice(1); -+ } -+ -+ str = str // Remove decimal 0. `1.000` => `1.`, `1.100` => `1.1` -+ .replace(/(\.\d*[^0])0*$/, '$1') // Remove useless decimal. `1.` => `1` -+ .replace(/\.0*$/, '') // Remove integer 0. `0001` => `1`, 000.1' => `.1` -+ .replace(/^0+/, ''); -+ -+ if (str.startsWith('.')) { -+ str = "0".concat(str); -+ } -+ -+ var trimStr = str || '0'; -+ var splitNumber = trimStr.split('.'); -+ var integerStr = splitNumber[0] || '0'; -+ var decimalStr = splitNumber[1] || '0'; -+ -+ if (integerStr === '0' && decimalStr === '0') { -+ negative = false; -+ } -+ -+ var negativeStr = negative ? '-' : ''; -+ return { -+ negative: negative, -+ negativeStr: negativeStr, -+ trimStr: trimStr, -+ integerStr: integerStr, -+ decimalStr: decimalStr, -+ fullStr: "".concat(negativeStr).concat(trimStr) -+ }; -+} -+ -+function isE(number) { -+ var str = String(number); -+ return !Number.isNaN(Number(str)) && str.includes('e'); -+} -+/** -+ * [Legacy] Convert 1e-9 to 0.000000001. -+ * This may lose some precision if user really want 1e-9. -+ */ -+ -+ -+function getNumberPrecision(number) { -+ var numStr = String(number); -+ -+ if (isE(number)) { -+ var precision = Number(numStr.slice(numStr.indexOf('e-') + 2)); -+ var decimalMatch = numStr.match(/\.(\d+)/); -+ -+ if (decimalMatch === null || decimalMatch === void 0 ? void 0 : decimalMatch[1]) { -+ precision += decimalMatch[1].length; -+ } -+ -+ return precision; -+ } -+ -+ return numStr.includes('.') && validateNumber(numStr) ? numStr.length - numStr.indexOf('.') - 1 : 0; -+} -+/** -+ * Convert number (includes scientific notation) to -xxx.yyy format -+ */ -+ -+ -+function num2str(number) { -+ var numStr = String(number); -+ -+ if (isE(number)) { -+ if (number > Number.MAX_SAFE_INTEGER) { -+ return String((0, _supportUtil.supportBigInt)() ? BigInt(number).toString() : Number.MAX_SAFE_INTEGER); -+ } -+ -+ if (number < Number.MIN_SAFE_INTEGER) { -+ return String((0, _supportUtil.supportBigInt)() ? BigInt(number).toString() : Number.MIN_SAFE_INTEGER); -+ } -+ -+ numStr = number.toFixed(getNumberPrecision(numStr)); -+ } -+ -+ return trimNumber(numStr).fullStr; -+} -+ -+function validateNumber(num) { -+ if (typeof num === 'number') { -+ return !Number.isNaN(num); -+ } // Empty -+ -+ -+ if (!num) { -+ return false; -+ } -+ -+ return (// Normal type: 11.28 -+ /^\s*-?\d+(\.\d+)?\s*$/.test(num) || // Pre-number: 1. -+ /^\s*-?\d+\.\s*$/.test(num) || // Post-number: .1 -+ /^\s*-?\.\d+\s*$/.test(num) -+ ); - } -\ No newline at end of file -diff --git a/node_modules/rc-input-number/lib/utils/supportUtil.d.ts b/node_modules/rc-input-number/lib/utils/supportUtil.d.ts -new file mode 100644 -index 0000000..885df7c ---- /dev/null -+++ b/node_modules/rc-input-number/lib/utils/supportUtil.d.ts -@@ -0,0 +1 @@ -+export declare function supportBigInt(): boolean; -diff --git a/node_modules/rc-input-number/lib/utils/supportUtil.js b/node_modules/rc-input-number/lib/utils/supportUtil.js -new file mode 100644 -index 0000000..a9a38bf ---- /dev/null -+++ b/node_modules/rc-input-number/lib/utils/supportUtil.js -@@ -0,0 +1,10 @@ -+"use strict"; -+ -+Object.defineProperty(exports, "__esModule", { -+ value: true -+}); -+exports.supportBigInt = supportBigInt; -+ -+function supportBigInt() { -+ return typeof BigInt === 'function'; -+} -\ No newline at end of file +diff --git a/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts b/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts +new file mode 100644 +index 0000000..d038531 +--- /dev/null ++++ b/node_modules/rc-input-number/lib/utils/MiniDecimal.d.ts +@@ -0,0 +1,67 @@ ++export declare type ValueType = string | number; ++export interface DecimalClass { ++ add: (value: ValueType) => DecimalClass; ++ isEmpty: () => boolean; ++ isNaN: () => boolean; ++ isInvalidate: () => boolean; ++ toNumber: () => number; ++ /** ++ * Parse value as string. Will return empty string if `isInvalidate`. ++ * You can set `safe=false` to get origin string content. ++ */ ++ toString: (safe?: boolean) => string; ++ equals: (target: DecimalClass) => boolean; ++ lessEquals: (target: DecimalClass) => boolean; ++ negate: () => DecimalClass; ++} ++/** ++ * We can remove this when IE not support anymore ++ */ ++export declare class NumberDecimal implements DecimalClass { ++ origin: string; ++ number: number; ++ empty: boolean; ++ constructor(value: ValueType); ++ negate(): NumberDecimal; ++ add(value: ValueType): NumberDecimal; ++ isEmpty(): boolean; ++ isNaN(): boolean; ++ isInvalidate(): boolean; ++ equals(target: DecimalClass): boolean; ++ lessEquals(target: DecimalClass): boolean; ++ toNumber(): number; ++ toString(safe?: boolean): string; ++} ++export declare class BigIntDecimal implements DecimalClass { ++ origin: string; ++ negative: boolean; ++ integer: bigint; ++ decimal: bigint; ++ /** BigInt will convert `0009` to `9`. We need record the len of decimal */ ++ decimalLen: number; ++ empty: boolean; ++ nan: boolean; ++ constructor(value: string | number); ++ private getMark; ++ private getIntegerStr; ++ private getDecimalStr; ++ /** ++ * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000 ++ * This is used for add function only. ++ */ ++ private alignDecimal; ++ negate(): BigIntDecimal; ++ add(value: ValueType): BigIntDecimal; ++ isEmpty(): boolean; ++ isNaN(): boolean; ++ isInvalidate(): boolean; ++ equals(target: DecimalClass): boolean; ++ lessEquals(target: DecimalClass): boolean; ++ toNumber(): number; ++ toString(safe?: boolean): string; ++} ++export default function getMiniDecimal(value: ValueType): DecimalClass; ++/** ++ * Align the logic of toFixed to around like 1.5 => 2 ++ */ ++export declare function toFixed(numStr: string, separatorStr: string, precision?: number): any; +diff --git a/node_modules/rc-input-number/lib/utils/MiniDecimal.js b/node_modules/rc-input-number/lib/utils/MiniDecimal.js +new file mode 100644 +index 0000000..d17033c +--- /dev/null ++++ b/node_modules/rc-input-number/lib/utils/MiniDecimal.js +@@ -0,0 +1,329 @@ ++"use strict"; ++ ++var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); ++ ++Object.defineProperty(exports, "__esModule", { ++ value: true ++}); ++exports.NumberDecimal = exports.BigIntDecimal = void 0; ++exports.default = getMiniDecimal; ++exports.toFixed = toFixed; ++ ++var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); ++ ++var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); ++ ++var _numberUtil = require("./numberUtil"); ++ ++var _supportUtil = require("./supportUtil"); ++ ++/* eslint-disable max-classes-per-file */ ++ ++/** ++ * We can remove this when IE not support anymore ++ */ ++var NumberDecimal = /*#__PURE__*/function () { ++ function NumberDecimal(value) { ++ (0, _classCallCheck2.default)(this, NumberDecimal); ++ this.origin = ''; ++ this.number = void 0; ++ this.empty = void 0; ++ ++ if (!value && value !== 0 || !String(value).trim()) { ++ this.empty = true; ++ return; ++ } ++ ++ this.origin = String(value); ++ this.number = Number(value); ++ } ++ ++ (0, _createClass2.default)(NumberDecimal, [{ ++ key: "negate", ++ value: function negate() { ++ return new NumberDecimal(-this.toNumber()); ++ } ++ }, { ++ key: "add", ++ value: function add(value) { ++ if (this.isInvalidate()) { ++ return new NumberDecimal(value); ++ } ++ ++ var target = Number(value); ++ ++ if (Number.isNaN(target)) { ++ return this; ++ } ++ ++ var number = this.number + target; // [Legacy] Back to safe integer ++ ++ if (number > Number.MAX_SAFE_INTEGER) { ++ return new NumberDecimal(Number.MAX_SAFE_INTEGER); ++ } ++ ++ if (number < Number.MIN_SAFE_INTEGER) { ++ return new NumberDecimal(Number.MIN_SAFE_INTEGER); ++ } ++ ++ var maxPrecision = Math.max((0, _numberUtil.getNumberPrecision)(this.number), (0, _numberUtil.getNumberPrecision)(target)); ++ return new NumberDecimal(number.toFixed(maxPrecision)); ++ } ++ }, { ++ key: "isEmpty", ++ value: function isEmpty() { ++ return this.empty; ++ } ++ }, { ++ key: "isNaN", ++ value: function isNaN() { ++ return Number.isNaN(this.number); ++ } ++ }, { ++ key: "isInvalidate", ++ value: function isInvalidate() { ++ return this.isEmpty() || this.isNaN(); ++ } ++ }, { ++ key: "equals", ++ value: function equals(target) { ++ return this.toNumber() === (target === null || target === void 0 ? void 0 : target.toNumber()); ++ } ++ }, { ++ key: "lessEquals", ++ value: function lessEquals(target) { ++ return this.add(target.negate().toString()).toNumber() <= 0; ++ } ++ }, { ++ key: "toNumber", ++ value: function toNumber() { ++ return this.number; ++ } ++ }, { ++ key: "toString", ++ value: function toString() { ++ var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; ++ ++ if (!safe) { ++ return this.origin; ++ } ++ ++ if (this.isInvalidate()) { ++ return ''; ++ } ++ ++ return (0, _numberUtil.num2str)(this.number); ++ } ++ }]); ++ return NumberDecimal; ++}(); ++ ++exports.NumberDecimal = NumberDecimal; ++ ++var BigIntDecimal = /*#__PURE__*/function () { ++ /** BigInt will convert `0009` to `9`. We need record the len of decimal */ ++ function BigIntDecimal(value) { ++ (0, _classCallCheck2.default)(this, BigIntDecimal); ++ this.origin = ''; ++ this.negative = void 0; ++ this.integer = void 0; ++ this.decimal = void 0; ++ this.decimalLen = void 0; ++ this.empty = void 0; ++ this.nan = void 0; ++ ++ if (!value && value !== 0 || !String(value).trim()) { ++ this.empty = true; ++ return; ++ } ++ ++ this.origin = String(value); // Act like Number convert ++ ++ if (value === '-') { ++ this.nan = true; ++ return; ++ } ++ ++ var mergedValue = value; // We need convert back to Number since it require `toFixed` to handle this ++ ++ if ((0, _numberUtil.isE)(mergedValue)) { ++ mergedValue = Number(mergedValue); ++ } ++ ++ mergedValue = typeof mergedValue === 'string' ? mergedValue : (0, _numberUtil.num2str)(mergedValue); ++ ++ if ((0, _numberUtil.validateNumber)(mergedValue)) { ++ var trimRet = (0, _numberUtil.trimNumber)(mergedValue); ++ this.negative = trimRet.negative; ++ var numbers = trimRet.trimStr.split('.'); ++ this.integer = BigInt(numbers[0]); ++ var decimalStr = numbers[1] || '0'; ++ this.decimal = BigInt(decimalStr); ++ this.decimalLen = decimalStr.length; ++ } else { ++ this.nan = true; ++ } ++ } ++ ++ (0, _createClass2.default)(BigIntDecimal, [{ ++ key: "getMark", ++ value: function getMark() { ++ return this.negative ? '-' : ''; ++ } ++ }, { ++ key: "getIntegerStr", ++ value: function getIntegerStr() { ++ return this.integer.toString(); ++ } ++ }, { ++ key: "getDecimalStr", ++ value: function getDecimalStr() { ++ return this.decimal.toString().padStart(this.decimalLen, '0'); ++ } ++ /** ++ * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000 ++ * This is used for add function only. ++ */ ++ ++ }, { ++ key: "alignDecimal", ++ value: function alignDecimal(decimalLength) { ++ var str = "".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(decimalLength, '0')); ++ return BigInt(str); ++ } ++ }, { ++ key: "negate", ++ value: function negate() { ++ var clone = new BigIntDecimal(this.toString()); ++ clone.negative = !clone.negative; ++ return clone; ++ } ++ }, { ++ key: "add", ++ value: function add(value) { ++ if (this.isInvalidate()) { ++ return new BigIntDecimal(value); ++ } ++ ++ var offset = new BigIntDecimal(value); ++ ++ if (offset.isInvalidate()) { ++ return this; ++ } ++ ++ var maxDecimalLength = Math.max(this.getDecimalStr().length, offset.getDecimalStr().length); ++ var myAlignedDecimal = this.alignDecimal(maxDecimalLength); ++ var offsetAlignedDecimal = offset.alignDecimal(maxDecimalLength); ++ var valueStr = (myAlignedDecimal + offsetAlignedDecimal).toString(); // We need fill string length back to `maxDecimalLength` to avoid parser failed ++ ++ var _trimNumber = (0, _numberUtil.trimNumber)(valueStr), ++ negativeStr = _trimNumber.negativeStr, ++ trimStr = _trimNumber.trimStr; ++ ++ var hydrateValueStr = "".concat(negativeStr).concat(trimStr.padStart(maxDecimalLength + 1, '0')); ++ return new BigIntDecimal("".concat(hydrateValueStr.slice(0, -maxDecimalLength), ".").concat(hydrateValueStr.slice(-maxDecimalLength))); ++ } ++ }, { ++ key: "isEmpty", ++ value: function isEmpty() { ++ return this.empty; ++ } ++ }, { ++ key: "isNaN", ++ value: function isNaN() { ++ return this.nan; ++ } ++ }, { ++ key: "isInvalidate", ++ value: function isInvalidate() { ++ return this.isEmpty() || this.isNaN(); ++ } ++ }, { ++ key: "equals", ++ value: function equals(target) { ++ return this.toString() === (target === null || target === void 0 ? void 0 : target.toString()); ++ } ++ }, { ++ key: "lessEquals", ++ value: function lessEquals(target) { ++ return this.add(target.negate().toString()).toNumber() <= 0; ++ } ++ }, { ++ key: "toNumber", ++ value: function toNumber() { ++ if (this.isNaN()) { ++ return NaN; ++ } ++ ++ return Number(this.toString()); ++ } ++ }, { ++ key: "toString", ++ value: function toString() { ++ var safe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; ++ ++ if (!safe) { ++ return this.origin; ++ } ++ ++ if (this.isInvalidate()) { ++ return ''; ++ } ++ ++ return (0, _numberUtil.trimNumber)("".concat(this.getMark()).concat(this.getIntegerStr(), ".").concat(this.getDecimalStr())).fullStr; ++ } ++ }]); ++ return BigIntDecimal; ++}(); ++ ++exports.BigIntDecimal = BigIntDecimal; ++ ++function getMiniDecimal(value) { ++ // We use BigInt here. ++ // Will fallback to Number if not support. ++ if ((0, _supportUtil.supportBigInt)()) { ++ return new BigIntDecimal(value); ++ } ++ ++ return new NumberDecimal(value); ++} ++/** ++ * Align the logic of toFixed to around like 1.5 => 2 ++ */ ++ ++ ++function toFixed(numStr, separatorStr, precision) { ++ if (numStr === '') { ++ return ''; ++ } ++ ++ var _trimNumber2 = (0, _numberUtil.trimNumber)(numStr), ++ negativeStr = _trimNumber2.negativeStr, ++ integerStr = _trimNumber2.integerStr, ++ decimalStr = _trimNumber2.decimalStr; ++ ++ var precisionDecimalStr = "".concat(separatorStr).concat(decimalStr); ++ var numberWithoutDecimal = "".concat(negativeStr).concat(integerStr); ++ ++ if (precision >= 0) { ++ // We will get last + 1 number to check if need advanced number ++ var advancedNum = Number(decimalStr[precision]); ++ ++ if (advancedNum >= 5) { ++ var advancedDecimal = getMiniDecimal(numStr).add("".concat(negativeStr, "0.").concat('0'.repeat(precision)).concat(10 - advancedNum)); ++ return toFixed(advancedDecimal.toString(), separatorStr, precision); ++ } ++ ++ if (precision === 0) { ++ return numberWithoutDecimal; ++ } ++ ++ return "".concat(numberWithoutDecimal).concat(separatorStr).concat(decimalStr.padEnd(precision, '0').slice(0, precision)); ++ } ++ ++ if (precisionDecimalStr === '.0') { ++ return numberWithoutDecimal; ++ } ++ ++ return "".concat(numberWithoutDecimal).concat(precisionDecimalStr); ++} +\ No newline at end of file +diff --git a/node_modules/rc-input-number/lib/utils/numberUtil.d.ts b/node_modules/rc-input-number/lib/utils/numberUtil.d.ts +index c1e0948..34c94e2 100644 +--- a/node_modules/rc-input-number/lib/utils/numberUtil.d.ts ++++ b/node_modules/rc-input-number/lib/utils/numberUtil.d.ts +@@ -1 +1,22 @@ +-export declare function getDecupleSteps(step: string | number): string; ++/** ++ * Format string number to readable number ++ */ ++export declare function trimNumber(numStr: string): { ++ negative: boolean; ++ negativeStr: string; ++ trimStr: string; ++ integerStr: string; ++ decimalStr: string; ++ fullStr: string; ++}; ++export declare function isE(number: string | number): boolean; ++/** ++ * [Legacy] Convert 1e-9 to 0.000000001. ++ * This may lose some precision if user really want 1e-9. ++ */ ++export declare function getNumberPrecision(number: string | number): number; ++/** ++ * Convert number (includes scientific notation) to -xxx.yyy format ++ */ ++export declare function num2str(number: number): string; ++export declare function validateNumber(num: string | number): boolean; +diff --git a/node_modules/rc-input-number/lib/utils/numberUtil.js b/node_modules/rc-input-number/lib/utils/numberUtil.js +index af511db..8b73bf4 100644 +--- a/node_modules/rc-input-number/lib/utils/numberUtil.js ++++ b/node_modules/rc-input-number/lib/utils/numberUtil.js +@@ -3,13 +3,116 @@ + Object.defineProperty(exports, "__esModule", { + value: true + }); +-exports.getDecupleSteps = getDecupleSteps; +-var _miniDecimal = require("@rc-component/mini-decimal"); +-function getDecupleSteps(step) { +- var stepStr = typeof step === 'number' ? (0, _miniDecimal.num2str)(step) : (0, _miniDecimal.trimNumber)(step).fullStr; +- var hasPoint = stepStr.includes('.'); +- if (!hasPoint) { +- return step + '0'; +- } +- return (0, _miniDecimal.trimNumber)(stepStr.replace(/(\d)\.(\d)/g, '$1$2.')).fullStr; ++exports.getNumberPrecision = getNumberPrecision; ++exports.isE = isE; ++exports.num2str = num2str; ++exports.trimNumber = trimNumber; ++exports.validateNumber = validateNumber; ++ ++var _supportUtil = require("./supportUtil"); ++ ++/** ++ * Format string number to readable number ++ */ ++function trimNumber(numStr) { ++ var str = numStr.trim(); ++ var negative = str.startsWith('-'); ++ ++ if (negative) { ++ str = str.slice(1); ++ } ++ ++ str = str // Remove decimal 0. `1.000` => `1.`, `1.100` => `1.1` ++ .replace(/(\.\d*[^0])0*$/, '$1') // Remove useless decimal. `1.` => `1` ++ .replace(/\.0*$/, '') // Remove integer 0. `0001` => `1`, 000.1' => `.1` ++ .replace(/^0+/, ''); ++ ++ if (str.startsWith('.')) { ++ str = "0".concat(str); ++ } ++ ++ var trimStr = str || '0'; ++ var splitNumber = trimStr.split('.'); ++ var integerStr = splitNumber[0] || '0'; ++ var decimalStr = splitNumber[1] || '0'; ++ ++ if (integerStr === '0' && decimalStr === '0') { ++ negative = false; ++ } ++ ++ var negativeStr = negative ? '-' : ''; ++ return { ++ negative: negative, ++ negativeStr: negativeStr, ++ trimStr: trimStr, ++ integerStr: integerStr, ++ decimalStr: decimalStr, ++ fullStr: "".concat(negativeStr).concat(trimStr) ++ }; ++} ++ ++function isE(number) { ++ var str = String(number); ++ return !Number.isNaN(Number(str)) && str.includes('e'); ++} ++/** ++ * [Legacy] Convert 1e-9 to 0.000000001. ++ * This may lose some precision if user really want 1e-9. ++ */ ++ ++ ++function getNumberPrecision(number) { ++ var numStr = String(number); ++ ++ if (isE(number)) { ++ var precision = Number(numStr.slice(numStr.indexOf('e-') + 2)); ++ var decimalMatch = numStr.match(/\.(\d+)/); ++ ++ if (decimalMatch === null || decimalMatch === void 0 ? void 0 : decimalMatch[1]) { ++ precision += decimalMatch[1].length; ++ } ++ ++ return precision; ++ } ++ ++ return numStr.includes('.') && validateNumber(numStr) ? numStr.length - numStr.indexOf('.') - 1 : 0; ++} ++/** ++ * Convert number (includes scientific notation) to -xxx.yyy format ++ */ ++ ++ ++function num2str(number) { ++ var numStr = String(number); ++ ++ if (isE(number)) { ++ if (number > Number.MAX_SAFE_INTEGER) { ++ return String((0, _supportUtil.supportBigInt)() ? BigInt(number).toString() : Number.MAX_SAFE_INTEGER); ++ } ++ ++ if (number < Number.MIN_SAFE_INTEGER) { ++ return String((0, _supportUtil.supportBigInt)() ? BigInt(number).toString() : Number.MIN_SAFE_INTEGER); ++ } ++ ++ numStr = number.toFixed(getNumberPrecision(numStr)); ++ } ++ ++ return trimNumber(numStr).fullStr; ++} ++ ++function validateNumber(num) { ++ if (typeof num === 'number') { ++ return !Number.isNaN(num); ++ } // Empty ++ ++ ++ if (!num) { ++ return false; ++ } ++ ++ return (// Normal type: 11.28 ++ /^\s*-?\d+(\.\d+)?\s*$/.test(num) || // Pre-number: 1. ++ /^\s*-?\d+\.\s*$/.test(num) || // Post-number: .1 ++ /^\s*-?\.\d+\s*$/.test(num) ++ ); + } +\ No newline at end of file +diff --git a/node_modules/rc-input-number/lib/utils/supportUtil.d.ts b/node_modules/rc-input-number/lib/utils/supportUtil.d.ts +new file mode 100644 +index 0000000..885df7c +--- /dev/null ++++ b/node_modules/rc-input-number/lib/utils/supportUtil.d.ts +@@ -0,0 +1 @@ ++export declare function supportBigInt(): boolean; +diff --git a/node_modules/rc-input-number/lib/utils/supportUtil.js b/node_modules/rc-input-number/lib/utils/supportUtil.js +new file mode 100644 +index 0000000..a9a38bf +--- /dev/null ++++ b/node_modules/rc-input-number/lib/utils/supportUtil.js +@@ -0,0 +1,10 @@ ++"use strict"; ++ ++Object.defineProperty(exports, "__esModule", { ++ value: true ++}); ++exports.supportBigInt = supportBigInt; ++ ++function supportBigInt() { ++ return typeof BigInt === 'function'; ++} +\ No newline at end of file diff --git a/src/api/Export/index.js b/src/api/Export/index.js index 91cc34d14d..b406f13002 100644 --- a/src/api/Export/index.js +++ b/src/api/Export/index.js @@ -71,3 +71,25 @@ export async function ImportParse(className, file) { data: formData, }) } + +/** + * @description 导入物模型 + * @param params + * @return {Promise<*|ElMessageComponent>} + */ +export async function ImportWmx(type, productid, file) { + let formData = new FormData() + formData.append('type', type) + formData.append('objectId', productid) + formData.append('file', file) + console.log('formdata', formData, productid, file) + return request({ + url: 'import_wmxdata', + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data', + accept: 'application/json', + }, + data: formData, + }) +} diff --git a/src/components/Device/info.vue b/src/components/Device/info.vue index a5a43e361e..5a9a158f69 100644 --- a/src/components/Device/info.vue +++ b/src/components/Device/info.vue @@ -13,6 +13,10 @@ {{ $translateTitle('konva.id') + ':' }} {{ devicedetail.objectId }} + + {{ '设备名称' }} + + {{ devicedetail.name }} {{ $translateTitle('equipment.devicenumber') + ':' }} @@ -23,16 +27,6 @@ {{ devicedetail.address ? devicedetail.address : '' }} - - {{ $translateTitle('equipment.state') + ':' }} - - - - {{ $translateTitle('product.active') }} - @@ -78,14 +72,16 @@ {{ $translateTitle('application.secretkey') + ':' }} {{ devicedetail.deviceSecret || '-' }} - - - - - - - - + + {{ '经纬度' }} + + + {{ + devicedetail.location.latitude + + ',' + + devicedetail.location.longitude + }} + - + - + - + - + diff --git a/src/dgiot/plugins/permissions.js b/src/dgiot/plugins/permissions.js index 35df8fa8c1..53838ebea2 100644 --- a/src/dgiot/plugins/permissions.js +++ b/src/dgiot/plugins/permissions.js @@ -39,38 +39,42 @@ router.beforeEach(async (to, from, next) => { }) if (to.name == '404') { window.errRoute = to - return false } if (to.query.tempToken) { - let checkoutflag = false - await checkoutToken(to.query.tempToken).then((res) => { - if (res.code == 200) { - checkoutflag = true - } - }) - if (checkoutflag) { - Vue.prototype.$baseMessage( - Vue.prototype.$translateTitle(`token有效,登录跳转中`), - 'success' - ) - await store.dispatch('user/login', { - username: 'dgiot', - password: 'w9943535dsgfgdsgdsertet', - }) + let hasToken = localStorage.getItem('sessionToken') + if (!loginInterception) hasToken = true + if (hasToken) { } else { - Vue.prototype.$baseMessage( - Vue.prototype.$translateTitle(`token已失效。`), - 'error' - ) + let checkoutflag = false + await checkoutToken(to.query.tempToken).then((res) => { + if (res.code == 200) { + checkoutflag = true + } + }) + if (checkoutflag) { + Vue.prototype.$baseMessage( + Vue.prototype.$translateTitle(`token有效,登录跳转中`), + 'success' + ) + await store.dispatch('user/login', { + username: 'dgiot', + password: 'w9943535dsgfgdsgdsertet', + }) + } else { + Vue.prototype.$baseMessage( + Vue.prototype.$translateTitle(`token已失效。`), + 'error' + ) + } } } const { showProgressBar } = store.getters['settings/theme'] if (showProgressBar) DgiotProgress.start() // let hasToken = store.getters['user/token'] - let hasToken = localStorage.getItem('sessionToken') - if (!loginInterception) hasToken = true - if (hasToken) { + let hasToken1 = localStorage.getItem('sessionToken') + if (!loginInterception) hasToken1 = true + if (hasToken1) { if (store.getters['routes/routes'].length) { // 禁止已登录用户返回登录页 if (to.path === '/login') { diff --git a/src/i18n/zh.js b/src/i18n/zh.js index 21dd5b6d61..e472b7e691 100644 --- a/src/i18n/zh.js +++ b/src/i18n/zh.js @@ -239,7 +239,7 @@ export default { action: '动作', stop: '停止', start: '启动', - trace: '消息跟踪', + trace: '在线调试', alert: '告警设置', tracetype: '类型', instruct: '设备指令', diff --git a/src/store/modules/routes.js b/src/store/modules/routes.js index a483c910e1..b4cef4e13e 100644 --- a/src/store/modules/routes.js +++ b/src/store/modules/routes.js @@ -73,12 +73,12 @@ const actions = { const { results } = await getRouterList() const cookie = Cookies.get('dgiot_auth_token') !== 'undefined' if (!results && cookie) { - Vue.prototype.$baseMessage( - '路由未正常返回!', - 'error', - false, - 'dgiot-hey-message-error' - ) + // Vue.prototype.$baseMessage( + // '路由未正常返回!', + // 'error', + // false, + // 'dgiot-hey-message-error' + // ) return false } /** diff --git a/src/store/modules/topo.js b/src/store/modules/topo.js index ccedcdf25b..76eb6723ab 100644 --- a/src/store/modules/topo.js +++ b/src/store/modules/topo.js @@ -381,9 +381,6 @@ const mutations = { data: thing.data, productid: thing.productid, }) - console.log('%c 添加amis低代码节点', 'background:#ff00ff;') - console.log(simpleImage) - console.log(thing) } else if (thing.type == 'gifimage') { simpleImage = addNodeEvent( _.merge(canvas.handlerArgs, { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8d211e4d03..a668ce1339 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -420,14 +420,17 @@ const actions = { }, _userInfo ) - // console.log('查看数据', data) - const { sessionToken = '', roles = [], objectId = '', tag = {} } = data + const { + error = '', + sessionToken = '', + roles = [], + objectId = '', + tag = {}, + } = data let homeScreen = tag.companyinfo?.homeScreen || 0 //大屏类型 let background = tag.companyinfo?.backgroundimage || '' //大屏背景图 localStorage.setItem('homeScreen', homeScreen) localStorage.setItem('background', background) - localStorage.setItem('rolename', roles[0].name) - localStorage.setItem('sessionToken', sessionToken) // console.log('不是pc端', isPC()) if (!isPC()) { window.jstoken?.setJsToken( @@ -437,16 +440,26 @@ const actions = { ) } if (sessionToken) { + localStorage.setItem('rolename', roles[0].name) + localStorage.setItem('sessionToken', sessionToken) await queryAllMsg(commit, dispatch, data, 'ajax') await departmentToken(roles[0].name) commit('setLoginInfo', userInfo) } else { - Vue.prototype.$baseMessage( - Vue.prototype.$translateTitle( - `route.登录失败,可能是密码错误或者账号被禁用!请与平台管理员联系。` - ), - 'error' - ) + + if (error.indexOf('locked') > 0) { + Vue.prototype.$baseMessage( + Vue.prototype.$translateTitle( + `route.由于多次登录失败,您的帐户被锁定。请在10分钟后再试。` + ), + 'error' + ) + } else { + Vue.prototype.$baseMessage( + Vue.prototype.$translateTitle(`route.账号/密码错误请检查后重试`), + 'error' + ) + } return Promise.reject() } }, diff --git a/src/utils/request/request.js b/src/utils/request/request.js index 13f83d4caa..3c92a4a31f 100644 --- a/src/utils/request/request.js +++ b/src/utils/request/request.js @@ -126,8 +126,8 @@ instance.interceptors.request.use( let { headers = {} } = config _.merge(headers, { departmentToken: departmentToken, - author: 'h7ml', - email: 'h7ml@qq.com', + author: 'dgiot', + email: 'dgiot@iotn2n.com', platform: 'web', }) headers[`${tokenName}`] = usertoken diff --git a/src/utils/utilwen.js b/src/utils/utilwen.js index 5e6ebe2aaa..083c5eee52 100644 --- a/src/utils/utilwen.js +++ b/src/utils/utilwen.js @@ -55,7 +55,7 @@ Vue.mixin(dgiotMixin) Vue.use(Bus) const Headers = { - sessionToken: store ? store.getters['user/token'] : '', + sessionToken: store ? store.getters['user/token'] : 'undefined', } function moreHttp(option) { diff --git a/src/views/CloudFunction/engine/channel.vue b/src/views/CloudFunction/engine/channel.vue index cb1655d28e..4a60078afe 100644 --- a/src/views/CloudFunction/engine/channel.vue +++ b/src/views/CloudFunction/engine/channel.vue @@ -37,7 +37,13 @@ @onChange="onChange" /> - +
+
+ + {{ $translateTitle('application.uploadfile') }} + + {{ addchannel[item.showname + 'filename'] }} +
- {{ $translateTitle('application.preview') }} + {{ $translateTitle('article.view') }} diff --git a/src/views/CloudFunction/topo/js/evidence.js b/src/views/CloudFunction/topo/js/evidence.js index 464bf53615..c13ce8cb4e 100644 --- a/src/views/CloudFunction/topo/js/evidence.js +++ b/src/views/CloudFunction/topo/js/evidence.js @@ -363,6 +363,7 @@ export default { 'dgiot-hey-message-error' ) } + event.target.value = '' }, utc2beijing(utc_datetime) { // 转为正常的时间格式 年-月-日 时:分:秒 diff --git a/src/views/CloudOT/maintenance/alert.vue b/src/views/CloudOT/maintenance/alert.vue index 66dea147d9..a3de581224 100644 --- a/src/views/CloudOT/maintenance/alert.vue +++ b/src/views/CloudOT/maintenance/alert.vue @@ -161,7 +161,7 @@ diff --git a/src/views/CloudPressure/index.vue b/src/views/CloudPressure/index.vue index 73c629c7ac..c69031395b 100644 --- a/src/views/CloudPressure/index.vue +++ b/src/views/CloudPressure/index.vue @@ -634,6 +634,7 @@ const previerUrl = `${location.protocol}//${location.hostname}/onlinePreview?url=${encodeUrl}` window.open(previerUrl, '_blank') }, + // 下载PLC模板 async download(row) { window.location = row.docxUrl }, diff --git a/src/views/CloudSystem/installation/log.vue b/src/views/CloudSystem/installation/log.vue index a98b361d81..ce12ba86d1 100644 --- a/src/views/CloudSystem/installation/log.vue +++ b/src/views/CloudSystem/installation/log.vue @@ -17,7 +17,7 @@ :height="height" style="width: 100%; margin-top: 20px" > - +
- - -