UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

1,342 lines (1,297 loc) 303 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ng-zorro-antd/core/logger'), require('rxjs'), require('@angular/common'), require('date-fns/format'), require('date-fns/getISOWeek'), require('date-fns/parse')) : typeof define === 'function' && define.amd ? define('ng-zorro-antd/i18n', ['exports', '@angular/core', 'ng-zorro-antd/core/logger', 'rxjs', '@angular/common', 'date-fns/format', 'date-fns/getISOWeek', 'date-fns/parse'], factory) : (global = global || self, factory((global['ng-zorro-antd'] = global['ng-zorro-antd'] || {}, global['ng-zorro-antd'].i18n = {}), global.ng.core, global['ng-zorro-antd'].core.logger, global.rxjs, global.ng.common, global.fnsFormat, global.fnsGetISOWeek, global.fnsParse)); }(this, (function (exports, core, logger, rxjs, common, fnsFormat, fnsGetISOWeek, fnsParse) { 'use strict'; fnsFormat = fnsFormat && Object.prototype.hasOwnProperty.call(fnsFormat, 'default') ? fnsFormat['default'] : fnsFormat; fnsGetISOWeek = fnsGetISOWeek && Object.prototype.hasOwnProperty.call(fnsGetISOWeek, 'default') ? fnsGetISOWeek['default'] : fnsGetISOWeek; fnsParse = fnsParse && Object.prototype.hasOwnProperty.call(fnsParse, 'default') ? fnsParse['default'] : fnsParse; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __exportStar(m, exports) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } /** * @fileoverview added by tsickle * Generated from: languages/calendar/zh_CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ var Calendar = { today: '今天', now: '此刻', backToToday: '返回今天', ok: '确定', timeSelect: '选择时间', dateSelect: '选择日期', weekSelect: '选择周', clear: '清除', month: '月', year: '年', previousMonth: '上个月 (翻页上键)', nextMonth: '下个月 (翻页下键)', monthSelect: '选择月份', yearSelect: '选择年份', decadeSelect: '选择年代', yearFormat: 'YYYY年', dayFormat: 'D日', dateFormat: 'YYYY年M月D日', dateTimeFormat: 'YYYY年M月D日 HH时mm分ss秒', previousYear: '上一年 (Control键加左方向键)', nextYear: '下一年 (Control键加右方向键)', previousDecade: '上一年代', nextDecade: '下一年代', previousCentury: '上一世纪', nextCentury: '下一世纪' }; /** * @fileoverview added by tsickle * Generated from: languages/time-picker/zh_CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** @type {?} */ var locale = { placeholder: '请选择时间' }; /** * @fileoverview added by tsickle * Generated from: languages/date-picker/zh_CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var locale$1 = { lang: __assign({ placeholder: '请选择日期', rangePlaceholder: ['开始日期', '结束日期'] }, Calendar), timePickerLocale: __assign({}, locale) }; // should add whitespace between char in Button locale$1.lang.ok = '确 定'; /** * @fileoverview added by tsickle * Generated from: languages/pagination/zh_CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ var Pagination = { // Options.jsx items_per_page: '条/页', jump_to: '跳至', jump_to_confirm: '确定', page: '页', // Pagination.jsx prev_page: '上一页', next_page: '下一页', prev_5: '向前 5 页', next_5: '向后 5 页', prev_3: '向前 3 页', next_3: '向后 3 页' }; /** * @fileoverview added by tsickle * Generated from: languages/zh_CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var zh_CN = { locale: 'zh-cn', Pagination: Pagination, DatePicker: locale$1, TimePicker: locale, Calendar: Calendar, // locales for all comoponents global: { placeholder: '请选择' }, Table: { filterTitle: '筛选', filterConfirm: '确定', filterReset: '重置', selectAll: '全选当页', selectInvert: '反选当页', sortTitle: '排序', expand: '展开行', collapse: '关闭行' }, Modal: { okText: '确定', cancelText: '取消', justOkText: '知道了' }, Popconfirm: { cancelText: '取消', okText: '确定' }, Transfer: { searchPlaceholder: '请输入搜索内容', itemUnit: '项', itemsUnit: '项' }, Upload: { uploading: '文件上传中', removeFile: '删除文件', uploadError: '上传错误', previewFile: '预览文件', downloadFile: '下载文件' }, Empty: { description: '暂无数据' }, Icon: { icon: '图标' }, Text: { edit: '编辑', copy: '复制', copied: '复制成功', expand: '展开' }, PageHeader: { back: '返回' } }; /** * @fileoverview added by tsickle * Generated from: nz-i18n.token.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NZ_I18N = new core.InjectionToken('nz-i18n'); /** * Locale for date operations, should import from date-fns, see example: https://github.com/date-fns/date-fns/blob/v1.30.1/src/locale/zh_cn/index.js * @type {?} */ var NZ_DATE_LOCALE = new core.InjectionToken('nz-date-locale'); /** * @fileoverview added by tsickle * Generated from: nz-i18n.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzI18nService = /** @class */ (function () { function NzI18nService(locale, dateLocale) { this._change = new rxjs.BehaviorSubject(this._locale); this.setLocale(locale || zh_CN); this.setDateLocale(dateLocale || null); } Object.defineProperty(NzI18nService.prototype, "localeChange", { get: /** * @return {?} */ function () { return this._change.asObservable(); }, enumerable: true, configurable: true }); // [NOTE] Performance issue: this method may called by every change detections // TODO: cache more deeply paths for performance // [NOTE] Performance issue: this method may called by every change detections // TODO: cache more deeply paths for performance /** * @param {?} path * @param {?=} data * @return {?} */ NzI18nService.prototype.translate = // [NOTE] Performance issue: this method may called by every change detections // TODO: cache more deeply paths for performance /** * @param {?} path * @param {?=} data * @return {?} */ function (path, data) { // this._logger.debug(`[NzI18nService] Translating(${this._locale.locale}): ${path}`); /** @type {?} */ var content = (/** @type {?} */ (this._getObjectPath(this._locale, path))); if (typeof content === 'string') { if (data) { Object.keys(data).forEach((/** * @param {?} key * @return {?} */ function (key) { return (content = content.replace(new RegExp("%" + key + "%", 'g'), data[key])); })); } return content; } return path; }; /** * Set/Change current locale globally throughout the WHOLE application * NOTE: If called at runtime, rendered interface may not change along with the locale change, * because this do not trigger another render schedule. * * @param locale The translating letters */ /** * Set/Change current locale globally throughout the WHOLE application * NOTE: If called at runtime, rendered interface may not change along with the locale change, * because this do not trigger another render schedule. * * @param {?} locale The translating letters * @return {?} */ NzI18nService.prototype.setLocale = /** * Set/Change current locale globally throughout the WHOLE application * NOTE: If called at runtime, rendered interface may not change along with the locale change, * because this do not trigger another render schedule. * * @param {?} locale The translating letters * @return {?} */ function (locale) { if (this._locale && this._locale.locale === locale.locale) { return; } this._locale = locale; this._change.next(locale); }; /** * @return {?} */ NzI18nService.prototype.getLocale = /** * @return {?} */ function () { return this._locale; }; /** * @return {?} */ NzI18nService.prototype.getLocaleId = /** * @return {?} */ function () { return this._locale ? this._locale.locale : ''; }; /** * @param {?} dateLocale * @return {?} */ NzI18nService.prototype.setDateLocale = /** * @param {?} dateLocale * @return {?} */ function (dateLocale) { this.dateLocale = dateLocale; }; /** * @return {?} */ NzI18nService.prototype.getDateLocale = /** * @return {?} */ function () { return this.dateLocale; }; /** * Get locale data * @param path dot paths for finding exist value from locale data, eg. "a.b.c" * @param defaultValue default value if the result is not "truthy" */ /** * Get locale data * @param {?} path dot paths for finding exist value from locale data, eg. "a.b.c" * @param {?=} defaultValue default value if the result is not "truthy" * @return {?} */ NzI18nService.prototype.getLocaleData = /** * Get locale data * @param {?} path dot paths for finding exist value from locale data, eg. "a.b.c" * @param {?=} defaultValue default value if the result is not "truthy" * @return {?} */ function (path, defaultValue) { /** @type {?} */ var result = path ? this._getObjectPath(this._locale, path) : this._locale; if (!result && !defaultValue) { logger.warn("Missing translations for \"" + path + "\" in language \"" + this._locale.locale + "\".\nYou can use \"NzI18nService.setLocale\" as a temporary fix.\nWelcome to submit a pull request to help us optimize the translations!\nhttps://github.com/NG-ZORRO/ng-zorro-antd/blob/master/CONTRIBUTING.md"); } return result || defaultValue || {}; }; /** * @private * @param {?} obj * @param {?} path * @return {?} */ NzI18nService.prototype._getObjectPath = /** * @private * @param {?} obj * @param {?} path * @return {?} */ function (obj, path) { /** @type {?} */ var res = obj; /** @type {?} */ var paths = path.split('.'); /** @type {?} */ var depth = paths.length; /** @type {?} */ var index = 0; while (res && index < depth) { res = res[paths[index++]]; } return index === depth ? res : null; }; NzI18nService.decorators = [ { type: core.Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ NzI18nService.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [NZ_I18N,] }] }, { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [NZ_DATE_LOCALE,] }] } ]; }; /** @nocollapse */ NzI18nService.ɵprov = core.ɵɵdefineInjectable({ factory: function NzI18nService_Factory() { return new NzI18nService(core.ɵɵinject(NZ_I18N, 8), core.ɵɵinject(NZ_DATE_LOCALE, 8)); }, token: NzI18nService, providedIn: "root" }); return NzI18nService; }()); if (false) { /** * @type {?} * @private */ NzI18nService.prototype._locale; /** * @type {?} * @private */ NzI18nService.prototype._change; /** * @type {?} * @private */ NzI18nService.prototype.dateLocale; } /** * @fileoverview added by tsickle * Generated from: nz-i18n.pipe.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzI18nPipe = /** @class */ (function () { function NzI18nPipe(_locale) { this._locale = _locale; } /** * @param {?} path * @param {?=} keyValue * @return {?} */ NzI18nPipe.prototype.transform = /** * @param {?} path * @param {?=} keyValue * @return {?} */ function (path, keyValue) { return this._locale.translate(path, keyValue); }; NzI18nPipe.decorators = [ { type: core.Pipe, args: [{ name: 'nzI18n' },] } ]; /** @nocollapse */ NzI18nPipe.ctorParameters = function () { return [ { type: NzI18nService } ]; }; return NzI18nPipe; }()); if (false) { /** * @type {?} * @private */ NzI18nPipe.prototype._locale; } /** * @fileoverview added by tsickle * Generated from: nz-i18n.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzI18nModule = /** @class */ (function () { function NzI18nModule() { } NzI18nModule.decorators = [ { type: core.NgModule, args: [{ declarations: [NzI18nPipe], exports: [NzI18nPipe] },] } ]; return NzI18nModule; }()); /** * @fileoverview added by tsickle * Generated from: date-config.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function NzDateConfig() { } if (false) { /** * Customize the first day of a week * @type {?|undefined} */ NzDateConfig.prototype.firstDayOfWeek; } /** @type {?} */ var NZ_DATE_CONFIG = new core.InjectionToken('date-config'); /** @type {?} */ var NZ_DATE_CONFIG_DEFAULT = { firstDayOfWeek: undefined }; /** * @deprecated Will be removed in 10.0.0, please update to date-fns v2 format * @type {?} */ var NZ_DATE_FNS_COMPATIBLE = new core.InjectionToken('date-format-convert'); /** * @param {?} config * @return {?} */ function mergeDateConfig(config) { return __assign(__assign({}, NZ_DATE_CONFIG_DEFAULT), config); } /** * @fileoverview added by tsickle * Generated from: nz-i18n.interface.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function NzPaginationI18nInterface() { } if (false) { /** @type {?} */ NzPaginationI18nInterface.prototype.items_per_page; /** @type {?} */ NzPaginationI18nInterface.prototype.jump_to; /** @type {?} */ NzPaginationI18nInterface.prototype.jump_to_confirm; /** @type {?} */ NzPaginationI18nInterface.prototype.page; /** @type {?} */ NzPaginationI18nInterface.prototype.prev_page; /** @type {?} */ NzPaginationI18nInterface.prototype.next_page; /** @type {?} */ NzPaginationI18nInterface.prototype.prev_5; /** @type {?} */ NzPaginationI18nInterface.prototype.next_5; /** @type {?} */ NzPaginationI18nInterface.prototype.prev_3; /** @type {?} */ NzPaginationI18nInterface.prototype.next_3; } /** * @record */ function NzGlobalI18nInterface() { } if (false) { /** @type {?} */ NzGlobalI18nInterface.prototype.placeholder; } /** * @record */ function NzDatePickerI18nInterface() { } if (false) { /** @type {?} */ NzDatePickerI18nInterface.prototype.lang; /** @type {?} */ NzDatePickerI18nInterface.prototype.timePickerLocale; } /** * @record */ function NzCalendarI18nInterface() { } if (false) { /** @type {?} */ NzCalendarI18nInterface.prototype.today; /** @type {?} */ NzCalendarI18nInterface.prototype.now; /** @type {?} */ NzCalendarI18nInterface.prototype.backToToday; /** @type {?} */ NzCalendarI18nInterface.prototype.ok; /** @type {?} */ NzCalendarI18nInterface.prototype.clear; /** @type {?} */ NzCalendarI18nInterface.prototype.month; /** @type {?} */ NzCalendarI18nInterface.prototype.year; /** @type {?} */ NzCalendarI18nInterface.prototype.timeSelect; /** @type {?} */ NzCalendarI18nInterface.prototype.dateSelect; /** @type {?} */ NzCalendarI18nInterface.prototype.monthSelect; /** @type {?} */ NzCalendarI18nInterface.prototype.yearSelect; /** @type {?} */ NzCalendarI18nInterface.prototype.decadeSelect; /** @type {?} */ NzCalendarI18nInterface.prototype.yearFormat; /** @type {?|undefined} */ NzCalendarI18nInterface.prototype.monthFormat; /** @type {?} */ NzCalendarI18nInterface.prototype.dateFormat; /** @type {?} */ NzCalendarI18nInterface.prototype.dayFormat; /** @type {?} */ NzCalendarI18nInterface.prototype.dateTimeFormat; /** @type {?|undefined} */ NzCalendarI18nInterface.prototype.monthBeforeYear; /** @type {?} */ NzCalendarI18nInterface.prototype.previousMonth; /** @type {?} */ NzCalendarI18nInterface.prototype.nextMonth; /** @type {?} */ NzCalendarI18nInterface.prototype.previousYear; /** @type {?} */ NzCalendarI18nInterface.prototype.nextYear; /** @type {?} */ NzCalendarI18nInterface.prototype.previousDecade; /** @type {?} */ NzCalendarI18nInterface.prototype.nextDecade; /** @type {?} */ NzCalendarI18nInterface.prototype.previousCentury; /** @type {?} */ NzCalendarI18nInterface.prototype.nextCentury; } /** * @record */ function NzDatePickerLangI18nInterface() { } if (false) { /** @type {?} */ NzDatePickerLangI18nInterface.prototype.placeholder; /** @type {?} */ NzDatePickerLangI18nInterface.prototype.rangePlaceholder; } /** * @record */ function NzTimePickerI18nInterface() { } if (false) { /** @type {?} */ NzTimePickerI18nInterface.prototype.placeholder; } /** * @record */ function NzI18nInterface() { } if (false) { /** @type {?} */ NzI18nInterface.prototype.locale; /** @type {?} */ NzI18nInterface.prototype.Pagination; /** @type {?} */ NzI18nInterface.prototype.DatePicker; /** @type {?} */ NzI18nInterface.prototype.TimePicker; /** @type {?} */ NzI18nInterface.prototype.Calendar; /** @type {?|undefined} */ NzI18nInterface.prototype.global; /** @type {?} */ NzI18nInterface.prototype.Table; /** @type {?} */ NzI18nInterface.prototype.Modal; /** @type {?} */ NzI18nInterface.prototype.Popconfirm; /** @type {?} */ NzI18nInterface.prototype.Transfer; /** @type {?} */ NzI18nInterface.prototype.Upload; /** @type {?} */ NzI18nInterface.prototype.Empty; /** @type {?|undefined} */ NzI18nInterface.prototype.Text; } /** * @fileoverview added by tsickle * Generated from: convert-tokens.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function TokensMap() { } /** @type {?} */ var tokensMap = { M: 'L', Mo: 'Mo', MM: 'LL', MMM: 'LLL', MMMM: 'LLLL', Q: 'q', Qo: 'qo', D: 'd', Do: 'do', DD: 'dd', DDD: 'D', DDDo: 'Do', DDDD: 'DDD', d: 'i', do: 'io', dd: 'iiiiii', ddd: 'iii', dddd: 'iiii', A: 'a', a: 'a', aa: 'aaaa', E: 'i', W: 'I', Wo: 'Io', WW: 'II', YY: 'yy', YYYY: 'yyyy', GG: 'RR', GGGG: 'RRRR', H: 'H', HH: 'HH', h: 'h', hh: 'hh', m: 'm', mm: 'mm', s: 's', ss: 'ss', S: 'S', SS: 'SS', SSS: 'SSS', Z: 'xxx', ZZ: 'xx', X: 't', x: 'T' }; /** @type {?} */ var v1tokens = Object.keys(tokensMap) .sort() .reverse(); // tslint:disable-next-line:prefer-template /** @type {?} */ var tokensRegExp = new RegExp('(\\[[^\\[]*\\])|(\\\\)?' + '(' + v1tokens.join('|') + '|.)', 'g'); /** * @record */ function TokensBuffer() { } if (false) { /** @type {?} */ TokensBuffer.prototype.formatBuffer; /** @type {?} */ TokensBuffer.prototype.textBuffer; } /** * @param {?} format * @return {?} */ function convertTokens(format) { logger.warnDeprecation("'NZ_DATE_FNS_COMPATIBLE' will be removed in 10.0.0, please update to date-fns v2 format."); /** @type {?} */ var tokensCaptures = format.match(tokensRegExp); if (tokensCaptures) { return tokensCaptures .reduce((/** * @param {?} acc * @param {?} tokenString * @param {?} index * @return {?} */ function (acc, tokenString, index) { /** @type {?} */ var v2token = tokensMap[tokenString]; if (!v2token) { /** @type {?} */ var escapedCaptures = tokenString.match(/^\[(.+)\]$/); if (escapedCaptures) { acc.textBuffer.push(escapedCaptures[1]); } else { acc.textBuffer.push(tokenString); } } /** @type {?} */ var endOfString = index === tokensCaptures.length - 1; if (acc.textBuffer.length && (v2token || endOfString)) { acc.formatBuffer.push("'" + acc.textBuffer.join('') + "'"); acc.textBuffer = []; } if (v2token) { acc.formatBuffer.push(v2token); } return acc; }), (/** @type {?} */ ({ formatBuffer: [], textBuffer: [] }))) .formatBuffer.join(''); } else { return format; } } /** * @fileoverview added by tsickle * Generated from: date-helper.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} injector * @param {?} config * @param {?} convertFormat * @return {?} */ function DATE_HELPER_SERVICE_FACTORY(injector, config, convertFormat) { /** @type {?} */ var i18n = injector.get(NzI18nService); return i18n.getDateLocale() ? new DateHelperByDateFns(i18n, config, convertFormat) : new DateHelperByDatePipe(i18n, config, convertFormat); } /** * Abstract DateHelperService(Token via Class) * Compatibility: compact for original usage by default which using DatePipe * @abstract */ var DateHelperService = /** @class */ (function () { function DateHelperService(i18n, config, convertFormat) { this.i18n = i18n; this.config = config; this.convertFormat = convertFormat; this.config = mergeDateConfig(this.config); } DateHelperService.decorators = [ { type: core.Injectable, args: [{ providedIn: 'root', useFactory: DATE_HELPER_SERVICE_FACTORY, deps: [core.Injector, [new core.Optional(), NZ_DATE_CONFIG], [new core.Optional(), NZ_DATE_FNS_COMPATIBLE]] },] } ]; /** @nocollapse */ DateHelperService.ctorParameters = function () { return [ { type: NzI18nService }, { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [NZ_DATE_CONFIG,] }] }, { type: Boolean, decorators: [{ type: core.Optional }, { type: core.Inject, args: [NZ_DATE_FNS_COMPATIBLE,] }] } ]; }; /** @nocollapse */ DateHelperService.ɵprov = core.ɵɵdefineInjectable({ factory: function DateHelperService_Factory() { return DATE_HELPER_SERVICE_FACTORY(core.ɵɵinject(core.INJECTOR), core.ɵɵinject(NZ_DATE_CONFIG, 8), core.ɵɵinject(NZ_DATE_FNS_COMPATIBLE, 8)); }, token: DateHelperService, providedIn: "root" }); return DateHelperService; }()); if (false) { /** * @type {?} * @protected */ DateHelperService.prototype.i18n; /** * @type {?} * @protected */ DateHelperService.prototype.config; /** * @type {?} * @protected */ DateHelperService.prototype.convertFormat; /** * @abstract * @param {?} date * @return {?} */ DateHelperService.prototype.getISOWeek = function (date) { }; /** * @abstract * @return {?} */ DateHelperService.prototype.getFirstDayOfWeek = function () { }; /** * @abstract * @param {?} date * @param {?} formatStr * @return {?} */ DateHelperService.prototype.format = function (date, formatStr) { }; /** * @abstract * @param {?} text * @param {?=} formatStr * @return {?} */ DateHelperService.prototype.parseDate = function (text, formatStr) { }; /** * @abstract * @param {?} text * @param {?=} formatStr * @return {?} */ DateHelperService.prototype.parseTime = function (text, formatStr) { }; } /** * DateHelper that handles date formats with date-fns */ var DateHelperByDateFns = /** @class */ (function (_super) { __extends(DateHelperByDateFns, _super); function DateHelperByDateFns() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} date * @return {?} */ DateHelperByDateFns.prototype.getISOWeek = /** * @param {?} date * @return {?} */ function (date) { return fnsGetISOWeek(date); }; // Use date-fns's "weekStartsOn" to support different locale when "config.firstDayOfWeek" is null // https://github.com/date-fns/date-fns/blob/v2.0.0-alpha.27/src/locale/en-US/index.js#L23 // Use date-fns's "weekStartsOn" to support different locale when "config.firstDayOfWeek" is null // https://github.com/date-fns/date-fns/blob/v2.0.0-alpha.27/src/locale/en-US/index.js#L23 /** * @return {?} */ DateHelperByDateFns.prototype.getFirstDayOfWeek = // Use date-fns's "weekStartsOn" to support different locale when "config.firstDayOfWeek" is null // https://github.com/date-fns/date-fns/blob/v2.0.0-alpha.27/src/locale/en-US/index.js#L23 /** * @return {?} */ function () { /** @type {?} */ var defaultWeekStartsOn; try { defaultWeekStartsOn = (/** @type {?} */ ((/** @type {?} */ (this.i18n.getDateLocale().options)).weekStartsOn)); } catch (e) { defaultWeekStartsOn = 1; } return this.config.firstDayOfWeek == null ? defaultWeekStartsOn : this.config.firstDayOfWeek; }; /** * Format a date * @see https://date-fns.org/docs/format#description * @param date Date * @param formatStr format string */ /** * Format a date * @see https://date-fns.org/docs/format#description * @param {?} date Date * @param {?} formatStr format string * @return {?} */ DateHelperByDateFns.prototype.format = /** * Format a date * @see https://date-fns.org/docs/format#description * @param {?} date Date * @param {?} formatStr format string * @return {?} */ function (date, formatStr) { /** @type {?} */ var mergedStr = this.convertFormat ? convertTokens(formatStr) : formatStr; return date ? fnsFormat(date, mergedStr, { locale: this.i18n.getDateLocale() }) : ''; }; /** * @param {?} text * @param {?} formatStr * @return {?} */ DateHelperByDateFns.prototype.parseDate = /** * @param {?} text * @param {?} formatStr * @return {?} */ function (text, formatStr) { /** @type {?} */ var mergedStr = this.convertFormat ? convertTokens(formatStr) : formatStr; return fnsParse(text, mergedStr, new Date(), { locale: this.i18n.getDateLocale(), weekStartsOn: this.getFirstDayOfWeek() }); }; /** * @param {?} text * @param {?} formatStr * @return {?} */ DateHelperByDateFns.prototype.parseTime = /** * @param {?} text * @param {?} formatStr * @return {?} */ function (text, formatStr) { return this.parseDate(text, formatStr); }; /** @nocollapse */ DateHelperByDateFns.ɵprov = core.ɵɵdefineInjectable({ factory: function DateHelperByDateFns_Factory() { return DATE_HELPER_SERVICE_FACTORY(core.ɵɵinject(core.INJECTOR), core.ɵɵinject(NZ_DATE_CONFIG, 8), core.ɵɵinject(NZ_DATE_FNS_COMPATIBLE, 8)); }, token: DateHelperByDateFns, providedIn: "root" }); return DateHelperByDateFns; }(DateHelperService)); /** * DateHelper that handles date formats with angular's date-pipe * * @see https://github.com/NG-ZORRO/ng-zorro-antd/issues/2406 - DatePipe may cause non-standard week bug, see: * */ var DateHelperByDatePipe = /** @class */ (function (_super) { __extends(DateHelperByDatePipe, _super); function DateHelperByDatePipe() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} date * @return {?} */ DateHelperByDatePipe.prototype.getISOWeek = /** * @param {?} date * @return {?} */ function (date) { return +this.format(date, 'w'); }; /** * @return {?} */ DateHelperByDatePipe.prototype.getFirstDayOfWeek = /** * @return {?} */ function () { if (this.config.firstDayOfWeek === undefined) { /** @type {?} */ var locale = this.i18n.getLocaleId(); return locale && ['zh-cn', 'zh-tw'].indexOf(locale.toLowerCase()) > -1 ? 1 : 0; } return this.config.firstDayOfWeek; }; /** * @param {?} date * @param {?} formatStr * @return {?} */ DateHelperByDatePipe.prototype.format = /** * @param {?} date * @param {?} formatStr * @return {?} */ function (date, formatStr) { return date ? (/** @type {?} */ (common.formatDate(date, formatStr, this.i18n.getLocaleId()))) : ''; }; /** * @param {?} text * @return {?} */ DateHelperByDatePipe.prototype.parseDate = /** * @param {?} text * @return {?} */ function (text) { return new Date(text); }; /** * @param {?} text * @return {?} */ DateHelperByDatePipe.prototype.parseTime = /** * @param {?} text * @return {?} */ function (text) { if (!text) { return; } return new Date(Date.parse("1970-01-01 " + text)); }; /** @nocollapse */ DateHelperByDatePipe.ɵprov = core.ɵɵdefineInjectable({ factory: function DateHelperByDatePipe_Factory() { return DATE_HELPER_SERVICE_FACTORY(core.ɵɵinject(core.INJECTOR), core.ɵɵinject(NZ_DATE_CONFIG, 8), core.ɵɵinject(NZ_DATE_FNS_COMPATIBLE, 8)); }, token: DateHelperByDatePipe, providedIn: "root" }); return DateHelperByDatePipe; }(DateHelperService)); /** * @fileoverview added by tsickle * Generated from: languages/calendar/ar_EG.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ var Calendar$1 = { today: 'اليوم', now: 'الأن', backToToday: 'العودة إلى اليوم', ok: 'تأكيد', clear: 'مسح', month: 'الشهر', year: 'السنة', timeSelect: 'اختيار الوقت', dateSelect: 'اختيار التاريخ', monthSelect: 'اختيار الشهر', yearSelect: 'اختيار السنة', decadeSelect: 'اختيار العقد', yearFormat: 'YYYY', dateFormat: 'M/D/YYYY', dayFormat: 'D', dateTimeFormat: 'M/D/YYYY HH:mm:ss', monthBeforeYear: true, previousMonth: 'الشهر السابق (PageUp)', nextMonth: 'الشهر التالى(PageDown)', previousYear: 'العام السابق (Control + left)', nextYear: 'العام التالى (Control + right)', previousDecade: 'العقد السابق', nextDecade: 'العقد التالى', previousCentury: 'القرن السابق', nextCentury: 'القرن التالى' }; /** * @fileoverview added by tsickle * Generated from: languages/time-picker/ar_EG.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** @type {?} */ var locale$2 = { placeholder: 'اختيار الوقت' }; /** * @fileoverview added by tsickle * Generated from: languages/date-picker/ar_EG.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Merge into a locale object /** @type {?} */ var locale$3 = { lang: __assign({ placeholder: 'اختيار التاريخ', rangePlaceholder: ['البداية', 'النهاية'] }, Calendar$1), timePickerLocale: __assign({}, locale$2), dateFormat: 'DD-MM-YYYY', monthFormat: 'MM-YYYY', dateTimeFormat: 'DD-MM-YYYY HH:mm:ss', weekFormat: 'wo-YYYY' }; /** * @fileoverview added by tsickle * Generated from: languages/pagination/ar_EG.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Alibaba.com All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ var Pagination$1 = { // Options.jsx items_per_page: '/ الصفحة', jump_to: 'الذهاب إلى', jump_to_confirm: 'تأكيد', page: '', // Pagination.jsx prev_page: 'الصفحة السابقة', next_page: 'الصفحة التالية',