@svadmin/core 0.82.0 → 0.83.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/core",
3
- "version": "0.82.0",
3
+ "version": "0.83.1",
4
4
  "author": "zuohuadong",
5
5
  "repository": {
6
6
  "type": "git",
@@ -214,3 +214,23 @@ export function formatAdminDate(value: Date | number | string, options: AdminDat
214
214
  if (options.timeZone) fields.timeZone = options.timeZone;
215
215
  return new Intl.DateTimeFormat(options.locale, fields).format(date);
216
216
  }
217
+
218
+ /** 中文破折号是两字宽,写成两个 em dash。单独的 — 和半角 -- 都换成 ——。 */
219
+ export function formatAdminEmDash(text: string): string {
220
+ return text.replace(/—{2,}|--+/g, '——').replace(/(?<!—)—(?!—)/g, '——');
221
+ }
222
+
223
+ /** 小于等于用 ≤。只替换半角 <=。 */
224
+ export function formatAdminLessThanOrEqual(text: string): string {
225
+ return text.replace(/<=/g, '≤');
226
+ }
227
+
228
+ /** 数字区间用 ~。已经写成 ~ 的保持不动。 */
229
+ export function formatAdminNumericRange(text: string): string {
230
+ return text.replace(/(\d(?:[\d,.]*\d)?)\s*(?:-|—)\s*(\d(?:[\d,.]*\d)?)/g, '$1~$2');
231
+ }
232
+
233
+ /** 英文标点后面补一个空格。小数点、中文标点和已有空格不动。 */
234
+ export function formatAdminEnglishPunctuation(text: string): string {
235
+ return text.replace(/([,;:!?])(?=[A-Za-z])/g, '$1 ');
236
+ }
package/src/index.ts CHANGED
@@ -171,7 +171,11 @@ export {
171
171
  formatAdminCurrency,
172
172
  formatAdminDate,
173
173
  formatAdminEllipsis,
174
+ formatAdminEmDash,
175
+ formatAdminEnglishPunctuation,
176
+ formatAdminLessThanOrEqual,
174
177
  formatAdminNumber,
178
+ formatAdminNumericRange,
175
179
  formatAdminPercent,
176
180
  formatAdminTime,
177
181
  spaceCjkLatin,
@@ -314,7 +318,7 @@ export type { UseExportOptions } from './export-hooks.svelte';
314
318
  export { useImport } from './import-hooks.svelte';
315
319
  export type { ImportArtifact, ImportArtifactProvider, ImportTaskResult, ImportPreviewFailure, ImportPreviewResult } from './import-contract';
316
320
  export { snapshotImportArtifact, snapshotImportTaskResult, invalidImportPreviewFailure } from './import-contract';
317
- export { IMPORT_LIMITS } from './import-contract';
321
+ export { IMPORT_LIMITS, parseImportRows } from './import-contract';
318
322
  export type { UseImportOptions, ImportProgress, ImportResult } from './import-hooks.svelte';
319
323
  export type { ExportFormat } from './data-transfer.svelte';
320
324
  export {