@indigina/ui-kit 1.1.653 → 1.1.654

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.
Binary file
@@ -0,0 +1,93 @@
1
+ Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -17268,18 +17268,22 @@ const gridExportOptions = [
17268
17268
  ];
17269
17269
 
17270
17270
  const pdfMake = pdfMakeNamespace.default ?? pdfMakeNamespace;
17271
+ const CJK_FONT_FAMILY = 'NotoSansSC';
17272
+ const CJK_FONT_FILE = 'NotoSansCJKsc-Regular.otf';
17273
+ const CJK_FONT_URL = `assets/${CJK_FONT_FILE}`;
17271
17274
  const COLOR_TEXT = '#2a2b32';
17272
17275
  const COLOR_BORDER = '#e3e4e5';
17273
17276
  const COLOR_HEADER_BACKGROUND = '#f0f0f0';
17274
- const ZERO_WIDTH_SPACE = String.fromCodePoint(0x200b);
17275
- const softWrapLongToken = (value) => value.replace(/\S{6,}/g, token => token.match(/.{1,3}/g)?.join(ZERO_WIDTH_SPACE) ?? token);
17276
17277
  const buildTableHeader = (columns, translateTitle) => columns.map(column => ({
17277
17278
  text: translateTitle(column.title),
17278
17279
  style: 'tableHeader',
17279
17280
  fillColor: COLOR_HEADER_BACKGROUND,
17280
17281
  }));
