Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
confirm(options: ModalOptionsForService = {}, confirmType: ConfirmType = 'confirm'): NzModalRef {
if ('nzFooter' in options) {
warn(`The Confirm-Modal doesn't support "nzFooter", this property will be ignored.`);
}
if (!('nzWidth' in options)) {
options.nzWidth = 416;
}
if (!('nzMaskClosable' in options)) {
options.nzMaskClosable = false;
}
if (typeof options.nzOnOk !== 'function') {
// NOTE: only support function currently by calling confirm()
options.nzOnOk = () => {}; // Leave a empty function to close this modal by default
}
options.nzModalType = 'confirm';
options.nzClassName = `ant-modal-confirm ant-modal-confirm-${confirmType} ${options.nzClassName || ''}`;
return this.create(options);
}
currentRow = [];
width = 0;
};
for (let i = 0; i < length; i++) {
const item = items[i];
const { nzTitle: title, content, nzSpan: span } = item;
width += span;
// If the last item make the row's length exceeds `nzColumn`, the last
// item should take all the space left. This logic is implemented in the template.
// Warn user about that.
if (width >= column) {
if (width > column) {
warn(`"nzColumn" is ${column} but we have row length ${width}`);
}
currentRow.push({ title, content, span: column - (width - span) });
flushRow();
} else if (i === length - 1) {
currentRow.push({ title, content, span: column - (width - span) });
flushRow();
} else {
currentRow.push({ title, content, span });
}
}
this.itemMatrix = matrix;
}
requestToInit(): Observable {
if (this.loadingStatus === NzCodeEditorLoadingStatus.LOADED) {
this.onInit();
return observableOf(this.getLatestOption());
}
if (this.loadingStatus === NzCodeEditorLoadingStatus.UNLOAD) {
if (this.config.useStaticLoading && typeof monaco === 'undefined') {
warn(
'You choose to use static loading but it seems that you forget ' +
'to config webpack plugin correctly. Please refer to our official website' +
'for more details about static loading.'
);
} else {
this.loadMonacoScript();
}
}
return this.loaded$.asObservable().pipe(
tap(() => this.onInit()),
map(() => this.getLatestOption())
);
}
e => {
warn(`Unhandled upload filter error`, e);
}
);
private setValue(): void {
if (!this.editorInstance) {
return;
}
if (this.nzFullControl && this.value) {
warn(`should not set value when you are using full control mode! It would result in ambiguous data flow!`);
return;
}
if (this.nzEditorMode === 'normal') {
if (this.modelSet) {
(this.editorInstance.getModel() as ITextModel).setValue(this.value);
} else {
(this.editorInstance as IEditor).setModel(
monaco.editor.createModel(this.value, (this.editorOptionCached as EditorOptions).language)
);
this.modelSet = true;
}
} else {
if (this.modelSet) {
const model = (this.editorInstance as IDiffEditor).getModel()!;
model.modified.setValue(this.value);
getLocaleData(path: string, defaultValue?: any): any {
const result = path ? this._getObjectPath(this._locale, path) : this._locale;
if (!result && !defaultValue) {
warn(`Missing translations for "${path}" in language "${this._locale.locale}".
You can use "NzI18nService.setLocale" as a temporary fix.
Welcome to submit a pull request to help us optimize the translations!
https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md`);
}
return result || defaultValue || {};
}
private configDefaultTwotoneColor(): void {
const iconConfig = this.getConfig();
const defaultTwotoneColor = iconConfig.nzTwotoneColor || this.legacyDefaultTwotoneColor;
let primaryColor = DEFAULT_TWOTONE_COLOR;
if (defaultTwotoneColor) {
if (defaultTwotoneColor.startsWith('#')) {
primaryColor = defaultTwotoneColor;
} else {
warn('Twotone color must be a hex color!');
}
}
this.twoToneColor = { primaryColor };
}