Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleClickExpandBtn = () => {
const tabLevel = RoleStore.tabLevel || this.tabLevel;
const expand = get(RoleStore.expand, tabLevel);
if (expand) {
// 需要展开
set(RoleStore.expandedRowKeys, tabLevel, this.getAllIdByLevel(tabLevel));
} else {
// 需要收起
set(RoleStore.expandedRowKeys, tabLevel, []);
}
set(RoleStore.expand, tabLevel, !expand);
}
function reconcileArraySnapshot(value: any, sn: SnapshotInOfArray): any[] {
if (!isArray(value)) {
// no reconciliation possible
return fromSnapshot(sn)
}
// remove excess items
if (value.length > sn.length) {
value.splice(sn.length, value.length - sn.length)
}
// reconcile present items
for (let i = 0; i < value.length; i++) {
set(value, i as any, reconcileSnapshot(value[i], sn[i]))
}
// add excess items
for (let i = value.length; i < sn.length; i++) {
value.push(fromSnapshot(sn[i]))
}
return value
}
for (let i = 0; i < dataKeysLen; i++) {
const k = dataKeys[i]
if (!(k in processedSn)) {
remove(data, k)
}
}
// reconcile the rest
const processedSnKeys = Object.keys(processedSn)
const processedSnKeysLen = processedSnKeys.length
for (let i = 0; i < processedSnKeysLen; i++) {
const k = processedSnKeys[i]
if (!isReservedModelKey(k)) {
const v = processedSn[k]
set(data, k, reconcileSnapshot(data[k], v))
}
}
return modelObj
}
setCacheOptions(options,cacheObj){
let start = this.optionsCache;
const len = this.relateKeys.length;
let counter = 0;
while(counter
if (isPrimitive(v)) {
if (!doNotTweakChildren) {
set(tweakedArr, i, v)
}
standardSn[i] = v
} else {
const path = { parent: tweakedArr, path: i }
let tweakedValue
if (doNotTweakChildren) {
tweakedValue = v
setParent(tweakedValue, path, false, false)
} else {
tweakedValue = tweak(v, path)
set(tweakedArr, i, tweakedValue)
}
const valueSn = getInternalSnapshot(tweakedValue)!
standardSn[i] = valueSn.standard
}
}
setInternalSnapshot(tweakedArr, standardSn)
interceptDisposer = intercept(tweakedArr, interceptArrayMutation.bind(undefined, tweakedArr))
observeDisposer = observe(tweakedArr, arrayDidChange)
return tweakedArr as any
}
setProposal(proposal: any) {
set(this.proposal, proposal as { [key: string]: any })
this.isProposalInitialized = proposal !== null
if (proposal && proposal.level) {
set(this.proposalLevel, proposal.level as { [key: string]: any})
}
}
async retrieveSchedule() {
const response = await getSchedule(client)({})
if (response.data.schedule) {
set(this.schedule, response.data.schedule)
}
}
@action setTaskList(stage, data) {
set(this.taskList, { [stage]: [...(this.taskList[stage] || []), data] });
}
Object.keys(group).forEach((key) => {
const found = group[key] && group[key].find(
({ dashboardCode, dashboardNamespace }) => dashboardCode === code
&& dashboardNamespace === namespace,
);
if (found) {
set(found, 'dashboardTitle', title);
set(found, 'dashboardName', name);
set(found, 'dashboardIcon', icon);
}
});
}
@action editStage(id, data) {
const stage = _.find(this.stageList, ['tempId', id]);
set(stage, { ...data });
}