@shival99/z-ui 2.3.10 → 2.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/fesm2022/shival99-z-ui-components-z-audio-player.mjs +210 -0
- package/fesm2022/shival99-z-ui-components-z-audio-player.mjs.map +1 -0
- package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs +2 -2
- package/fesm2022/shival99-z-ui-components-z-autocomplete.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-drawer.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-gallery.mjs +1482 -1761
- package/fesm2022/shival99-z-ui-components-z-gallery.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-icon.mjs +20 -11
- package/fesm2022/shival99-z-ui-components-z-icon.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-input.mjs +2 -2
- package/fesm2022/shival99-z-ui-components-z-input.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-media-player.mjs +413 -101
- package/fesm2022/shival99-z-ui-components-z-media-player.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-popover.mjs +75 -43
- package/fesm2022/shival99-z-ui-components-z-popover.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-select.mjs +2 -2
- package/fesm2022/shival99-z-ui-components-z-select.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-table.mjs +2 -0
- package/fesm2022/shival99-z-ui-components-z-table.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs +17 -11
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs +1 -1
- package/fesm2022/shival99-z-ui-components-z-tooltip.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-i18n.mjs +4 -2
- package/fesm2022/shival99-z-ui-i18n.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-services.mjs +144 -9
- package/fesm2022/shival99-z-ui-services.mjs.map +1 -1
- package/package.json +21 -1
- package/types/shival99-z-ui-components-z-audio-player.d.ts +46 -0
- package/types/shival99-z-ui-components-z-gallery.d.ts +67 -36
- package/types/shival99-z-ui-components-z-icon.d.ts +1 -1
- package/types/shival99-z-ui-components-z-media-player.d.ts +83 -7
- package/types/shival99-z-ui-components-z-popover.d.ts +1 -0
- package/types/shival99-z-ui-components-z-tabs.d.ts +6 -2
- package/types/shival99-z-ui-components-z-toast.d.ts +2 -2
- package/types/shival99-z-ui-components-z-upload.d.ts +3 -3
- package/types/shival99-z-ui-services.d.ts +25 -2
|
@@ -118,6 +118,7 @@ function zAppendLegacyScope(value, scopeSuffix) {
|
|
|
118
118
|
|
|
119
119
|
/** Injection token for data passed to a dynamic component or template. */
|
|
120
120
|
const Z_DYNAMIC_DATA = new InjectionToken('Z_DYNAMIC_DATA');
|
|
121
|
+
const Z_DYNAMIC_ANIMATION_DURATION = 150;
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
124
|
* Controls one free-form dynamic overlay instance.
|
|
@@ -175,13 +176,26 @@ let ZDynamicRef = class ZDynamicRef {
|
|
|
175
176
|
return;
|
|
176
177
|
}
|
|
177
178
|
this._isClosing = true;
|
|
178
|
-
this.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
this.
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
const contentElements = this._getContentElements();
|
|
180
|
+
for (const element of contentElements) {
|
|
181
|
+
element.classList.add('z-animate-out', 'z-fade-out', 'z-zoom-out-95');
|
|
182
|
+
}
|
|
183
|
+
this._overlayRef?.backdropElement?.classList.add('z-backdrop-leaving');
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
this._overlayRef?.dispose();
|
|
186
|
+
this._componentRef = null;
|
|
187
|
+
this.componentInstance = null;
|
|
188
|
+
this.afterClose.emit(result);
|
|
189
|
+
this.afterClose.complete();
|
|
190
|
+
this._destroy$.next();
|
|
191
|
+
this._destroy$.complete();
|
|
192
|
+
}, Z_DYNAMIC_ANIMATION_DURATION);
|
|
193
|
+
}
|
|
194
|
+
_getContentElements() {
|
|
195
|
+
if (!this._overlayRef) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
return Array.from(this._overlayRef.overlayElement.children).filter(element => element !== this._overlayRef?.backdropElement);
|
|
185
199
|
}
|
|
186
200
|
/**
|
|
187
201
|
* @deprecated Không còn tác dụng — overlay tự do giờ luôn dùng vị trí toàn cục (global),
|
|
@@ -195,6 +209,10 @@ let ZDynamicRef = class ZDynamicRef {
|
|
|
195
209
|
updateSize(width, height) {
|
|
196
210
|
this._overlayRef?.updateSize({ width, height });
|
|
197
211
|
}
|
|
212
|
+
/** Applies an input after the component has been attached. */
|
|
213
|
+
setInput(name, value) {
|
|
214
|
+
this._componentRef?.setInput(name, value);
|
|
215
|
+
}
|
|
198
216
|
/** @internal Used by the service after attaching a component portal. */
|
|
199
217
|
attachComponentRef(componentRef) {
|
|
200
218
|
this._componentRef = componentRef;
|
|
@@ -639,6 +657,9 @@ class ZDynamicService {
|
|
|
639
657
|
injector,
|
|
640
658
|
viewContainerRef: options.viewContainerRef,
|
|
641
659
|
});
|
|
660
|
+
for (const [name, value] of Object.entries(options.inputs ?? {})) {
|
|
661
|
+
componentRef.setInput(name, value);
|
|
662
|
+
}
|
|
642
663
|
componentRef.changeDetectorRef.detectChanges();
|
|
643
664
|
dynamicRef.attachComponentRef(componentRef);
|
|
644
665
|
return dynamicRef;
|
|
@@ -652,7 +673,7 @@ class ZDynamicService {
|
|
|
652
673
|
backdropClass: options.backdropClass ?? 'z-modal-backdrop-dark',
|
|
653
674
|
panelClass: options.panelClass,
|
|
654
675
|
scrollLock: options.scrollLock ?? true,
|
|
655
|
-
scrollable: true,
|
|
676
|
+
scrollable: options.scrollable ?? true,
|
|
656
677
|
size: {
|
|
657
678
|
width: options.width,
|
|
658
679
|
height: options.height,
|
|
@@ -1333,6 +1354,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
1333
1354
|
}]
|
|
1334
1355
|
}] });
|
|
1335
1356
|
|
|
1357
|
+
class ZGalleryOfficeRenderService {
|
|
1358
|
+
async renderDoc(container, blob) {
|
|
1359
|
+
const { renderAsync } = await import('docx-preview');
|
|
1360
|
+
await renderAsync(blob, container, undefined, {
|
|
1361
|
+
className: 'z-gallery-docx',
|
|
1362
|
+
inWrapper: true,
|
|
1363
|
+
breakPages: true,
|
|
1364
|
+
});
|
|
1365
|
+
const observer = this._observeDocxZoom(container);
|
|
1366
|
+
return { dispose: () => observer?.disconnect() };
|
|
1367
|
+
}
|
|
1368
|
+
async renderSheet(container, blob) {
|
|
1369
|
+
const [{ read, utils }, { createUniver, LocaleType, mergeLocales }, sheetsCore, viVN] = await Promise.all([
|
|
1370
|
+
import('xlsx'),
|
|
1371
|
+
import('@univerjs/presets'),
|
|
1372
|
+
import('@univerjs/preset-sheets-core'),
|
|
1373
|
+
import('@univerjs/preset-sheets-core/locales/vi-VN'),
|
|
1374
|
+
]);
|
|
1375
|
+
const workbook = read(await blob.arrayBuffer(), { type: 'array' });
|
|
1376
|
+
const { univerAPI } = createUniver({
|
|
1377
|
+
locale: LocaleType.VI_VN,
|
|
1378
|
+
locales: { [LocaleType.VI_VN]: mergeLocales(viVN.default ?? viVN) },
|
|
1379
|
+
presets: [
|
|
1380
|
+
sheetsCore.UniverSheetsCorePreset({
|
|
1381
|
+
container,
|
|
1382
|
+
header: true,
|
|
1383
|
+
toolbar: false,
|
|
1384
|
+
contextMenu: false,
|
|
1385
|
+
formulaBar: true,
|
|
1386
|
+
}),
|
|
1387
|
+
],
|
|
1388
|
+
});
|
|
1389
|
+
univerAPI.createWorkbook(this._toUniverWorkbook(workbook, utils)).setEditable(false);
|
|
1390
|
+
return { dispose: () => univerAPI.dispose() };
|
|
1391
|
+
}
|
|
1392
|
+
async renderSlide(container, blob) {
|
|
1393
|
+
const { PptxViewer, RECOMMENDED_ZIP_LIMITS } = await import('@aiden0z/pptx-renderer');
|
|
1394
|
+
const viewer = new PptxViewer(container, {
|
|
1395
|
+
fitMode: 'contain',
|
|
1396
|
+
zipLimits: RECOMMENDED_ZIP_LIMITS,
|
|
1397
|
+
pdfjs: {
|
|
1398
|
+
moduleUrl: '/assets/pdfjs/build/pdf.mjs',
|
|
1399
|
+
workerUrl: '/assets/pdfjs/build/pdf.worker.mjs',
|
|
1400
|
+
},
|
|
1401
|
+
});
|
|
1402
|
+
await viewer.open(blob, { renderMode: 'slide' });
|
|
1403
|
+
return { dispose: () => viewer.destroy() };
|
|
1404
|
+
}
|
|
1405
|
+
_toUniverWorkbook(workbook, utils) {
|
|
1406
|
+
const sheets = {};
|
|
1407
|
+
const sheetOrder = [];
|
|
1408
|
+
workbook.SheetNames.forEach((sheetName, index) => {
|
|
1409
|
+
const sheet = workbook.Sheets[sheetName];
|
|
1410
|
+
if (!sheet) {
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
const rows = utils.sheet_to_json(sheet, { header: 1, raw: true, defval: null });
|
|
1414
|
+
const sheetId = `sheet-${index}`;
|
|
1415
|
+
sheetOrder.push(sheetId);
|
|
1416
|
+
sheets[sheetId] = {
|
|
1417
|
+
id: sheetId,
|
|
1418
|
+
name: sheetName,
|
|
1419
|
+
rowCount: Math.max(rows.length + 10, 50),
|
|
1420
|
+
columnCount: Math.max(...rows.map(row => row.length), 10) + 5,
|
|
1421
|
+
cellData: this._toUniverCellData(rows),
|
|
1422
|
+
};
|
|
1423
|
+
});
|
|
1424
|
+
return {
|
|
1425
|
+
id: 'z-gallery-preview',
|
|
1426
|
+
appVersion: '0.25.1',
|
|
1427
|
+
name: workbook.Props?.Title ?? '',
|
|
1428
|
+
sheetOrder,
|
|
1429
|
+
sheets,
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
_toUniverCellData(rows) {
|
|
1433
|
+
const cellData = {};
|
|
1434
|
+
rows.forEach((row, rowIndex) => {
|
|
1435
|
+
row.forEach((value, columnIndex) => {
|
|
1436
|
+
if (value === null || value === undefined || value === '') {
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
cellData[rowIndex] ??= {};
|
|
1440
|
+
cellData[rowIndex][columnIndex] = typeof value === 'number' ? { v: value } : { v: String(value) };
|
|
1441
|
+
});
|
|
1442
|
+
});
|
|
1443
|
+
return cellData;
|
|
1444
|
+
}
|
|
1445
|
+
_observeDocxZoom(container) {
|
|
1446
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
1447
|
+
return null;
|
|
1448
|
+
}
|
|
1449
|
+
const observer = new ResizeObserver(() => {
|
|
1450
|
+
const wrapper = container.querySelector('.docx-wrapper');
|
|
1451
|
+
const page = wrapper?.querySelector('.docx');
|
|
1452
|
+
if (!wrapper || !page) {
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
const availableWidth = container.clientWidth;
|
|
1456
|
+
const pageWidth = page.offsetWidth;
|
|
1457
|
+
const scale = pageWidth > 0 && availableWidth < pageWidth ? availableWidth / pageWidth : 1;
|
|
1458
|
+
wrapper.style.zoom = `${scale}`;
|
|
1459
|
+
});
|
|
1460
|
+
observer.observe(container);
|
|
1461
|
+
return observer;
|
|
1462
|
+
}
|
|
1463
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: ZGalleryOfficeRenderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1464
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: ZGalleryOfficeRenderService, providedIn: 'root' });
|
|
1465
|
+
}
|
|
1466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: ZGalleryOfficeRenderService, decorators: [{
|
|
1467
|
+
type: Injectable,
|
|
1468
|
+
args: [{ providedIn: 'root' }]
|
|
1469
|
+
}] });
|
|
1470
|
+
|
|
1336
1471
|
class ZIndexDbService {
|
|
1337
1472
|
_db = null;
|
|
1338
1473
|
_dbName;
|
|
@@ -2691,5 +2826,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
2691
2826
|
* Generated bundle index. Do not edit.
|
|
2692
2827
|
*/
|
|
2693
2828
|
|
|
2694
|
-
export { ZCacheService, ZDynamicRef, ZDynamicService, ZExcelService, ZHttpAbstractService, ZIndexDbService, ZOverlayContainerService, ZOverlayZIndexService, ZSubjectService, ZThemeService, ZTranslateService, Z_CACHE_DEFAULT_PREFIX, Z_CACHE_SCOPE_SEPARATOR, Z_DB_SCOPE_SEPARATOR, Z_DEFAULT_THEME, Z_DYNAMIC_DATA, Z_EXCEL_BORDER_THIN, Z_EXCEL_CHAR_WIDTH_MAP, Z_EXCEL_COLORS, Z_EXCEL_DEFAULT_CONFIG, Z_EXCEL_FONT_MULTIPLIERS, Z_EXCEL_WIDTH_LIMITS, Z_HTTP_DEFAULT_CONFIG, Z_INDEXDB_BATCH_SIZE, Z_INDEXDB_DEFAULT_CONFIG, Z_INDEXDB_MAX_VERSION, Z_LANG_CACHE_KEY, Z_LANG_TO_LOCALE, Z_STORAGE_SCOPE_FALLBACK, Z_THEME_CONFIG, Z_THEME_CSS_MAP, Z_THEME_PREFERENCES_CACHE_KEY, zBuildLegacyScopedCacheKey, zBuildLegacyScopedDbName, zBuildScopedCacheKey, zBuildScopedDbName, zConfigureStorageAppName, zGetStorageAppName, zNormalizeStorageAppName, zStripLegacyScopedCacheKey, zStripScopedCacheKey };
|
|
2829
|
+
export { ZCacheService, ZDynamicRef, ZDynamicService, ZExcelService, ZGalleryOfficeRenderService, ZHttpAbstractService, ZIndexDbService, ZOverlayContainerService, ZOverlayZIndexService, ZSubjectService, ZThemeService, ZTranslateService, Z_CACHE_DEFAULT_PREFIX, Z_CACHE_SCOPE_SEPARATOR, Z_DB_SCOPE_SEPARATOR, Z_DEFAULT_THEME, Z_DYNAMIC_ANIMATION_DURATION, Z_DYNAMIC_DATA, Z_EXCEL_BORDER_THIN, Z_EXCEL_CHAR_WIDTH_MAP, Z_EXCEL_COLORS, Z_EXCEL_DEFAULT_CONFIG, Z_EXCEL_FONT_MULTIPLIERS, Z_EXCEL_WIDTH_LIMITS, Z_HTTP_DEFAULT_CONFIG, Z_INDEXDB_BATCH_SIZE, Z_INDEXDB_DEFAULT_CONFIG, Z_INDEXDB_MAX_VERSION, Z_LANG_CACHE_KEY, Z_LANG_TO_LOCALE, Z_STORAGE_SCOPE_FALLBACK, Z_THEME_CONFIG, Z_THEME_CSS_MAP, Z_THEME_PREFERENCES_CACHE_KEY, zBuildLegacyScopedCacheKey, zBuildLegacyScopedDbName, zBuildScopedCacheKey, zBuildScopedDbName, zConfigureStorageAppName, zGetStorageAppName, zNormalizeStorageAppName, zStripLegacyScopedCacheKey, zStripScopedCacheKey };
|
|
2695
2830
|
//# sourceMappingURL=shival99-z-ui-services.mjs.map
|