@xosue-utils/inputs 0.1.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/README.md +169 -0
- package/config/inputs-config.d.ts +18 -0
- package/config/media-adapters.d.ts +24 -0
- package/fesm2022/xosue-utils-inputs.mjs +11332 -0
- package/fesm2022/xosue-utils-inputs.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/boolean-entry/boolean-entry.component.d.ts +35 -0
- package/lib/color-picker/color-picker.component.d.ts +49 -0
- package/lib/color-picker/services/color-picker-modal/color-picker-modal.service.d.ts +23 -0
- package/lib/counter-entry/counter-entry.component.d.ts +37 -0
- package/lib/date-picker/date-picker.component.d.ts +85 -0
- package/lib/date-picker/date-picker.types.d.ts +6 -0
- package/lib/date-picker/services/date-picker-modal/date-picker-modal.service.d.ts +45 -0
- package/lib/datetime-picker/datetime-picker.component.d.ts +93 -0
- package/lib/datetime-picker/services/datetime-picker-modal/datetime-picker-modal.service.d.ts +51 -0
- package/lib/decimal-entry/decimal-entry.component.d.ts +31 -0
- package/lib/email-entry/email-entry.component.d.ts +29 -0
- package/lib/index.d.ts +84 -0
- package/lib/input-overlay-coordinator.service.d.ts +16 -0
- package/lib/integer-entry/integer-entry.component.d.ts +30 -0
- package/lib/media-entry/media-entry.component.d.ts +163 -0
- package/lib/month-picker/month-picker.component.d.ts +78 -0
- package/lib/month-picker/services/month-picker-modal/month-picker-modal.service.d.ts +38 -0
- package/lib/multichoice-entry/multichoice-entry.component.d.ts +28 -0
- package/lib/multiselect-combobox/multiselect-combobox.component.d.ts +100 -0
- package/lib/multiselect-combobox/services/multiselect-combobox-modal/multiselect-combobox-modal.service.d.ts +30 -0
- package/lib/only-select/only-select.component.d.ts +90 -0
- package/lib/only-select/only-select.types.d.ts +9 -0
- package/lib/only-select/services/only-select-modal/only-select-modal.service.d.ts +29 -0
- package/lib/onlychoice-entry/onlychoice-entry.component.d.ts +28 -0
- package/lib/otp-entry/otp-entry.component.d.ts +35 -0
- package/lib/password-entry/password-entry.component.d.ts +34 -0
- package/lib/phone-entry/phone-display.util.d.ts +19 -0
- package/lib/phone-entry/phone-entry.component.d.ts +80 -0
- package/lib/phone-entry/phone-entry.types.d.ts +6 -0
- package/lib/phone-entry/services/phone-entry-modal/phone-entry-modal.service.d.ts +24 -0
- package/lib/price-entry/price-entry.component.d.ts +42 -0
- package/lib/range-entry/range-entry.component.d.ts +74 -0
- package/lib/rating-entry/rating-entry.component.d.ts +25 -0
- package/lib/rich-text-entry/caludy-image.node.d.ts +36 -0
- package/lib/rich-text-entry/lexical-editor-theme.d.ts +3 -0
- package/lib/rich-text-entry/rich-text-entry.component.d.ts +92 -0
- package/lib/search-entry/search-entry.component.d.ts +65 -0
- package/lib/search-entry/search-entry.types.d.ts +8 -0
- package/lib/search-entry/services/search-entry-modal/search-entry-modal.service.d.ts +29 -0
- package/lib/signature-entry/signature-entry.component.d.ts +47 -0
- package/lib/slider-entry/slider-entry.component.d.ts +69 -0
- package/lib/switch-entry/switch-entry.component.d.ts +66 -0
- package/lib/tags-entry/tags-entry.component.d.ts +35 -0
- package/lib/text-area-entry/text-area-entry.component.d.ts +27 -0
- package/lib/text-entry/text-entry.component.d.ts +38 -0
- package/lib/time-picker/services/time-picker-modal/time-picker-modal.service.d.ts +30 -0
- package/lib/time-picker/time-picker.component.d.ts +70 -0
- package/lib/url-entry/url-entry.component.d.ts +29 -0
- package/package.json +55 -0
- package/public-api.d.ts +8 -0
- package/vendor/context-menu-service/context-menu-service.component.d.ts +37 -0
- package/vendor/context-menu-service/context-menu.service.d.ts +63 -0
- package/vendor/drag-scroll.directive.d.ts +10 -0
- package/vendor/field-help-tooltip/field-help-tooltip.component.d.ts +9 -0
- package/vendor/file-size.pipe.d.ts +7 -0
- package/vendor/lucide-icon/lucide-icon.component.d.ts +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# @xosue-utils/inputs
|
|
2
|
+
|
|
3
|
+
Librería Angular 19 de inputs standalone (text, select, date, media, rich-text, …), extraída de Caludy.
|
|
4
|
+
|
|
5
|
+
## Estructura
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
inputs/
|
|
9
|
+
package.json # manifiesto npm
|
|
10
|
+
ng-package.json # build con ng-packagr
|
|
11
|
+
src/
|
|
12
|
+
public-api.ts # API pública
|
|
13
|
+
config/ # provideXosueUtilsInputs / media adapters
|
|
14
|
+
lib/ # componentes de input
|
|
15
|
+
vendor/ # lucide-icon, field-help-tooltip, context-menu, pipes…
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Requisitos del host
|
|
19
|
+
|
|
20
|
+
En `app.config.ts` (o `main`):
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
provideXosueUtilsInputs,
|
|
25
|
+
provideXosueUtilsMedia,
|
|
26
|
+
ContextMenuServiceComponent,
|
|
27
|
+
} from '@xosue-utils/inputs';
|
|
28
|
+
import { environment } from './enviroments/environment';
|
|
29
|
+
import { AuthService } from './core/services/auth.service';
|
|
30
|
+
import { MediaPreviewService } from '...';
|
|
31
|
+
import { MediaViewerService } from '...';
|
|
32
|
+
|
|
33
|
+
export const appConfig = {
|
|
34
|
+
providers: [
|
|
35
|
+
...provideXosueUtilsInputs({
|
|
36
|
+
apiUrl: environment.apiUrl,
|
|
37
|
+
getAuthToken: () => inject(AuthService).getToken(), // o closure con tu auth
|
|
38
|
+
}),
|
|
39
|
+
// Solo si usas <media-entry>
|
|
40
|
+
...provideXosueUtilsMedia({
|
|
41
|
+
preview: inject(MediaPreviewService),
|
|
42
|
+
viewer: inject(MediaViewerService),
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Montá el overlay de context-menu una vez (field-help):
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<context-menu-service></context-menu-service>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Desarrollo local (sin publicar)
|
|
55
|
+
|
|
56
|
+
En el `package.json` de tu app:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@xosue-utils/inputs": "file:../xosue-utils/inputs"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
O en `tsconfig.json` (path mapping sin build):
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
"paths": {
|
|
68
|
+
"@xosue-utils/inputs": ["../xosue-utils/inputs/src/public-api.ts"],
|
|
69
|
+
"@xosue-utils/inputs/*": ["../xosue-utils/inputs/src/*"]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Build del paquete
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
cd D:\apps\xosue-utils\inputs
|
|
77
|
+
npm install
|
|
78
|
+
npm run build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
La salida queda en `dist/` lista para publicar.
|
|
82
|
+
|
|
83
|
+
## Cómo subirla a npm (librería oficial)
|
|
84
|
+
|
|
85
|
+
### 1) Cuenta y scope
|
|
86
|
+
|
|
87
|
+
1. Creá cuenta en [https://www.npmjs.com/signup](https://www.npmjs.com/signup)
|
|
88
|
+
2. Verificá el email
|
|
89
|
+
3. Creá una **organización** (recomendado) p.ej. `xosue-utils`:
|
|
90
|
+
- [https://www.npmjs.com/org/create](https://www.npmjs.com/org/create)
|
|
91
|
+
4. El nombre del paquete ya es `@xosue-utils/inputs` (scope = org)
|
|
92
|
+
|
|
93
|
+
Si la org `xosue-utils` no está libre, cambiá en `package.json`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"name": "@tu-org/inputs"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2) Login
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npm login
|
|
103
|
+
# usuario, password, email, OTP si tenés 2FA
|
|
104
|
+
npm whoami
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3) Publicar
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cd D:\apps\xosue-utils\inputs
|
|
111
|
+
npm run build
|
|
112
|
+
npm publish ./dist --access public
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- `--access public` es obligatorio la primera vez en scopes gratuitos.
|
|
116
|
+
- Si el paquete debe ser **privado** (npm Pro): omití `--access public` y usá plan de pago.
|
|
117
|
+
- El build deja el paquete listo en `dist/` (ahí está el `package.json` que se publica).
|
|
118
|
+
|
|
119
|
+
### 4) Versionado
|
|
120
|
+
|
|
121
|
+
Antes de cada release:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm version patch # 0.1.0 → 0.1.1
|
|
125
|
+
# o: npm version minor / major
|
|
126
|
+
npm run build
|
|
127
|
+
npm publish ./dist --access public
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 5) Usar desde un proyecto
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm install @xosue-utils/inputs
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { TextEntryComponent, OnlySelectComponent } from '@xosue-utils/inputs';
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 6) GitHub Packages (alternativa a npmjs)
|
|
141
|
+
|
|
142
|
+
Si preferís GitHub:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# .npmrc en xosue-utils/inputs
|
|
146
|
+
@xosue-utils:registry=https://npm.pkg.github.com
|
|
147
|
+
//npm.pkg.github.com/:_authToken=YOUR_GH_TOKEN
|
|
148
|
+
|
|
149
|
+
npm publish ./dist
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Y en la app:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm install @xosue-utils/inputs --registry=https://npm.pkg.github.com
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Peer dependencies
|
|
159
|
+
|
|
160
|
+
El host debe instalar (si aún no las tiene):
|
|
161
|
+
|
|
162
|
+
- `@angular/*` 19
|
|
163
|
+
- `@lucide/angular`
|
|
164
|
+
- `lexical` + `@lexical/*` (rich-text)
|
|
165
|
+
- `luxon`, `sortablejs`, `rxjs`
|
|
166
|
+
|
|
167
|
+
## Nota
|
|
168
|
+
|
|
169
|
+
`media-entry` exige `provideXosueUtilsMedia(...)`. El resto de inputs solo necesita `provideXosueUtilsInputs(...)`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
+
import { type XosueUtilsMediaPreview, type XosueUtilsMediaViewer } from './media-adapters';
|
|
3
|
+
export * from './media-adapters';
|
|
4
|
+
/**
|
|
5
|
+
* Configuración que cada app host debe proveer al usar @xosue-utils/inputs.
|
|
6
|
+
*/
|
|
7
|
+
export interface XosueUtilsInputsConfig {
|
|
8
|
+
/** Base URL del API (sin slash final), p.ej. https://api.ejemplo.com */
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
/** Token Bearer actual, o null si no hay sesión. */
|
|
11
|
+
getAuthToken: () => string | null;
|
|
12
|
+
}
|
|
13
|
+
export declare const XOSUE_UTILS_INPUTS_CONFIG: InjectionToken<XosueUtilsInputsConfig>;
|
|
14
|
+
export declare function provideXosueUtilsInputs(config: XosueUtilsInputsConfig): Provider[];
|
|
15
|
+
export declare function provideXosueUtilsMedia(options: {
|
|
16
|
+
preview: XosueUtilsMediaPreview;
|
|
17
|
+
viewer: XosueUtilsMediaViewer;
|
|
18
|
+
}): Provider[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
/** Estado mutable para resolver URLs de imagen desde el backend. */
|
|
3
|
+
export interface BackendMediaImageUrlState {
|
|
4
|
+
cache: Record<string, string>;
|
|
5
|
+
pending: Set<string>;
|
|
6
|
+
failed: Set<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createBackendMediaImageUrlState(): BackendMediaImageUrlState;
|
|
9
|
+
export type GeneralViewerMode = 'image' | 'video' | 'audio' | 'document' | 'download';
|
|
10
|
+
/**
|
|
11
|
+
* Contrato mínimo que el host debe implementar (adaptador sobre MediaPreviewService).
|
|
12
|
+
*/
|
|
13
|
+
export interface XosueUtilsMediaPreview {
|
|
14
|
+
scheduleBackendImageDisplayUrl(hash: string, state: BackendMediaImageUrlState, onReady: () => void): string;
|
|
15
|
+
resolveImageUrlForMetadata(hashOrUrl: string): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
export declare const XOSUE_UTILS_MEDIA_PREVIEW: InjectionToken<XosueUtilsMediaPreview>;
|
|
18
|
+
/**
|
|
19
|
+
* Contrato mínimo del visor global (adaptador sobre MediaViewerService).
|
|
20
|
+
*/
|
|
21
|
+
export interface XosueUtilsMediaViewer {
|
|
22
|
+
open(params: Record<string, unknown>): void;
|
|
23
|
+
}
|
|
24
|
+
export declare const XOSUE_UTILS_MEDIA_VIEWER: InjectionToken<XosueUtilsMediaViewer>;
|