@pallasoft/ps-mobile-components 1.3.0 → 1.5.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/dist/components/ps-action-menu/ps-action-menu-entries.js +1 -0
- package/dist/components/ps-action-menu/ps-action-menu.android.js +19 -30
- package/dist/components/ps-action-sheet/ps-action-sheet.js +6 -4
- package/dist/components/ps-barcode-scanner-sheet/index.d.ts +2 -0
- package/dist/components/ps-barcode-scanner-sheet/index.js +2 -0
- package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet-props.d.ts +11 -0
- package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet-props.js +1 -0
- package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet.d.ts +2 -0
- package/dist/components/ps-barcode-scanner-sheet/ps-barcode-scanner-sheet.js +82 -0
- package/dist/components/ps-button/ps-button.js +4 -2
- package/dist/components/ps-cartesian-chart/ps-cartesian-chart.js +25 -19
- package/dist/components/ps-checkbox/ps-checkbox.js +5 -2
- package/dist/components/ps-chip/ps-chip.js +3 -1
- package/dist/components/ps-date-field/ps-date-field.android.js +1 -1
- package/dist/components/ps-date-field/ps-date-field.ios.js +1 -1
- package/dist/components/ps-document-page/ps-document-page-props.d.ts +3 -0
- package/dist/components/ps-document-page/ps-document-page.d.ts +1 -1
- package/dist/components/ps-document-page/ps-document-page.js +16 -7
- package/dist/components/ps-document-page-strip/index.d.ts +2 -0
- package/dist/components/ps-document-page-strip/index.js +2 -0
- package/dist/components/ps-document-page-strip/ps-document-page-strip-props.d.ts +6 -0
- package/dist/components/ps-document-page-strip/ps-document-page-strip-props.js +1 -0
- package/dist/components/ps-document-page-strip/ps-document-page-strip.d.ts +2 -0
- package/dist/components/ps-document-page-strip/ps-document-page-strip.js +43 -0
- package/dist/components/ps-document-pdf-cover/index.d.ts +2 -0
- package/dist/components/ps-document-pdf-cover/index.js +2 -0
- package/dist/components/ps-document-pdf-cover/ps-document-pdf-cover-props.d.ts +6 -0
- package/dist/components/ps-document-pdf-cover/ps-document-pdf-cover-props.js +1 -0
- package/dist/components/ps-document-pdf-cover/ps-document-pdf-cover.d.ts +2 -0
- package/dist/components/ps-document-pdf-cover/ps-document-pdf-cover.js +18 -0
- package/dist/components/ps-document-preview/ps-document-preview.js +3 -4
- package/dist/components/ps-document-preview-face/index.d.ts +2 -0
- package/dist/components/ps-document-preview-face/index.js +2 -0
- package/dist/components/ps-document-preview-face/ps-document-preview-face-props.d.ts +6 -0
- package/dist/components/ps-document-preview-face/ps-document-preview-face-props.js +1 -0
- package/dist/components/ps-document-preview-face/ps-document-preview-face.d.ts +2 -0
- package/dist/components/ps-document-preview-face/ps-document-preview-face.js +18 -0
- package/dist/components/ps-document-text-page/index.d.ts +2 -0
- package/dist/components/ps-document-text-page/index.js +2 -0
- package/dist/components/ps-document-text-page/ps-document-text-page-props.d.ts +6 -0
- package/dist/components/ps-document-text-page/ps-document-text-page-props.js +1 -0
- package/dist/components/ps-document-text-page/ps-document-text-page.d.ts +2 -0
- package/dist/components/ps-document-text-page/ps-document-text-page.js +18 -0
- package/dist/components/ps-document-unsupported/index.d.ts +2 -0
- package/dist/components/ps-document-unsupported/index.js +2 -0
- package/dist/components/ps-document-unsupported/ps-document-unsupported-props.d.ts +7 -0
- package/dist/components/ps-document-unsupported/ps-document-unsupported-props.js +1 -0
- package/dist/components/ps-document-unsupported/ps-document-unsupported.d.ts +2 -0
- package/dist/components/ps-document-unsupported/ps-document-unsupported.js +10 -0
- package/dist/components/ps-document-viewer/ps-document-viewer.js +27 -7
- package/dist/components/ps-header-action/index.d.ts +2 -0
- package/dist/components/ps-header-action/index.js +2 -0
- package/dist/components/ps-header-action/ps-header-action-props.d.ts +6 -0
- package/dist/components/ps-header-action/ps-header-action-props.js +1 -0
- package/dist/components/ps-header-action/ps-header-action.android.d.ts +2 -0
- package/dist/components/ps-header-action/ps-header-action.android.js +9 -0
- package/dist/components/ps-header-action/ps-header-action.d.ts +2 -0
- package/dist/components/ps-header-action/ps-header-action.js +11 -0
- package/dist/components/ps-header-menu/index.d.ts +2 -0
- package/dist/components/ps-header-menu/index.js +2 -0
- package/dist/components/ps-header-menu/ps-header-menu-props.d.ts +7 -0
- package/dist/components/ps-header-menu/ps-header-menu-props.js +1 -0
- package/dist/components/ps-header-menu/ps-header-menu.android.d.ts +2 -0
- package/dist/components/ps-header-menu/ps-header-menu.android.js +11 -0
- package/dist/components/ps-header-menu/ps-header-menu.d.ts +2 -0
- package/dist/components/ps-header-menu/ps-header-menu.js +20 -0
- package/dist/components/ps-icon-button/ps-icon-button.js +7 -7
- package/dist/components/ps-kpi-card/ps-kpi-card.js +1 -2
- package/dist/components/ps-list/ps-list-action-row.d.ts +1 -1
- package/dist/components/ps-list/ps-list-action-row.js +9 -8
- package/dist/components/ps-list/ps-list-context-menu.android.d.ts +2 -0
- package/dist/components/ps-list/ps-list-context-menu.android.js +3 -0
- package/dist/components/ps-list/ps-list-link-menu.android.d.ts +2 -0
- package/dist/components/ps-list/ps-list-link-menu.android.js +7 -0
- package/dist/components/ps-list/ps-list-link-row-props.d.ts +1 -0
- package/dist/components/ps-list/ps-list-link-row.d.ts +1 -1
- package/dist/components/ps-list/ps-list-link-row.js +7 -7
- package/dist/components/ps-list/ps-list-props.d.ts +2 -0
- package/dist/components/ps-list/ps-list-row-body.d.ts +2 -2
- package/dist/components/ps-list/ps-list-row-body.js +7 -4
- package/dist/components/ps-list/ps-list-row-menu.d.ts +10 -0
- package/dist/components/ps-list/ps-list-row-menu.js +27 -0
- package/dist/components/ps-list/ps-list-row.d.ts +1 -1
- package/dist/components/ps-list/ps-list-row.js +2 -2
- package/dist/components/ps-list/ps-list-select-row.js +2 -1
- package/dist/components/ps-menu-popup/index.d.ts +4 -0
- package/dist/components/ps-menu-popup/index.js +4 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-divider.d.ts +1 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-divider.js +7 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-header.d.ts +5 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-header.js +8 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-row.d.ts +12 -0
- package/dist/components/ps-menu-popup/ps-menu-popup-row.js +22 -0
- package/dist/components/ps-menu-popup/ps-menu-popup.d.ts +9 -0
- package/dist/components/ps-menu-popup/ps-menu-popup.js +35 -0
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider-props.d.ts +1 -0
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.d.ts +1 -1
- package/dist/components/ps-mobile-theme-provider/ps-mobile-theme-provider.js +8 -2
- package/dist/components/ps-native-menu/ps-native-menu-row.js +5 -5
- package/dist/components/ps-native-menu/ps-native-menu.android.js +16 -24
- package/dist/components/ps-option-picker/ps-option-picker.js +3 -1
- package/dist/components/ps-page-header/ps-page-header.js +3 -1
- package/dist/components/ps-pallasoft-sign-in-button/ps-pallasoft-sign-in-button.js +3 -1
- package/dist/components/ps-screen/ps-screen.js +9 -4
- package/dist/components/ps-search-field/ps-search-field.js +3 -1
- package/dist/components/ps-segmented-control/ps-segmented-control.android.js +4 -9
- package/dist/components/ps-selection-mode/ps-selection-bar.d.ts +9 -0
- package/dist/components/ps-selection-mode/ps-selection-bar.js +49 -0
- package/dist/components/ps-selection-mode/ps-selection-mode.android.d.ts +2 -0
- package/dist/components/ps-selection-mode/ps-selection-mode.android.js +23 -0
- package/dist/components/ps-sheet-content/ps-sheet-content.js +1 -1
- package/dist/components/ps-sheet-presenter/ps-sheet-presenter.android.js +4 -4
- package/dist/components/ps-sortable-grid/ps-sortable-item.js +2 -0
- package/dist/components/ps-spinner/ps-spinner.android.d.ts +2 -0
- package/dist/components/ps-spinner/ps-spinner.android.js +13 -0
- package/dist/components/ps-switch/ps-switch.android.d.ts +2 -0
- package/dist/components/ps-switch/ps-switch.android.js +25 -0
- package/dist/components/ps-switcher/index.d.ts +2 -0
- package/dist/components/ps-switcher/index.js +2 -0
- package/dist/components/ps-switcher/ps-switcher-panel.d.ts +10 -0
- package/dist/components/ps-switcher/ps-switcher-panel.js +17 -0
- package/dist/components/ps-switcher/ps-switcher-props.d.ts +12 -0
- package/dist/components/ps-switcher/ps-switcher-props.js +1 -0
- package/dist/components/ps-switcher/ps-switcher-row.d.ts +7 -0
- package/dist/components/ps-switcher/ps-switcher-row.js +33 -0
- package/dist/components/ps-switcher/ps-switcher-trigger.d.ts +11 -0
- package/dist/components/ps-switcher/ps-switcher-trigger.js +35 -0
- package/dist/components/ps-switcher/ps-switcher.d.ts +2 -0
- package/dist/components/ps-switcher/ps-switcher.js +21 -0
- package/dist/components/ps-tab-bar-provider/ps-tab-bar-provider.js +1 -1
- package/dist/components/ps-tabs/ps-tabs.js +3 -1
- package/dist/components/ps-waterfall-chart/index.d.ts +2 -0
- package/dist/components/ps-waterfall-chart/index.js +2 -0
- package/dist/components/ps-waterfall-chart/ps-waterfall-chart-props.d.ts +9 -0
- package/dist/components/ps-waterfall-chart/ps-waterfall-chart-props.js +1 -0
- package/dist/components/ps-waterfall-chart/ps-waterfall-chart.d.ts +2 -0
- package/dist/components/ps-waterfall-chart/ps-waterfall-chart.js +37 -0
- package/dist/components/ps-widget-list/ps-widget-list.js +1 -1
- package/dist/constants/ps-android-state-config.d.ts +12 -0
- package/dist/constants/ps-android-state-config.js +12 -0
- package/dist/constants/ps-barcode-permission.d.ts +6 -0
- package/dist/constants/ps-barcode-permission.js +5 -0
- package/dist/constants/ps-barcode-scanner-config.d.ts +18 -0
- package/dist/constants/ps-barcode-scanner-config.js +31 -0
- package/dist/constants/ps-capture-config.d.ts +12 -0
- package/dist/constants/ps-capture-config.js +22 -0
- package/dist/constants/ps-capture-source.d.ts +7 -0
- package/dist/constants/ps-capture-source.js +6 -0
- package/dist/constants/ps-cartesian-series-shape.d.ts +5 -0
- package/dist/constants/ps-cartesian-series-shape.js +4 -0
- package/dist/constants/ps-chart-brand-config.d.ts +21 -0
- package/dist/constants/ps-chart-brand-config.js +10 -0
- package/dist/constants/ps-document-config.d.ts +3 -0
- package/dist/constants/ps-document-config.js +3 -0
- package/dist/constants/ps-document-file-config.d.ts +11 -0
- package/dist/constants/ps-document-file-config.js +11 -0
- package/dist/constants/ps-document-kind.d.ts +1 -0
- package/dist/constants/ps-document-kind.js +1 -0
- package/dist/constants/ps-document-load-status.d.ts +7 -0
- package/dist/constants/ps-document-load-status.js +6 -0
- package/dist/constants/ps-document-pdf-config.d.ts +14 -0
- package/dist/constants/ps-document-pdf-config.js +14 -0
- package/dist/constants/ps-header-config.d.ts +3 -0
- package/dist/constants/ps-header-config.js +3 -0
- package/dist/constants/ps-menu-popup-config.d.ts +10 -0
- package/dist/constants/ps-menu-popup-config.js +10 -0
- package/dist/constants/ps-mobile-icon-key.d.ts +1 -0
- package/dist/constants/ps-quick-action-config.d.ts +4 -0
- package/dist/constants/ps-quick-action-config.js +4 -0
- package/dist/constants/ps-ripple-kind.d.ts +8 -0
- package/dist/constants/ps-ripple-kind.js +7 -0
- package/dist/constants/ps-selection-bar-config.d.ts +4 -0
- package/dist/constants/ps-selection-bar-config.js +4 -0
- package/dist/constants/ps-sf-symbol-config.d.ts +1 -0
- package/dist/constants/ps-sf-symbol-config.js +1 -0
- package/dist/constants/ps-sortable-grid-config.d.ts +2 -1
- package/dist/constants/ps-sortable-grid-config.js +2 -1
- package/dist/constants/ps-switcher-config.d.ts +12 -0
- package/dist/constants/ps-switcher-config.js +12 -0
- package/dist/contexts/ps-tab-bar-context.js +1 -0
- package/dist/hooks/use-ps-barcode-scanner.d.ts +2 -0
- package/dist/hooks/use-ps-barcode-scanner.js +9 -0
- package/dist/hooks/use-ps-document-open.d.ts +3 -0
- package/dist/hooks/use-ps-document-open.js +14 -0
- package/dist/hooks/use-ps-document-pdf-cover.d.ts +3 -0
- package/dist/hooks/use-ps-document-pdf-cover.js +33 -0
- package/dist/hooks/use-ps-document-pdf-pages.d.ts +3 -0
- package/dist/hooks/use-ps-document-pdf-pages.js +31 -0
- package/dist/hooks/use-ps-document-text.d.ts +3 -0
- package/dist/hooks/use-ps-document-text.js +29 -0
- package/dist/hooks/use-ps-file-upload.d.ts +3 -0
- package/dist/hooks/use-ps-file-upload.js +32 -0
- package/dist/hooks/use-ps-header-right.d.ts +2 -0
- package/dist/hooks/use-ps-header-right.js +9 -0
- package/dist/hooks/use-ps-material-scheme.d.ts +2 -0
- package/dist/hooks/use-ps-material-scheme.js +3 -0
- package/dist/hooks/use-ps-menu-anchor.d.ts +10 -0
- package/dist/hooks/use-ps-menu-anchor.js +13 -0
- package/dist/hooks/use-ps-quick-actions.d.ts +2 -0
- package/dist/hooks/use-ps-quick-actions.js +30 -0
- package/dist/hooks/use-ps-stack-screen-options.d.ts +2 -0
- package/dist/hooks/use-ps-stack-screen-options.js +7 -0
- package/dist/hooks/use-ps-top-inset.d.ts +1 -0
- package/dist/hooks/use-ps-top-inset.js +10 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +43 -0
- package/dist/interfaces/ps-barcode-frame-size.d.ts +4 -0
- package/dist/interfaces/ps-barcode-frame-size.js +1 -0
- package/dist/interfaces/ps-barcode-last-read.d.ts +4 -0
- package/dist/interfaces/ps-barcode-last-read.js +1 -0
- package/dist/interfaces/ps-barcode-scan.d.ts +4 -0
- package/dist/interfaces/ps-barcode-scan.js +1 -0
- package/dist/interfaces/ps-barcode-scanner-labels.d.ts +8 -0
- package/dist/interfaces/ps-barcode-scanner-labels.js +1 -0
- package/dist/interfaces/ps-barcode-scanner-native.d.ts +23 -0
- package/dist/interfaces/ps-barcode-scanner-native.js +1 -0
- package/dist/interfaces/ps-capture-labels.d.ts +6 -0
- package/dist/interfaces/ps-capture-labels.js +1 -0
- package/dist/interfaces/ps-capture-menu-options.d.ts +6 -0
- package/dist/interfaces/ps-capture-menu-options.js +1 -0
- package/dist/interfaces/ps-capture-modules.d.ts +6 -0
- package/dist/interfaces/ps-capture-modules.js +1 -0
- package/dist/interfaces/ps-capture-options.d.ts +6 -0
- package/dist/interfaces/ps-capture-options.js +1 -0
- package/dist/interfaces/ps-cartesian-chart-series.d.ts +2 -0
- package/dist/interfaces/ps-date-dialog-colors.d.ts +19 -0
- package/dist/interfaces/ps-date-dialog-colors.js +1 -0
- package/dist/interfaces/ps-device-file.d.ts +6 -0
- package/dist/interfaces/ps-device-file.js +1 -0
- package/dist/interfaces/ps-document-file-system.d.ts +2 -0
- package/dist/interfaces/ps-document-file-system.js +1 -0
- package/dist/interfaces/ps-document-labels.d.ts +1 -0
- package/dist/interfaces/ps-document-page-image.d.ts +5 -0
- package/dist/interfaces/ps-document-page-image.js +1 -0
- package/dist/interfaces/ps-document-pdf-native.d.ts +9 -0
- package/dist/interfaces/ps-document-pdf-native.js +1 -0
- package/dist/interfaces/ps-document-pdf-options.d.ts +4 -0
- package/dist/interfaces/ps-document-pdf-options.js +1 -0
- package/dist/interfaces/ps-document-pdf-state.d.ts +6 -0
- package/dist/interfaces/ps-document-pdf-state.js +1 -0
- package/dist/interfaces/ps-document-viewer-entry.d.ts +8 -0
- package/dist/interfaces/ps-document-viewer-entry.js +1 -0
- package/dist/interfaces/ps-file-opener.d.ts +4 -0
- package/dist/interfaces/ps-file-opener.js +1 -0
- package/dist/interfaces/ps-file-upload-options.d.ts +8 -0
- package/dist/interfaces/ps-file-upload-options.js +1 -0
- package/dist/interfaces/ps-material-scheme.d.ts +38 -0
- package/dist/interfaces/ps-material-scheme.js +1 -0
- package/dist/interfaces/ps-material-segmented-colors.d.ts +14 -0
- package/dist/interfaces/ps-material-segmented-colors.js +1 -0
- package/dist/interfaces/ps-material-switch-colors.d.ts +14 -0
- package/dist/interfaces/ps-material-switch-colors.js +1 -0
- package/dist/interfaces/ps-menu-anchor.d.ts +6 -0
- package/dist/interfaces/ps-menu-anchor.js +1 -0
- package/dist/interfaces/ps-menu-item.d.ts +1 -0
- package/dist/interfaces/ps-menu-popup-layout.d.ts +6 -0
- package/dist/interfaces/ps-menu-popup-layout.js +1 -0
- package/dist/interfaces/ps-menu-popup-window.d.ts +4 -0
- package/dist/interfaces/ps-menu-popup-window.js +1 -0
- package/dist/interfaces/ps-mobile-theme-input.d.ts +2 -0
- package/dist/interfaces/ps-quick-action-native.d.ts +14 -0
- package/dist/interfaces/ps-quick-action-native.js +1 -0
- package/dist/interfaces/ps-quick-action.d.ts +7 -0
- package/dist/interfaces/ps-quick-action.js +1 -0
- package/dist/interfaces/ps-scanned-file.d.ts +2 -5
- package/dist/interfaces/ps-stack-screen-options.d.ts +2 -0
- package/dist/interfaces/ps-stack-screen-options.js +1 -0
- package/dist/interfaces/ps-switcher-item.d.ts +11 -0
- package/dist/interfaces/ps-switcher-item.js +1 -0
- package/dist/interfaces/ps-tab-bar-context-data.d.ts +1 -0
- package/dist/interfaces/ps-tab-bar-icon-colors.d.ts +4 -0
- package/dist/interfaces/ps-tab-bar-icon-colors.js +1 -0
- package/dist/interfaces/ps-tab-bar-label-style.d.ts +5 -0
- package/dist/interfaces/ps-tab-bar-label-style.js +1 -0
- package/dist/interfaces/ps-tab-bar-label-styles.d.ts +5 -0
- package/dist/interfaces/ps-tab-bar-label-styles.js +1 -0
- package/dist/interfaces/ps-tab-bar-style.d.ts +12 -0
- package/dist/interfaces/ps-tab-bar-style.js +1 -0
- package/dist/interfaces/ps-waterfall-datum.d.ts +6 -0
- package/dist/interfaces/ps-waterfall-datum.js +1 -0
- package/dist/interfaces/ps-waterfall-step.d.ts +7 -0
- package/dist/interfaces/ps-waterfall-step.js +1 -0
- package/dist/interfaces/use-ps-barcode-scanner-result.d.ts +6 -0
- package/dist/interfaces/use-ps-barcode-scanner-result.js +1 -0
- package/dist/interfaces/use-ps-document-open-result.d.ts +5 -0
- package/dist/interfaces/use-ps-document-open-result.js +1 -0
- package/dist/interfaces/use-ps-document-pdf-cover-result.d.ts +7 -0
- package/dist/interfaces/use-ps-document-pdf-cover-result.js +1 -0
- package/dist/interfaces/use-ps-document-pdf-pages-result.d.ts +5 -0
- package/dist/interfaces/use-ps-document-pdf-pages-result.js +1 -0
- package/dist/interfaces/use-ps-document-text-result.d.ts +5 -0
- package/dist/interfaces/use-ps-document-text-result.js +1 -0
- package/dist/interfaces/use-ps-file-upload-result.d.ts +8 -0
- package/dist/interfaces/use-ps-file-upload-result.js +1 -0
- package/dist/interfaces/use-ps-quick-actions-options.d.ts +5 -0
- package/dist/interfaces/use-ps-quick-actions-options.js +1 -0
- package/dist/services/ps-barcode-scanner-service.d.ts +14 -0
- package/dist/services/ps-barcode-scanner-service.js +53 -0
- package/dist/services/ps-button-style-service.d.ts +2 -0
- package/dist/services/ps-button-style-service.js +13 -1
- package/dist/services/ps-capture-picker-service.d.ts +12 -0
- package/dist/services/ps-capture-picker-service.js +72 -0
- package/dist/services/ps-capture-source-service.d.ts +10 -0
- package/dist/services/ps-capture-source-service.js +31 -0
- package/dist/services/ps-chart-brand-service.d.ts +4 -0
- package/dist/services/ps-chart-brand-service.js +20 -0
- package/dist/services/ps-chart-shape-service.d.ts +7 -0
- package/dist/services/ps-chart-shape-service.js +17 -0
- package/dist/services/ps-control-style-service.js +3 -2
- package/dist/services/ps-date-picker-service.d.ts +3 -0
- package/dist/services/ps-date-picker-service.js +21 -0
- package/dist/services/ps-device-file-bytes-service.d.ts +6 -0
- package/dist/services/ps-device-file-bytes-service.js +19 -0
- package/dist/services/ps-device-file-service.d.ts +14 -0
- package/dist/services/ps-device-file-service.js +27 -0
- package/dist/services/ps-document-file-service.d.ts +10 -0
- package/dist/services/ps-document-file-service.js +75 -0
- package/dist/services/ps-document-open-service.d.ts +5 -0
- package/dist/services/ps-document-open-service.js +16 -0
- package/dist/services/ps-document-pdf-service.d.ts +10 -0
- package/dist/services/ps-document-pdf-service.js +40 -0
- package/dist/services/ps-document-text-service.d.ts +5 -0
- package/dist/services/ps-document-text-service.js +14 -0
- package/dist/services/ps-document-viewer-entry-service.d.ts +11 -0
- package/dist/services/ps-document-viewer-entry-service.js +72 -0
- package/dist/services/ps-list-row-style-service.js +2 -5
- package/dist/services/ps-material-control-service.d.ts +9 -0
- package/dist/services/ps-material-control-service.js +46 -0
- package/dist/services/ps-material-scheme-service.d.ts +5 -0
- package/dist/services/ps-material-scheme-service.js +42 -0
- package/dist/services/ps-menu-popup-service.d.ts +6 -0
- package/dist/services/ps-menu-popup-service.js +23 -0
- package/dist/services/ps-mobile-theme-service.d.ts +1 -1
- package/dist/services/ps-mobile-theme-service.js +7 -2
- package/dist/services/ps-navigation-theme-service.d.ts +5 -0
- package/dist/services/ps-navigation-theme-service.js +21 -0
- package/dist/services/ps-pdf-native-service.d.ts +8 -0
- package/dist/services/ps-pdf-native-service.js +33 -0
- package/dist/services/ps-quick-action-service.d.ts +9 -0
- package/dist/services/ps-quick-action-service.js +31 -0
- package/dist/services/ps-ripple-service.d.ts +7 -0
- package/dist/services/ps-ripple-service.js +26 -0
- package/dist/services/ps-screen-service.d.ts +3 -1
- package/dist/services/ps-screen-service.js +8 -2
- package/dist/services/ps-sheet-service.d.ts +1 -0
- package/dist/services/ps-sheet-service.js +3 -0
- package/dist/services/ps-stack-options-service.d.ts +5 -0
- package/dist/services/ps-stack-options-service.js +18 -0
- package/dist/services/ps-state-service.d.ts +7 -0
- package/dist/services/ps-state-service.js +26 -0
- package/dist/services/ps-switcher-service.d.ts +6 -0
- package/dist/services/ps-switcher-service.js +15 -0
- package/dist/services/ps-tab-bar-style-service.d.ts +5 -0
- package/dist/services/ps-tab-bar-style-service.js +30 -0
- package/dist/services/ps-waterfall-service.d.ts +10 -0
- package/dist/services/ps-waterfall-service.js +38 -0
- package/jest-setup.js +86 -3
- package/package.json +37 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PsDocumentLoadStatus } from '../constants/ps-document-load-status';
|
|
2
|
+
import type { PsDocumentPageImage } from './ps-document-page-image';
|
|
3
|
+
export interface UsePsDocumentPdfCoverResult {
|
|
4
|
+
cover: PsDocumentPageImage | null;
|
|
5
|
+
retry: () => void;
|
|
6
|
+
status: PsDocumentLoadStatus;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PsCaptureSource } from '../constants/ps-capture-source';
|
|
2
|
+
import type { PsCaptureLabels } from './ps-capture-labels';
|
|
3
|
+
import type { PsMenuItem } from './ps-menu-item';
|
|
4
|
+
export interface UsePsFileUploadResult {
|
|
5
|
+
isUploading: boolean;
|
|
6
|
+
items: (labels: PsCaptureLabels, onPicked?: (source: PsCaptureSource) => void) => PsMenuItem[];
|
|
7
|
+
pick: (source: PsCaptureSource) => Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { PsBarcodeFrameSize } from '../interfaces/ps-barcode-frame-size';
|
|
3
|
+
import type { PsBarcodeLastRead } from '../interfaces/ps-barcode-last-read';
|
|
4
|
+
import type { PsBarcodeScannerCameraProps } from '../interfaces/ps-barcode-scanner-native';
|
|
5
|
+
export declare class PsBarcodeScannerService {
|
|
6
|
+
static isAvailable(): boolean;
|
|
7
|
+
static camera(): ComponentType<PsBarcodeScannerCameraProps> | null;
|
|
8
|
+
static requestPermission(): Promise<boolean>;
|
|
9
|
+
static normalise(data: string): string;
|
|
10
|
+
static accept(previous: PsBarcodeLastRead | null, data: string, now: number): boolean;
|
|
11
|
+
static types(barcodeTypes?: string[]): string[];
|
|
12
|
+
static frameSize(width: number): PsBarcodeFrameSize;
|
|
13
|
+
private static load;
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { PsBarcodeScannerConfig } from '../constants/ps-barcode-scanner-config';
|
|
2
|
+
export class PsBarcodeScannerService {
|
|
3
|
+
static isAvailable() {
|
|
4
|
+
return PsBarcodeScannerService.load() !== null;
|
|
5
|
+
}
|
|
6
|
+
static camera() {
|
|
7
|
+
const native = PsBarcodeScannerService.load();
|
|
8
|
+
return native === null ? null : native.CameraView;
|
|
9
|
+
}
|
|
10
|
+
static async requestPermission() {
|
|
11
|
+
const native = PsBarcodeScannerService.load();
|
|
12
|
+
if (native === null)
|
|
13
|
+
return false;
|
|
14
|
+
try {
|
|
15
|
+
const response = await native.Camera.requestCameraPermissionsAsync();
|
|
16
|
+
return response.granted;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static normalise(data) {
|
|
23
|
+
return data.trim();
|
|
24
|
+
}
|
|
25
|
+
static accept(previous, data, now) {
|
|
26
|
+
if (data === '')
|
|
27
|
+
return false;
|
|
28
|
+
if (previous === null)
|
|
29
|
+
return true;
|
|
30
|
+
return previous.data !== data || now - previous.at >= PsBarcodeScannerConfig.cooldownMs;
|
|
31
|
+
}
|
|
32
|
+
static types(barcodeTypes) {
|
|
33
|
+
return barcodeTypes === undefined || barcodeTypes.length === 0
|
|
34
|
+
? PsBarcodeScannerConfig.barcodeTypes
|
|
35
|
+
: barcodeTypes;
|
|
36
|
+
}
|
|
37
|
+
static frameSize(width) {
|
|
38
|
+
const frameWidth = Math.round(width * PsBarcodeScannerConfig.frameWidthFraction);
|
|
39
|
+
return {
|
|
40
|
+
height: Math.round(frameWidth * PsBarcodeScannerConfig.frameAspectRatio),
|
|
41
|
+
width: frameWidth,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static load() {
|
|
45
|
+
try {
|
|
46
|
+
const loaded = require('expo-camera');
|
|
47
|
+
return typeof loaded.CameraView === 'function' ? loaded : null;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { PsRippleKind } from '../constants/ps-ripple-kind';
|
|
1
2
|
import type { PsButtonStyleData } from '../interfaces/ps-button-style-data';
|
|
2
3
|
import type { PsMobileTheme } from '../interfaces/ps-mobile-theme';
|
|
3
4
|
export type PsButtonVariant = 'danger' | 'ghost' | 'primary' | 'secondary' | 'surface';
|
|
4
5
|
export declare class PsButtonStyleService {
|
|
6
|
+
static rippleKind(variant: PsButtonVariant): PsRippleKind;
|
|
5
7
|
static resolve(variant: PsButtonVariant, theme: PsMobileTheme): PsButtonStyleData;
|
|
6
8
|
}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { PsMobileControlConfig } from '../constants/ps-mobile-control-config';
|
|
2
|
+
import { PsRippleKind } from '../constants/ps-ripple-kind';
|
|
2
3
|
import { PsMobileColorService } from './ps-mobile-color-service';
|
|
4
|
+
import { PsStateService } from './ps-state-service';
|
|
3
5
|
export class PsButtonStyleService {
|
|
6
|
+
static rippleKind(variant) {
|
|
7
|
+
switch (variant) {
|
|
8
|
+
case 'primary':
|
|
9
|
+
return PsRippleKind.OnPrimary;
|
|
10
|
+
case 'danger':
|
|
11
|
+
return PsRippleKind.OnDanger;
|
|
12
|
+
default:
|
|
13
|
+
return PsRippleKind.Surface;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
4
16
|
static resolve(variant, theme) {
|
|
5
17
|
const hover = PsMobileColorService.withAlpha(theme.primary, PsMobileControlConfig.pressedBorderAlpha);
|
|
6
18
|
switch (variant) {
|
|
@@ -25,7 +37,7 @@ export class PsButtonStyleService {
|
|
|
25
37
|
background: theme.surface,
|
|
26
38
|
border: theme.line,
|
|
27
39
|
foreground: theme.ink,
|
|
28
|
-
pressedBackground:
|
|
40
|
+
pressedBackground: PsStateService.pressedFill(theme, theme.surface),
|
|
29
41
|
pressedBorder: hover,
|
|
30
42
|
};
|
|
31
43
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PsCaptureSource } from '../constants/ps-capture-source';
|
|
2
|
+
import type { PsCaptureOptions } from '../interfaces/ps-capture-options';
|
|
3
|
+
import type { PsDeviceFile } from '../interfaces/ps-device-file';
|
|
4
|
+
export declare class PsCapturePickerService {
|
|
5
|
+
static pick(source: PsCaptureSource, options?: PsCaptureOptions): Promise<PsDeviceFile[]>;
|
|
6
|
+
private static pickRaw;
|
|
7
|
+
private static scan;
|
|
8
|
+
private static pickImage;
|
|
9
|
+
private static pickDocument;
|
|
10
|
+
private static loadImagePicker;
|
|
11
|
+
private static loadDocumentPicker;
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { PsCaptureConfig } from '../constants/ps-capture-config';
|
|
2
|
+
import { PsCaptureSource } from '../constants/ps-capture-source';
|
|
3
|
+
import { PsDeviceFileBytesService } from './ps-device-file-bytes-service';
|
|
4
|
+
import { PsDeviceFileService } from './ps-device-file-service';
|
|
5
|
+
import { PsDocumentScannerService } from './ps-document-scanner-service';
|
|
6
|
+
export class PsCapturePickerService {
|
|
7
|
+
static async pick(source, options = {}) {
|
|
8
|
+
const files = await PsCapturePickerService.pickRaw(source, options);
|
|
9
|
+
return files.map((file) => PsDeviceFileBytesService.withBytes(file));
|
|
10
|
+
}
|
|
11
|
+
static async pickRaw(source, options) {
|
|
12
|
+
if (source === PsCaptureSource.Scan)
|
|
13
|
+
return PsCapturePickerService.scan(options);
|
|
14
|
+
const file = source === PsCaptureSource.Files
|
|
15
|
+
? await PsCapturePickerService.pickDocument(options)
|
|
16
|
+
: await PsCapturePickerService.pickImage(source === PsCaptureSource.Camera, options);
|
|
17
|
+
return file === null ? [] : [file];
|
|
18
|
+
}
|
|
19
|
+
static async scan(options) {
|
|
20
|
+
if (!PsDocumentScannerService.isAvailable()) {
|
|
21
|
+
const file = await PsCapturePickerService.pickImage(true, options);
|
|
22
|
+
return file === null ? [] : [file];
|
|
23
|
+
}
|
|
24
|
+
return PsDocumentScannerService.scan({
|
|
25
|
+
fileName: options.scanFileName === undefined ? PsCaptureConfig.scanFileName : options.scanFileName,
|
|
26
|
+
jpegQuality: options.scanQuality === undefined ? PsCaptureConfig.scanQuality : options.scanQuality,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static async pickImage(isCamera, options) {
|
|
30
|
+
const picker = PsCapturePickerService.loadImagePicker();
|
|
31
|
+
if (picker === null)
|
|
32
|
+
return null;
|
|
33
|
+
if (isCamera && !(await picker.requestCameraPermissionsAsync()).granted)
|
|
34
|
+
return null;
|
|
35
|
+
const pickerOptions = {
|
|
36
|
+
mediaTypes: ['images'],
|
|
37
|
+
quality: options.imageQuality === undefined ? PsCaptureConfig.imageQuality : options.imageQuality,
|
|
38
|
+
};
|
|
39
|
+
const result = isCamera
|
|
40
|
+
? await picker.launchCameraAsync(pickerOptions)
|
|
41
|
+
: await picker.launchImageLibraryAsync(pickerOptions);
|
|
42
|
+
return result.canceled ? null : PsDeviceFileService.fromImage(result.assets[0]);
|
|
43
|
+
}
|
|
44
|
+
static async pickDocument(options) {
|
|
45
|
+
const picker = PsCapturePickerService.loadDocumentPicker();
|
|
46
|
+
if (picker === null)
|
|
47
|
+
return null;
|
|
48
|
+
const result = await picker.getDocumentAsync({
|
|
49
|
+
copyToCacheDirectory: true,
|
|
50
|
+
type: options.documentTypes === undefined
|
|
51
|
+
? [...PsCaptureConfig.documentTypes]
|
|
52
|
+
: options.documentTypes,
|
|
53
|
+
});
|
|
54
|
+
return result.canceled ? null : PsDeviceFileService.fromDocument(result.assets[0]);
|
|
55
|
+
}
|
|
56
|
+
static loadImagePicker() {
|
|
57
|
+
try {
|
|
58
|
+
return require('expo-image-picker');
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static loadDocumentPicker() {
|
|
65
|
+
try {
|
|
66
|
+
return require('expo-document-picker');
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PsCaptureSource } from '../constants/ps-capture-source';
|
|
2
|
+
import type { PsCaptureLabels } from '../interfaces/ps-capture-labels';
|
|
3
|
+
import type { PsCaptureMenuOptions } from '../interfaces/ps-capture-menu-options';
|
|
4
|
+
import type { PsMenuItem } from '../interfaces/ps-menu-item';
|
|
5
|
+
export declare class PsCaptureSourceService {
|
|
6
|
+
static hasCamera(): boolean;
|
|
7
|
+
static sources(hasCamera: boolean): PsCaptureSource[];
|
|
8
|
+
static items(labels: PsCaptureLabels, options: PsCaptureMenuOptions): PsMenuItem[];
|
|
9
|
+
private static loadDevice;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PsCaptureConfig } from '../constants/ps-capture-config';
|
|
2
|
+
import { PsCaptureSource } from '../constants/ps-capture-source';
|
|
3
|
+
export class PsCaptureSourceService {
|
|
4
|
+
static hasCamera() {
|
|
5
|
+
const device = PsCaptureSourceService.loadDevice();
|
|
6
|
+
return device === null ? true : device.isDevice;
|
|
7
|
+
}
|
|
8
|
+
static sources(hasCamera) {
|
|
9
|
+
return hasCamera
|
|
10
|
+
? [...PsCaptureConfig.order]
|
|
11
|
+
: PsCaptureConfig.order.filter((source) => source !== PsCaptureSource.Scan && source !== PsCaptureSource.Camera);
|
|
12
|
+
}
|
|
13
|
+
static items(labels, options) {
|
|
14
|
+
const hasCamera = options.hasCamera === undefined ? PsCaptureSourceService.hasCamera() : options.hasCamera;
|
|
15
|
+
return PsCaptureSourceService.sources(hasCamera).map((source) => ({
|
|
16
|
+
iconKey: PsCaptureConfig.icons[source],
|
|
17
|
+
id: source,
|
|
18
|
+
isDisabled: options.isDisabled,
|
|
19
|
+
label: labels[source],
|
|
20
|
+
onSelect: () => options.onPick(source),
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
static loadDevice() {
|
|
24
|
+
try {
|
|
25
|
+
return require('expo-device');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PsChartBrandConfig } from '../constants/ps-chart-brand-config';
|
|
2
|
+
export class PsChartBrandService {
|
|
3
|
+
static series(bases) {
|
|
4
|
+
return PsChartBrandConfig.steps.map((_, index) => {
|
|
5
|
+
const step = PsChartBrandConfig.steps[Math.floor(index / bases.length)];
|
|
6
|
+
return PsChartBrandService.mix(bases[index % bases.length], step.isWhite, step.amount);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
static mix(hex, isWhite, amount) {
|
|
10
|
+
const match = /^#([0-9a-f]{6})/i.exec(hex);
|
|
11
|
+
if (match === null)
|
|
12
|
+
return hex;
|
|
13
|
+
const target = isWhite ? 255 : 0;
|
|
14
|
+
const channels = [0, 2, 4].map((offset) => {
|
|
15
|
+
const channel = parseInt(match[1].slice(offset, offset + 2), 16);
|
|
16
|
+
return Math.round(channel + (target - channel) * amount);
|
|
17
|
+
});
|
|
18
|
+
return `#${channels.map((channel) => channel.toString(16).padStart(2, '0')).join('')}`.toUpperCase();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PsCartesianChartKind } from '../constants/ps-chart-kind';
|
|
2
|
+
import type { PsCartesianChartSeries } from '../interfaces/ps-cartesian-chart-series';
|
|
3
|
+
export declare class PsChartShapeService {
|
|
4
|
+
static barIndexes(kind: PsCartesianChartKind, series: PsCartesianChartSeries[]): number[];
|
|
5
|
+
static lineIndexes(kind: PsCartesianChartKind, series: PsCartesianChartSeries[]): number[];
|
|
6
|
+
private static indexes;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PsCartesianSeriesShape } from '../constants/ps-cartesian-series-shape';
|
|
2
|
+
import { PsChartKindService } from './ps-chart-kind-service';
|
|
3
|
+
export class PsChartShapeService {
|
|
4
|
+
static barIndexes(kind, series) {
|
|
5
|
+
if (!PsChartKindService.isBars(kind))
|
|
6
|
+
return [];
|
|
7
|
+
return PsChartShapeService.indexes(series, (entry) => entry.shape !== PsCartesianSeriesShape.Line);
|
|
8
|
+
}
|
|
9
|
+
static lineIndexes(kind, series) {
|
|
10
|
+
if (!PsChartKindService.isBars(kind))
|
|
11
|
+
return series.map((_, index) => index);
|
|
12
|
+
return PsChartShapeService.indexes(series, (entry) => entry.shape === PsCartesianSeriesShape.Line);
|
|
13
|
+
}
|
|
14
|
+
static indexes(series, matches) {
|
|
15
|
+
return series.flatMap((entry, index) => (matches(entry) ? [index] : []));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PsMobileControlConfig } from '../constants/ps-mobile-control-config';
|
|
2
|
+
import { PsStateService } from './ps-state-service';
|
|
2
3
|
export class PsControlStyleService {
|
|
3
4
|
static container(theme, state) {
|
|
4
5
|
return {
|
|
@@ -9,8 +10,8 @@ export class PsControlStyleService {
|
|
|
9
10
|
borderWidth: 1,
|
|
10
11
|
flexDirection: 'row',
|
|
11
12
|
minHeight: PsMobileControlConfig.controlHeights.default,
|
|
12
|
-
opacity: state.isDisabled ?
|
|
13
|
-
outlineColor: state.isFocused ? theme.
|
|
13
|
+
opacity: state.isDisabled ? PsStateService.disabledOpacity() : 1,
|
|
14
|
+
outlineColor: state.isFocused ? PsStateService.ringColor(theme, state.hasError) : undefined,
|
|
14
15
|
outlineOffset: state.isFocused ? PsMobileControlConfig.ringOffset : undefined,
|
|
15
16
|
outlineStyle: state.isFocused ? 'solid' : undefined,
|
|
16
17
|
outlineWidth: state.isFocused ? PsMobileControlConfig.ringWidth : undefined,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { PsDateDialogColors } from '../interfaces/ps-date-dialog-colors';
|
|
1
2
|
import type { PsDateLimits } from '../interfaces/ps-date-limits';
|
|
3
|
+
import type { PsMobileTheme } from '../interfaces/ps-mobile-theme';
|
|
2
4
|
export declare class PsDatePickerService {
|
|
3
5
|
static limits(min: string | undefined, max: string | undefined): PsDateLimits;
|
|
4
6
|
static clamp(value: string, min: string | undefined, max: string | undefined): string;
|
|
7
|
+
static dialogColors(theme: PsMobileTheme): PsDateDialogColors;
|
|
5
8
|
}
|
|
@@ -13,4 +13,25 @@ export class PsDatePickerService {
|
|
|
13
13
|
return max;
|
|
14
14
|
return value;
|
|
15
15
|
}
|
|
16
|
+
static dialogColors(theme) {
|
|
17
|
+
return {
|
|
18
|
+
containerColor: theme.surface,
|
|
19
|
+
currentYearContentColor: theme.primaryText,
|
|
20
|
+
dayContentColor: theme.ink,
|
|
21
|
+
disabledDayContentColor: theme.muted,
|
|
22
|
+
dividerColor: theme.line,
|
|
23
|
+
headlineContentColor: theme.ink,
|
|
24
|
+
navigationContentColor: theme.ink,
|
|
25
|
+
selectedDayContainerColor: theme.primary,
|
|
26
|
+
selectedDayContentColor: theme.primaryContrast,
|
|
27
|
+
selectedYearContainerColor: theme.primary,
|
|
28
|
+
selectedYearContentColor: theme.primaryContrast,
|
|
29
|
+
subheadContentColor: theme.muted,
|
|
30
|
+
titleContentColor: theme.muted,
|
|
31
|
+
todayContentColor: theme.primaryText,
|
|
32
|
+
todayDateBorderColor: theme.primaryText,
|
|
33
|
+
weekdayContentColor: theme.muted,
|
|
34
|
+
yearContentColor: theme.ink,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
16
37
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PsDeviceFile } from '../interfaces/ps-device-file';
|
|
2
|
+
import type { PsFileOpener } from '../interfaces/ps-file-opener';
|
|
3
|
+
export declare class PsDeviceFileBytesService {
|
|
4
|
+
static withBytes(file: PsDeviceFile, open?: PsFileOpener | null): PsDeviceFile;
|
|
5
|
+
private static opener;
|
|
6
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class PsDeviceFileBytesService {
|
|
2
|
+
static withBytes(file, open = PsDeviceFileBytesService.opener()) {
|
|
3
|
+
if (open === null)
|
|
4
|
+
return file;
|
|
5
|
+
return {
|
|
6
|
+
...file,
|
|
7
|
+
bytes: async () => new Uint8Array(await open(file.uri).arrayBuffer()),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
static opener() {
|
|
11
|
+
try {
|
|
12
|
+
const loaded = require('expo-file-system');
|
|
13
|
+
return typeof loaded.File === 'function' ? (uri) => new loaded.File(uri) : null;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PsDeviceFile } from '../interfaces/ps-device-file';
|
|
2
|
+
export declare class PsDeviceFileService {
|
|
3
|
+
static fromImage(asset: {
|
|
4
|
+
fileName?: string | null;
|
|
5
|
+
mimeType?: string;
|
|
6
|
+
uri: string;
|
|
7
|
+
}): PsDeviceFile;
|
|
8
|
+
static fromDocument(asset: {
|
|
9
|
+
mimeType?: string;
|
|
10
|
+
name: string;
|
|
11
|
+
uri: string;
|
|
12
|
+
}): PsDeviceFile;
|
|
13
|
+
static nameOf(uri: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PsCaptureConfig } from '../constants/ps-capture-config';
|
|
2
|
+
export class PsDeviceFileService {
|
|
3
|
+
static fromImage(asset) {
|
|
4
|
+
return {
|
|
5
|
+
name: asset.fileName === undefined || asset.fileName === null || asset.fileName === ''
|
|
6
|
+
? PsDeviceFileService.nameOf(asset.uri)
|
|
7
|
+
: asset.fileName,
|
|
8
|
+
type: asset.mimeType === undefined || asset.mimeType === ''
|
|
9
|
+
? PsCaptureConfig.imageFallbackType
|
|
10
|
+
: asset.mimeType,
|
|
11
|
+
uri: asset.uri,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static fromDocument(asset) {
|
|
15
|
+
return {
|
|
16
|
+
name: asset.name === '' ? PsDeviceFileService.nameOf(asset.uri) : asset.name,
|
|
17
|
+
type: asset.mimeType === undefined || asset.mimeType === ''
|
|
18
|
+
? PsCaptureConfig.unknownType
|
|
19
|
+
: asset.mimeType,
|
|
20
|
+
uri: asset.uri,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
static nameOf(uri) {
|
|
24
|
+
const name = uri.split('/').pop();
|
|
25
|
+
return name === undefined || name === '' ? uri : name;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PsDocumentSource } from '../interfaces/ps-document-source';
|
|
2
|
+
export declare class PsDocumentFileService {
|
|
3
|
+
static isAvailable(): boolean;
|
|
4
|
+
static local(source: PsDocumentSource, name: string, fallbackExtension: string): Promise<string | null>;
|
|
5
|
+
static readText(uri: string): Promise<string | null>;
|
|
6
|
+
static preview(uri: string, name: string): Promise<boolean>;
|
|
7
|
+
static cacheName(uri: string, name: string, fallbackExtension: string): string;
|
|
8
|
+
private static hash;
|
|
9
|
+
private static load;
|
|
10
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { PsDocumentFileConfig } from '../constants/ps-document-file-config';
|
|
2
|
+
export class PsDocumentFileService {
|
|
3
|
+
static isAvailable() {
|
|
4
|
+
return PsDocumentFileService.load() !== null;
|
|
5
|
+
}
|
|
6
|
+
static async local(source, name, fallbackExtension) {
|
|
7
|
+
const system = PsDocumentFileService.load();
|
|
8
|
+
if (system === null)
|
|
9
|
+
return null;
|
|
10
|
+
try {
|
|
11
|
+
const directory = new system.Directory(system.Paths.cache, PsDocumentFileConfig.cacheFolder);
|
|
12
|
+
if (!directory.exists)
|
|
13
|
+
directory.create({ intermediates: true });
|
|
14
|
+
const file = new system.File(directory, PsDocumentFileService.cacheName(source.uri, name, fallbackExtension));
|
|
15
|
+
if (file.exists)
|
|
16
|
+
return file.uri;
|
|
17
|
+
const saved = await system.File.downloadFileAsync(source.uri, file, {
|
|
18
|
+
headers: source.headers,
|
|
19
|
+
idempotent: true,
|
|
20
|
+
});
|
|
21
|
+
return saved.uri;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
static async readText(uri) {
|
|
28
|
+
const system = PsDocumentFileService.load();
|
|
29
|
+
if (system === null)
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
return await new system.File(uri).text();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
static async preview(uri, name) {
|
|
39
|
+
const system = PsDocumentFileService.load();
|
|
40
|
+
if (system === null)
|
|
41
|
+
return false;
|
|
42
|
+
try {
|
|
43
|
+
await system.File.preview(new system.File(uri), { title: name });
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static cacheName(uri, name, fallbackExtension) {
|
|
51
|
+
const dot = name.lastIndexOf('.');
|
|
52
|
+
const hasExtension = dot > 0 && dot < name.length - 1;
|
|
53
|
+
const base = hasExtension ? name.slice(0, dot) : name.replace(/\.$/, '');
|
|
54
|
+
const extension = hasExtension ? name.slice(dot + 1).toLowerCase() : fallbackExtension;
|
|
55
|
+
const safeBase = base.replace(PsDocumentFileConfig.unsafeName, '-');
|
|
56
|
+
return `${PsDocumentFileService.hash(uri)}-${safeBase}.${extension}`;
|
|
57
|
+
}
|
|
58
|
+
static hash(value) {
|
|
59
|
+
let hash = PsDocumentFileConfig.hashSeed;
|
|
60
|
+
for (let index = 0; index < value.length; index += 1)
|
|
61
|
+
hash =
|
|
62
|
+
(hash * PsDocumentFileConfig.hashMultiplier + value.charCodeAt(index)) %
|
|
63
|
+
PsDocumentFileConfig.hashModulus;
|
|
64
|
+
return hash.toString(PsDocumentFileConfig.hashRadix);
|
|
65
|
+
}
|
|
66
|
+
static load() {
|
|
67
|
+
try {
|
|
68
|
+
const loaded = require('expo-file-system');
|
|
69
|
+
return typeof loaded.File === 'function' ? loaded : null;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PsDocumentFileConfig } from '../constants/ps-document-file-config';
|
|
2
|
+
import { PsDocumentKind } from '../constants/ps-document-kind';
|
|
3
|
+
import { PsDocumentFileService } from './ps-document-file-service';
|
|
4
|
+
export class PsDocumentOpenService {
|
|
5
|
+
static canOpen(item) {
|
|
6
|
+
return item.source !== null;
|
|
7
|
+
}
|
|
8
|
+
static async open(item) {
|
|
9
|
+
if (item.source === null)
|
|
10
|
+
return false;
|
|
11
|
+
const uri = await PsDocumentFileService.local(item.source, item.name, item.kind === PsDocumentKind.Pdf
|
|
12
|
+
? PsDocumentFileConfig.pdfExtension
|
|
13
|
+
: PsDocumentFileConfig.fallbackExtension);
|
|
14
|
+
return uri === null ? false : PsDocumentFileService.preview(uri, item.name);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PsDocumentPdfState } from '../interfaces/ps-document-pdf-state';
|
|
2
|
+
import type { PsDocumentSource } from '../interfaces/ps-document-source';
|
|
3
|
+
export declare class PsDocumentPdfService {
|
|
4
|
+
private static readonly rendered;
|
|
5
|
+
static isAvailable(): boolean;
|
|
6
|
+
static cover(source: PsDocumentSource, name: string): Promise<PsDocumentPdfState>;
|
|
7
|
+
static pages(source: PsDocumentSource, name: string): Promise<PsDocumentPdfState>;
|
|
8
|
+
static clear(): void;
|
|
9
|
+
private static render;
|
|
10
|
+
}
|