@ones-open/store
Advanced tools
Comparing version 0.14.3-27607.928 to 2.1.0
@@ -1,55 +0,66 @@ | ||
import { createStore as createStore$1 } from "redux"; | ||
import { isPlainObject, cloneDeep } from "lodash-es"; | ||
import { useState, useEffect, useRef, useCallback, useMemo } from "react"; | ||
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty"; | ||
import { MFPluginDispatch, MFDispatch, MFListener } from "@ones-open/event"; | ||
import { createStore as createStore$1 } from 'redux'; | ||
import { useState, useEffect, useRef, useCallback, useMemo } from 'react'; | ||
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty'; | ||
import { MFPluginDispatch, MFDispatch, MFListener } from '@ones-open/event'; | ||
import { cloneDeep } from '@senojs/lodash'; | ||
/****************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
/* global Reflect, Promise, SuppressedError, Symbol */ | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { | ||
d2.__proto__ = b2; | ||
} || function(d2, b2) { | ||
for (var p in b2) | ||
if (Object.prototype.hasOwnProperty.call(b2, p)) | ||
d2[p] = b2[p]; | ||
}; | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
var genericMessage = "Invariant Violation"; | ||
var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function(obj, proto) { | ||
obj.__proto__ = proto; | ||
return obj; | ||
var _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) { | ||
obj.__proto__ = proto; | ||
return obj; | ||
} : _a; | ||
var InvariantError = ( | ||
/** @class */ | ||
function(_super) { | ||
__extends(InvariantError2, _super); | ||
function InvariantError2(message) { | ||
if (message === void 0) { | ||
message = genericMessage; | ||
} | ||
var _this = _super.call(this, typeof message === "number" ? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" : message) || this; | ||
_this.framesToPop = 1; | ||
_this.name = genericMessage; | ||
setPrototypeOf(_this, InvariantError2.prototype); | ||
return _this; | ||
var InvariantError = /** @class */ (function (_super) { | ||
__extends(InvariantError, _super); | ||
function InvariantError(message) { | ||
if (message === void 0) { message = genericMessage; } | ||
var _this = _super.call(this, typeof message === "number" | ||
? genericMessage + ": " + message + " (see https://github.com/apollographql/invariant-packages)" | ||
: message) || this; | ||
_this.framesToPop = 1; | ||
_this.name = genericMessage; | ||
setPrototypeOf(_this, InvariantError.prototype); | ||
return _this; | ||
} | ||
return InvariantError2; | ||
}(Error) | ||
); | ||
return InvariantError; | ||
}(Error)); | ||
function invariant(condition, message) { | ||
if (!condition) { | ||
throw new InvariantError(message); | ||
} | ||
if (!condition) { | ||
throw new InvariantError(message); | ||
} | ||
} | ||
@@ -59,15 +70,219 @@ var verbosityLevels = ["debug", "log", "warn", "error", "silent"]; | ||
function wrapConsoleMethod(name) { | ||
return function() { | ||
if (verbosityLevels.indexOf(name) >= verbosityLevel) { | ||
var method = console[name] || console.log; | ||
return method.apply(console, arguments); | ||
return function () { | ||
if (verbosityLevels.indexOf(name) >= verbosityLevel) { | ||
// Default to console.log if this host environment happens not to provide | ||
// all the console.* methods we need. | ||
var method = console[name] || console.log; | ||
return method.apply(console, arguments); | ||
} | ||
}; | ||
} | ||
(function (invariant) { | ||
invariant.debug = wrapConsoleMethod("debug"); | ||
invariant.log = wrapConsoleMethod("log"); | ||
invariant.warn = wrapConsoleMethod("warn"); | ||
invariant.error = wrapConsoleMethod("error"); | ||
})(invariant || (invariant = {})); | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = freeGlobal || freeSelf || Function('return this')(); | ||
/** Built-in value references. */ | ||
var Symbol$1 = root.Symbol; | ||
/** Used for built-in method references. */ | ||
var objectProto$2 = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty$1 = objectProto$2.hasOwnProperty; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString$1 = objectProto$2.toString; | ||
/** Built-in value references. */ | ||
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined; | ||
/** | ||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the raw `toStringTag`. | ||
*/ | ||
function getRawTag(value) { | ||
var isOwn = hasOwnProperty$1.call(value, symToStringTag$1), | ||
tag = value[symToStringTag$1]; | ||
try { | ||
value[symToStringTag$1] = undefined; | ||
var unmasked = true; | ||
} catch (e) {} | ||
var result = nativeObjectToString$1.call(value); | ||
if (unmasked) { | ||
if (isOwn) { | ||
value[symToStringTag$1] = tag; | ||
} else { | ||
delete value[symToStringTag$1]; | ||
} | ||
} | ||
return result; | ||
} | ||
/** Used for built-in method references. */ | ||
var objectProto$1 = Object.prototype; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var nativeObjectToString = objectProto$1.toString; | ||
/** | ||
* Converts `value` to a string using `Object.prototype.toString`. | ||
* | ||
* @private | ||
* @param {*} value The value to convert. | ||
* @returns {string} Returns the converted string. | ||
*/ | ||
function objectToString(value) { | ||
return nativeObjectToString.call(value); | ||
} | ||
/** `Object#toString` result references. */ | ||
var nullTag = '[object Null]', | ||
undefinedTag = '[object Undefined]'; | ||
/** Built-in value references. */ | ||
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; | ||
/** | ||
* The base implementation of `getTag` without fallbacks for buggy environments. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {string} Returns the `toStringTag`. | ||
*/ | ||
function baseGetTag(value) { | ||
if (value == null) { | ||
return value === undefined ? undefinedTag : nullTag; | ||
} | ||
return (symToStringTag && symToStringTag in Object(value)) | ||
? getRawTag(value) | ||
: objectToString(value); | ||
} | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return value != null && typeof value == 'object'; | ||
} | ||
/** | ||
* Creates a unary function that invokes `func` with its argument transformed. | ||
* | ||
* @private | ||
* @param {Function} func The function to wrap. | ||
* @param {Function} transform The argument transform. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function overArg(func, transform) { | ||
return function(arg) { | ||
return func(transform(arg)); | ||
}; | ||
} | ||
(function(invariant2) { | ||
invariant2.debug = wrapConsoleMethod("debug"); | ||
invariant2.log = wrapConsoleMethod("log"); | ||
invariant2.warn = wrapConsoleMethod("warn"); | ||
invariant2.error = wrapConsoleMethod("error"); | ||
})(invariant || (invariant = {})); | ||
/** Built-in value references. */ | ||
var getPrototype = overArg(Object.getPrototypeOf, Object); | ||
/** `Object#toString` result references. */ | ||
var objectTag = '[object Object]'; | ||
/** Used for built-in method references. */ | ||
var funcProto = Function.prototype, | ||
objectProto = Object.prototype; | ||
/** Used to resolve the decompiled source of functions. */ | ||
var funcToString = funcProto.toString; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** Used to infer the `Object` constructor. */ | ||
var objectCtorString = funcToString.call(Object); | ||
/** | ||
* Checks if `value` is a plain object, that is, an object created by the | ||
* `Object` constructor or one with a `[[Prototype]]` of `null`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.8.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. | ||
* @example | ||
* | ||
* function Foo() { | ||
* this.a = 1; | ||
* } | ||
* | ||
* _.isPlainObject(new Foo); | ||
* // => false | ||
* | ||
* _.isPlainObject([1, 2, 3]); | ||
* // => false | ||
* | ||
* _.isPlainObject({ 'x': 0, 'y': 0 }); | ||
* // => true | ||
* | ||
* _.isPlainObject(Object.create(null)); | ||
* // => true | ||
*/ | ||
function isPlainObject(value) { | ||
if (!isObjectLike(value) || baseGetTag(value) != objectTag) { | ||
return false; | ||
} | ||
var proto = getPrototype(value); | ||
if (proto === null) { | ||
return true; | ||
} | ||
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; | ||
return typeof Ctor == 'function' && Ctor instanceof Ctor && | ||
funcToString.call(Ctor) == objectCtorString; | ||
} | ||
function createStore(slice) { | ||
@@ -91,11 +306,10 @@ const innerReducer = (state, action) => { | ||
} | ||
function getGlobals() { | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#search_for_the_global_across_environments | ||
const globals = (() => { | ||
if (typeof self !== "undefined") | ||
return self; | ||
if (typeof window !== "undefined") | ||
return window; | ||
if (typeof global !== "undefined") | ||
return global; | ||
throw new Error("unable to locate global object"); | ||
if (typeof self !== 'undefined') return self; | ||
if (typeof window !== 'undefined') return window; | ||
if (typeof global !== 'undefined') return global; | ||
throw new Error('unable to locate global object'); | ||
})(); | ||
@@ -105,7 +319,8 @@ return globals; | ||
class AssignmentToReadOnlyValueException extends TypeError { | ||
constructor() { | ||
super(...arguments); | ||
_defineProperty(this, "name", "Can not assignment to read-only value"); | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "name", 'Can not assignment to read-only value'); | ||
} | ||
} | ||
const readOnlyHandler = { | ||
@@ -136,23 +351,13 @@ get(target, propertyKey, receiver) { | ||
}; | ||
const handlers = /* @__PURE__ */ new Map([ | ||
// 所有标量都不能被代理 | ||
// 可以被代理的类型 | ||
[Array, readOnlyHandler], | ||
[Object, readOnlyHandler], | ||
// 可以模拟代理但暂不支持的类型 | ||
[Set, null], | ||
[WeakSet, null], | ||
[Map, null], | ||
[WeakMap, null], | ||
// 不能被代理的类型 | ||
[Int8Array, null], | ||
[Uint8Array, null], | ||
[Uint8ClampedArray, null], | ||
[Int16Array, null], | ||
[Uint16Array, null], | ||
[Int32Array, null], | ||
[Uint32Array, null], | ||
[Float32Array, null], | ||
[Float64Array, null] | ||
]); | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
const handlers = new Map([ | ||
// 所有标量都不能被代理 | ||
// 可以被代理的类型 | ||
[Array, readOnlyHandler], [Object, readOnlyHandler], | ||
// 可以模拟代理但暂不支持的类型 | ||
[Set, null], [WeakSet, null], [Map, null], [WeakMap, null], | ||
// 不能被代理的类型 | ||
[Int8Array, null], [Uint8Array, null], [Uint8ClampedArray, null], [Int16Array, null], [Uint16Array, null], [Int32Array, null], [Uint32Array, null], [Float32Array, null], [Float64Array, null]]); | ||
function getHandler(obj) { | ||
@@ -162,14 +367,19 @@ const handler = handlers.get(obj === null || obj === void 0 ? void 0 : obj.constructor); | ||
} | ||
const proxyToRaw = /* @__PURE__ */ new WeakMap(); | ||
const rawToProxy = /* @__PURE__ */ new WeakMap(); | ||
const proxyToRaw = new WeakMap(); | ||
const rawToProxy = new WeakMap(); | ||
function createProxiable(obj, handler) { | ||
const proxiable2 = new Proxy(obj, handler); | ||
rawToProxy.set(obj, proxiable2); | ||
proxyToRaw.set(proxiable2, obj); | ||
return proxiable2; | ||
const proxiable = new Proxy(obj, handler); | ||
rawToProxy.set(obj, proxiable); | ||
proxyToRaw.set(proxiable, obj); | ||
return proxiable; | ||
} | ||
function proxiable(obj) { | ||
// 如果 obj 已经是代理则不进行任何处理 | ||
if (proxyToRaw.has(obj)) { | ||
return obj; | ||
} | ||
// 已经处理过的对象直接返回,避免同一份数据产生不同的引用 | ||
if (rawToProxy.has(obj)) { | ||
@@ -181,5 +391,8 @@ return rawToProxy.get(obj); | ||
} | ||
function retrieveStoreFromGlobal() { | ||
var _globals$__ONES_MF_EN; | ||
const globals = getGlobals(); | ||
// @ts-expect-error: TODO | ||
return globals === null || globals === void 0 || (_globals$__ONES_MF_EN = globals.__ONES_MF_ENV__) === null || _globals$__ONES_MF_EN === void 0 ? void 0 : _globals$__ONES_MF_EN.store; | ||
@@ -190,3 +403,3 @@ } | ||
const concreteStore = (_retrieveStoreFromGlo = retrieveStoreFromGlobal()) !== null && _retrieveStoreFromGlo !== void 0 ? _retrieveStoreFromGlo : createStore({ | ||
state: void 0 | ||
state: undefined | ||
}); | ||
@@ -207,3 +420,6 @@ const storeProxy = { | ||
} | ||
const store = getStore(); | ||
// 目前存在没有传递store的插槽 | ||
function useStoreInfo() { | ||
@@ -213,2 +429,3 @@ const storeRef = store; | ||
useEffect(() => { | ||
// 在`useStoreInfo`执行后,`useEffect`还未执行之前,如果这个时候`store.dispatch`更新了数据,会导致`info`不是最新的数据。 | ||
setInfo(storeRef === null || storeRef === void 0 ? void 0 : storeRef.getState()); | ||
@@ -224,2 +441,3 @@ const unsubscribe = storeRef === null || storeRef === void 0 ? void 0 : storeRef.subscribe(() => { | ||
} | ||
function useAction(type, handler) { | ||
@@ -240,2 +458,3 @@ var _useStoreInfo; | ||
} | ||
function useVariablesInfo() { | ||
@@ -246,2 +465,4 @@ var _useStoreInfo; | ||
} | ||
// 团队信息 | ||
function useTeamInfo() { | ||
@@ -251,2 +472,4 @@ var _useStoreInfo; | ||
} | ||
// 产品信息 | ||
function useProductInfo() { | ||
@@ -256,2 +479,4 @@ var _useStoreInfo2; | ||
} | ||
// 组织信息 | ||
function useOrganizationInfo() { | ||
@@ -261,2 +486,4 @@ var _useStoreInfo3; | ||
} | ||
// 仪表盘信息 | ||
function useDashboardInfo() { | ||
@@ -266,2 +493,4 @@ var _useStoreInfo4; | ||
} | ||
// 筛选器信息 | ||
function useFilterInfo() { | ||
@@ -271,2 +500,4 @@ var _useStoreInfo5; | ||
} | ||
// 项目信息 | ||
function useProjectInfo() { | ||
@@ -276,2 +507,4 @@ var _useStoreInfo6; | ||
} | ||
// 项目成员组件-项目角色信息 | ||
function useProjectRoleInfo() { | ||
@@ -281,2 +514,4 @@ var _useStoreInfo7; | ||
} | ||
// 测试计划信息 | ||
function useTestPlanInfo() { | ||
@@ -286,2 +521,4 @@ var _useStoreInfo8; | ||
} | ||
// 用例库信息 | ||
function useTestCaseLibraryInfo() { | ||
@@ -291,2 +528,4 @@ var _useStoreInfo9; | ||
} | ||
// 用例库用例列表信息 | ||
function useTestCaseListInfo() { | ||
@@ -296,2 +535,4 @@ var _useStoreInfo10; | ||
} | ||
// 流水线信息 | ||
function usePipelineInfo() { | ||
@@ -301,2 +542,4 @@ var _useStoreInfo11; | ||
} | ||
// 项目集信息 | ||
function useProgramInfo() { | ||
@@ -306,2 +549,4 @@ var _useStoreInfo12; | ||
} | ||
// 用户信息 | ||
function useUserInfo() { | ||
@@ -311,2 +556,4 @@ var _useStoreInfo13; | ||
} | ||
// 路由前缀信息,供内部路由库使用 | ||
function useBasenameInfo() { | ||
@@ -316,2 +563,4 @@ var _useStoreInfo14; | ||
} | ||
// 插件信息 | ||
function usePluginInfo() { | ||
@@ -321,2 +570,4 @@ var _useStoreInfo15; | ||
} | ||
// 进度管理器任务信息 | ||
function useProgressJobInfo() { | ||
@@ -330,3 +581,3 @@ var _useStoreInfo16; | ||
const module = (_useStoreInfo18 = useStoreInfo()) === null || _useStoreInfo18 === void 0 || (_useStoreInfo18 = _useStoreInfo18.store) === null || _useStoreInfo18 === void 0 ? void 0 : _useStoreInfo18.module; | ||
const dispatchData = useCallback((eventData) => { | ||
const dispatchData = useCallback(eventData => { | ||
return MFPluginDispatch(`${wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.data.moduleId}:${wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.blockId}:${module === null || module === void 0 ? void 0 : module.id}`, eventData); | ||
@@ -336,3 +587,3 @@ }, [module === null || module === void 0 ? void 0 : module.id, wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.blockId, wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.data.moduleId]); | ||
dispatchData({ | ||
type: "SaveToDoc", | ||
type: 'SaveToDoc', | ||
data, | ||
@@ -342,5 +593,5 @@ exportSpec: config.exportSpec | ||
}, [dispatchData]); | ||
const setToolbarState = useCallback((data) => { | ||
const setToolbarState = useCallback(data => { | ||
dispatchData({ | ||
type: "ToolbarState", | ||
type: 'ToolbarState', | ||
data | ||
@@ -351,11 +602,11 @@ }); | ||
return dispatchData({ | ||
type: "GetApiService" | ||
}).then((data) => { | ||
const apiService = data.length > 0 ? data[0] : void 0; | ||
type: 'GetApiService' | ||
}).then(data => { | ||
const apiService = data.length > 0 ? data[0] : undefined; | ||
return apiService === null || apiService === void 0 ? void 0 : apiService.data; | ||
}); | ||
}, [dispatchData]); | ||
const setStatus = useCallback((status) => { | ||
const setStatus = useCallback(status => { | ||
dispatchData({ | ||
type: "PluginStatus", | ||
type: 'PluginStatus', | ||
data: status | ||
@@ -366,3 +617,3 @@ }); | ||
dispatchData({ | ||
type: "RemoveDoc" | ||
type: 'RemoveDoc' | ||
}); | ||
@@ -380,3 +631,3 @@ }, [dispatchData]); | ||
destroy, | ||
id: (_wizDocument$blockId = wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.blockId) !== null && _wizDocument$blockId !== void 0 ? _wizDocument$blockId : "", | ||
id: (_wizDocument$blockId = wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.blockId) !== null && _wizDocument$blockId !== void 0 ? _wizDocument$blockId : '', | ||
exportSpec: wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.data.exportSpec, | ||
@@ -390,2 +641,4 @@ uploadResource: wizDocument === null || wizDocument === void 0 ? void 0 : wizDocument.uploadResource, | ||
} | ||
// 工作项信息 | ||
function useTaskInfo() { | ||
@@ -395,2 +648,4 @@ var _useStoreInfo19; | ||
} | ||
// 配置中心-流水线管理-代码仓信息 | ||
function useCodeRepositoryInfo() { | ||
@@ -400,2 +655,3 @@ var _useStoreInfo20; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useTestReportComponentInfo() { | ||
@@ -413,18 +669,18 @@ var _useStoreInfo21; | ||
const eventPrefix = `${contentUUID}:${componentUUID}`; | ||
const dispatch = useCallback(async (action) => { | ||
const dispatch = useCallback(async action => { | ||
await MFDispatch(`${eventPrefix}:dispatchAction`, action); | ||
}, [eventPrefix]); | ||
const updateComponentSetting = useCallback((newSetting) => { | ||
const updateComponentSetting = useCallback(newSetting => { | ||
return dispatch({ | ||
type: "updateComponentSetting", | ||
type: 'updateComponentSetting', | ||
payload: newSetting | ||
}); | ||
}, [dispatch]); | ||
const updateComponentExportContent = useCallback((exportItems) => { | ||
const updateComponentExportContent = useCallback(exportItems => { | ||
return dispatch({ | ||
type: "updateComponentExportContent", | ||
type: 'updateComponentExportContent', | ||
payload: exportItems | ||
}); | ||
}, [dispatch]); | ||
const addOnSubmitSettingListener = useCallback((callback) => { | ||
const addOnSubmitSettingListener = useCallback(callback => { | ||
return MFListener(`${eventPrefix}:submitSetting`, callback); | ||
@@ -444,2 +700,4 @@ }, [eventPrefix]); | ||
} | ||
// wiki页面组信息 | ||
function useWikiSpaceInfo() { | ||
@@ -449,2 +707,4 @@ var _useStoreInfo22; | ||
} | ||
// wiki 分享页面信息 | ||
function useWikiShareInfo() { | ||
@@ -466,2 +726,8 @@ var _useStoreInfo23; | ||
} | ||
/** | ||
* Get current plugin module instance information | ||
* | ||
* WARNING: Currently, only manually activated plugin module are supported to obtain information | ||
*/ | ||
function useModuleInstanceInfo() { | ||
@@ -471,2 +737,4 @@ var _useStoreInfo27; | ||
} | ||
// 自定义仪表盘组件的配置弹窗的信息 | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useDashboardCardConfigInfo() { | ||
@@ -476,2 +744,5 @@ var _useStoreInfo28; | ||
} | ||
// 自定义仪表盘卡片信息 | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function useDashboardCardInfo() { | ||
@@ -481,40 +752,52 @@ var _useStoreInfo29; | ||
} | ||
var EmbedPluginRuntimeStatus = /* @__PURE__ */ ((EmbedPluginRuntimeStatus2) => { | ||
EmbedPluginRuntimeStatus2["VALID"] = "VALID"; | ||
EmbedPluginRuntimeStatus2["DATA_INVALID"] = "DATA_INVALID"; | ||
EmbedPluginRuntimeStatus2["PLUGIN_RESOURCE_INVALID"] = "PLUGIN_RESOURCE_INVALID"; | ||
return EmbedPluginRuntimeStatus2; | ||
})(EmbedPluginRuntimeStatus || {}); | ||
var ProgressJobStatus = /* @__PURE__ */ ((ProgressJobStatus2) => { | ||
ProgressJobStatus2["DONE"] = "done"; | ||
ProgressJobStatus2["FAIL"] = "fail"; | ||
return ProgressJobStatus2; | ||
})(ProgressJobStatus || {}); | ||
var ProgressJobType = /* @__PURE__ */ ((ProgressJobType2) => { | ||
ProgressJobType2["PluginDataSync"] = "plugin_data_sync"; | ||
return ProgressJobType2; | ||
})(ProgressJobType || {}); | ||
var PageScene = /* @__PURE__ */ ((PageScene2) => { | ||
PageScene2[PageScene2["Space"] = 0] = "Space"; | ||
PageScene2[PageScene2["SpaceHistory"] = 1] = "SpaceHistory"; | ||
PageScene2[PageScene2["SpaceEdit"] = 2] = "SpaceEdit"; | ||
PageScene2[PageScene2["Share"] = 3] = "Share"; | ||
PageScene2[PageScene2["ShareHistory"] = 4] = "ShareHistory"; | ||
PageScene2[PageScene2["ShareEdit"] = 5] = "ShareEdit"; | ||
PageScene2[PageScene2["Draft"] = 6] = "Draft"; | ||
PageScene2[PageScene2["DraftEdit"] = 7] = "DraftEdit"; | ||
PageScene2[PageScene2["PageDraft"] = 8] = "PageDraft"; | ||
PageScene2[PageScene2["PageDraftEdit"] = 9] = "PageDraftEdit"; | ||
PageScene2[PageScene2["ConflictDraftEdit"] = 10] = "ConflictDraftEdit"; | ||
PageScene2[PageScene2["Recycle"] = 11] = "Recycle"; | ||
PageScene2[PageScene2["Template"] = 12] = "Template"; | ||
PageScene2[PageScene2["TemplateEdit"] = 13] = "TemplateEdit"; | ||
PageScene2[PageScene2["GlobalTemplate"] = 14] = "GlobalTemplate"; | ||
PageScene2[PageScene2["GlobalTemplateEdit"] = 15] = "GlobalTemplateEdit"; | ||
PageScene2[PageScene2["Archived"] = 16] = "Archived"; | ||
PageScene2[PageScene2["Project"] = 17] = "Project"; | ||
return PageScene2; | ||
})(PageScene || {}); | ||
let EmbedPluginRuntimeStatus = /*#__PURE__*/function (EmbedPluginRuntimeStatus) { | ||
EmbedPluginRuntimeStatus["VALID"] = "VALID"; | ||
EmbedPluginRuntimeStatus["DATA_INVALID"] = "DATA_INVALID"; | ||
EmbedPluginRuntimeStatus["PLUGIN_RESOURCE_INVALID"] = "PLUGIN_RESOURCE_INVALID"; | ||
return EmbedPluginRuntimeStatus; | ||
}({}); | ||
let ProgressJobStatus = /*#__PURE__*/function (ProgressJobStatus) { | ||
ProgressJobStatus["DONE"] = "done"; | ||
ProgressJobStatus["FAIL"] = "fail"; | ||
return ProgressJobStatus; | ||
}({}); | ||
let ProgressJobType = /*#__PURE__*/function (ProgressJobType) { | ||
ProgressJobType["PluginDataSync"] = "plugin_data_sync"; | ||
return ProgressJobType; | ||
}({}); | ||
let PageScene = /*#__PURE__*/function (PageScene) { | ||
PageScene[PageScene["Space"] = 0] = "Space"; | ||
PageScene[PageScene["SpaceHistory"] = 1] = "SpaceHistory"; | ||
PageScene[PageScene["SpaceEdit"] = 2] = "SpaceEdit"; | ||
PageScene[PageScene["Share"] = 3] = "Share"; | ||
PageScene[PageScene["ShareHistory"] = 4] = "ShareHistory"; | ||
PageScene[PageScene["ShareEdit"] = 5] = "ShareEdit"; | ||
PageScene[PageScene["Draft"] = 6] = "Draft"; | ||
PageScene[PageScene["DraftEdit"] = 7] = "DraftEdit"; | ||
PageScene[PageScene["PageDraft"] = 8] = "PageDraft"; | ||
PageScene[PageScene["PageDraftEdit"] = 9] = "PageDraftEdit"; | ||
PageScene[PageScene["ConflictDraftEdit"] = 10] = "ConflictDraftEdit"; | ||
PageScene[PageScene["Recycle"] = 11] = "Recycle"; | ||
PageScene[PageScene["Template"] = 12] = "Template"; | ||
PageScene[PageScene["TemplateEdit"] = 13] = "TemplateEdit"; | ||
PageScene[PageScene["GlobalTemplate"] = 14] = "GlobalTemplate"; | ||
PageScene[PageScene["GlobalTemplateEdit"] = 15] = "GlobalTemplateEdit"; | ||
PageScene[PageScene["Archived"] = 16] = "Archived"; | ||
PageScene[PageScene["Project"] = 17] = "Project"; | ||
return PageScene; | ||
}({}); // 项目页面查看 | ||
/** | ||
* WARNING: 插件模块生命周期相关函数已迁移至 @ones-open/bridge,请勿在此处文件追加方法。 | ||
* 存放插槽生命周期相关函数 | ||
*/ | ||
/** | ||
* 销毁当前手动激活的插槽 | ||
* window.__ONES_MF_NAME__ => `${appid}:${moduleID}` | ||
*/ | ||
const destroyCurrentModule = () => { | ||
if (process.env.NODE_ENV === "development") { | ||
if (process.env.NODE_ENV === 'development') { | ||
console.warn(`"destroyCurrentModule" is deprecated, please use the @ones-open/bridge "lifecycle" instead. | ||
@@ -527,40 +810,3 @@ e.g. | ||
}; | ||
export { | ||
EmbedPluginRuntimeStatus, | ||
PageScene, | ||
ProgressJobStatus, | ||
ProgressJobType, | ||
destroyCurrentModule, | ||
getStore, | ||
useAction, | ||
useBasenameInfo, | ||
useCodeRepositoryInfo, | ||
useCustomEditorInfo, | ||
useDashboardCardConfigInfo, | ||
useDashboardCardInfo, | ||
useDashboardInfo, | ||
useDocumentInfo, | ||
useFilterInfo, | ||
useModuleInstanceInfo, | ||
useOrganizationInfo, | ||
usePipelineInfo, | ||
usePluginInfo, | ||
useProductInfo, | ||
useProgramInfo, | ||
useProgressJobInfo, | ||
useProjectInfo, | ||
useProjectRoleInfo, | ||
useStoreInfo, | ||
useTaskInfo, | ||
useTeamInfo, | ||
useTestCaseLibraryInfo, | ||
useTestCaseListInfo, | ||
useTestPlanInfo, | ||
useTestReportComponentInfo, | ||
useUserInfo, | ||
useVariablesInfo, | ||
useWikiPageInfo, | ||
useWikiShareInfo, | ||
useWikiSpaceInfo, | ||
useWikiTemplatePageInfo | ||
}; | ||
export { EmbedPluginRuntimeStatus, PageScene, ProgressJobStatus, ProgressJobType, destroyCurrentModule, getStore, useAction, useBasenameInfo, useCodeRepositoryInfo, useCustomEditorInfo, useDashboardCardConfigInfo, useDashboardCardInfo, useDashboardInfo, useDocumentInfo, useFilterInfo, useModuleInstanceInfo, useOrganizationInfo, usePipelineInfo, usePluginInfo, useProductInfo, useProgramInfo, useProgressJobInfo, useProjectInfo, useProjectRoleInfo, useStoreInfo, useTaskInfo, useTeamInfo, useTestCaseLibraryInfo, useTestCaseListInfo, useTestPlanInfo, useTestReportComponentInfo, useUserInfo, useVariablesInfo, useWikiPageInfo, useWikiShareInfo, useWikiSpaceInfo, useWikiTemplatePageInfo }; |
@@ -108,2 +108,3 @@ import type { CodeRepositoryInfo, TestReportComponentExportItem } from '../type'; | ||
name: string; | ||
scene?: number | undefined; | ||
} | undefined; | ||
@@ -110,0 +111,0 @@ declare function useWikiTemplatePageInfo(): { |
/** | ||
* WARNING: 插件模块生命周期相关函数已迁移至 @ones-open/bridge,请勿在此处文件追加方法。 | ||
* 存放插槽生命周期相关函数 | ||
*/ | ||
/** | ||
* 销毁当前手动激活的插槽 | ||
@@ -7,0 +3,0 @@ * window.__ONES_MF_NAME__ => `${appid}:${moduleID}` |
@@ -149,2 +149,3 @@ import { type ActionType } from '@ones-open/utils'; | ||
name: string; | ||
scene?: number; | ||
}; | ||
@@ -151,0 +152,0 @@ } |
{ | ||
"name": "@ones-open/store", | ||
"version": "0.14.3-27607.928+cb600015", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -51,17 +51,18 @@ "type": "module", | ||
"peerDependencies": { | ||
"react": "^16.9.0 || ^17.0.0", | ||
"react-dom": "^16.9.0 || ^17.0.0" | ||
"react": "^16.14.0 || ^17.0.0", | ||
"react-dom": "^16.14.0 || ^17.0.0" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime-corejs3": "~7.22.6", | ||
"@ones-open/event": "0.13.1-27607.928+cb600015", | ||
"@ones-open/utils": "0.32.1-27607.928+cb600015", | ||
"@types/lodash-es": "^4.17.6", | ||
"lodash-es": "~4.17.21", | ||
"@babel/runtime-corejs3": "^7.22.15", | ||
"@ones-open/event": "^2.1.0", | ||
"@ones-open/utils": "^2.1.0", | ||
"@senojs/lodash": "^1.0.2", | ||
"@types/react": "^17.0.19", | ||
"@types/react-dom": "^17.0.0", | ||
"redux": "~4.1.2" | ||
}, | ||
"devDependencies": { | ||
"@ones-mf/store": "0.3.1-27607.53+cb600015" | ||
"@ones-mf/store": "^0.3.0" | ||
}, | ||
"gitHead": "cb6000157b4647ed4df97f24aedf38390684dd63" | ||
"gitHead": "a15f5cf783067b23ff384818c3270eabc8675d5c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
3
131150
9
34
2058
3
+ Added@senojs/lodash@^1.0.2
+ Added@types/react@^17.0.19
+ Added@types/react-dom@^17.0.0
+ Added@babel/runtime-corejs3@7.26.0(transitive)
+ Added@ones-open/event@2.1.1(transitive)
+ Added@ones-open/utils@2.1.1(transitive)
+ Added@senojs/lodash@1.0.2(transitive)
+ Added@types/prop-types@15.7.14(transitive)
+ Added@types/react@17.0.83(transitive)
+ Added@types/react-dom@17.0.26(transitive)
+ Added@types/scheduler@0.16.8(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedlodash@4.17.21(transitive)
- Removed@types/lodash-es@^4.17.6
- Removedlodash-es@~4.17.21
- Removed@babel/runtime-corejs3@7.22.15(transitive)
Updated@ones-open/event@^2.1.0
Updated@ones-open/utils@^2.1.0