17281
- const buildTableBody = (data, columns, getCellValue) => data.map(row => columns.map(column => softWrapLongToken(String(getCellValue(column, row) ?? ''))));
17282
- const buildDocDefinition = (columns, header, body, options, fontSize, cellPadding) => ({
17282
+ const buildTableBody = (data, columns, getCellValue) => data.map(row => columns.map(column => ({
17283
+ text: String(getCellValue(column, row) ?? ''),
17284
+ wordBreak: 'break-all',
17285
+ })));
17286
+ const buildDocDefinition = (columns, header, body, options, fontSize, cellPadding, useChineseFont) => ({
17283
17287
  pageOrientation: (options.landscape ?? columns.length > 5) ? 'landscape' : 'portrait',
17284
17288
  pageSize: (options.paperSize ?? 'A4'),
17285
17289
  pageMargins: [
@@ -17288,7 +17292,7 @@ const buildDocDefinition = (columns, header, body, options, fontSize, cellPaddin
17288
17292
  10,
17289
17293
  10,
17290
17294
  ],
17291
- defaultStyle: { fontSize, color: COLOR_TEXT },
17295
+ defaultStyle: { font: useChineseFont ? CJK_FONT_FAMILY : undefined, fontSize, color: COLOR_TEXT },
17292
17296
  styles: {
17293
17297
  tableHeader: { bold: true, fontSize: fontSize + 1, color: COLOR_TEXT },
17294
17298
  },
@@ -17313,14 +17317,25 @@ const buildDocDefinition = (columns, header, body, options, fontSize, cellPaddin
17313
17317
  },
17314
17318
  }],
17315
17319
  });
17316
- const kitCreateGridPdfBlob = (data, columns, getCellValue, translateTitle, options = {}) => {
17320
+ const kitCreateGridPdfBlob = (data, columns, getCellValue, translateTitle, options = {}, useChineseFont = false) => {
17317
17321
  pdfMake.addVirtualFileSystem(vfs);
17322
+ if (useChineseFont) {
17323
+ const fontUrl = new URL(CJK_FONT_URL, document.baseURI).toString();
17324
+ pdfMake.addFonts({
17325
+ [CJK_FONT_FAMILY]: {
17326
+ normal: fontUrl,
17327
+ bold: fontUrl,
17328
+ italics: fontUrl,
17329
+ bolditalics: fontUrl,
17330
+ },
17331
+ });
17332
+ }
17318
17333
  const scale = options.scale ?? 1;
17319
17334
  const fontSize = Math.round(11 * scale);
17320
17335
  const cellPadding = Math.round(3 * scale);
17321
17336
  const header = buildTableHeader(columns, translateTitle);
17322
17337
  const body = buildTableBody(data, columns, getCellValue);
17323
- const docDefinition = buildDocDefinition(columns, header, body, options, fontSize, cellPadding);
17338
+ const docDefinition = buildDocDefinition(columns, header, body, options, fontSize, cellPadding, useChineseFont);
17324
17339
  return pdfMake.createPdf(docDefinition).getBlob();
17325
17340
  };
17326
17341
 
@@ -17408,7 +17423,7 @@ class KitGridExportComponent {
17408
17423
  reject(new Error('No data to export'));
17409
17424
  return;
17410
17425
  }
17411
- kitCreateGridPdfBlob(data, this.exportedColumns, (column, row) => this.gridCellService.createCellValue(column.type, column.field, row, this.translationMap(), '', this.gridCellValueTransformMap()), (title) => this.translateService.instant(title), this.pdfExportOptions())
17426
+ kitCreateGridPdfBlob(data, this.exportedColumns, (column, row) => this.gridCellService.createCellValue(column.type, column.field, row, this.translationMap(), '', this.gridCellValueTransformMap()), (title) => this.translateService.instant(title), this.pdfExportOptions(), this.translateService.currentLang() === KitLanguage.CHINESE)
17412
17427
  .then((blob) => {
17413
17428
  saveAs(blob, `${this.exportedFileName()}.pdf`);
17414
17429
  resolve();
@@ -17464,7 +17479,7 @@ class KitGridExportComponent {
17464
17479
  return new Promise((resolve, reject) => this.getExportedData()().subscribe({
17465
17480
  next: ({ data }) => {
17466
17481
  const xmlContent = this.convertToXML(data, this.exportedColumns);
17467
- const blob = new Blob([xmlContent], { type: 'application/xml' });
17482
+ const blob = new Blob([xmlContent], { type: 'application/xml;charset=utf-8' });
17468
17483
  saveAs(blob, `${this.exportedFileName()}.xml`);
17469
17484
  resolve();
17470
17485
  },
@@ -17520,7 +17535,7 @@ class KitGridExportComponent {
17520
17535
  .replaceAll('(', '_')
17521
17536
  .replaceAll(')', '_')
17522
17537
  .replaceAll('\'', '')
17523
- .replace(/[^A-Za-z0-9_.-]/g, '');
17538
+ .replace(/[^\p{L}\p{N}\p{M}_.-]/gu, '');
17524
17539
  }
17525
17540
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: KitGridExportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
17526
17541
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.1", type: KitGridExportComponent, isStandalone: true, selector: "kit-grid-export", inputs: { getExportedData: { classPropertyName: "getExportedData", publicName: "getExportedData", isSignal: true, isRequired: true, transformFunction: null }, translationMap: { classPropertyName: "translationMap", publicName: "translationMap", isSignal: true, isRequired: true, transformFunction: null }, exportedFileName: { classPropertyName: "exportedFileName", publicName: "exportedFileName", isSignal: true, isRequired: true, transformFunction: null }, pdfExportOptions: { classPropertyName: "pdfExportOptions", publicName: "pdfExportOptions", isSignal: true, isRequired: false, transformFunction: null }, gridHasData: { classPropertyName: "gridHasData", publicName: "gridHasData", isSignal: true, isRequired: true, transformFunction: null }, exportDataCount: { classPropertyName: "exportDataCount", publicName: "exportDataCount", isSignal: true, isRequired: false, transformFunction: null }, gridCellValueTransformMap: { classPropertyName: "gridCellValueTransformMap", publicName: "gridCellValueTransformMap", isSignal: true, isRequired: false, transformFunction: null }, visibleColumns: { classPropertyName: "visibleColumns", publicName: "visibleColumns", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exportRequested: "exportRequested" }, viewQueries: [{ propertyName: "popup", first: true, predicate: ["popup"], descendants: true, read: KitPopupComponent, isSignal: true }, { propertyName: "anchor", first: true, predicate: ["toggleButton"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"kit-grid-export\">\n <kit-button #toggleButton\n kitTooltip\n kitTooltipFilter=\"kit-button\"\n [title]=\"'kit.export.title' | translate\"\n [kitTooltipPosition]=\"kitTooltipPosition.TOP\"\n [disabled]=\"!gridHasData() || isGridExporting()\"\n [icon]=\"kitSvgIcon.DOWNLOAD\"\n [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.MEDIUM\"\n [active]=\"popup.isPopupOpen\"\n (clicked)=\"onPopupToggle()\" />\n</div>\n\n<kit-popup #popup\n popupClass=\"kit-grid-export-popup\"\n [anchor]=\"anchor()\"\n [content]=\"content\">\n</kit-popup>\n\n<ng-template #content>\n <span class=\"kit-grid-export-popup-label\">{{ \"kit.export.exportTableData\" | translate }}</span>\n <kit-radio-button [type]=\"kitRadioButtonType.ICON_LIST\"\n [items]=\"gridExportOptions\" \n (changed)=\"onExport($event)\"/>\n</ng-template>\n", styles: ["::ng-deep .kit-grid-export-popup{width:220px}::ng-deep .kit-grid-export-popup-label{font-size:14px;font-weight:500;margin-bottom:20px;display:block}\n"], dependencies: [{ kind: "component", type: KitButtonComponent, selector: "kit-button", inputs: ["disabled", "label", "type", "icon", "iconType", "kind", "state", "iconPosition", "buttonClass", "active"], outputs: ["clicked"] }, { kind: "component", type: KitPopupComponent, selector: "kit-popup", inputs: ["anchor", "content", "closeOnOutsideClick", "showFooter", "cancelButtonLabel", "applyButtonLabel", "isApplyButtonDisabled", "positionMode", "popupClass", "closePopupOnCancel", "extraInsideSelectors"], outputs: ["cancelAction", "applyAction", "opened", "closed"] }, { kind: "component", type: KitRadioButtonComponent, selector: "kit-radio-button", inputs: ["items", "label", "name", "readonly", "type", "value", "checked", "icon", "disabled"], outputs: ["checkedChange", "disabledChange", "changed"] }, { kind: "directive", type: KitTooltipDirective, selector: "[kitTooltip]", inputs: ["kitTooltipPosition", "kitTooltipFilter", "kitTooltipTemplateRef", "kitTooltipVisible", "kitTooltipOffset"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }