@webx-ui/module-media 0.2.0 → 0.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.
@@ -1,17 +1,31 @@
1
- import { MediaKind, MediaValue } from './types';
1
+ import { MediaAspect, MediaKind, MediaValue } from './types';
2
2
  /**
3
3
  * A picture on a form, with the words this entity uses for it.
4
4
  *
5
- * `alt` and `title` live here rather than on the file because one picture is used by two
6
- * articles and needs two captions. What the field stores is the key and those words; the
7
- * address is worked out when the page is drawn, so moving the library to another disk changes
8
- * nothing here.
5
+ * Two states and nothing in between: an empty frame that opens the library, and the picture
6
+ * with what can be done to it. `alt` and `title` live here rather than on the file, because one
7
+ * picture used by two articles needs two captions — and they are localized for the same reason
8
+ * everything else on a form is.
9
+ *
10
+ * What the field stores is the key and those words. The address is worked out when the page is
11
+ * drawn, so moving the library to another disk changes nothing written before.
9
12
  */
10
13
  type __VLS_Props = {
11
14
  label?: string;
12
15
  accept?: MediaKind | null;
13
16
  /** Off for a decorative picture, where a caption is noise. */
14
17
  captions?: boolean;
18
+ /**
19
+ * Shape of the frame: one of the presets, any `width / height`, or `null` for a fixed
20
+ * height instead.
21
+ *
22
+ * A field that holds a cover and a field that holds an avatar are not the same shape, and
23
+ * the frame should say which before anything is in it.
24
+ */
25
+ aspect?: MediaAspect | null;
26
+ /** Height of the frame when there is no aspect — a number in pixels, or any CSS length. */
27
+ height?: number | string;
28
+ disabled?: boolean;
15
29
  };
16
30
  type __VLS_PublicProps = {
17
31
  modelValue?: MediaValue | null;
@@ -22,7 +36,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
22
36
  "onUpdate:modelValue"?: ((value: MediaValue | null) => any) | undefined;
23
37
  }>, {
24
38
  label: string;
25
- accept: MediaKind | null;
39
+ disabled: boolean;
40
+ height: number | string;
26
41
  captions: boolean;
42
+ accept: MediaKind | null;
43
+ aspect: MediaAspect | null;
27
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
28
45
  export default _default;
@@ -10,6 +10,8 @@ type __VLS_Props = {
10
10
  canUpload: boolean;
11
11
  canManage: boolean;
12
12
  selected: number;
13
+ /** The caller asked for one kind of file, so there is nothing to filter by. */
14
+ fixedType?: boolean;
13
15
  /** Narrow screens get the folders behind a button instead of beside the files. */
14
16
  compact: boolean;
15
17
  };
package/dist/api.d.ts CHANGED
@@ -9,6 +9,13 @@ export interface MediaApi {
9
9
  deleteDirectory(id: number, force?: boolean): Promise<void>;
10
10
  files(query?: FileQuery): Promise<MediaPage>;
11
11
  file(id: number): Promise<MediaFile>;
12
+ /**
13
+ * The file behind a key.
14
+ *
15
+ * An entity stores the key and nothing else, so this is how a form draws the picture it
16
+ * saved last time. `null` when the file is gone from the library.
17
+ */
18
+ fileByPath(path: string): Promise<MediaFile | null>;
12
19
  upload(directoryId: number, files: File[], onProgress?: (percent: number) => void): Promise<MediaFile[]>;
13
20
  rename(id: number, name: string): Promise<MediaFile>;
14
21
  move(ids: number[], directoryId: number): Promise<number>;
package/dist/index.d.ts CHANGED
@@ -19,4 +19,4 @@ export { default as WxMediaManager } from './MediaManager';
19
19
  export { default as WxMediaPage } from './MediaPage';
20
20
  export { default as WxMediaPicker } from './MediaPicker';
21
21
  export { default as WxMediaField } from './MediaField';
22
- export type { DirectoryNotEmpty, EditOperations, FileQuery, MediaDirectory, MediaFile, MediaKind, MediaPage, MediaValue, } from './types';
22
+ export type { DirectoryNotEmpty, EditOperations, FileQuery, MediaDirectory, MediaFile, MediaAspect, MediaKind, MediaPage, MediaValue, } from './types';