Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const organizations: Reducer = (
state: OrganizationsState = initialState,
action?:
| ResourceAdd
| ResourceListGetSuccess
| { type: '' },
) => {
if (!action) {
return state;
} // Compiler needs help
// Discriminate resource related actions by resource name
if (
get(action, 'resourceName') &&
get(action, 'resourceName') !== modelName.ORGANIZATIONS
) {
return state;
}
return flow([partialRight(byId, action), partialRight(currentQuery, action)])(
state,
action,
);
};
disabled: false,
readonly: false,
hidden: false,
help: {
show: false,
content: ""
},
/* 渲染组件字段 */
widget:
fieldSchema.widget || getDefWidget(type),
widgetConfig: {
placeholder: _get(fieldSchema, "ui.placeholder", ""),
disabled: _get(fieldSchema, "ui.disabled", false),
readonly: _get(fieldSchema, "ui.readonly", false),
hidden: _get(fieldSchema, "ui.hidden", false)
}
},
rules: {}
};
if (fullFields.ui.widget === "input") {
fullFields.ui.widgetConfig.type = getInputWidgetType(fullFields.type);
}
const result = extend(true, fullFields, fieldSchema);
result.ui.widget = _kebabCase(result.ui.widget);
return result;
}
: res.data;
});
}
this.$data.prependSelectVal = _get(
this.value,
_get(this.mergeConfig, "compound.prependSelect.modelField")
);
this.$watch("prependSelectVal", function() {
let val = this._processModelVal();
this.$emit("input", val);
});
}
if (_get(this.mergeConfig, "compound.appendSelect")) {
if (_get(this.mergeConfig, "compound.appendSelect.enumSource")) {
this.$data.appendSelectOptions = _get(
this.mergeConfig,
"compound.appendSelect.enumSource"
);
} else {
this.$http({
url: _get(
this.mergeConfig,
"compound.appendSelect.enumSourceRemote.remoteUrl"
)
}).then(res => {
this.$data.appendSelectOptions = this.mergeConfig.compound
.appendSelect.enumSourceRemote.resField
? _get(
res.data,
this.mergeConfig.compound.appendSelect.enumSourceRemote
.resField
get (name) {
const path = toPath(name);
const prop = path.pop();
path.shift();
const obj = path.length === 0 ? this.data : getPath(this.data, path);
return obj[prop];
}
this.$http(options).then(res => {
this.$data.options = this.mergeConfig.enumSourceRemote.resField
? _get(res.data, this.mergeConfig.enumSourceRemote.resField)
: res.data;
if (
this.mergeConfig.enumSourceRemote.selectFirstItem &&
this.$data.options.length > 0
) {
this.$data.modelVal =
this.$data.modelVal ||
this.$data.options[0][this.mergeConfig.itemValueField];
}
this._keepSelectedItem();
});
},
if (ncformUtils.isNormalObjSchema(schema)) {
Object.keys(schema.properties).forEach(key => {
if (schema.properties && schema.properties[key]) {
valToFirstLevelProperties(
val[key],
schema.properties[key],
!parentPath ? key : `${parentPath}.${key}`
);
}
});
} else if (force || schema.value === undefined) {
schema.value = !parentPath
? value
: ncformUtils.priorityGetValue(
"basic",
_get(value, parentPath),
schema.value,
ncformUtils.smartAnalyze(schema.default),
ncformUtils.getDefVal(schema.type)
);
}
}
const itemsOfType = allItems.reduce((accumulator, item) => {
try {
const json = JSON.parse(item);
const itemType = get(json, 'type');
if (itemType && itemType === type) {
accumulator.push(json);
}
return accumulator;
} catch (e) {
return accumulator;
}
}, []);
return itemsOfType;
async newMessage(message) {
const card = await prepareData(get(message, 'data'));
await writeToStorage(card);
await this.checkExpired();
}
useEffect(() => firebase.auth().onAuthStateChanged(async (newUser) => {
if (get(newUser, 'isAnonymous')) {
const { mockClient } = await import('../__mocks__/client')
setClient(mockClient)
} else {
setClient(getApolloClient(async () => (newUser ? newUser!.getIdToken() : '')))
}
setUserLoaded(true)
setUser(newUser!)
if (newUser) {
setUserId(newUser.uid)
}
}), [])
export default function getCurrentCompiledProjectKey(state) {
return get(state.get('compiledProjects').last(), ['compiledProjectKey']);
}