ngwr 15.2.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/styles/_index.scss +13 -5
- package/bits/border-glow/styles/_rules.scss +60 -49
- package/bits/click-spark/click-spark.scss +5 -1
- package/bits/click-spark/styles/_index.scss +10 -15
- package/bits/click-spark/styles/_rules.scss +20 -0
- package/fesm2022/ngwr-alert.mjs +2 -2
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-bits-aurora.mjs +108 -52
- package/fesm2022/ngwr-bits-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-bits-border-glow-testing.mjs +8 -8
- package/fesm2022/ngwr-bits-border-glow-testing.mjs.map +1 -1
- package/fesm2022/ngwr-bits-border-glow.mjs +29 -26
- package/fesm2022/ngwr-bits-border-glow.mjs.map +1 -1
- package/fesm2022/ngwr-bits-dot-grid.mjs +11 -14
- package/fesm2022/ngwr-bits-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-bits-fuzzy-text.mjs +18 -4
- package/fesm2022/ngwr-bits-fuzzy-text.mjs.map +1 -1
- package/fesm2022/ngwr-bits-ripple-grid.mjs +14 -13
- package/fesm2022/ngwr-bits-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-bits-splash-cursor.mjs +21 -10
- package/fesm2022/ngwr-bits-splash-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-bits-waves.mjs +10 -15
- package/fesm2022/ngwr-bits-waves.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +18 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +23 -1
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +2 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +2 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +2 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +2 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +2 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +2 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +2 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +2 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +2 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +2 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +2 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +2 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +2 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +2 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +2 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +2 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +2 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +2 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +2 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +2 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +2 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +3 -0
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +163 -49
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +3 -0
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-select-testing.mjs +16 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +218 -38
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +20 -21
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/i18n/ar.json +2 -0
- package/i18n/cs.json +2 -0
- package/i18n/de.json +2 -0
- package/i18n/en.json +2 -0
- package/i18n/es.json +2 -0
- package/i18n/fr.json +2 -0
- package/i18n/he.json +2 -0
- package/i18n/hi.json +2 -0
- package/i18n/id.json +2 -0
- package/i18n/it.json +2 -0
- package/i18n/ja.json +2 -0
- package/i18n/ko.json +2 -0
- package/i18n/nl.json +2 -0
- package/i18n/pl.json +2 -0
- package/i18n/pt.json +2 -0
- package/i18n/ru.json +2 -0
- package/i18n/sv.json +2 -0
- package/i18n/tr.json +2 -0
- package/i18n/uk.json +2 -0
- package/i18n/vi.json +2 -0
- package/i18n/zh-TW.json +2 -0
- package/i18n/zh.json +2 -0
- package/llms-full.txt +5 -5
- package/package.json +1 -1
- package/schematics/use/symbol-map.json +2 -0
- package/select/styles/_index.scss +23 -1
- package/skills/ngwr/SKILL.md +3 -1
- package/skills/ngwr/references/catalog.md +1 -1
- package/types/ngwr-alert.d.ts +3 -1
- package/types/ngwr-bits-aurora.d.ts +24 -2
- package/types/ngwr-bits-border-glow-testing.d.ts +9 -5
- package/types/ngwr-bits-border-glow.d.ts +10 -4
- package/types/ngwr-bits-fuzzy-text.d.ts +2 -1
- package/types/ngwr-bits-ripple-grid.d.ts +7 -2
- package/types/ngwr-bits-splash-cursor.d.ts +2 -1
- package/types/ngwr-breadcrumbs.d.ts +15 -0
- package/types/ngwr-hotkey.d.ts +14 -2
- package/types/ngwr-pipes.d.ts +142 -32
- package/types/ngwr-select-testing.d.ts +9 -0
- package/types/ngwr-select.d.ts +133 -2
- package/types/ngwr-sidebar.d.ts +1 -1
- package/types/ngwr-version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-i18n-zh.mjs","names":[],"sources":["../../../projects/lib/i18n/zh/public-api.ts"],"sourcesContent":["import { type WrI18nCatalog } from 'ngwr/i18n';\n\n/** Base Simplified Chinese catalog for ngwr built-in component strings. */\nexport const wrZh: WrI18nCatalog = {\n common: {\n ok: '确定',\n cancel: '取消',\n close: '关闭',\n confirm: '确认',\n delete: '删除',\n save: '保存',\n edit: '编辑',\n add: '添加',\n remove: '移除',\n clear: '清除',\n search: '搜索',\n loading: '加载中…',\n select: '选择',\n next: '下一步',\n previous: '上一步',\n back: '返回',\n today: '今天',\n yesterday: '昨天',\n tomorrow: '明天',\n of: '共',\n },\n pagination: {\n prev: '上一页',\n next: '下一页',\n itemsPerPage: '每页条数',\n perPage: '{{size}} 条/页',\n goToPage: '跳转到第 {{page}} 页',\n label: '分页',\n pageOf: '第 {{current}} 页,共 {{total}} 页',\n range: '{{from}}–{{to}},共 {{total}} 条',\n compact: '{{current}} / {{total}}',\n },\n table: {\n empty: '暂无数据',\n loading: '加载中…',\n sort: '对{{column}}列排序',\n filter: '筛选{{column}}列',\n selectAll: '选择所有行',\n selectRow: '选择行',\n expandRow: '展开或收起行详情',\n toggleRow: '展开或收起子行',\n selectGroup: '选择分组',\n toggleGroup: '展开或收起分组',\n noMatches: '无匹配结果',\n search: '搜索',\n reset: '重置',\n },\n eventCalendar: {\n today: '今天',\n previous: '上一个',\n next: '下一个',\n month: '月',\n week: '周',\n day: '日',\n time: '时间',\n allDay: '全天',\n label: '日历',\n more: '+{{count}} 项',\n header: '{{year}}年{{month}}',\n range: '{{from}} – {{to}}',\n chipLabel: '{{title}},{{time}}',\n slotLabel: '{{date}} {{time}}',\n allDayCellLabel: '{{date}} {{label}}',\n },\n tour: {\n next: '下一步',\n back: '上一步',\n done: '完成',\n skip: '跳过引导',\n progress: '第 {{current}} 步,共 {{total}} 步',\n },\n splitter: {\n divider: '调整面板大小',\n },\n stepper: {\n optional: '可选',\n completed: '已完成',\n },\n transfer: {\n source: '待选',\n target: '已选',\n search: '搜索',\n empty: '暂无内容',\n selectAll: '全选',\n toTarget: '移至已选',\n toSource: '移回待选',\n count: '{{checked}} / {{total}}',\n selectAllAria: '{{pane}} — {{action}}',\n },\n form: {\n optional: '选填',\n },\n select: {\n label: '选择',\n placeholder: '请选择',\n empty: '暂无选项',\n clearSelection: '清除选择',\n removeItem: '移除 {{label}}',\n noResults: '无搜索结果',\n loading: '加载中…',\n more: '+{{count}} 项',\n },\n tree: {\n expand: '展开',\n collapse: '收起',\n placeholder: '请选择',\n clearSelection: '清除选择',\n removeItem: '移除 {{label}}',\n more: '+{{count}} 项',\n },\n commandPalette: {\n label: '命令面板',\n placeholder: '输入命令或搜索…',\n noResults: '无搜索结果',\n loading: '搜索中…',\n escHint: 'esc',\n },\n empty: {\n noData: '暂无数据',\n },\n fileUpload: {\n browse: '点击选择文件',\n dropZone: '或将文件拖放到此处',\n removeFile: '移除文件',\n invalid: '不支持的文件类型',\n tooBig: '文件过大',\n size: '{{value}} {{unit}}',\n unitByte: 'B',\n unitKb: 'KB',\n unitMb: 'MB',\n unitGb: 'GB',\n unitTb: 'TB',\n },\n popconfirm: {\n label: '确认操作',\n confirm: '确认',\n cancel: '取消',\n },\n toast: {\n region: '通知',\n close: '关闭',\n copy: '复制',\n copied: '已复制',\n closeAll: '全部关闭',\n },\n input: {\n showPassword: '显示密码',\n hidePassword: '隐藏密码',\n },\n inputNumber: {\n increment: '增加',\n decrement: '减少',\n },\n inputOtp: {\n label: '验证码',\n digit: '第 {{index}} 位数字',\n character: '第 {{index}} 个字符',\n },\n anchor: {\n label: '目录',\n },\n avatar: {\n alt: '头像',\n },\n backTop: {\n label: '返回顶部',\n },\n breadcrumbs: {\n label: '面包屑导航',\n },\n burger: {\n label: '打开或关闭菜单',\n },\n calendar: {\n prevMonth: '上个月',\n nextMonth: '下个月',\n prevYear: '上一年',\n nextYear: '下一年',\n monthList: '月份',\n yearList: '年份',\n prevYears: '前 12 年',\n nextYears: '后 12 年',\n header: '{{year}}年{{month}}',\n yearRange: '{{from}} – {{to}}',\n dayLabel: '{{date}} {{weekday}}',\n },\n imageCropper: {\n empty: '暂无图片',\n window: '裁剪区域',\n keyHelp:\n '方向键移动裁剪框。按住 Alt 加方向键可调整大小,按住 Shift 可加大步长。' +\n '裁剪框会以图像像素为单位,依次朗读左、上、宽、高四个值。',\n },\n sortableList: {\n keyHelp: '按空格键拿起此项,然后用方向键移动。再次按空格键放下,或按 Esc 键放回原位。',\n grabbed: '已拿起。第 {{index}} 项,共 {{total}} 项。',\n moved: '第 {{index}} 项,共 {{total}} 项。',\n dropped: '已放下。第 {{index}} 项,共 {{total}} 项。',\n cancelled: '已取消移动。',\n },\n colorPicker: {\n area: '饱和度 {{saturation}}%,明度 {{brightness}}%',\n hue: '色相',\n alpha: '不透明度',\n formatHex: 'HEX',\n formatRgb: 'RGB',\n formatHsl: 'HSL',\n channelHex: 'HEX',\n channelRed: 'R',\n channelGreen: 'G',\n channelBlue: 'B',\n channelHue: 'H',\n channelSaturation: 'S%',\n channelLightness: 'L%',\n channelAlpha: 'A%',\n },\n barChart: {\n label: '柱状图',\n total: '合计',\n value: '值',\n datum: '{{label}}: {{value}}',\n },\n calendarHeatmap: {\n label: '日历热力图',\n cell: '{{date}}: {{count}}',\n },\n lineChart: {\n label: '折线图',\n areaLabel: '面积图',\n },\n donutChart: {\n label: '环形图',\n pieLabel: '饼图',\n },\n chartLegend: {\n toggleLabel: '切换系列显示',\n hidden: '已隐藏',\n },\n scatterChart: {\n label: '散点图',\n x: 'X',\n y: 'Y',\n size: '大小',\n },\n radarChart: {\n label: '雷达图',\n polarAreaLabel: '极坐标面积图',\n },\n heatmapChart: {\n label: '热力图',\n noData: '无数据',\n },\n funnelChart: {\n label: '漏斗图',\n stage: '阶段',\n value: '值',\n fromPrevious: '较上一阶段',\n fromFirst: '较第一阶段',\n ofPrevious: '上一阶段的 {{percent}}',\n ofFirst: '第一阶段的 {{percent}}',\n stageName: '{{label}}: {{value}}',\n stageNameOne: '{{label}}: {{value}},{{conversion}}',\n stageNameBoth: '{{label}}: {{value}},{{previous}},{{first}}',\n },\n waterfallChart: {\n label: '瀑布图',\n step: '步骤',\n change: '变化',\n runningTotal: '累计',\n changeStep: '{{label}}: {{change}},累计 {{total}}',\n totalStep: '{{label}}: 合计 {{total}}',\n },\n treemapChart: {\n label: '矩形树图',\n value: '值',\n share: '占比',\n },\n bulletChart: {\n label: '子弹图',\n target: '目标',\n summary: '{{label}}: {{value}},目标 {{target}}',\n summaryNoTarget: '{{label}}: {{value}}',\n summaryNoValue: '{{label}}: 无值,目标 {{target}}',\n noValue: '{{label}}: 无值',\n },\n boxplotChart: {\n label: '箱线图',\n group: '分组',\n upperWhisker: '上须',\n q3: 'Q3',\n median: '中位数',\n q1: 'Q1',\n lowerWhisker: '下须',\n outliers: '异常值',\n moreOutliers: '另有 {{count}} 个',\n },\n candlestickChart: {\n label: 'K 线图',\n open: '开盘',\n high: '最高',\n low: '最低',\n close: '收盘',\n },\n compare: {\n label: '对比分隔条',\n },\n carousel: {\n label: '轮播图',\n goToSlide: '转到第 {{index}} 张幻灯片',\n prev: '上一张幻灯片',\n next: '下一张幻灯片',\n pagination: '轮播分页',\n roledescription: '轮播图',\n slideRoledescription: '幻灯片',\n },\n alert: {\n close: '关闭提示',\n },\n qr: {\n label: '二维码',\n },\n image: {\n viewer: '图片预览',\n open: '打开预览',\n close: '关闭预览',\n },\n window: {\n close: '关闭',\n minimize: '最小化',\n maximize: '最大化',\n restore: '还原',\n restoreDown: '向下还原',\n restoreWindow: '还原 {{title}}',\n closeWindow: '关闭窗口',\n untitled: '无标题',\n taskbar: '已最小化的窗口',\n taskbarAll: '已打开的窗口',\n taskbarMore: '其他窗口: {{count}}',\n moveMode: '正在移动窗口。使用方向键移动,按 Enter 键完成,按 Esc 键取消。',\n resizeMode: '正在调整窗口大小。使用方向键调整,按 Enter 键完成,按 Esc 键取消。',\n moved: '窗口已移动到 {{x}},{{y}}',\n resized: '窗口大小已调整为宽 {{width}}、高 {{height}}',\n },\n dialog: {\n close: '关闭对话框',\n },\n popover: {\n label: '弹出面板',\n },\n editor: {\n label: '富文本',\n toolbar: '格式',\n bold: '加粗',\n italic: '斜体',\n underline: '下划线',\n strike: '删除线',\n code: '行内代码',\n paragraph: '正文',\n heading: '标题 {{level}}',\n bulletList: '项目符号列表',\n orderedList: '编号列表',\n blockquote: '引用',\n codeBlock: '代码块',\n link: '插入链接',\n horizontalRule: '水平线',\n undo: '撤销',\n redo: '重做',\n linkUrl: '链接地址',\n linkApply: '应用',\n linkRemove: '移除链接',\n linkInvalid: '此地址不能用作链接。',\n shortcut: '{{label}}({{keys}})',\n keyCtrl: 'Ctrl',\n keyShift: 'Shift',\n keyAlt: 'Alt',\n taskDone: '已完成:',\n taskTodo: '待办:',\n },\n marquee: {\n label: '跑马灯',\n link: '链接',\n },\n mention: {\n listbox: '提及',\n available: '匹配项:{{count}}',\n inserted: '已插入:{{label}}',\n },\n drawer: {\n close: '关闭抽屉',\n },\n datePicker: {\n open: '打开日历',\n openTime: '打开时间选择器',\n openDateTime: '打开日期时间选择器',\n openRange: '打开日期范围日历',\n panel: '选择日期',\n panelTime: '选择时间',\n panelDateTime: '选择日期和时间',\n panelRange: '选择日期范围',\n panelRangeDateTime: '选择日期和时间范围',\n rangeStart: '起始日期',\n rangeEnd: '结束日期',\n startTime: '开始时间',\n endTime: '结束时间',\n hours: '小时',\n minutes: '分钟',\n seconds: '秒',\n incrementHours: '增加小时',\n decrementHours: '减少小时',\n incrementMinutes: '增加分钟',\n decrementMinutes: '减少分钟',\n incrementSeconds: '增加秒',\n decrementSeconds: '减少秒',\n toggleAmPm: '切换上午/下午',\n am: '上午',\n pm: '下午',\n },\n sidebar: {\n label: '侧边栏',\n containsCurrent: '包含当前页面',\n subpages: '{{title}} 的子页面',\n separator: ',',\n },\n spinner: {\n label: '加载中',\n },\n rating: {\n label: '评分',\n },\n gauge: {\n label: '仪表盘',\n },\n graph: {\n label: '图',\n parents: '父节点:{{names}}。',\n children: '子节点:{{names}}。',\n },\n progress: {\n label: '进度',\n },\n meterGroup: {\n label: '计量条',\n },\n knob: {\n label: '数值',\n },\n slider: {\n label: '数值',\n lower: '下限值',\n upper: '上限值',\n },\n speedDial: {\n label: '操作',\n },\n statistic: {\n delta: '{{value}}{{suffix}}',\n deltaSuffix: '%',\n },\n result: {\n notFound: '抱歉,您访问的页面不存在。',\n forbidden: '抱歉,您无权访问此页面。',\n serverError: '抱歉,出错了。',\n },\n date: {\n months: {\n jan: '一月',\n feb: '二月',\n mar: '三月',\n apr: '四月',\n may: '五月',\n jun: '六月',\n jul: '七月',\n aug: '八月',\n sep: '九月',\n oct: '十月',\n nov: '十一月',\n dec: '十二月',\n },\n },\n};\n"],"mappings":"AAGA,MAAa,OAAsB;CACjC,QAAQ;EACN,IAAI;EACJ,QAAQ;EACR,OAAO;EACP,SAAS;EACT,QAAQ;EACR,MAAM;EACN,MAAM;EACN,KAAK;EACL,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,MAAM;EAC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EACT,UAAU;EACV,QAAQ;EACR,UAAU;EACV,UAAU;CACX;CACD,SAAS;EACP,OAAO;EACP,MAAM;CACP;CACD,SAAS;EACP,SAAS;EACT,WAAW;EACX,UAAU;CACX;CACD,QAAQ,EACN,OAAO,OACR;CACD,YAAY;EACV,MAAM;EACN,UAAU;EACV,cAAc;EACd,WAAW;EACX,OAAO;EACP,WAAW;EACX,eAAe;EACf,YAAY;EACZ,oBAAoB;EACpB,YAAY;EACZ,UAAU;EACV,WAAW;EACX,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,gBAAgB;EAChB,gBAAgB;EAChB,kBAAkB;EAClB,kBAAkB;EAClB,kBAAkB;EAClB,kBAAkB;EAClB,YAAY;EACZ,IAAI;EACJ,IAAI;CACL;CACD,SAAS;EACP,OAAO;EACP,iBAAiB;EACjB,UAAU;EACV,WAAW;CACZ;CACD,SAAS,EACP,OAAO,MACR;CACD,QAAQ,EACN,OAAO,KACR;CACD,OAAO,EACL,OAAO,MACR;CACD,OAAO;EACL,OAAO;EACP,SAAS;EACT,UAAU;CACX;CACD,UAAU,EACR,OAAO,KACR;CACD,YAAY,EACV,OAAO,MACR;CACD,MAAM,EACJ,OAAO,KACR;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,OAAO;CACR;CACD,WAAW,EACT,OAAO,KACR;CACD,WAAW;EACT,OAAO;EACP,aAAa;CACd;CACD,QAAQ;EACN,UAAU;EACV,WAAW;EACX,aAAa;CACd;CACD,MAAM,EACJ,QAAQ;EACN,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;CACN,EACF;AACF"}
|
|
1
|
+
{"version":3,"file":"ngwr-i18n-zh.mjs","names":[],"sources":["../../../projects/lib/i18n/zh/public-api.ts"],"sourcesContent":["import { type WrI18nCatalog } from 'ngwr/i18n';\n\n/** Base Simplified Chinese catalog for ngwr built-in component strings. */\nexport const wrZh: WrI18nCatalog = {\n common: {\n ok: '确定',\n cancel: '取消',\n close: '关闭',\n confirm: '确认',\n delete: '删除',\n save: '保存',\n edit: '编辑',\n add: '添加',\n remove: '移除',\n clear: '清除',\n search: '搜索',\n loading: '加载中…',\n select: '选择',\n next: '下一步',\n previous: '上一步',\n back: '返回',\n today: '今天',\n yesterday: '昨天',\n tomorrow: '明天',\n of: '共',\n },\n pagination: {\n prev: '上一页',\n next: '下一页',\n itemsPerPage: '每页条数',\n perPage: '{{size}} 条/页',\n goToPage: '跳转到第 {{page}} 页',\n label: '分页',\n pageOf: '第 {{current}} 页,共 {{total}} 页',\n range: '{{from}}–{{to}},共 {{total}} 条',\n compact: '{{current}} / {{total}}',\n },\n table: {\n empty: '暂无数据',\n loading: '加载中…',\n sort: '对{{column}}列排序',\n filter: '筛选{{column}}列',\n selectAll: '选择所有行',\n selectRow: '选择行',\n expandRow: '展开或收起行详情',\n toggleRow: '展开或收起子行',\n selectGroup: '选择分组',\n toggleGroup: '展开或收起分组',\n noMatches: '无匹配结果',\n search: '搜索',\n reset: '重置',\n },\n eventCalendar: {\n today: '今天',\n previous: '上一个',\n next: '下一个',\n month: '月',\n week: '周',\n day: '日',\n time: '时间',\n allDay: '全天',\n label: '日历',\n more: '+{{count}} 项',\n header: '{{year}}年{{month}}',\n range: '{{from}} – {{to}}',\n chipLabel: '{{title}},{{time}}',\n slotLabel: '{{date}} {{time}}',\n allDayCellLabel: '{{date}} {{label}}',\n },\n tour: {\n next: '下一步',\n back: '上一步',\n done: '完成',\n skip: '跳过引导',\n progress: '第 {{current}} 步,共 {{total}} 步',\n },\n splitter: {\n divider: '调整面板大小',\n },\n stepper: {\n optional: '可选',\n completed: '已完成',\n },\n transfer: {\n source: '待选',\n target: '已选',\n search: '搜索',\n empty: '暂无内容',\n selectAll: '全选',\n toTarget: '移至已选',\n toSource: '移回待选',\n count: '{{checked}} / {{total}}',\n selectAllAria: '{{pane}} — {{action}}',\n },\n form: {\n optional: '选填',\n },\n select: {\n label: '选择',\n placeholder: '请选择',\n empty: '暂无选项',\n clearSelection: '清除选择',\n removeItem: '移除 {{label}}',\n noResults: '无搜索结果',\n loading: '加载中…',\n loadError: '无法加载结果',\n retry: '重试',\n more: '+{{count}} 项',\n },\n tree: {\n expand: '展开',\n collapse: '收起',\n placeholder: '请选择',\n clearSelection: '清除选择',\n removeItem: '移除 {{label}}',\n more: '+{{count}} 项',\n },\n commandPalette: {\n label: '命令面板',\n placeholder: '输入命令或搜索…',\n noResults: '无搜索结果',\n loading: '搜索中…',\n escHint: 'esc',\n },\n empty: {\n noData: '暂无数据',\n },\n fileUpload: {\n browse: '点击选择文件',\n dropZone: '或将文件拖放到此处',\n removeFile: '移除文件',\n invalid: '不支持的文件类型',\n tooBig: '文件过大',\n size: '{{value}} {{unit}}',\n unitByte: 'B',\n unitKb: 'KB',\n unitMb: 'MB',\n unitGb: 'GB',\n unitTb: 'TB',\n },\n popconfirm: {\n label: '确认操作',\n confirm: '确认',\n cancel: '取消',\n },\n toast: {\n region: '通知',\n close: '关闭',\n copy: '复制',\n copied: '已复制',\n closeAll: '全部关闭',\n },\n input: {\n showPassword: '显示密码',\n hidePassword: '隐藏密码',\n },\n inputNumber: {\n increment: '增加',\n decrement: '减少',\n },\n inputOtp: {\n label: '验证码',\n digit: '第 {{index}} 位数字',\n character: '第 {{index}} 个字符',\n },\n anchor: {\n label: '目录',\n },\n avatar: {\n alt: '头像',\n },\n backTop: {\n label: '返回顶部',\n },\n breadcrumbs: {\n label: '面包屑导航',\n },\n burger: {\n label: '打开或关闭菜单',\n },\n calendar: {\n prevMonth: '上个月',\n nextMonth: '下个月',\n prevYear: '上一年',\n nextYear: '下一年',\n monthList: '月份',\n yearList: '年份',\n prevYears: '前 12 年',\n nextYears: '后 12 年',\n header: '{{year}}年{{month}}',\n yearRange: '{{from}} – {{to}}',\n dayLabel: '{{date}} {{weekday}}',\n },\n imageCropper: {\n empty: '暂无图片',\n window: '裁剪区域',\n keyHelp:\n '方向键移动裁剪框。按住 Alt 加方向键可调整大小,按住 Shift 可加大步长。' +\n '裁剪框会以图像像素为单位,依次朗读左、上、宽、高四个值。',\n },\n sortableList: {\n keyHelp: '按空格键拿起此项,然后用方向键移动。再次按空格键放下,或按 Esc 键放回原位。',\n grabbed: '已拿起。第 {{index}} 项,共 {{total}} 项。',\n moved: '第 {{index}} 项,共 {{total}} 项。',\n dropped: '已放下。第 {{index}} 项,共 {{total}} 项。',\n cancelled: '已取消移动。',\n },\n colorPicker: {\n area: '饱和度 {{saturation}}%,明度 {{brightness}}%',\n hue: '色相',\n alpha: '不透明度',\n formatHex: 'HEX',\n formatRgb: 'RGB',\n formatHsl: 'HSL',\n channelHex: 'HEX',\n channelRed: 'R',\n channelGreen: 'G',\n channelBlue: 'B',\n channelHue: 'H',\n channelSaturation: 'S%',\n channelLightness: 'L%',\n channelAlpha: 'A%',\n },\n barChart: {\n label: '柱状图',\n total: '合计',\n value: '值',\n datum: '{{label}}: {{value}}',\n },\n calendarHeatmap: {\n label: '日历热力图',\n cell: '{{date}}: {{count}}',\n },\n lineChart: {\n label: '折线图',\n areaLabel: '面积图',\n },\n donutChart: {\n label: '环形图',\n pieLabel: '饼图',\n },\n chartLegend: {\n toggleLabel: '切换系列显示',\n hidden: '已隐藏',\n },\n scatterChart: {\n label: '散点图',\n x: 'X',\n y: 'Y',\n size: '大小',\n },\n radarChart: {\n label: '雷达图',\n polarAreaLabel: '极坐标面积图',\n },\n heatmapChart: {\n label: '热力图',\n noData: '无数据',\n },\n funnelChart: {\n label: '漏斗图',\n stage: '阶段',\n value: '值',\n fromPrevious: '较上一阶段',\n fromFirst: '较第一阶段',\n ofPrevious: '上一阶段的 {{percent}}',\n ofFirst: '第一阶段的 {{percent}}',\n stageName: '{{label}}: {{value}}',\n stageNameOne: '{{label}}: {{value}},{{conversion}}',\n stageNameBoth: '{{label}}: {{value}},{{previous}},{{first}}',\n },\n waterfallChart: {\n label: '瀑布图',\n step: '步骤',\n change: '变化',\n runningTotal: '累计',\n changeStep: '{{label}}: {{change}},累计 {{total}}',\n totalStep: '{{label}}: 合计 {{total}}',\n },\n treemapChart: {\n label: '矩形树图',\n value: '值',\n share: '占比',\n },\n bulletChart: {\n label: '子弹图',\n target: '目标',\n summary: '{{label}}: {{value}},目标 {{target}}',\n summaryNoTarget: '{{label}}: {{value}}',\n summaryNoValue: '{{label}}: 无值,目标 {{target}}',\n noValue: '{{label}}: 无值',\n },\n boxplotChart: {\n label: '箱线图',\n group: '分组',\n upperWhisker: '上须',\n q3: 'Q3',\n median: '中位数',\n q1: 'Q1',\n lowerWhisker: '下须',\n outliers: '异常值',\n moreOutliers: '另有 {{count}} 个',\n },\n candlestickChart: {\n label: 'K 线图',\n open: '开盘',\n high: '最高',\n low: '最低',\n close: '收盘',\n },\n compare: {\n label: '对比分隔条',\n },\n carousel: {\n label: '轮播图',\n goToSlide: '转到第 {{index}} 张幻灯片',\n prev: '上一张幻灯片',\n next: '下一张幻灯片',\n pagination: '轮播分页',\n roledescription: '轮播图',\n slideRoledescription: '幻灯片',\n },\n alert: {\n close: '关闭提示',\n },\n qr: {\n label: '二维码',\n },\n image: {\n viewer: '图片预览',\n open: '打开预览',\n close: '关闭预览',\n },\n window: {\n close: '关闭',\n minimize: '最小化',\n maximize: '最大化',\n restore: '还原',\n restoreDown: '向下还原',\n restoreWindow: '还原 {{title}}',\n closeWindow: '关闭窗口',\n untitled: '无标题',\n taskbar: '已最小化的窗口',\n taskbarAll: '已打开的窗口',\n taskbarMore: '其他窗口: {{count}}',\n moveMode: '正在移动窗口。使用方向键移动,按 Enter 键完成,按 Esc 键取消。',\n resizeMode: '正在调整窗口大小。使用方向键调整,按 Enter 键完成,按 Esc 键取消。',\n moved: '窗口已移动到 {{x}},{{y}}',\n resized: '窗口大小已调整为宽 {{width}}、高 {{height}}',\n },\n dialog: {\n close: '关闭对话框',\n },\n popover: {\n label: '弹出面板',\n },\n editor: {\n label: '富文本',\n toolbar: '格式',\n bold: '加粗',\n italic: '斜体',\n underline: '下划线',\n strike: '删除线',\n code: '行内代码',\n paragraph: '正文',\n heading: '标题 {{level}}',\n bulletList: '项目符号列表',\n orderedList: '编号列表',\n blockquote: '引用',\n codeBlock: '代码块',\n link: '插入链接',\n horizontalRule: '水平线',\n undo: '撤销',\n redo: '重做',\n linkUrl: '链接地址',\n linkApply: '应用',\n linkRemove: '移除链接',\n linkInvalid: '此地址不能用作链接。',\n shortcut: '{{label}}({{keys}})',\n keyCtrl: 'Ctrl',\n keyShift: 'Shift',\n keyAlt: 'Alt',\n taskDone: '已完成:',\n taskTodo: '待办:',\n },\n marquee: {\n label: '跑马灯',\n link: '链接',\n },\n mention: {\n listbox: '提及',\n available: '匹配项:{{count}}',\n inserted: '已插入:{{label}}',\n },\n drawer: {\n close: '关闭抽屉',\n },\n datePicker: {\n open: '打开日历',\n openTime: '打开时间选择器',\n openDateTime: '打开日期时间选择器',\n openRange: '打开日期范围日历',\n panel: '选择日期',\n panelTime: '选择时间',\n panelDateTime: '选择日期和时间',\n panelRange: '选择日期范围',\n panelRangeDateTime: '选择日期和时间范围',\n rangeStart: '起始日期',\n rangeEnd: '结束日期',\n startTime: '开始时间',\n endTime: '结束时间',\n hours: '小时',\n minutes: '分钟',\n seconds: '秒',\n incrementHours: '增加小时',\n decrementHours: '减少小时',\n incrementMinutes: '增加分钟',\n decrementMinutes: '减少分钟',\n incrementSeconds: '增加秒',\n decrementSeconds: '减少秒',\n toggleAmPm: '切换上午/下午',\n am: '上午',\n pm: '下午',\n },\n sidebar: {\n label: '侧边栏',\n containsCurrent: '包含当前页面',\n subpages: '{{title}} 的子页面',\n separator: ',',\n },\n spinner: {\n label: '加载中',\n },\n rating: {\n label: '评分',\n },\n gauge: {\n label: '仪表盘',\n },\n graph: {\n label: '图',\n parents: '父节点:{{names}}。',\n children: '子节点:{{names}}。',\n },\n progress: {\n label: '进度',\n },\n meterGroup: {\n label: '计量条',\n },\n knob: {\n label: '数值',\n },\n slider: {\n label: '数值',\n lower: '下限值',\n upper: '上限值',\n },\n speedDial: {\n label: '操作',\n },\n statistic: {\n delta: '{{value}}{{suffix}}',\n deltaSuffix: '%',\n },\n result: {\n notFound: '抱歉,您访问的页面不存在。',\n forbidden: '抱歉,您无权访问此页面。',\n serverError: '抱歉,出错了。',\n },\n date: {\n months: {\n jan: '一月',\n feb: '二月',\n mar: '三月',\n apr: '四月',\n may: '五月',\n jun: '六月',\n jul: '七月',\n aug: '八月',\n sep: '九月',\n oct: '十月',\n nov: '十一月',\n dec: '十二月',\n },\n },\n};\n"],"mappings":"AAGA,MAAa,OAAsB;CACjC,QAAQ;EACN,IAAI;EACJ,QAAQ;EACR,OAAO;EACP,SAAS;EACT,QAAQ;EACR,MAAM;EACN,MAAM;EACN,KAAK;EACL,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,MAAM;EACN,UAAU;EACV,MAAM;EACN,OAAO;EACP,WAAW;EACX,UAAU;EACV,IAAI;CACL;CACD,YAAY;EACV,MAAM;EACN,MAAM;EACN,cAAc;EACd,SAAS;EACT,UAAU;EACV,OAAO;EACP,QAAQ;EACR,OAAO;EACP,SAAS;CACV;CACD,OAAO;EACL,OAAO;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,aAAa;EACb,aAAa;EACb,WAAW;EACX,QAAQ;EACR,OAAO;CACR;CACD,eAAe;EACb,OAAO;EACP,UAAU;EACV,MAAM;EACN,OAAO;EACP,MAAM;EACN,KAAK;EACL,MAAM;EACN,QAAQ;EACR,OAAO;EACP,MAAM;EACN,QAAQ;EACR,OAAO;EACP,WAAW;EACX,WAAW;EACX,iBAAiB;CAClB;CACD,MAAM;EACJ,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,UAAU;CACX;CACD,UAAU,EACR,SAAS,SACV;CACD,SAAS;EACP,UAAU;EACV,WAAW;CACZ;CACD,UAAU;EAC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AS;EACT,UAAU;CACX;CACD,UAAU,EACR,OAAO,KACR;CACD,YAAY,EACV,OAAO,MACR;CACD,MAAM,EACJ,OAAO,KACR;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,OAAO;CACR;CACD,WAAW,EACT,OAAO,KACR;CACD,WAAW;EACT,OAAO;EACP,aAAa;CACd;CACD,QAAQ;EACN,UAAU;EACV,WAAW;EACX,aAAa;CACd;CACD,MAAM,EACJ,QAAQ;EACN,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;CACN,EACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-pagination.mjs","names":[],"sources":["../../../projects/lib/pagination/pagination.ts","../../../projects/lib/pagination/pagination.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, LOCALE_ID, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrOption, WrSelect } from 'ngwr/select';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrPaginationAlign, WrPaginationShape, WrPaginationSize } from './types';\n\nconst ELLIPSIS = '…' as const;\ntype PageEntry = number | typeof ELLIPSIS;\n\n/**\n * Numbered page navigator with optional total / page-size controls.\n *\n * Two-way binds `page` and `pageSize` via signal `model()` inputs.\n *\n * @example\n * ```html\n * <wr-pagination\n * [total]=\"120\"\n * [(page)]=\"page\"\n * [(pageSize)]=\"size\"\n * showTotal\n * showSizeChanger\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/pagination\n */\n@Component({\n selector: 'wr-pagination',\n templateUrl: './pagination.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()', role: 'navigation', '[attr.aria-label]': 'navLabel()' },\n imports: [WrButton, WrSelect, WrOption],\n})\nexport class WrPagination {\n /**\n * Currently displayed page (1-based). Two-way bindable.\n *\n * `page` rather than `currentPage` since v14, so this and `<wr-table>` — which\n * renders one of these in its own footer — spell the two concepts they share\n * one way each. It also names the output: a `model()` called `X` forces\n * `(XChange)`, so the old name produced `(currentPageChange)` against the\n * table's `(pageChange)`.\n */\n readonly page = model<number>(1);\n\n /** Items per page. Two-way bindable. */\n readonly pageSize = model<number>(10);\n\n /** Total item count across all pages. */\n readonly total = input(0, { transform: numAttr(0) });\n\n /** Options shown in the page-size dropdown. */\n readonly pageSizeOptions = input<readonly number[]>([10, 20, 50, 100]);\n\n /** Render the page-size dropdown. @default false */\n readonly showSizeChanger = input(false, { transform: coerceBooleanProperty });\n\n /** Render the \"X–Y of Z\" total label. @default false */\n readonly showTotal = input(false, { transform: coerceBooleanProperty });\n\n /** Horizontal alignment. @default 'start' */\n readonly align = input<WrPaginationAlign>('start');\n\n /** Size variant — cascades to every internal button. @default 'sm' */\n readonly size = input<WrPaginationSize>('sm');\n\n /** Cell corner treatment. @default 'rounded' */\n readonly shape = input<WrPaginationShape>('rounded');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Collapse to a compact `‹ page / total ›` pager when the control's own box\n * is too narrow for the full numbered strip (a container query on its own\n * width, not the viewport). @default false\n */\n readonly responsive = input(false, { transform: coerceBooleanProperty });\n\n /** Previous-page button aria-label. Falls back to `pagination.prev`. */\n readonly prevLabel = input<string | null>(null);\n\n /** Next-page button aria-label. Falls back to `pagination.next`. */\n readonly nextLabel = input<string | null>(null);\n\n /** \"Items per page\" label. Falls back to `pagination.itemsPerPage`. */\n readonly itemsPerPageLabel = input<string | null>(null);\n\n /** Accessible name for the `role=\"navigation\"` host. Falls back to `pagination.label`. */\n readonly label = input<string | null>(null);\n\n /** Resolved labels. */\n protected readonly resolvedPrev = useI18nText(this.prevLabel, 'pagination.prev', 'Previous page');\n protected readonly resolvedNext = useI18nText(this.nextLabel, 'pagination.next', 'Next page');\n protected readonly resolvedItemsPerPage = useI18nText(\n this.itemsPerPageLabel,\n 'pagination.itemsPerPage',\n 'Items per page'\n );\n\n /**\n * Page-size option text — interpolates `{{size}}`. Was the template literal\n * `{{ option }} / page`, which no catalog could reach, so a Russian UI read\n * \"25 / page\".\n */\n protected readonly perPage = useI18nFormatter('pagination.perPage', '{{size}} / page');\n\n /** Per-page-button aria-label — interpolates `{{page}}`. */\n protected readonly goToPage = useI18nFormatter('pagination.goToPage', 'Go to page {{page}}');\n\n /** The nav landmark's own accessible name — was a hardcoded English literal. */\n protected readonly navLabel = useI18nText(this.label, 'pagination.label', 'Pagination');\n\n /** Internal: total page count. */\n /**\n * A page size that is not a positive number yields ONE page, not `Infinity`.\n *\n * `pageSize` is a `model()`, so Angular offers no `transform` to coerce it and\n * whatever the host writes arrives raw. At 0 the division is `Infinity`,\n * `Math.max(1, …)` keeps it, and the item list below pushes `total` as the\n * last page — so the strip rendered a clickable cell reading \"Infinity\", and\n * clicking it locked the tab. `NaN` (a `pageSize` bound to an emptied number\n * field) came through untouched for the same reason.\n *\n * One page is the honest answer: a size of zero describes no paging at all.\n * Note this is about `pageSize` and does NOT touch the recorded contract\n * about `total` — pagination still refuses to pull the page DOWN while\n * `total` is at or below zero, because 0 is ambiguous with \"still loading\".\n */\n private readonly usablePageSize = computed(() => {\n const size = this.pageSize();\n if (Number.isFinite(size) && size >= 1) return size;\n // Everything on one page. Deliberately not `Infinity`, which gives the\n // right page COUNT by accident and then puts `Infinity` in the range label\n // the moment `page` is above 1.\n return Math.max(1, this.total());\n });\n\n protected readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.usablePageSize())));\n\n /**\n * Internal: where the previous arrow goes. Clamped to the end of the valid\n * range rather than being a plain `page() - 1`, because the page can\n * legitimately sit past that end while `total` is 0 (see the guard effect).\n * From page 5 of one page, `goTo(4)` is refused as out of range, so the arrow\n * was enabled and did nothing — and under `responsive` on a narrow box the\n * numbered cells are hidden by a container query, which left no way back at\n * all. `Math.min` only ever moves the target INWARD, so `goTo`'s own\n * past-the-end refusal keeps working as the backstop it is.\n */\n protected readonly prevPage = computed(() => Math.min(this.page() - 1, this.totalPages()));\n\n /**\n * Internal: the \"1–10 of 235\" line, as ONE catalog template.\n *\n * It used to be `` `${start}-${end} ${of} ${total}` ``, which localised the\n * word in the middle and nothing else: the ASCII hyphen between the bounds and\n * the operand order were both frozen in TypeScript, so ja-JP and ar-SA got\n * English word order and no language could change the range separator. The\n * three numbers go through `Intl.NumberFormat` for the same reason the total\n * beside them does — a five-figure total needs the locale's grouping, and\n * ar-SA needs its own digits.\n *\n * The `ofLabel` input is gone with it: an input for the middle word is the\n * concatenation, re-offered as API.\n */\n protected readonly rangeLabel = computed(() => {\n // The same guarded size, or the range label reads \"1 – NaN of 100\".\n const size = this.usablePageSize();\n const start = this.total() === 0 ? 0 : (this.page() - 1) * size + 1;\n const end = Math.min(this.page() * size, this.total());\n return this.rangeText({\n from: this.number(start),\n to: this.number(end),\n total: this.number(this.total()),\n });\n });\n\n /** Internal: the compact pager's `1 / 24`, likewise a catalog template. */\n protected readonly compactLabel = computed(() =>\n this.compactText({ current: this.number(this.page()), total: this.number(this.totalPages()) })\n );\n\n private readonly rangeText = useI18nFormatter('pagination.range', '{{from}}–{{to}} of {{total}}');\n private readonly compactText = useI18nFormatter('pagination.compact', '{{current}} / {{total}}');\n\n private readonly locale = inject(LOCALE_ID);\n\n /**\n * Grouped per `LOCALE_ID`. Only the range and the compact pager go through\n * this — a page NUMBER on a button is an identifier, and `1,024` on a button\n * reads as two things.\n */\n private number(value: number): string {\n return new Intl.NumberFormat(this.locale).format(value);\n }\n\n /**\n * Internal: page list with ellipses. Window of 7 visible page slots.\n *\n * 1 … 5 6 [7] 8 9 … 20\n */\n protected readonly pages = computed<readonly PageEntry[]>(() => {\n const total = this.totalPages();\n const current = this.page();\n\n if (total <= 7) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const items: PageEntry[] = [1];\n if (current > 4) items.push(ELLIPSIS);\n\n let start: number;\n let end: number;\n if (current <= 4) {\n start = 2;\n end = 5;\n } else if (current >= total - 3) {\n start = total - 4;\n end = total - 1;\n } else {\n start = current - 2;\n end = current + 2;\n }\n\n for (let i = start; i <= end; i++) items.push(i);\n if (current < total - 3) items.push(ELLIPSIS);\n if (end !== total) items.push(total);\n\n return items;\n });\n\n protected readonly ellipsis = ELLIPSIS;\n\n protected readonly classes = computed(() => {\n const parts = [\n 'wr-pagination',\n `wr-pagination--${this.align()}`,\n `wr-pagination--${this.size()}`,\n `wr-pagination--${this.shape()}`,\n ];\n if (this.disabled()) parts.push('wr-pagination--disabled');\n if (this.responsive()) parts.push('wr-pagination--responsive');\n return parts.join(' ');\n });\n\n protected isCurrent(page: number): boolean {\n return this.page() === page;\n }\n\n protected goTo(page: number | typeof ELLIPSIS): void {\n if (typeof page !== 'number') return;\n if (this.disabled() || page < 1 || page > this.totalPages() || page === this.page()) return;\n this.page.set(page);\n }\n\n /**\n * `wr-select` carries an `unknown` value by design, so the size arrives\n * untyped and is narrowed here. It used to arrive as `any` through\n * `[ngModel]`, which hid the coercion rather than removing the need for it.\n */\n constructor() {\n // `page` is a plain `model` — a `model()` takes no transform — so a\n // shrinking `total` and a host `[(page)]` write both land in it\n // unchecked. The guard used to read and write the page inside `untracked()`\n // and pull DOWNWARDS only, so it fired when `total` / `pageSize` moved and\n // never when the host wrote: past the end no cell carries `aria-current`,\n // the arrow at that end stays enabled and inert (`goTo` refuses the step\n // rather than correcting the stored page), and below 1 `rangeLabel()` counts\n // backwards (\"-9-0 of 120\"). Two-sided and tracked, the same shape\n // `wr-stepper` and `wr-carousel` use for their own host-owned `model()`.\n //\n // Only the UPPER bound is conditional. A `total` at or below 0 is the one\n // value where pulling the page down is destructive rather than cosmetic:\n // there is no `loading` input, so 0 is genuinely ambiguous between \"the\n // list is empty\" and \"the page is still in flight\", and the second is the\n // ordinary state of a server-paged host — Angular's `resource` drops its\n // value whenever the params change, and a params function returning an\n // object literal is never reference-equal, so `total` reads 0 between the\n // click and the response. `totalPages()` is 1 there, so the guard pulled\n // every page above the first back to 1 and emitted a `pageChange`\n // the host could not tell from a click: the pager could not leave page 1,\n // and each click cost two events. A negative `total` is folded into the\n // same branch because it is as meaningless as a zero one.\n //\n // The LOWER bound is unconditional, and gating it on `total` was a mistake\n // in the first cut of this fix: no value of `total` makes page 0 correct,\n // and while it was skipped a host write of -3 survived — `rangeLabel()`\n // guards `start` for an empty total and not `end`, so it read \"0--30 of 0\",\n // and the compact pager read \"-3 / 1\". It is written as one expression\n // rather than an early return so the effect depends on `page()` and\n // `total()` on every run, whichever branch decides the result.\n //\n // What IS still given up while `total` is 0 and the held page is past the\n // first: no cell carries `aria-current`, because `pages` renders the single\n // page and that is not the page the host holds. `rangeLabel()` is not in\n // that list — it already special-cases an empty total and reads \"0-0 of 0\".\n // Nor are the arrows: they compare against the RANGE rather than its ends\n // (see the template), so past the end next renders disabled and prev stays\n // enabled and steps back INTO range via `prevPage`. That is a change from\n // the \"enabled and inert\" behaviour described above, which this component\n // used to accept at both ends.\n effect(() => {\n const page = this.page();\n const floored = Math.max(1, page);\n const clamped = this.total() <= 0 ? floored : Math.min(floored, this.totalPages());\n if (clamped !== page) this.page.set(clamped);\n });\n }\n\n protected onSizeChange(size: unknown): void {\n const next = Number(size);\n if (this.disabled() || !Number.isFinite(next) || next <= 0 || next === this.pageSize()) return;\n // The size and nothing else. This used to clamp the page against the new\n // size too, and it read a value that was already superseded: `pageSize.set`\n // emits `pageSizeChange` synchronously, so by the following statement the\n // host has run its own policy — most tables reset to the first page — and\n // that write has not reached the model yet, it arrives on the next binding\n // pass. So the clamp computed a cap from the PRE-change page and wrote the\n // result over the host's decision: from page 6 at size 10, choosing 25\n // emitted `pageChange(5)` on top of the host's reset to 1, which the\n // host cannot tell from a navigation, and a second request went out. The\n // guard effect in the constructor takes it over and runs once the bindings\n // have settled, so it clamps the page the host actually wants.\n //\n // For a SETTLED `total` that is the whole story. For the server-paged host\n // this fix exists for it is not: the size change invalidates the payload\n // too, so `total` reads 0 and the guard returns early. Measured, from page\n // 6 at size 10 choosing 25 with a host that does not reset — in flight:\n // `navigations []`, page 6, total 0; after settle: `navigations [5]`, page\n // 5. So a non-resetting host issues one doomed request for a page that no\n // longer exists and is corrected only when the answer lands. That is an\n // accepted cost of refusing to write back from transient state, not\n // something the guard covers.\n this.pageSize.set(next);\n }\n}\n","<div class=\"wr-pagination__inner\">\n @if (showTotal()) {\n <span class=\"wr-pagination__total\">{{ rangeLabel() }}</span>\n }\n\n <div class=\"wr-pagination__nav\">\n <!--\n `wr-pagination__nav-btn` exists so the stylesheet can mirror the arrow\n glyph under `dir=\"rtl\"`. A class rather than `:first-child` /\n `:last-child` on the row: those two positions do hold today — which is why\n the `--square` end caps use them — but only while the prev button, the\n compact label and the next button all stay unconditional and in this\n order. A mirror keyed to position would follow a reorder, or land on a\n page cell, without a word.\n\n The two `[disabled]` bindings compare against the RANGE (`<= 1`,\n `>= totalPages()`) rather than for equality with its ends. While `total`\n is 0 the guard effect stops enforcing the upper bound, so the page can\n legitimately sit past `totalPages()` — and `=== totalPages()` reported\n next as enabled there while `goTo` refused the step. Prev is still\n enabled in that state, correctly: `prevPage()` walks it back into range.\n -->\n <wr-btn\n class=\"wr-pagination__nav-btn\"\n [size]=\"size()\"\n outlined\n [attr.aria-label]=\"resolvedPrev()\"\n [disabled]=\"disabled() || page() <= 1\"\n (click)=\"goTo(prevPage())\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n </wr-btn>\n\n @for (page of pages(); track $index) {\n @if (page === ellipsis) {\n <span class=\"wr-pagination__ellipsis\">{{ ellipsis }}</span>\n } @else {\n <wr-btn\n class=\"wr-pagination__page\"\n [size]=\"size()\"\n [outlined]=\"!isCurrent(page)\"\n [color]=\"isCurrent(page) ? 'primary' : null\"\n [attr.aria-current]=\"isCurrent(page) ? 'page' : null\"\n [attr.aria-label]=\"goToPage({ page })\"\n [disabled]=\"disabled()\"\n (click)=\"goTo(page)\"\n >\n {{ page }}\n </wr-btn>\n }\n }\n\n <!-- Compact pager — shown only in responsive mode on a narrow box (CSS). Not\n `aria-hidden`: `display: none` already keeps whichever of the two is\n hidden out of the accessibility tree, and on a narrow box this label is\n the only position on screen. -->\n <span class=\"wr-pagination__current\">{{ compactLabel() }}</span>\n\n <wr-btn\n class=\"wr-pagination__nav-btn\"\n [size]=\"size()\"\n outlined\n [attr.aria-label]=\"resolvedNext()\"\n [disabled]=\"disabled() || page() >= totalPages()\"\n (click)=\"goTo(page() + 1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n </wr-btn>\n </div>\n\n @if (showSizeChanger()) {\n <!--\n `ariaLabel`, not `[attr.aria-label]`: `<wr-select>`'s host carries no role,\n so an attribute there names nothing and never reaches the `role=\"combobox\"`\n button inside — the size changer announced itself as the catalog's generic\n \"Select\".\n -->\n <wr-select\n class=\"wr-pagination__size\"\n [ariaLabel]=\"resolvedItemsPerPage()\"\n [disabled]=\"disabled()\"\n [value]=\"pageSize()\"\n (valueChange)=\"onSizeChange($event)\"\n >\n @for (option of pageSizeOptions(); track option) {\n <wr-option [value]=\"option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names":[],"sources":["../../../projects/lib/pagination/pagination.ts","../../../projects/lib/pagination/pagination.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, LOCALE_ID, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrOption, WrSelect } from 'ngwr/select';\nimport { numAttr } from 'ngwr/utils';\n\nimport type { WrPaginationAlign, WrPaginationShape, WrPaginationSize } from './types';\n\nconst ELLIPSIS = '…' as const;\ntype PageEntry = number | typeof ELLIPSIS;\n\n/**\n * Numbered page navigator with optional total / page-size controls.\n *\n * Two-way binds `page` and `pageSize` via signal `model()` inputs.\n *\n * @example\n * ```html\n * <wr-pagination\n * [total]=\"120\"\n * [(page)]=\"page\"\n * [(pageSize)]=\"size\"\n * showTotal\n * showSizeChanger\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/pagination\n */\n@Component({\n selector: 'wr-pagination',\n templateUrl: './pagination.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()', role: 'navigation', '[attr.aria-label]': 'navLabel()' },\n imports: [WrButton, WrSelect, WrOption],\n})\nexport class WrPagination {\n /**\n * Currently displayed page (1-based). Two-way bindable.\n *\n * `page` rather than `currentPage` since v14, so this and `<wr-table>` — which\n * renders one of these in its own footer — spell the two concepts they share\n * one way each. It also names the output: a `model()` called `X` forces\n * `(XChange)`, so the old name produced `(currentPageChange)` against the\n * table's `(pageChange)`.\n */\n readonly page = model<number>(1);\n\n /** Items per page. Two-way bindable. */\n readonly pageSize = model<number>(10);\n\n /** Total item count across all pages. */\n readonly total = input(0, { transform: numAttr(0) });\n\n /** Options shown in the page-size dropdown. */\n readonly pageSizeOptions = input<readonly number[]>([10, 20, 50, 100]);\n\n /** Render the page-size dropdown. @default false */\n readonly showSizeChanger = input(false, { transform: coerceBooleanProperty });\n\n /** Render the \"X–Y of Z\" total label. @default false */\n readonly showTotal = input(false, { transform: coerceBooleanProperty });\n\n /** Horizontal alignment. @default 'start' */\n readonly align = input<WrPaginationAlign>('start');\n\n /** Size variant — cascades to every internal button. @default 'sm' */\n readonly size = input<WrPaginationSize>('sm');\n\n /** Cell corner treatment. @default 'rounded' */\n readonly shape = input<WrPaginationShape>('rounded');\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Collapse to a compact `‹ page / total ›` pager when the control's own box\n * is too narrow for the full numbered strip (a container query on its own\n * width, not the viewport). @default false\n */\n readonly responsive = input(false, { transform: coerceBooleanProperty });\n\n /** Previous-page button aria-label. Falls back to `pagination.prev`. */\n readonly prevLabel = input<string | null>(null);\n\n /** Next-page button aria-label. Falls back to `pagination.next`. */\n readonly nextLabel = input<string | null>(null);\n\n /** \"Items per page\" label. Falls back to `pagination.itemsPerPage`. */\n readonly itemsPerPageLabel = input<string | null>(null);\n\n /** Accessible name for the `role=\"navigation\"` host. Falls back to `pagination.label`. */\n readonly label = input<string | null>(null);\n\n /** Resolved labels. */\n protected readonly resolvedPrev = useI18nText(this.prevLabel, 'pagination.prev', 'Previous page');\n protected readonly resolvedNext = useI18nText(this.nextLabel, 'pagination.next', 'Next page');\n protected readonly resolvedItemsPerPage = useI18nText(\n this.itemsPerPageLabel,\n 'pagination.itemsPerPage',\n 'Items per page'\n );\n\n /**\n * Page-size option text — interpolates `{{size}}`. Was the template literal\n * `{{ option }} / page`, which no catalog could reach, so a Russian UI read\n * \"25 / page\".\n */\n protected readonly perPage = useI18nFormatter('pagination.perPage', '{{size}} / page');\n\n /** Per-page-button aria-label — interpolates `{{page}}`. */\n protected readonly goToPage = useI18nFormatter('pagination.goToPage', 'Go to page {{page}}');\n\n /** The nav landmark's own accessible name — was a hardcoded English literal. */\n protected readonly navLabel = useI18nText(this.label, 'pagination.label', 'Pagination');\n\n /** Internal: total page count. */\n /**\n * A page size that is not a positive number yields ONE page, not `Infinity`.\n *\n * `pageSize` is a `model()`, so Angular offers no `transform` to coerce it and\n * whatever the host writes arrives raw. At 0 the division is `Infinity`,\n * `Math.max(1, …)` keeps it, and the item list below pushes `total` as the\n * last page — so the strip rendered a clickable cell reading \"Infinity\", and\n * clicking it locked the tab. `NaN` (a `pageSize` bound to an emptied number\n * field) came through untouched for the same reason.\n *\n * One page is the honest answer: a size of zero describes no paging at all.\n * Note this is about `pageSize` and does NOT touch the recorded contract\n * about `total` — pagination still refuses to pull the page DOWN while\n * `total` is at or below zero, because 0 is ambiguous with \"still loading\".\n */\n private readonly usablePageSize = computed(() => {\n const size = this.pageSize();\n if (Number.isFinite(size) && size >= 1) return size;\n // Everything on one page. Deliberately not `Infinity`, which gives the\n // right page COUNT by accident and then puts `Infinity` in the range label\n // the moment `page` is above 1.\n return Math.max(1, this.total());\n });\n\n protected readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.usablePageSize())));\n\n /**\n * Internal: where the previous arrow goes. Clamped to the end of the valid\n * range rather than being a plain `page() - 1`, because the page can\n * legitimately sit past that end while `total` is 0 (see the guard effect).\n * From page 5 of one page, `goTo(4)` is refused as out of range, so the arrow\n * was enabled and did nothing — and under `responsive` on a narrow box the\n * numbered cells are hidden by a container query, which left no way back at\n * all. `Math.min` only ever moves the target INWARD, so `goTo`'s own\n * past-the-end refusal keeps working as the backstop it is.\n */\n protected readonly prevPage = computed(() => Math.min(this.page() - 1, this.totalPages()));\n\n /**\n * Internal: the \"1–10 of 235\" line, as ONE catalog template.\n *\n * It used to be `` `${start}-${end} ${of} ${total}` ``, which localised the\n * word in the middle and nothing else: the ASCII hyphen between the bounds and\n * the operand order were both frozen in TypeScript, so ja-JP and ar-SA got\n * English word order and no language could change the range separator. The\n * three numbers go through `Intl.NumberFormat` for the same reason the total\n * beside them does — a five-figure total needs the locale's grouping, and\n * ar-SA needs its own digits.\n *\n * The `ofLabel` input is gone with it: an input for the middle word is the\n * concatenation, re-offered as API.\n */\n protected readonly rangeLabel = computed(() => {\n // The same guarded size, or the range label reads \"1 – NaN of 100\".\n const size = this.usablePageSize();\n const start = this.total() === 0 ? 0 : (this.page() - 1) * size + 1;\n const end = Math.min(this.page() * size, this.total());\n return this.rangeText({\n from: this.number(start),\n to: this.number(end),\n total: this.number(this.total()),\n });\n });\n\n /** Internal: the compact pager's `1 / 24`, likewise a catalog template. */\n protected readonly compactLabel = computed(() =>\n this.compactText({ current: this.number(this.page()), total: this.number(this.totalPages()) })\n );\n\n private readonly rangeText = useI18nFormatter('pagination.range', '{{from}}–{{to}} of {{total}}');\n private readonly compactText = useI18nFormatter('pagination.compact', '{{current}} / {{total}}');\n\n private readonly locale = inject(LOCALE_ID);\n\n /**\n * Grouped per `LOCALE_ID`. Only the range and the compact pager go through\n * this — a page NUMBER on a button is an identifier, and `1,024` on a button\n * reads as two things.\n */\n private number(value: number): string {\n return new Intl.NumberFormat(this.locale).format(value);\n }\n\n /**\n * Internal: page list with ellipses. Window of 7 visible page slots.\n *\n * 1 … 5 6 [7] 8 9 … 20\n */\n protected readonly pages = computed<readonly PageEntry[]>(() => {\n const total = this.totalPages();\n const current = this.page();\n\n if (total <= 7) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const items: PageEntry[] = [1];\n if (current > 4) items.push(ELLIPSIS);\n\n let start: number;\n let end: number;\n if (current <= 4) {\n start = 2;\n end = 5;\n } else if (current >= total - 3) {\n start = total - 4;\n end = total - 1;\n } else {\n start = current - 2;\n end = current + 2;\n }\n\n for (let i = start; i <= end; i++) items.push(i);\n if (current < total - 3) items.push(ELLIPSIS);\n if (end !== total) items.push(total);\n\n return items;\n });\n\n protected readonly ellipsis = ELLIPSIS;\n\n protected readonly classes = computed(() => {\n const parts = [\n 'wr-pagination',\n `wr-pagination--${this.align()}`,\n `wr-pagination--${this.size()}`,\n `wr-pagination--${this.shape()}`,\n ];\n if (this.disabled()) parts.push('wr-pagination--disabled');\n if (this.responsive()) parts.push('wr-pagination--responsive');\n return parts.join(' ');\n });\n\n protected isCurrent(page: number): boolean {\n return this.page() === page;\n }\n\n protected goTo(page: number | typeof ELLIPSIS): void {\n if (typeof page !== 'number') return;\n if (this.disabled() || page < 1 || page > this.totalPages() || page === this.page()) return;\n this.page.set(page);\n }\n\n /**\n * `wr-select` carries an `unknown` value by design, so the size arrives\n * untyped and is narrowed here. It used to arrive as `any` through\n * `[ngModel]`, which hid the coercion rather than removing the need for it.\n */\n constructor() {\n // `page` is a plain `model` — a `model()` takes no transform — so a\n // shrinking `total` and a host `[(page)]` write both land in it\n // unchecked. The guard used to read and write the page inside `untracked()`\n // and pull DOWNWARDS only, so it fired when `total` / `pageSize` moved and\n // never when the host wrote: past the end no cell carries `aria-current`,\n // the arrow at that end stays enabled and inert (`goTo` refuses the step\n // rather than correcting the stored page), and below 1 `rangeLabel()` counts\n // backwards (\"-9-0 of 120\"). Two-sided and tracked, the same shape\n // `wr-stepper` and `wr-carousel` use for their own host-owned `model()`.\n //\n // Only the UPPER bound is conditional. A `total` at or below 0 is the one\n // value where pulling the page down is destructive rather than cosmetic:\n // there is no `loading` input, so 0 is genuinely ambiguous between \"the\n // list is empty\" and \"the page is still in flight\", and the second is the\n // ordinary state of a server-paged host — Angular's `resource` drops its\n // value whenever the params change, and a params function returning an\n // object literal is never reference-equal, so `total` reads 0 between the\n // click and the response. `totalPages()` is 1 there, so the guard pulled\n // every page above the first back to 1 and emitted a `pageChange`\n // the host could not tell from a click: the pager could not leave page 1,\n // and each click cost two events. A negative `total` is folded into the\n // same branch because it is as meaningless as a zero one.\n //\n // The LOWER bound is unconditional, and gating it on `total` was a mistake\n // in the first cut of this fix: no value of `total` makes page 0 correct,\n // and while it was skipped a host write of -3 survived — `rangeLabel()`\n // guards `start` for an empty total and not `end`, so it read \"0--30 of 0\",\n // and the compact pager read \"-3 / 1\". It is written as one expression\n // rather than an early return so the effect depends on `page()` and\n // `total()` on every run, whichever branch decides the result.\n //\n // What IS still given up while `total` is 0 and the held page is past the\n // first: no cell carries `aria-current`, because `pages` renders the single\n // page and that is not the page the host holds. `rangeLabel()` is not in\n // that list — it already special-cases an empty total and reads \"0-0 of 0\".\n // Nor are the arrows: they compare against the RANGE rather than its ends\n // (see the template), so past the end next renders disabled and prev stays\n // enabled and steps back INTO range via `prevPage`. That is a change from\n // the \"enabled and inert\" behaviour described above, which this component\n // used to accept at both ends.\n effect(() => {\n const page = this.page();\n const floored = Math.max(1, page);\n const clamped = this.total() <= 0 ? floored : Math.min(floored, this.totalPages());\n if (clamped !== page) this.page.set(clamped);\n });\n }\n\n protected onSizeChange(size: unknown): void {\n const next = Number(size);\n if (this.disabled() || !Number.isFinite(next) || next <= 0 || next === this.pageSize()) return;\n // The size and nothing else. This used to clamp the page against the new\n // size too, and it read a value that was already superseded: `pageSize.set`\n // emits `pageSizeChange` synchronously, so by the following statement the\n // host has run its own policy — most tables reset to the first page — and\n // that write has not reached the model yet, it arrives on the next binding\n // pass. So the clamp computed a cap from the PRE-change page and wrote the\n // result over the host's decision: from page 6 at size 10, choosing 25\n // emitted `pageChange(5)` on top of the host's reset to 1, which the\n // host cannot tell from a navigation, and a second request went out. The\n // guard effect in the constructor takes it over and runs once the bindings\n // have settled, so it clamps the page the host actually wants.\n //\n // For a SETTLED `total` that is the whole story. For the server-paged host\n // this fix exists for it is not: the size change invalidates the payload\n // too, so `total` reads 0 and the guard returns early. Measured, from page\n // 6 at size 10 choosing 25 with a host that does not reset — in flight:\n // `navigations []`, page 6, total 0; after settle: `navigations [5]`, page\n // 5. So a non-resetting host issues one doomed request for a page that no\n // longer exists and is corrected only when the answer lands. That is an\n // accepted cost of refusing to write back from transient state, not\n // something the guard covers.\n this.pageSize.set(next);\n }\n}\n","<div class=\"wr-pagination__inner\">\n @if (showTotal()) {\n <span class=\"wr-pagination__total\">{{ rangeLabel() }}</span>\n }\n\n <div class=\"wr-pagination__nav\">\n <!--\n `wr-pagination__nav-btn` exists so the stylesheet can mirror the arrow\n glyph under `dir=\"rtl\"`. A class rather than `:first-child` /\n `:last-child` on the row: those two positions do hold today — which is why\n the `--square` end caps use them — but only while the prev button, the\n compact label and the next button all stay unconditional and in this\n order. A mirror keyed to position would follow a reorder, or land on a\n page cell, without a word.\n\n The two `[disabled]` bindings compare against the RANGE (`<= 1`,\n `>= totalPages()`) rather than for equality with its ends. While `total`\n is 0 the guard effect stops enforcing the upper bound, so the page can\n legitimately sit past `totalPages()` — and `=== totalPages()` reported\n next as enabled there while `goTo` refused the step. Prev is still\n enabled in that state, correctly: `prevPage()` walks it back into range.\n -->\n <wr-btn\n class=\"wr-pagination__nav-btn\"\n [size]=\"size()\"\n outlined\n [attr.aria-label]=\"resolvedPrev()\"\n [disabled]=\"disabled() || page() <= 1\"\n (click)=\"goTo(prevPage())\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m12 19-7-7 7-7\" />\n <path d=\"M19 12H5\" />\n </svg>\n </wr-btn>\n\n @for (page of pages(); track $index) {\n @if (page === ellipsis) {\n <span class=\"wr-pagination__ellipsis\">{{ ellipsis }}</span>\n } @else {\n <wr-btn\n class=\"wr-pagination__page\"\n [size]=\"size()\"\n [outlined]=\"!isCurrent(page)\"\n [color]=\"isCurrent(page) ? 'primary' : null\"\n [attr.aria-current]=\"isCurrent(page) ? 'page' : null\"\n [attr.aria-label]=\"goToPage({ page })\"\n [disabled]=\"disabled()\"\n (click)=\"goTo(page)\"\n >\n {{ page }}\n </wr-btn>\n }\n }\n\n <!-- Compact pager — shown only in responsive mode on a narrow box (CSS). Not\n `aria-hidden`: `display: none` already keeps whichever of the two is\n hidden out of the accessibility tree, and on a narrow box this label is\n the only position on screen. -->\n <span class=\"wr-pagination__current\">{{ compactLabel() }}</span>\n\n <wr-btn\n class=\"wr-pagination__nav-btn\"\n [size]=\"size()\"\n outlined\n [attr.aria-label]=\"resolvedNext()\"\n [disabled]=\"disabled() || page() >= totalPages()\"\n (click)=\"goTo(page() + 1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" />\n </svg>\n </wr-btn>\n </div>\n\n @if (showSizeChanger()) {\n <!--\n `ariaLabel`, not `[attr.aria-label]`: `<wr-select>`'s host carries no role,\n so an attribute there names nothing and never reaches the `role=\"combobox\"`\n button inside — the size changer announced itself as the catalog's generic\n \"Select\".\n -->\n <wr-select\n class=\"wr-pagination__size\"\n [ariaLabel]=\"resolvedItemsPerPage()\"\n [disabled]=\"disabled()\"\n [value]=\"pageSize()\"\n (valueChange)=\"onSizeChange($event)\"\n >\n @for (option of pageSizeOptions(); track option) {\n <wr-option [value]=\"option\">{{ perPage({ size: option }) }}</wr-option>\n }\n </wr-select>\n }\n</div>\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,WAAW;AA4BjB,IAAa,eAAb,MAAa,aAAY;CAUd,OAAO,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGvB,WAAW,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAG5B,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,QAAQ,CAAC;CAAC,CAAA;CAGxC,kBAAkB,MAAyB;EAAC;EAAI;EAAI;EAAI;CAAG,GAAE,GAAA,YAAA,CAAA,EAA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IAAA,MAAA;IAAA,MAAE;IAAQ,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAQ,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;GAAA;EAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAE3B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAPxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,eAEV,kBAAkB;GAAI,MAC/B;IAAE,WAAW;IAAa,MAAM;IAAc,qBAAqB;GAAY;GAAE,SAC9E;IAAC;IAAU;IAAU;GAAQ;GAAC,UAAA;EAAA,CAAA"}
|
package/fesm2022/ngwr-pipes.mjs
CHANGED
|
@@ -16,30 +16,26 @@ const UNITS = [
|
|
|
16
16
|
"terabyte",
|
|
17
17
|
"petabyte"
|
|
18
18
|
];
|
|
19
|
+
function format(locale, value, unit, fractionDigits) {
|
|
20
|
+
const parts = new Intl.NumberFormat(locale, {
|
|
21
|
+
style: "unit",
|
|
22
|
+
unit: UNITS[unit],
|
|
23
|
+
unitDisplay: "narrow",
|
|
24
|
+
minimumFractionDigits: fractionDigits,
|
|
25
|
+
maximumFractionDigits: fractionDigits
|
|
26
|
+
}).formatToParts(value);
|
|
27
|
+
const at = parts.findIndex((part) => part.type === "unit");
|
|
28
|
+
if (at === -1) return parts.map((part) => part.value).join("");
|
|
29
|
+
const out = parts.map((part) => part.value);
|
|
30
|
+
const gap = at === 0 ? 1 : at - 1;
|
|
31
|
+
if (parts[gap]?.type === "literal") out[gap] = " ";
|
|
32
|
+
else out.splice(at === 0 ? 1 : at, 0, " ");
|
|
33
|
+
return out.join("");
|
|
34
|
+
}
|
|
19
35
|
var WrBytes = class WrBytes {
|
|
20
36
|
locale = inject(LOCALE_ID);
|
|
21
37
|
transform(value, decimals = 1) {
|
|
22
|
-
|
|
23
|
-
const n = Number(value);
|
|
24
|
-
if (!Number.isFinite(n) || n <= 0) return this.format(0, 0, 0);
|
|
25
|
-
const i = Math.min(Math.max(0, Math.floor(Math.log(n) / Math.log(1024))), UNITS.length - 1);
|
|
26
|
-
return this.format(n / 1024 ** i, i, i === 0 ? 0 : Math.max(0, decimals));
|
|
27
|
-
}
|
|
28
|
-
format(value, unit, fractionDigits) {
|
|
29
|
-
const parts = new Intl.NumberFormat(this.locale, {
|
|
30
|
-
style: "unit",
|
|
31
|
-
unit: UNITS[unit],
|
|
32
|
-
unitDisplay: "narrow",
|
|
33
|
-
minimumFractionDigits: fractionDigits,
|
|
34
|
-
maximumFractionDigits: fractionDigits
|
|
35
|
-
}).formatToParts(value);
|
|
36
|
-
const at = parts.findIndex((part) => part.type === "unit");
|
|
37
|
-
if (at === -1) return parts.map((part) => part.value).join("");
|
|
38
|
-
const out = parts.map((part) => part.value);
|
|
39
|
-
const gap = at === 0 ? 1 : at - 1;
|
|
40
|
-
if (parts[gap]?.type === "literal") out[gap] = " ";
|
|
41
|
-
else out.splice(at === 0 ? 1 : at, 0, " ");
|
|
42
|
-
return out.join("");
|
|
38
|
+
return wrFormatBytes(value, this.locale, decimals);
|
|
43
39
|
}
|
|
44
40
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
45
41
|
minVersion: "12.0.0",
|
|
@@ -68,19 +64,29 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
68
64
|
args: [{ name: "wrBytes" }]
|
|
69
65
|
}]
|
|
70
66
|
});
|
|
67
|
+
function wrFormatBytes(value, locale, decimals = 1) {
|
|
68
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
69
|
+
const n = Number(value);
|
|
70
|
+
if (!Number.isFinite(n) || n <= 0) return format(locale, 0, 0, 0);
|
|
71
|
+
const i = Math.min(Math.max(0, Math.floor(Math.log(n) / Math.log(1024))), UNITS.length - 1);
|
|
72
|
+
return format(locale, n / 1024 ** i, i, i === 0 ? 0 : Math.max(0, decimals));
|
|
73
|
+
}
|
|
71
74
|
/**
|
|
72
75
|
* @license
|
|
73
76
|
*
|
|
74
77
|
* Use of this source code is governed by an MIT-style license that can be
|
|
75
78
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
76
79
|
*/
|
|
80
|
+
function wrFormatDate(value, adapter, format = "shortDate") {
|
|
81
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
82
|
+
const date = value instanceof Date ? value : toLocalDate(value);
|
|
83
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
84
|
+
return adapter.format(date, format);
|
|
85
|
+
}
|
|
77
86
|
var WrDate = class WrDate {
|
|
78
87
|
adapter = inject(WrDateAdapter);
|
|
79
88
|
transform(value, format = "shortDate") {
|
|
80
|
-
|
|
81
|
-
const date = value instanceof Date ? value : toLocalDate(value);
|
|
82
|
-
if (Number.isNaN(date.getTime())) return "";
|
|
83
|
-
return this.adapter.format(date, format);
|
|
89
|
+
return wrFormatDate(value, this.adapter, format);
|
|
84
90
|
}
|
|
85
91
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
86
92
|
minVersion: "12.0.0",
|
|
@@ -115,6 +121,105 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
115
121
|
* Use of this source code is governed by an MIT-style license that can be
|
|
116
122
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
117
123
|
*/
|
|
124
|
+
const UNIT_MS = [
|
|
125
|
+
["day", 864e5],
|
|
126
|
+
["hour", 36e5],
|
|
127
|
+
["minute", 6e4],
|
|
128
|
+
["second", 1e3],
|
|
129
|
+
["millisecond", 1]
|
|
130
|
+
];
|
|
131
|
+
const CLOCK_UNITS = /* @__PURE__ */ new Set([
|
|
132
|
+
"hour",
|
|
133
|
+
"minute",
|
|
134
|
+
"second"
|
|
135
|
+
]);
|
|
136
|
+
const LIST_UNITS = /* @__PURE__ */ new Set([
|
|
137
|
+
"day",
|
|
138
|
+
"hour",
|
|
139
|
+
"minute",
|
|
140
|
+
"second"
|
|
141
|
+
]);
|
|
142
|
+
function formatClock(ms, locale) {
|
|
143
|
+
const { hour = 0, minute = 0, second = 0 } = wrSplitDuration(ms, CLOCK_UNITS);
|
|
144
|
+
const digits = (n, width) => new Intl.NumberFormat(locale, {
|
|
145
|
+
useGrouping: false,
|
|
146
|
+
minimumIntegerDigits: width
|
|
147
|
+
}).format(n);
|
|
148
|
+
const tail = `${digits(minute, hour > 0 ? 2 : 1)}:${digits(second, 2)}`;
|
|
149
|
+
return hour > 0 ? `${digits(hour, 1)}:${tail}` : tail;
|
|
150
|
+
}
|
|
151
|
+
function formatUnits(ms, locale) {
|
|
152
|
+
const parts = wrSplitDuration(ms, LIST_UNITS);
|
|
153
|
+
const unit = (name, n) => new Intl.NumberFormat(locale, {
|
|
154
|
+
style: "unit",
|
|
155
|
+
unit: name,
|
|
156
|
+
unitDisplay: "short"
|
|
157
|
+
}).format(n);
|
|
158
|
+
const words = Object.entries(parts).filter(([, n]) => n > 0).map(([name, n]) => unit(name, n));
|
|
159
|
+
if (words.length === 0) return unit("second", 0);
|
|
160
|
+
return new Intl.ListFormat(locale, {
|
|
161
|
+
style: "narrow",
|
|
162
|
+
type: "unit"
|
|
163
|
+
}).format(words);
|
|
164
|
+
}
|
|
165
|
+
function wrSplitDuration(ms, units) {
|
|
166
|
+
const out = {};
|
|
167
|
+
let rest = ms;
|
|
168
|
+
for (const [unit, size] of UNIT_MS) {
|
|
169
|
+
if (!units.has(unit)) continue;
|
|
170
|
+
const n = Math.floor(rest / size);
|
|
171
|
+
out[unit] = n;
|
|
172
|
+
rest -= n * size;
|
|
173
|
+
}
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
function wrFormatDuration(value, locale, style = "clock") {
|
|
177
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
178
|
+
const ms = Number(typeof value === "string" ? value.trim() : value);
|
|
179
|
+
if (!Number.isFinite(ms)) return "";
|
|
180
|
+
const span = Math.abs(ms);
|
|
181
|
+
const body = style === "units" ? formatUnits(span, locale) : formatClock(span, locale);
|
|
182
|
+
if (ms >= 0 || span < 1e3) return body;
|
|
183
|
+
return `${new Intl.NumberFormat(locale).formatToParts(-1).find((part) => part.type === "minusSign")?.value ?? "-"}${body}`;
|
|
184
|
+
}
|
|
185
|
+
var WrDuration = class WrDuration {
|
|
186
|
+
locale = inject(LOCALE_ID);
|
|
187
|
+
transform(value, style = "clock") {
|
|
188
|
+
return wrFormatDuration(value, this.locale, style);
|
|
189
|
+
}
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
191
|
+
minVersion: "12.0.0",
|
|
192
|
+
version: "22.2.4",
|
|
193
|
+
ngImport: i0,
|
|
194
|
+
type: WrDuration,
|
|
195
|
+
deps: [],
|
|
196
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
197
|
+
});
|
|
198
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({
|
|
199
|
+
minVersion: "14.0.0",
|
|
200
|
+
version: "22.2.4",
|
|
201
|
+
ngImport: i0,
|
|
202
|
+
type: WrDuration,
|
|
203
|
+
isStandalone: true,
|
|
204
|
+
name: "wrDuration"
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
208
|
+
minVersion: "12.0.0",
|
|
209
|
+
version: "22.2.4",
|
|
210
|
+
ngImport: i0,
|
|
211
|
+
type: WrDuration,
|
|
212
|
+
decorators: [{
|
|
213
|
+
type: Pipe,
|
|
214
|
+
args: [{ name: "wrDuration" }]
|
|
215
|
+
}]
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* @license
|
|
219
|
+
*
|
|
220
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
221
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
222
|
+
*/
|
|
118
223
|
const RE_META = /[\\^$.*+?()[\]{}|]/g;
|
|
119
224
|
function escapeHtml(s) {
|
|
120
225
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -162,27 +267,33 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
162
267
|
* Use of this source code is governed by an MIT-style license that can be
|
|
163
268
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
164
269
|
*/
|
|
270
|
+
const PLAIN_DECIMAL = /^[+-]?(?:\d+\.?\d*|\.\d+)$/;
|
|
271
|
+
function toOptions(style, currency) {
|
|
272
|
+
switch (style) {
|
|
273
|
+
case "percent": return {
|
|
274
|
+
style: "percent",
|
|
275
|
+
maximumFractionDigits: 2
|
|
276
|
+
};
|
|
277
|
+
case "currency": return {
|
|
278
|
+
style: "currency",
|
|
279
|
+
currency
|
|
280
|
+
};
|
|
281
|
+
default: return { style: "decimal" };
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function wrFormatNumber(value, locale, styleOrOptions = "decimal", currency = "USD") {
|
|
285
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
286
|
+
const text = typeof value === "string" ? value.trim() : null;
|
|
287
|
+
const n = Number(text ?? value);
|
|
288
|
+
if (!Number.isFinite(n)) return "";
|
|
289
|
+
const options = typeof styleOrOptions === "string" ? toOptions(styleOrOptions, currency) : styleOrOptions;
|
|
290
|
+
const exact = text !== null && PLAIN_DECIMAL.test(text) ? text : n;
|
|
291
|
+
return new Intl.NumberFormat(locale, options).format(exact);
|
|
292
|
+
}
|
|
165
293
|
var WrNumber = class WrNumber {
|
|
166
294
|
locale = inject(LOCALE_ID);
|
|
167
295
|
transform(value, styleOrOptions = "decimal", currency = "USD") {
|
|
168
|
-
|
|
169
|
-
const n = Number(value);
|
|
170
|
-
if (!Number.isFinite(n)) return "";
|
|
171
|
-
const options = typeof styleOrOptions === "string" ? this.toOptions(styleOrOptions, currency) : styleOrOptions;
|
|
172
|
-
return new Intl.NumberFormat(this.locale, options).format(n);
|
|
173
|
-
}
|
|
174
|
-
toOptions(style, currency) {
|
|
175
|
-
switch (style) {
|
|
176
|
-
case "percent": return {
|
|
177
|
-
style: "percent",
|
|
178
|
-
maximumFractionDigits: 2
|
|
179
|
-
};
|
|
180
|
-
case "currency": return {
|
|
181
|
-
style: "currency",
|
|
182
|
-
currency
|
|
183
|
-
};
|
|
184
|
-
default: return { style: "decimal" };
|
|
185
|
-
}
|
|
296
|
+
return wrFormatNumber(value, this.locale, styleOrOptions, currency);
|
|
186
297
|
}
|
|
187
298
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
188
299
|
minVersion: "12.0.0",
|
|
@@ -217,14 +328,17 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
217
328
|
* Use of this source code is governed by an MIT-style license that can be
|
|
218
329
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
219
330
|
*/
|
|
331
|
+
function wrFormatPlural(value, locale, forms, options = {}) {
|
|
332
|
+
if (value === null || value === void 0 || !Number.isFinite(value)) return "";
|
|
333
|
+
const tag = options.locale ?? locale;
|
|
334
|
+
const word = forms[new Intl.PluralRules(tag).select(value)] ?? forms.other;
|
|
335
|
+
if (options.includeValue === false) return word;
|
|
336
|
+
return `${new Intl.NumberFormat(tag).format(value)} ${word}`;
|
|
337
|
+
}
|
|
220
338
|
var WrPlural = class WrPlural {
|
|
221
339
|
locale = inject(LOCALE_ID);
|
|
222
340
|
transform(value, forms, options = {}) {
|
|
223
|
-
|
|
224
|
-
const locale = options.locale ?? this.locale;
|
|
225
|
-
const word = forms[new Intl.PluralRules(locale).select(value)] ?? forms.other;
|
|
226
|
-
if (options.includeValue === false) return word;
|
|
227
|
-
return `${new Intl.NumberFormat(locale).format(value)} ${word}`;
|
|
341
|
+
return wrFormatPlural(value, this.locale, forms, options);
|
|
228
342
|
}
|
|
229
343
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
230
344
|
minVersion: "12.0.0",
|
|
@@ -338,6 +452,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
338
452
|
args: [{ name: "wrTruncate" }]
|
|
339
453
|
}]
|
|
340
454
|
});
|
|
341
|
-
export { WrBytes, WrDate, WrMark, WrNumber, WrPlural, WrRange, WrTruncate };
|
|
455
|
+
export { WrBytes, WrDate, WrDuration, WrMark, WrNumber, WrPlural, WrRange, WrTruncate, wrFormatBytes, wrFormatDate, wrFormatDuration, wrFormatNumber, wrFormatPlural, wrSplitDuration };
|
|
342
456
|
|
|
343
457
|
//# sourceMappingURL=ngwr-pipes.mjs.map
|