@wordpress/media-fields 0.23.0 → 0.25.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/build/alt_text/index.cjs +31 -57
- package/build/alt_text/index.cjs.map +1 -7
- package/build/attached_to/edit.cjs +98 -133
- package/build/attached_to/edit.cjs.map +1 -7
- package/build/attached_to/index.cjs +33 -38
- package/build/attached_to/index.cjs.map +1 -7
- package/build/attached_to/view.cjs +25 -46
- package/build/attached_to/view.cjs.map +1 -7
- package/build/author/index.cjs +43 -56
- package/build/author/index.cjs.map +1 -7
- package/build/author/view.cjs +67 -74
- package/build/author/view.cjs.map +1 -7
- package/build/caption/index.cjs +21 -39
- package/build/caption/index.cjs.map +1 -7
- package/build/date_added/index.cjs +13 -34
- package/build/date_added/index.cjs.map +1 -7
- package/build/date_modified/index.cjs +13 -34
- package/build/date_modified/index.cjs.map +1 -7
- package/build/description/index.cjs +22 -40
- package/build/description/index.cjs.map +1 -7
- package/build/filename/index.cjs +33 -39
- package/build/filename/index.cjs.map +1 -7
- package/build/filename/view.cjs +23 -51
- package/build/filename/view.cjs.map +1 -7
- package/build/filesize/index.cjs +54 -83
- package/build/filesize/index.cjs.map +1 -7
- package/build/index.cjs +111 -63
- package/build/media_dimensions/index.cjs +19 -42
- package/build/media_dimensions/index.cjs.map +1 -7
- package/build/media_thumbnail/index.cjs +30 -36
- package/build/media_thumbnail/index.cjs.map +1 -7
- package/build/media_thumbnail/view.cjs +117 -162
- package/build/media_thumbnail/view.cjs.map +1 -7
- package/build/mime_type/index.cjs +16 -37
- package/build/mime_type/index.cjs.map +1 -7
- package/build/types.cjs +4 -18
- package/build/utils/get-media-type-from-mime-type.cjs +41 -56
- package/build/utils/get-media-type-from-mime-type.cjs.map +1 -7
- package/build/utils/get-raw-content.cjs +23 -38
- package/build/utils/get-raw-content.cjs.map +1 -7
- package/build/utils/get-rendered-content.cjs +23 -38
- package/build/utils/get-rendered-content.cjs.map +1 -7
- package/build-module/alt_text/index.mjs +25 -35
- package/build-module/alt_text/index.mjs.map +1 -7
- package/build-module/attached_to/edit.mjs +88 -110
- package/build-module/attached_to/edit.mjs.map +1 -7
- package/build-module/attached_to/index.mjs +12 -14
- package/build-module/attached_to/index.mjs.map +1 -7
- package/build-module/attached_to/view.mjs +19 -24
- package/build-module/attached_to/view.mjs.map +1 -7
- package/build-module/author/index.mjs +23 -32
- package/build-module/author/index.mjs.map +1 -7
- package/build-module/author/view.mjs +47 -53
- package/build-module/author/view.mjs.map +1 -7
- package/build-module/caption/index.mjs +16 -18
- package/build-module/caption/index.mjs.map +1 -7
- package/build-module/date_added/index.mjs +10 -14
- package/build-module/date_added/index.mjs.map +1 -7
- package/build-module/date_modified/index.mjs +10 -14
- package/build-module/date_modified/index.mjs.map +1 -7
- package/build-module/description/index.mjs +16 -18
- package/build-module/description/index.mjs.map +1 -7
- package/build-module/filename/index.mjs +13 -15
- package/build-module/filename/index.mjs.map +1 -7
- package/build-module/filename/view.mjs +16 -28
- package/build-module/filename/view.mjs.map +1 -7
- package/build-module/filesize/index.mjs +50 -63
- package/build-module/filesize/index.mjs.map +1 -7
- package/build-module/index.mjs +13 -28
- package/build-module/media_dimensions/index.mjs +15 -22
- package/build-module/media_dimensions/index.mjs.map +1 -7
- package/build-module/media_thumbnail/index.mjs +11 -13
- package/build-module/media_thumbnail/index.mjs.map +1 -7
- package/build-module/media_thumbnail/view.mjs +94 -136
- package/build-module/media_thumbnail/view.mjs.map +1 -7
- package/build-module/mime_type/index.mjs +13 -17
- package/build-module/mime_type/index.mjs.map +1 -7
- package/build-module/types.mjs +0 -1
- package/build-module/utils/get-media-type-from-mime-type.mjs +37 -32
- package/build-module/utils/get-media-type-from-mime-type.mjs.map +1 -7
- package/build-module/utils/get-raw-content.mjs +19 -14
- package/build-module/utils/get-raw-content.mjs.map +1 -7
- package/build-module/utils/get-rendered-content.mjs +19 -14
- package/build-module/utils/get-rendered-content.mjs.map +1 -7
- package/build-style/style-rtl.css +3 -3
- package/build-style/style.css +3 -3
- package/package.json +14 -14
- package/build/index.cjs.map +0 -7
- package/build/types.cjs.map +0 -7
- package/build-module/index.mjs.map +0 -7
- package/build-module/types.mjs.map +0 -7
package/build/author/index.cjs
CHANGED
|
@@ -1,67 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
28
|
+
let _wordpress_data = require("@wordpress/data");
|
|
29
|
+
let _wordpress_core_data = require("@wordpress/core-data");
|
|
30
|
+
let __view_tsx = require("./view.cjs");
|
|
31
|
+
__view_tsx = __toESM(__view_tsx);
|
|
30
32
|
// packages/media-fields/src/author/index.tsx
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
per_page: -1,
|
|
50
|
-
who: "authors",
|
|
51
|
-
_fields: "id,name",
|
|
52
|
-
context: "view"
|
|
53
|
-
}
|
|
54
|
-
) ?? [];
|
|
55
|
-
return authors.map(({ id, name }) => ({
|
|
56
|
-
value: id,
|
|
57
|
-
label: name
|
|
58
|
-
}));
|
|
59
|
-
},
|
|
60
|
-
render: import_view.default,
|
|
61
|
-
filterBy: {
|
|
62
|
-
operators: ["isAny", "isNone"]
|
|
63
|
-
},
|
|
64
|
-
readOnly: true
|
|
33
|
+
const authorField = {
|
|
34
|
+
label: (0, _wordpress_i18n.__)("Author"),
|
|
35
|
+
id: "author",
|
|
36
|
+
type: "integer",
|
|
37
|
+
getElements: async () => {
|
|
38
|
+
return (await (0, _wordpress_data.resolveSelect)(_wordpress_core_data.store).getEntityRecords("root", "user", {
|
|
39
|
+
per_page: -1,
|
|
40
|
+
who: "authors",
|
|
41
|
+
_fields: "id,name",
|
|
42
|
+
context: "view"
|
|
43
|
+
}) ?? []).map(({ id, name }) => ({
|
|
44
|
+
value: id,
|
|
45
|
+
label: name
|
|
46
|
+
}));
|
|
47
|
+
},
|
|
48
|
+
render: __view_tsx.default,
|
|
49
|
+
filterBy: { operators: ["isAny", "isNone"] },
|
|
50
|
+
readOnly: true
|
|
65
51
|
};
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
exports.default = authorField;
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/author/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport type { MediaItem } from '../types';\nimport AuthorView from './view';\n\ninterface Author {\n\tid: number;\n\tname: string;\n}\n\nconst authorField: Partial< Field< MediaItem > > = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\ttype: 'integer',\n\tgetElements: async () => {\n\t\tconst authors: Author[] =\n\t\t\t( await resolveSelect( coreDataStore ).getEntityRecords< Author >(\n\t\t\t\t'root',\n\t\t\t\t'user',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\twho: 'authors',\n\t\t\t\t\t_fields: 'id,name',\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t}\n\t\t\t) ) ?? [];\n\t\treturn authors.map( ( { id, name } ) => ( {\n\t\t\tvalue: id,\n\t\t\tlabel: name,\n\t\t} ) );\n\t},\n\trender: AuthorView,\n\tfilterBy: {\n\t\toperators: [ 'isAny', 'isNone' ],\n\t},\n\treadOnly: true,\n};\n\nexport default authorField;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAmB;AACnB,kBAA8B;AAC9B,uBAAuC;AAEvC,kBAAuB;AAOvB,IAAM,cAA6C;AAAA,EAClD,WAAO,gBAAI,QAAS;AAAA,EACpB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa,YAAY;AACxB,UAAM,UACH,UAAM,2BAAe,iBAAAA,KAAc,EAAE;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,QACC,UAAU;AAAA,QACV,KAAK;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,MACV;AAAA,IACD,KAAO,CAAC;AACT,WAAO,QAAQ,IAAK,CAAE,EAAE,IAAI,KAAK,OAAS;AAAA,MACzC,OAAO;AAAA,MACP,OAAO;AAAA,IACR,EAAI;AAAA,EACL;AAAA,EACA,QAAQ,YAAAC;AAAA,EACR,UAAU;AAAA,IACT,WAAW,CAAE,SAAS,QAAS;AAAA,EAChC;AAAA,EACA,UAAU;AACX;AAEA,IAAO,iBAAQ;",
|
|
6
|
-
"names": ["coreDataStore", "AuthorView"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__","resolveSelect","coreDataStore","AuthorView"],"sources":["../../src/author/index.tsx"],"sourcesContent":["import type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport type { MediaItem } from '../types';\nimport AuthorView from './view';\n\ninterface Author {\n\tid: number;\n\tname: string;\n}\n\nconst authorField: Partial< Field< MediaItem > > = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\ttype: 'integer',\n\tgetElements: async () => {\n\t\tconst authors: Author[] =\n\t\t\t( await resolveSelect( coreDataStore ).getEntityRecords< Author >(\n\t\t\t\t'root',\n\t\t\t\t'user',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t\twho: 'authors',\n\t\t\t\t\t_fields: 'id,name',\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t}\n\t\t\t) ) ?? [];\n\t\treturn authors.map( ( { id, name } ) => ( {\n\t\t\tvalue: id,\n\t\t\tlabel: name,\n\t\t} ) );\n\t},\n\trender: AuthorView,\n\tfilterBy: {\n\t\toperators: [ 'isAny', 'isNone' ],\n\t},\n\treadOnly: true,\n};\n\nexport default authorField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,cAA6C;CAClD,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,QAAS;CACpB,IAAI;CACJ,MAAM;CACN,aAAa,YAAY;EAYxB,QAVG,OAAA,GAAMC,gBAAAA,cAAAA,CAAeC,qBAAAA,KAAc,CAAC,CAAC,iBACtC,QACA,QACA;GACC,UAAU;GACV,KAAK;GACL,SAAS;GACT,SAAS;EACV,CACD,KAAO,CAAC,EAAA,CACM,KAAO,EAAE,IAAI,YAAc;GACzC,OAAO;GACP,OAAO;EACR,EAAI;CACL;CACA,QAAQC,WAAAA;CACR,UAAU,EACT,WAAW,CAAE,SAAS,QAAS,EAChC;CACA,UAAU;AACX"}
|
package/build/author/view.cjs
CHANGED
|
@@ -1,85 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let clsx = require("clsx");
|
|
28
|
+
clsx = __toESM(clsx);
|
|
29
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
30
|
+
let _wordpress_element = require("@wordpress/element");
|
|
31
|
+
let _wordpress_icons = require("@wordpress/icons");
|
|
32
|
+
let _wordpress_components = require("@wordpress/components");
|
|
33
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
30
34
|
// packages/media-fields/src/author/view.tsx
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"img",
|
|
72
|
-
{
|
|
73
|
-
ref: imgRef,
|
|
74
|
-
onLoad: handleLoad,
|
|
75
|
-
alt: (0, import_i18n.__)("Author avatar"),
|
|
76
|
-
src: imageUrl
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
),
|
|
81
|
-
!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "media-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.commentAuthorAvatar }) }),
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "media-author-field__name", children: text })
|
|
83
|
-
] });
|
|
35
|
+
function AuthorView({ item }) {
|
|
36
|
+
const author = item?._embedded?.author?.[0];
|
|
37
|
+
const text = author?.name;
|
|
38
|
+
const imageUrl = author?.avatar_urls?.[48];
|
|
39
|
+
const [loadingState, setLoadingState] = (0, _wordpress_element.useState)("loading");
|
|
40
|
+
(0, _wordpress_element.useEffect)(() => {
|
|
41
|
+
setLoadingState("loading");
|
|
42
|
+
}, [imageUrl]);
|
|
43
|
+
const imgRef = (0, _wordpress_element.useCallback)((img) => {
|
|
44
|
+
if (img?.complete) setLoadingState("instant");
|
|
45
|
+
}, []);
|
|
46
|
+
const handleLoad = () => {
|
|
47
|
+
if (loadingState === "loading") setLoadingState("loaded");
|
|
48
|
+
};
|
|
49
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalHStack, {
|
|
50
|
+
alignment: "left",
|
|
51
|
+
spacing: 0,
|
|
52
|
+
children: [
|
|
53
|
+
!!imageUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
54
|
+
className: (0, clsx.default)("media-author-field__avatar", {
|
|
55
|
+
"is-loading": loadingState === "loading",
|
|
56
|
+
"is-loaded": loadingState === "loaded"
|
|
57
|
+
}),
|
|
58
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
59
|
+
ref: imgRef,
|
|
60
|
+
onLoad: handleLoad,
|
|
61
|
+
alt: (0, _wordpress_i18n.__)("Author avatar"),
|
|
62
|
+
src: imageUrl
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
!imageUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
66
|
+
className: "media-author-field__icon",
|
|
67
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Icon, { icon: _wordpress_icons.commentAuthorAvatar })
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
70
|
+
className: "media-author-field__name",
|
|
71
|
+
children: text
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
});
|
|
84
75
|
}
|
|
85
|
-
|
|
76
|
+
exports.default = AuthorView;
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=view.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/author/view.tsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport {\n\t__experimentalHStack as HStack,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nexport default function AuthorView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst author = item?._embedded?.author?.[ 0 ];\n\tconst text = author?.name;\n\tconst imageUrl = author?.avatar_urls?.[ 48 ];\n\n\t/*\n\t * Use three states to avoid fade-in animation for cached images:\n\t * 'instant' = image already cached, 'loading' = waiting, 'loaded' = just finished.\n\t */\n\tconst [ loadingState, setLoadingState ] = useState<\n\t\t'instant' | 'loading' | 'loaded'\n\t>( 'loading' );\n\n\tuseEffect( () => {\n\t\tsetLoadingState( 'loading' );\n\t}, [ imageUrl ] );\n\n\tconst imgRef = useCallback( ( img: HTMLImageElement | null ) => {\n\t\tif ( img?.complete ) {\n\t\t\tsetLoadingState( 'instant' );\n\t\t}\n\t}, [] );\n\n\tconst handleLoad = () => {\n\t\tif ( loadingState === 'loading' ) {\n\t\t\tsetLoadingState( 'loaded' );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'media-author-field__avatar', {\n\t\t\t\t\t\t'is-loading': loadingState === 'loading',\n\t\t\t\t\t\t'is-loaded': loadingState === 'loaded',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tref={ imgRef }\n\t\t\t\t\t\tonLoad={ handleLoad }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"media-author-field__icon\">\n\t\t\t\t\t<WCIcon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"media-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAmB;AACnB,qBAAiD;AACjD,mBAAkD;AAClD,wBAGO;AAoCL;AAhCa,SAAR,WAA6B;AAAA,EACnC;AACD,GAA2C;AAC1C,QAAM,SAAS,MAAM,WAAW,SAAU,CAAE;AAC5C,QAAM,OAAO,QAAQ;AACrB,QAAM,WAAW,QAAQ,cAAe,EAAG;AAM3C,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAEvC,SAAU;AAEb,gCAAW,MAAM;AAChB,oBAAiB,SAAU;AAAA,EAC5B,GAAG,CAAE,QAAS,CAAE;AAEhB,QAAM,aAAS,4BAAa,CAAE,QAAkC;AAC/D,QAAK,KAAK,UAAW;AACpB,sBAAiB,SAAU;AAAA,IAC5B;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,aAAa,MAAM;AACxB,QAAK,iBAAiB,WAAY;AACjC,sBAAiB,QAAS;AAAA,IAC3B;AAAA,EACD;AAEA,SACC,6CAAC,kBAAAA,sBAAA,EAAO,WAAU,QAAO,SAAU,GAChC;AAAA,KAAC,CAAE,YACJ;AAAA,MAAC;AAAA;AAAA,QACA,eAAY,YAAAC,SAAM,8BAA8B;AAAA,UAC/C,cAAc,iBAAiB;AAAA,UAC/B,aAAa,iBAAiB;AAAA,QAC/B,CAAE;AAAA,QAEF;AAAA,UAAC;AAAA;AAAA,YACA,KAAM;AAAA,YACN,QAAS;AAAA,YACT,SAAM,gBAAI,eAAgB;AAAA,YAC1B,KAAM;AAAA;AAAA,QACP;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,YACH,4CAAC,SAAI,WAAU,4BACd,sDAAC,kBAAAC,MAAA,EAAO,MAAO,aAAAC,qBAAa,GAC7B;AAAA,IAED,4CAAC,UAAK,WAAU,4BAA6B,gBAAM;AAAA,KACpD;AAEF;",
|
|
6
|
-
"names": ["HStack", "clsx", "WCIcon", "authorIcon"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"view.cjs","names":["useState","useCallback","HStack","__","WCIcon","authorIcon"],"sources":["../../src/author/view.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport { commentAuthorAvatar as authorIcon } from '@wordpress/icons';\nimport {\n\t__experimentalHStack as HStack,\n\tIcon as WCIcon,\n} from '@wordpress/components';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nexport default function AuthorView( {\n\titem,\n}: DataViewRenderFieldProps< MediaItem > ) {\n\tconst author = item?._embedded?.author?.[ 0 ];\n\tconst text = author?.name;\n\tconst imageUrl = author?.avatar_urls?.[ 48 ];\n\n\t/*\n\t * Use three states to avoid fade-in animation for cached images:\n\t * 'instant' = image already cached, 'loading' = waiting, 'loaded' = just finished.\n\t */\n\tconst [ loadingState, setLoadingState ] = useState<\n\t\t'instant' | 'loading' | 'loaded'\n\t>( 'loading' );\n\n\tuseEffect( () => {\n\t\tsetLoadingState( 'loading' );\n\t}, [ imageUrl ] );\n\n\tconst imgRef = useCallback( ( img: HTMLImageElement | null ) => {\n\t\tif ( img?.complete ) {\n\t\t\tsetLoadingState( 'instant' );\n\t\t}\n\t}, [] );\n\n\tconst handleLoad = () => {\n\t\tif ( loadingState === 'loading' ) {\n\t\t\tsetLoadingState( 'loaded' );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ !! imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'media-author-field__avatar', {\n\t\t\t\t\t\t'is-loading': loadingState === 'loading',\n\t\t\t\t\t\t'is-loaded': loadingState === 'loaded',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tref={ imgRef }\n\t\t\t\t\t\tonLoad={ handleLoad }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"media-author-field__icon\">\n\t\t\t\t\t<WCIcon icon={ authorIcon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"media-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAwB,WAAY,EACnC,QAC0C;CAC1C,MAAM,SAAS,MAAM,WAAW,SAAU;CAC1C,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,QAAQ,cAAe;CAMxC,MAAM,CAAE,cAAc,oBAAA,GAAoBA,mBAAAA,SAAAA,CAEvC,SAAU;CAEb,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,gBAAiB,SAAU;CAC5B,GAAG,CAAE,QAAS,CAAE;CAEhB,MAAM,UAAA,GAASC,mBAAAA,YAAAA,EAAe,QAAkC;EAC/D,IAAK,KAAK,UACT,gBAAiB,SAAU;CAE7B,GAAG,CAAC,CAAE;CAEN,MAAM,mBAAmB;EACxB,IAAK,iBAAiB,WACrB,gBAAiB,QAAS;CAE5B;CAEA,OACC,iBAAA,GAAA,kBAAA,KAAA,CAACC,sBAAAA,sBAAD;EAAQ,WAAU;EAAO,SAAU;EAAnC,UAAA;GACG,CAAC,CAAE,YACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACC,YAAA,GAAY,KAAA,QAAA,CAAM,8BAA8B;KAC/C,cAAc,iBAAiB;KAC/B,aAAa,iBAAiB;IAC/B,CAAE;IAEF,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KACC,KAAM;KACN,QAAS;KACT,MAAA,GAAMC,gBAAAA,GAAAA,CAAI,eAAgB;KAC1B,KAAM;IACN,CAAA;GACG,CAAA;GAEJ,CAAE,YACH,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IACd,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,MAAD,EAAQ,MAAOC,iBAAAA,oBAAc,CAAA;GACzB,CAAA;GAEN,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAA6B,UAAA;GAAY,CAAA;EAClD;;AAEV"}
|
package/build/caption/index.cjs
CHANGED
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/media-fields/src/caption/index.tsx
|
|
21
|
-
var caption_exports = {};
|
|
22
|
-
__export(caption_exports, {
|
|
23
|
-
default: () => caption_default
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
6
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
7
|
+
let ___utils_get_raw_content_ts = require("../utils/get-raw-content.cjs");
|
|
8
|
+
// packages/media-fields/src/caption/index.tsx
|
|
9
|
+
const captionField = {
|
|
10
|
+
id: "caption",
|
|
11
|
+
type: "text",
|
|
12
|
+
label: (0, _wordpress_i18n.__)("Caption"),
|
|
13
|
+
getValue: ({ item }) => (0, ___utils_get_raw_content_ts.getRawContent)(item?.caption),
|
|
14
|
+
render: ({ item }) => (0, ___utils_get_raw_content_ts.getRawContent)(item?.caption) || "-",
|
|
15
|
+
Edit: {
|
|
16
|
+
control: "textarea",
|
|
17
|
+
rows: 2
|
|
18
|
+
},
|
|
19
|
+
enableSorting: false,
|
|
20
|
+
filterBy: false
|
|
40
21
|
};
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
exports.default = captionField;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/caption/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\nimport { getRawContent } from '../utils/get-raw-content';\n\nconst captionField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'caption',\n\ttype: 'text',\n\tlabel: __( 'Caption' ),\n\tgetValue: ( { item } ) => getRawContent( item?.caption ),\n\trender: ( { item } ) => getRawContent( item?.caption ) || '-',\n\tEdit: {\n\t\tcontrol: 'textarea',\n\t\trows: 2,\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\nexport default captionField;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AAGnB,6BAA8B;AAE9B,IAAM,eAA4D;AAAA,EACjE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,SAAU;AAAA,EACrB,UAAU,CAAE,EAAE,KAAK,UAAO,sCAAe,MAAM,OAAQ;AAAA,EACvD,QAAQ,CAAE,EAAE,KAAK,UAAO,sCAAe,MAAM,OAAQ,KAAK;AAAA,EAC1D,MAAM;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AACX;AAEA,IAAO,kBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__","getRawContent"],"sources":["../../src/caption/index.tsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\nimport { getRawContent } from '../utils/get-raw-content';\n\nconst captionField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'caption',\n\ttype: 'text',\n\tlabel: __( 'Caption' ),\n\tgetValue: ( { item } ) => getRawContent( item?.caption ),\n\trender: ( { item } ) => getRawContent( item?.caption ) || '-',\n\tEdit: {\n\t\tcontrol: 'textarea',\n\t\trows: 2,\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\nexport default captionField;\n"],"mappings":";;;;;;;;AAKA,MAAM,eAA4D;CACjE,IAAI;CACJ,MAAM;CACN,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,SAAU;CACrB,WAAY,EAAE,YAAA,GAAYC,4BAAAA,cAAAA,CAAe,MAAM,OAAQ;CACvD,SAAU,EAAE,YAAA,GAAYA,4BAAAA,cAAAA,CAAe,MAAM,OAAQ,KAAK;CAC1D,MAAM;EACL,SAAS;EACT,MAAM;CACP;CACA,eAAe;CACf,UAAU;AACX"}
|
|
@@ -1,37 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/media-fields/src/date_added/index.tsx
|
|
21
|
-
var date_added_exports = {};
|
|
22
|
-
__export(date_added_exports, {
|
|
23
|
-
default: () => date_added_default
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
operators: ["before", "after"]
|
|
33
|
-
},
|
|
34
|
-
readOnly: true
|
|
6
|
+
// packages/media-fields/src/date_added/index.tsx
|
|
7
|
+
const dateAddedField = {
|
|
8
|
+
id: "date",
|
|
9
|
+
type: "datetime",
|
|
10
|
+
label: (0, require("@wordpress/i18n").__)("Date added"),
|
|
11
|
+
filterBy: { operators: ["before", "after"] },
|
|
12
|
+
readOnly: true
|
|
35
13
|
};
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
exports.default = dateAddedField;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/date_added/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nconst dateAddedField: Partial< Field< MediaItem > > = {\n\tid: 'date',\n\ttype: 'datetime',\n\tlabel: __( 'Date added' ),\n\tfilterBy: {\n\t\toperators: [ 'before', 'after' ],\n\t},\n\treadOnly: true,\n};\n\nexport default dateAddedField;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AAInB,IAAM,iBAAgD;AAAA,EACrD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,YAAa;AAAA,EACxB,UAAU;AAAA,IACT,WAAW,CAAE,UAAU,OAAQ;AAAA,EAChC;AAAA,EACA,UAAU;AACX;AAEA,IAAO,qBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__"],"sources":["../../src/date_added/index.tsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nconst dateAddedField: Partial< Field< MediaItem > > = {\n\tid: 'date',\n\ttype: 'datetime',\n\tlabel: __( 'Date added' ),\n\tfilterBy: {\n\t\toperators: [ 'before', 'after' ],\n\t},\n\treadOnly: true,\n};\n\nexport default dateAddedField;\n"],"mappings":";;;;;;AAIA,MAAM,iBAAgD;CACrD,IAAI;CACJ,MAAM;CACN,QAAA,G,yBAAOA,CAAAA,CAAAA,GAAAA,CAAI,YAAa;CACxB,UAAU,EACT,WAAW,CAAE,UAAU,OAAQ,EAChC;CACA,UAAU;AACX"}
|
|
@@ -1,37 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/media-fields/src/date_modified/index.tsx
|
|
21
|
-
var date_modified_exports = {};
|
|
22
|
-
__export(date_modified_exports, {
|
|
23
|
-
default: () => date_modified_default
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
operators: ["before", "after"]
|
|
33
|
-
},
|
|
34
|
-
readOnly: true
|
|
6
|
+
// packages/media-fields/src/date_modified/index.tsx
|
|
7
|
+
const dateModifiedField = {
|
|
8
|
+
id: "modified",
|
|
9
|
+
type: "datetime",
|
|
10
|
+
label: (0, require("@wordpress/i18n").__)("Date modified"),
|
|
11
|
+
filterBy: { operators: ["before", "after"] },
|
|
12
|
+
readOnly: true
|
|
35
13
|
};
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
exports.default = dateModifiedField;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/date_modified/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nconst dateModifiedField: Partial< Field< MediaItem > > = {\n\tid: 'modified',\n\ttype: 'datetime',\n\tlabel: __( 'Date modified' ),\n\tfilterBy: {\n\t\toperators: [ 'before', 'after' ],\n\t},\n\treadOnly: true,\n};\n\nexport default dateModifiedField;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AAInB,IAAM,oBAAmD;AAAA,EACxD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,eAAgB;AAAA,EAC3B,UAAU;AAAA,IACT,WAAW,CAAE,UAAU,OAAQ;AAAA,EAChC;AAAA,EACA,UAAU;AACX;AAEA,IAAO,wBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__"],"sources":["../../src/date_modified/index.tsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport type { Field } from '@wordpress/dataviews';\nimport type { MediaItem } from '../types';\n\nconst dateModifiedField: Partial< Field< MediaItem > > = {\n\tid: 'modified',\n\ttype: 'datetime',\n\tlabel: __( 'Date modified' ),\n\tfilterBy: {\n\t\toperators: [ 'before', 'after' ],\n\t},\n\treadOnly: true,\n};\n\nexport default dateModifiedField;\n"],"mappings":";;;;;;AAIA,MAAM,oBAAmD;CACxD,IAAI;CACJ,MAAM;CACN,QAAA,G,yBAAOA,CAAAA,CAAAA,GAAAA,CAAI,eAAgB;CAC3B,UAAU,EACT,WAAW,CAAE,UAAU,OAAQ,EAChC;CACA,UAAU;AACX"}
|
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/media-fields/src/description/index.tsx
|
|
21
|
-
var description_exports = {};
|
|
22
|
-
__export(description_exports, {
|
|
23
|
-
default: () => description_default
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
7
|
+
let ___utils_get_raw_content_ts = require("../utils/get-raw-content.cjs");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
// packages/media-fields/src/description/index.tsx
|
|
10
|
+
const descriptionField = {
|
|
11
|
+
id: "description",
|
|
12
|
+
type: "text",
|
|
13
|
+
label: (0, _wordpress_i18n.__)("Description"),
|
|
14
|
+
getValue: ({ item }) => (0, ___utils_get_raw_content_ts.getRawContent)(item?.description),
|
|
15
|
+
render: ({ item }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: (0, ___utils_get_raw_content_ts.getRawContent)(item?.description) || "-" }),
|
|
16
|
+
Edit: {
|
|
17
|
+
control: "textarea",
|
|
18
|
+
rows: 5
|
|
19
|
+
},
|
|
20
|
+
enableSorting: false,
|
|
21
|
+
filterBy: false
|
|
41
22
|
};
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
exports.default = descriptionField;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/description/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\nimport { getRawContent } from '../utils/get-raw-content';\n\nconst descriptionField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'description',\n\ttype: 'text',\n\tlabel: __( 'Description' ),\n\tgetValue: ( { item } ) => getRawContent( item?.description ),\n\trender: ( { item } ) => (\n\t\t<div>{ getRawContent( item?.description ) || '-' }</div>\n\t),\n\tEdit: {\n\t\tcontrol: 'textarea',\n\t\trows: 5,\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\nexport default descriptionField;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AAGnB,6BAA8B;AAQ5B;AANF,IAAM,mBAAgE;AAAA,EACrE,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,WAAO,gBAAI,aAAc;AAAA,EACzB,UAAU,CAAE,EAAE,KAAK,UAAO,sCAAe,MAAM,WAAY;AAAA,EAC3D,QAAQ,CAAE,EAAE,KAAK,MAChB,4CAAC,SAAM,oDAAe,MAAM,WAAY,KAAK,KAAK;AAAA,EAEnD,MAAM;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,EACP;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AACX;AAEA,IAAO,sBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__","getRawContent"],"sources":["../../src/description/index.tsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport type { Attachment, Updatable } from '@wordpress/core-data';\nimport type { Field } from '@wordpress/dataviews';\nimport { getRawContent } from '../utils/get-raw-content';\n\nconst descriptionField: Partial< Field< Updatable< Attachment > > > = {\n\tid: 'description',\n\ttype: 'text',\n\tlabel: __( 'Description' ),\n\tgetValue: ( { item } ) => getRawContent( item?.description ),\n\trender: ( { item } ) => (\n\t\t<div>{ getRawContent( item?.description ) || '-' }</div>\n\t),\n\tEdit: {\n\t\tcontrol: 'textarea',\n\t\trows: 5,\n\t},\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\nexport default descriptionField;\n"],"mappings":";;;;;;;;;AAKA,MAAM,mBAAgE;CACrE,IAAI;CACJ,MAAM;CACN,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,aAAc;CACzB,WAAY,EAAE,YAAA,GAAYC,4BAAAA,cAAAA,CAAe,MAAM,WAAY;CAC3D,SAAU,EAAE,WACX,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAA,WAAA,GAAOA,4BAAAA,cAAAA,CAAe,MAAM,WAAY,KAAK,IAAU,CAAA;CAExD,MAAM;EACL,SAAS;EACT,MAAM;CACP;CACA,eAAe;CACf,UAAU;AACX"}
|