@brilo/base-blocks 0.1.36 → 0.1.38
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/.tsbuildinfo +1 -1
- package/build/blocks/anchor/anchor-group/factory.d.ts.map +1 -1
- package/build/blocks/anchor/anchor-group/factory.js +2 -1
- package/build/blocks/anchor/anchor-group/icon.d.ts +2 -0
- package/build/blocks/anchor/anchor-group/icon.d.ts.map +1 -0
- package/build/blocks/anchor/anchor-group/icon.js +2 -0
- package/build/blocks/anchor/anchor-group/index.d.ts.map +1 -1
- package/build/blocks/anchor/anchor-group/index.js +1 -0
- package/build/blocks/career/career-header/constants.d.ts +2 -0
- package/build/blocks/career/career-header/constants.d.ts.map +1 -0
- package/build/blocks/career/career-header/constants.js +1 -0
- package/build/blocks/career/career-header/edit.d.ts +1 -1
- package/build/blocks/career/career-header/edit.d.ts.map +1 -1
- package/build/blocks/career/career-header/edit.js +6 -3
- package/build/blocks/career/career-header/factory.d.ts.map +1 -1
- package/build/blocks/career/career-header/factory.js +3 -1
- package/build/blocks/career/career-header/index.d.ts +1 -0
- package/build/blocks/career/career-header/index.d.ts.map +1 -1
- package/build/blocks/career/career-header/index.js +4 -0
- package/build/blocks/career/job-position-group/index.d.ts.map +1 -1
- package/build/blocks/career/job-position-group/index.js +1 -0
- package/build/blocks/document/documents-grid/index.d.ts +1 -0
- package/build/blocks/document/documents-grid/index.d.ts.map +1 -1
- package/build/blocks/document/documents-grid/index.js +2 -0
- package/build/blocks/event/event-calendar-group/constants.d.ts +2 -0
- package/build/blocks/event/event-calendar-group/constants.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/constants.js +2 -0
- package/build/blocks/event/event-calendar-group/edit.d.ts +6 -0
- package/build/blocks/event/event-calendar-group/edit.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/edit.js +18 -0
- package/build/blocks/event/event-calendar-group/factory.d.ts +5 -0
- package/build/blocks/event/event-calendar-group/factory.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/factory.js +25 -0
- package/build/blocks/event/event-calendar-group/icon.d.ts +2 -0
- package/build/blocks/event/event-calendar-group/icon.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/icon.js +2 -0
- package/build/blocks/event/event-calendar-group/index.d.ts +6 -0
- package/build/blocks/event/event-calendar-group/index.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/index.js +6 -0
- package/build/blocks/event/event-calendar-group/types.d.ts +12 -0
- package/build/blocks/event/event-calendar-group/types.d.ts.map +1 -0
- package/build/blocks/event/event-calendar-group/types.js +1 -0
- package/build/blocks/event/event-detail-content/constants.d.ts +2 -0
- package/build/blocks/event/event-detail-content/constants.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/constants.js +1 -0
- package/build/blocks/event/event-detail-content/edit.d.ts +6 -0
- package/build/blocks/event/event-detail-content/edit.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/edit.js +9 -0
- package/build/blocks/event/event-detail-content/factory.d.ts +5 -0
- package/build/blocks/event/event-detail-content/factory.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/factory.js +18 -0
- package/build/blocks/event/event-detail-content/icon.d.ts +2 -0
- package/build/blocks/event/event-detail-content/icon.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/icon.js +2 -0
- package/build/blocks/event/event-detail-content/index.d.ts +5 -0
- package/build/blocks/event/event-detail-content/index.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/index.js +5 -0
- package/build/blocks/event/event-detail-content/types.d.ts +6 -0
- package/build/blocks/event/event-detail-content/types.d.ts.map +1 -0
- package/build/blocks/event/event-detail-content/types.js +1 -0
- package/build/blocks/event/event-detail-header/constants.d.ts +2 -0
- package/build/blocks/event/event-detail-header/constants.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/constants.js +1 -0
- package/build/blocks/event/event-detail-header/edit.d.ts +6 -0
- package/build/blocks/event/event-detail-header/edit.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/edit.js +11 -0
- package/build/blocks/event/event-detail-header/factory.d.ts +5 -0
- package/build/blocks/event/event-detail-header/factory.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/factory.js +22 -0
- package/build/blocks/event/event-detail-header/icon.d.ts +2 -0
- package/build/blocks/event/event-detail-header/icon.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/icon.js +2 -0
- package/build/blocks/event/event-detail-header/index.d.ts +5 -0
- package/build/blocks/event/event-detail-header/index.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/index.js +5 -0
- package/build/blocks/event/event-detail-header/types.d.ts +9 -0
- package/build/blocks/event/event-detail-header/types.d.ts.map +1 -0
- package/build/blocks/event/event-detail-header/types.js +1 -0
- package/build/blocks/event/event-list-group/constants.d.ts +5 -0
- package/build/blocks/event/event-list-group/constants.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/constants.js +5 -0
- package/build/blocks/event/event-list-group/edit.d.ts +6 -0
- package/build/blocks/event/event-list-group/edit.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/edit.js +23 -0
- package/build/blocks/event/event-list-group/factory.d.ts +5 -0
- package/build/blocks/event/event-list-group/factory.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/factory.js +28 -0
- package/build/blocks/event/event-list-group/icon.d.ts +2 -0
- package/build/blocks/event/event-list-group/icon.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/icon.js +2 -0
- package/build/blocks/event/event-list-group/index.d.ts +8 -0
- package/build/blocks/event/event-list-group/index.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/index.js +8 -0
- package/build/blocks/event/event-list-group/types.d.ts +30 -0
- package/build/blocks/event/event-list-group/types.d.ts.map +1 -0
- package/build/blocks/event/event-list-group/types.js +7 -0
- package/build/blocks/post/post-content/index.d.ts.map +1 -1
- package/build/blocks/post/post-content/index.js +1 -0
- package/build/blocks/sections/base-section/controls.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.js +3 -1
- package/build/blocks/sections/base-section/types.d.ts.map +1 -1
- package/build/components/Document/DocumentTermSelectModal.d.ts +8 -0
- package/build/components/Document/DocumentTermSelectModal.d.ts.map +1 -0
- package/build/components/Document/DocumentTermSelectModal.js +49 -0
- package/build/components/Event/EntitySelectModal.d.ts +27 -0
- package/build/components/Event/EntitySelectModal.d.ts.map +1 -0
- package/build/components/Event/EntitySelectModal.js +100 -0
- package/build/components/Event/EventSelectModal.d.ts +7 -0
- package/build/components/Event/EventSelectModal.d.ts.map +1 -0
- package/build/components/Event/EventSelectModal.js +42 -0
- package/build/components/Event/EventTermSelectModal.d.ts +7 -0
- package/build/components/Event/EventTermSelectModal.d.ts.map +1 -0
- package/build/components/Event/EventTermSelectModal.js +48 -0
- package/build/components/Post/PostSelectModal.d.ts +7 -0
- package/build/components/Post/PostSelectModal.d.ts.map +1 -0
- package/build/components/Post/PostSelectModal.js +42 -0
- package/build/components/Post/PostTermSelectModal.d.ts +8 -0
- package/build/components/Post/PostTermSelectModal.d.ts.map +1 -0
- package/build/components/Post/PostTermSelectModal.js +49 -0
- package/build/index.d.ts +11 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -1
- package/build/types.d.ts +4 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blocks/anchor/anchor-group/editor.scss +1 -1
- package/src/blocks/anchor/anchor-group/factory.tsx +2 -1
- package/src/blocks/anchor/anchor-group/icon.tsx +23 -0
- package/src/blocks/anchor/anchor-group/index.ts +1 -0
- package/src/blocks/anchor/anchor-item/editor.scss +1 -1
- package/src/blocks/career/career-header/constants.ts +1 -0
- package/src/blocks/career/career-header/edit.tsx +5 -2
- package/src/blocks/career/career-header/factory.tsx +2 -1
- package/src/blocks/career/career-header/index.ts +4 -0
- package/src/blocks/career/job-position-group/index.ts +1 -0
- package/src/blocks/document/documents-grid/index.ts +2 -0
- package/src/blocks/event/event-calendar-group/constants.ts +3 -0
- package/src/blocks/event/event-calendar-group/edit.tsx +60 -0
- package/src/blocks/event/event-calendar-group/editor.scss +13 -0
- package/src/blocks/event/event-calendar-group/factory.tsx +30 -0
- package/src/blocks/event/event-calendar-group/icon.tsx +13 -0
- package/src/blocks/event/event-calendar-group/index.tsx +10 -0
- package/src/blocks/event/event-calendar-group/types.ts +13 -0
- package/src/blocks/event/event-detail-content/constants.ts +1 -0
- package/src/blocks/event/event-detail-content/edit.tsx +24 -0
- package/src/blocks/event/event-detail-content/factory.tsx +22 -0
- package/src/blocks/event/event-detail-content/icon.tsx +9 -0
- package/src/blocks/event/event-detail-content/index.ts +9 -0
- package/src/blocks/event/event-detail-content/types.ts +5 -0
- package/src/blocks/event/event-detail-header/constants.ts +2 -0
- package/src/blocks/event/event-detail-header/edit.tsx +49 -0
- package/src/blocks/event/event-detail-header/factory.tsx +26 -0
- package/src/blocks/event/event-detail-header/icon.tsx +8 -0
- package/src/blocks/event/event-detail-header/index.ts +9 -0
- package/src/blocks/event/event-detail-header/types.ts +9 -0
- package/src/blocks/event/event-list-group/constants.ts +6 -0
- package/src/blocks/event/event-list-group/edit.tsx +84 -0
- package/src/blocks/event/event-list-group/editor.scss +9 -0
- package/src/blocks/event/event-list-group/factory.tsx +33 -0
- package/src/blocks/event/event-list-group/icon.tsx +27 -0
- package/src/blocks/event/event-list-group/index.tsx +12 -0
- package/src/blocks/event/event-list-group/types.ts +27 -0
- package/src/blocks/post/post-content/index.ts +1 -0
- package/src/blocks/sections/base-section/controls.tsx +5 -1
- package/src/blocks/sections/base-section/edit.tsx +3 -1
- package/src/blocks/sections/base-section/types.ts +9 -3
- package/src/components/Document/DocumentTermSelectModal.tsx +60 -0
- package/src/components/Event/EntitySelectModal.tsx +249 -0
- package/src/components/Event/EventSelectModal.tsx +51 -0
- package/src/components/Event/EventTermSelectModal.tsx +58 -0
- package/src/components/Post/PostSelectModal.tsx +51 -0
- package/src/components/Post/PostTermSelectModal.tsx +60 -0
- package/src/editor.scss +2 -0
- package/src/index.ts +44 -1
- package/src/types.ts +5 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EventListGroupAttributes, EventListGroupOptions } from './types';
|
|
2
|
+
export declare function createEventListGroupEdit(options: EventListGroupOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
attributes: EventListGroupAttributes;
|
|
4
|
+
setAttributes: (a: Partial<EventListGroupAttributes>) => void;
|
|
5
|
+
}) => import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/event/event-list-group/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,wBAAwB,EAAsB,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAEhG,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,oCAIlE;IACD,UAAU,EAAE,wBAAwB,CAAA;IACpC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAA;CAC9D,iCAqEF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
3
|
+
import { PanelBody, RangeControl, SelectControl, ToggleControl, TextControl } from '@wordpress/components';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { EVENTS_PER_PAGE_DEFAULT, EVENTS_PER_PAGE_MAX, EVENTS_PER_PAGE_MIN } from './constants';
|
|
6
|
+
import { EVENT_LIST_GROUP_MODES } from './types';
|
|
7
|
+
export function createEventListGroupEdit(options) {
|
|
8
|
+
return function Edit({ attributes, setAttributes, }) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const { mode, selectedEvents, selectedCategories, emptyMessage, postsPerPage, showPagination } = attributes;
|
|
11
|
+
const blockProps = useBlockProps({ className: 'g-event wp-block-section' });
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Nastavení výpisu', 'brilo-blocks'), initialOpen: true, children: [_jsx(SelectControl, { label: __('Režim', 'brilo-blocks'), value: mode, options: EVENT_LIST_GROUP_MODES.map((m) => ({ label: m.label, value: m.value })), onChange: (mode) => setAttributes({ mode: mode }) }), mode !== 'manual' && (_jsxs(_Fragment, { children: [_jsx(RangeControl, { label: __('Počet příspěvků', 'brilo-blocks'), value: postsPerPage, onChange: (value) => setAttributes({ postsPerPage: value !== null && value !== void 0 ? value : EVENTS_PER_PAGE_DEFAULT }), min: EVENTS_PER_PAGE_MIN, max: EVENTS_PER_PAGE_MAX }), mode !== 'filter' && (_jsx(ToggleControl, { label: __('Zobrazit stránkování', 'brilo-blocks'), checked: showPagination, onChange: (value) => setAttributes({ showPagination: value }) }))] })), _jsx(TextControl, { label: __('Zpráva při prázdném výsledku', 'brilo-blocks'), value: emptyMessage, onChange: (value) => setAttributes({ emptyMessage: value }) })] }) }), _jsxs("div", { ...blockProps, children: [_jsx("div", { className: "g-event__label", children: __('Seznam událostí', 'brilo-blocks') }), _jsxs("div", { className: "g-event__instructions", children: [mode === 'manual' && __('Ručně vybrané události.', 'brilo-blocks'), mode === 'upcoming' && __('Zobrazuje nadcházející události.', 'brilo-blocks'), mode === 'past' && __('Zobrazuje proběhlé události.', 'brilo-blocks'), mode === 'filter' && __('S filtrováním.', 'brilo-blocks')] }), mode !== 'manual' &&
|
|
13
|
+
mode !== 'filter' &&
|
|
14
|
+
((_a = options.renderCategoryControl) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
15
|
+
selectedItems: selectedCategories,
|
|
16
|
+
onChange: (ids) => setAttributes({ selectedCategories: ids }),
|
|
17
|
+
})), mode === 'manual' &&
|
|
18
|
+
((_b = options.renderEventsControl) === null || _b === void 0 ? void 0 : _b.call(options, {
|
|
19
|
+
selectedItems: selectedEvents,
|
|
20
|
+
onChange: (ids) => setAttributes({ selectedEvents: ids }),
|
|
21
|
+
}))] })] }));
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { EventListGroupAttributes, EventListGroupOptions } from './types';
|
|
3
|
+
export type { EventListGroupAttributes, EventListGroupOptions };
|
|
4
|
+
export declare function createEventListGroupBlock(options: EventListGroupOptions): BlockConfiguration<EventListGroupAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/event/event-list-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAE5E,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,CAAA;AAE7D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAuBtH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { DEFAULT_EMPTY_MESSAGE, EVENTS_PER_PAGE_DEFAULT } from './constants';
|
|
3
|
+
import { createEventListGroupEdit } from './edit';
|
|
4
|
+
import { icon as defaultIcon } from './icon';
|
|
5
|
+
export function createEventListGroupBlock(options) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
const emptyMessage = (_a = options.emptyMessage) !== null && _a !== void 0 ? _a : DEFAULT_EMPTY_MESSAGE;
|
|
8
|
+
const postsPerPage = (_b = options.postsPerPage) !== null && _b !== void 0 ? _b : EVENTS_PER_PAGE_DEFAULT;
|
|
9
|
+
return {
|
|
10
|
+
name: options.name,
|
|
11
|
+
title: (_c = options.title) !== null && _c !== void 0 ? _c : __('Seznam událostí', 'brilo-blocks'),
|
|
12
|
+
description: options.description,
|
|
13
|
+
category: (_d = options.category) !== null && _d !== void 0 ? _d : 'layout',
|
|
14
|
+
icon: (_e = options.icon) !== null && _e !== void 0 ? _e : { src: defaultIcon },
|
|
15
|
+
...(options.parent && { parent: options.parent }),
|
|
16
|
+
supports: { html: false, customClassName: false },
|
|
17
|
+
attributes: {
|
|
18
|
+
mode: { type: 'string', default: 'upcoming' },
|
|
19
|
+
selectedEvents: { type: 'array', default: [] },
|
|
20
|
+
selectedCategories: { type: 'array', default: [] },
|
|
21
|
+
emptyMessage: { type: 'string', default: emptyMessage },
|
|
22
|
+
postsPerPage: { type: 'number', default: postsPerPage },
|
|
23
|
+
showPagination: { type: 'boolean', default: false },
|
|
24
|
+
},
|
|
25
|
+
edit: createEventListGroupEdit(options),
|
|
26
|
+
save: () => null,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/event/event-list-group/icon.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,6BA0BhB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M4 4H9V5H4V4Z", fill: "black" }), _jsx("path", { d: "M10 4H16V5H10V4Z", fill: "black" }), _jsx("path", { d: "M12 2C12 1.44772 12.4477 1 13 1H14C14.5523 1 15 1.44772 15 2C15 2.55228 14.5523 3 14 3H13C12.4477 3 12 2.55228 12 2Z", fill: "black" }), _jsx("path", { d: "M5 2C5 1.44772 5.44772 1 6 1H10C10.5523 1 11 1.44772 11 2C11 2.55228 10.5523 3 10 3H6C5.44772 3 5 2.55228 5 2Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 14H20V15H17V14Z", fill: "black" }), _jsx("path", { d: "M17 16H19V17H17V16Z", fill: "black" }), _jsx("path", { d: "M18 18H20V19H18V18Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "14.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 14H9V15H6V14Z", fill: "black" }), _jsx("path", { d: "M6 16H8V17H6V16Z", fill: "black" }), _jsx("path", { d: "M7 18H9V19H7V18Z", fill: "#357AB5" }), _jsx("rect", { x: "11.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M17 7H20V8H17V7Z", fill: "black" }), _jsx("path", { d: "M17 9H19V10H17V9Z", fill: "black" }), _jsx("path", { d: "M18 11H20V12H18V11Z", fill: "#357AB5" }), _jsx("rect", { x: "0.5", y: "7.5", width: "4", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M6 7H9V8H6V7Z", fill: "black" }), _jsx("path", { d: "M6 9H8V10H6V9Z", fill: "black" }), _jsx("path", { d: "M7 11H9V12H7V11Z", fill: "#357AB5" })] }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { EventListGroupAttributes, EventListGroupOptions, EventListGroupMode } from './types';
|
|
2
|
+
export { EVENT_LIST_GROUP_MODES } from './types';
|
|
3
|
+
export { createEventListGroupBlock } from './factory';
|
|
4
|
+
export { EventSelectModal } from '../../../components/Event/EventSelectModal';
|
|
5
|
+
export { EventTermSelectModal } from '../../../components/Event/EventTermSelectModal';
|
|
6
|
+
import type { EventListGroupOptions } from './types';
|
|
7
|
+
export declare const eventListGroupDefaults: EventListGroupOptions;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/event/event-list-group/index.tsx"],"names":[],"mappings":"AAAA,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAChG,OAAO,EAAC,sBAAsB,EAAC,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAC,oBAAoB,EAAC,MAAM,yCAAyC,CAAA;AAE5E,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAGpC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { EVENT_LIST_GROUP_MODES } from './types';
|
|
2
|
+
export { createEventListGroupBlock } from './factory';
|
|
3
|
+
export { EventSelectModal } from '../../../components/Event/EventSelectModal';
|
|
4
|
+
export { EventTermSelectModal } from '../../../components/Event/EventTermSelectModal';
|
|
5
|
+
export const eventListGroupDefaults = {
|
|
6
|
+
name: 'brilo/event-list-group',
|
|
7
|
+
parent: ['brilo/base-section'],
|
|
8
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BriloBlockType, SelectControlProps } from '../../../types';
|
|
2
|
+
export declare const EVENT_LIST_GROUP_MODES: readonly [{
|
|
3
|
+
readonly value: 'manual';
|
|
4
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Výběr událostí">;
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: 'upcoming';
|
|
7
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Nadcházející">;
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: 'past';
|
|
10
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Proběhlé">;
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: 'filter';
|
|
13
|
+
readonly label: import("@wordpress/i18n").TransformedText<"S filtrováním">;
|
|
14
|
+
}];
|
|
15
|
+
export type EventListGroupMode = (typeof EVENT_LIST_GROUP_MODES)[number]['value'];
|
|
16
|
+
export interface EventListGroupAttributes extends Record<string, unknown> {
|
|
17
|
+
mode: EventListGroupMode;
|
|
18
|
+
selectedEvents: number[];
|
|
19
|
+
selectedCategories: number[];
|
|
20
|
+
emptyMessage: string;
|
|
21
|
+
postsPerPage: number;
|
|
22
|
+
showPagination: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface EventListGroupOptions extends BriloBlockType {
|
|
25
|
+
emptyMessage?: string;
|
|
26
|
+
postsPerPage?: number;
|
|
27
|
+
renderCategoryControl?: (props: SelectControlProps) => JSX.Element;
|
|
28
|
+
renderEventsControl?: (props: SelectControlProps) => JSX.Element;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/event/event-list-group/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/D,eAAO,MAAM,sBAAsB;aAChC,KAAK,EAAE,QAAQ;aAAE,KAAK;;aACtB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,QAAQ;aAAE,KAAK;EACf,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEjF,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,IAAI,EAAE,kBAAkB,CAAA;IACxB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;IAClE,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;CACjE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
export const EVENT_LIST_GROUP_MODES = [
|
|
3
|
+
{ value: 'manual', label: __('Výběr událostí', 'brilo-blocks') },
|
|
4
|
+
{ value: 'upcoming', label: __('Nadcházející', 'brilo-blocks') },
|
|
5
|
+
{ value: 'past', label: __('Proběhlé', 'brilo-blocks') },
|
|
6
|
+
{ value: 'filter', label: __('S filtrováním', 'brilo-blocks') },
|
|
7
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/post/post-content/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/post/post-content/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,kBAGjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/controls.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,mBAAmB,EAMnB,kBAAkB,EAGnB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/controls.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,mBAAmB,EAMnB,kBAAkB,EAGnB,MAAM,SAAS,CAAA;AAmShB,UAAU,iBAAiB;IACzB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC5D,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAC,EAAE,iBAAiB,+BAkFnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAG3G,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAG3G,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,iCAkDzE"}
|
|
@@ -25,7 +25,9 @@ export function createBaseSectionEdit(options) {
|
|
|
25
25
|
? {
|
|
26
26
|
backgroundImage: [tintLayer, `url(${bgImageSrc})`].filter(Boolean).join(', '),
|
|
27
27
|
backgroundSize: [tintLayer ? '100% 100%' : null, (_c = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.fit) !== null && _c !== void 0 ? _c : 'cover'].filter(Boolean).join(', '),
|
|
28
|
-
backgroundPosition: [tintLayer ? 'center center' : null, (_d = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.position) !== null && _d !== void 0 ? _d : 'center center']
|
|
28
|
+
backgroundPosition: [tintLayer ? 'center center' : null, (_d = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.position) !== null && _d !== void 0 ? _d : 'center center']
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(', '),
|
|
29
31
|
backgroundRepeat: 'no-repeat',
|
|
30
32
|
padding: '16px',
|
|
31
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;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kbox
|
|
3
|
+
* selection, reorderable selection list) with name/slug/count columns. See
|
|
4
|
+
* `EntitySelectModal` for the shared DataViews wiring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DocumentTermSelectModal: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
7
|
+
export declare const DocumentTermSelect: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=DocumentTermSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentTermSelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Document/DocumentTermSelectModal.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,wGA8BlC,CAAA;AAEF,eAAO,MAAM,kBAAkB,wGAA0B,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { createEntitySelectModal } from '../../components/Event/EntitySelectModal';
|
|
3
|
+
const DEFAULT_VIEW = {
|
|
4
|
+
type: 'table',
|
|
5
|
+
search: '',
|
|
6
|
+
filters: [],
|
|
7
|
+
page: 1,
|
|
8
|
+
perPage: 20,
|
|
9
|
+
sort: { field: 'name', direction: 'asc' },
|
|
10
|
+
fields: ['slug', 'count'],
|
|
11
|
+
titleField: 'name',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Manual document_category picker (table view, search, sort, checkbox
|
|
15
|
+
* selection, reorderable selection list) with name/slug/count columns. See
|
|
16
|
+
* `EntitySelectModal` for the shared DataViews wiring.
|
|
17
|
+
*/
|
|
18
|
+
export const DocumentTermSelectModal = createEntitySelectModal({
|
|
19
|
+
endpoint: '/wp/v2/document_category?per_page=100&orderby=name&order=asc&_fields=id,name,slug,count',
|
|
20
|
+
defaultView: DEFAULT_VIEW,
|
|
21
|
+
buttonLabel: __('Vybrat kategorie', 'brilo-blocks'),
|
|
22
|
+
modalTitle: __('Vybrat kategorie', 'brilo-blocks'),
|
|
23
|
+
emptyLabel: __('Nevybrány žádné kategorie.', 'brilo-blocks'),
|
|
24
|
+
getItemLabel: (item) => item.name,
|
|
25
|
+
matchesSearch: (item, needle) => item.name.toLowerCase().includes(needle) || item.slug.toLowerCase().includes(needle),
|
|
26
|
+
sortValue: (item, field) => item[field],
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
id: 'name',
|
|
30
|
+
label: __('Název', 'brilo-blocks'),
|
|
31
|
+
enableHiding: false,
|
|
32
|
+
enableSorting: true,
|
|
33
|
+
render: ({ item }) => item.name || __('(bez názvu)', 'brilo-blocks'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'slug',
|
|
37
|
+
label: __('Slug', 'brilo-blocks'),
|
|
38
|
+
enableSorting: true,
|
|
39
|
+
render: ({ item }) => item.slug || '—',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'count',
|
|
43
|
+
label: __('Počet', 'brilo-blocks'),
|
|
44
|
+
enableSorting: true,
|
|
45
|
+
render: ({ item }) => (undefined !== item.count ? String(item.count) : '—'),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
export const DocumentTermSelect = DocumentTermSelectModal;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Field, type View } from '@wordpress/dataviews/wp';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { SelectControlProps } from '../../types';
|
|
4
|
+
type EntityRecord = {
|
|
5
|
+
id: number;
|
|
6
|
+
};
|
|
7
|
+
export type EntitySelectModalConfig<T extends EntityRecord> = {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
fields: Field<T>[];
|
|
10
|
+
defaultView: View;
|
|
11
|
+
getItemLabel: (item: T) => string;
|
|
12
|
+
matchesSearch: (item: T, needle: string) => boolean;
|
|
13
|
+
sortValue: (item: T, field: string) => string | number;
|
|
14
|
+
buttonLabel: string;
|
|
15
|
+
modalTitle: string;
|
|
16
|
+
emptyLabel: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Generic table-view entity picker built on @wordpress/dataviews (search, sort,
|
|
21
|
+
* checkbox selection, reorderable selection list). Feed it a REST endpoint +
|
|
22
|
+
* DataViews field config to get an `EventSelectModal`/`EventTermSelectModal`-style
|
|
23
|
+
* component without duplicating the DataViews wiring per entity type.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createEntitySelectModal<T extends EntityRecord>(config: EntitySelectModalConfig<T>): ({ selectedItems, onChange }: SelectControlProps) => React.JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=EntitySelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntitySelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Event/EntitySelectModal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,KAAK,EAAE,KAAK,IAAI,EAAC,MAAM,yBAAyB,CAAA;AAIxE,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,KAAK,YAAY,GAAG;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAAA;AA0BhC,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,YAAY,IAAI;IAC5D,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAClB,WAAW,EAAE,IAAI,CAAA;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAA;IACjC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAA;IACnD,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAA;IACtD,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA2FD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,iCACnC,kBAAkB,uBAwGhF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
3
|
+
import { Button, Card, CardBody, __experimentalHStack as HStack, Modal, __experimentalVStack as VStack } from '@wordpress/components';
|
|
4
|
+
import { DataViews } from '@wordpress/dataviews/wp';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { arrowDown, arrowUp, close, plusCircle } from '@wordpress/icons';
|
|
7
|
+
// biome-ignore lint/correctness/noUnusedImports: required in scope for classic JSX transform
|
|
8
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
const TypedDataViews = DataViews;
|
|
10
|
+
function useEntities(endpoint) {
|
|
11
|
+
const [entities, setEntities] = useState([]);
|
|
12
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setIsLoading(true);
|
|
15
|
+
apiFetch({ path: endpoint })
|
|
16
|
+
.then((result) => setEntities(result))
|
|
17
|
+
.catch(() => setEntities([]))
|
|
18
|
+
.finally(() => setIsLoading(false));
|
|
19
|
+
}, [endpoint]);
|
|
20
|
+
return { entities, isLoading };
|
|
21
|
+
}
|
|
22
|
+
function SelectedOrderList({ items, getItemLabel, onChange, onRemove, emptyLabel, }) {
|
|
23
|
+
if (0 === items.length) {
|
|
24
|
+
return _jsx("p", { className: "i-event-select-modal__empty", children: emptyLabel });
|
|
25
|
+
}
|
|
26
|
+
const move = (index, direction) => {
|
|
27
|
+
const target = index + direction;
|
|
28
|
+
if (target < 0 || target >= items.length) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const next = [...items];
|
|
32
|
+
[next[index], next[target]] = [next[target], next[index]];
|
|
33
|
+
onChange(next.map((item) => item.id));
|
|
34
|
+
};
|
|
35
|
+
return (_jsx(VStack, { spacing: 2, children: items.map((item, index) => (_jsx(Card, { size: "small", className: "i-event-select-modal__item", children: _jsx(CardBody, { children: _jsxs(HStack, { alignment: "center", children: [_jsx("span", { className: "i-event-select-modal__item-title", style: {
|
|
36
|
+
flexGrow: 1,
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
textAlign: 'left',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
textOverflow: 'ellipsis',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
}, children: getItemLabel(item) || __('(bez názvu)', 'brilo-blocks') }), _jsxs(HStack, { expanded: false, spacing: 1, children: [_jsx(Button, { size: "small", icon: arrowUp, label: __('Posunout výš', 'brilo-blocks'), onClick: () => move(index, -1), disabled: 0 === index }), _jsx(Button, { size: "small", icon: arrowDown, label: __('Posunout níž', 'brilo-blocks'), onClick: () => move(index, 1), disabled: index === items.length - 1 }), _jsx(Button, { size: "small", icon: close, isDestructive: true, label: __('Odebrat', 'brilo-blocks'), onClick: () => onRemove(item.id) })] })] }) }) }, item.id))) }));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Generic table-view entity picker built on @wordpress/dataviews (search, sort,
|
|
46
|
+
* checkbox selection, reorderable selection list). Feed it a REST endpoint +
|
|
47
|
+
* DataViews field config to get an `EventSelectModal`/`EventTermSelectModal`-style
|
|
48
|
+
* component without duplicating the DataViews wiring per entity type.
|
|
49
|
+
*/
|
|
50
|
+
export function createEntitySelectModal(config) {
|
|
51
|
+
return function EntitySelectModal({ selectedItems, onChange }) {
|
|
52
|
+
var _a;
|
|
53
|
+
const { entities, isLoading } = useEntities(config.endpoint);
|
|
54
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
55
|
+
const [view, setView] = useState(config.defaultView);
|
|
56
|
+
const selectedEntities = useMemo(() => selectedItems.map((id) => entities.find((entity) => entity.id === id)).filter((entity) => undefined !== entity), [selectedItems, entities]);
|
|
57
|
+
const { data, paginationInfo } = useMemo(() => {
|
|
58
|
+
var _a;
|
|
59
|
+
var _b, _c;
|
|
60
|
+
let filtered = entities;
|
|
61
|
+
if (view.search) {
|
|
62
|
+
const needle = view.search.toLowerCase();
|
|
63
|
+
filtered = filtered.filter((entity) => config.matchesSearch(entity, needle));
|
|
64
|
+
}
|
|
65
|
+
if ((_a = view.sort) === null || _a === void 0 ? void 0 : _a.field) {
|
|
66
|
+
const { field, direction } = view.sort;
|
|
67
|
+
const sorted = [...filtered];
|
|
68
|
+
sorted.sort((a, b) => {
|
|
69
|
+
const valueA = config.sortValue(a, field);
|
|
70
|
+
const valueB = config.sortValue(b, field);
|
|
71
|
+
const result = typeof valueA === 'number' && typeof valueB === 'number' ? valueA - valueB : String(valueA).localeCompare(String(valueB));
|
|
72
|
+
return 'desc' === direction ? -result : result;
|
|
73
|
+
});
|
|
74
|
+
filtered = sorted;
|
|
75
|
+
}
|
|
76
|
+
const perPage = (_b = view.perPage) !== null && _b !== void 0 ? _b : 20;
|
|
77
|
+
const page = (_c = view.page) !== null && _c !== void 0 ? _c : 1;
|
|
78
|
+
const start = (page - 1) * perPage;
|
|
79
|
+
return {
|
|
80
|
+
data: filtered.slice(start, start + perPage),
|
|
81
|
+
paginationInfo: { totalItems: filtered.length, totalPages: Math.ceil(filtered.length / perPage) || 1 },
|
|
82
|
+
};
|
|
83
|
+
}, [entities, view]);
|
|
84
|
+
const toggleSelected = (id) => {
|
|
85
|
+
onChange(selectedItems.includes(id) ? selectedItems.filter((itemId) => itemId !== id) : [...selectedItems, id]);
|
|
86
|
+
};
|
|
87
|
+
return (_jsxs(VStack, { spacing: 3, className: (_a = config.className) !== null && _a !== void 0 ? _a : 'i-event-select-modal', children: [_jsx(Button, { variant: "secondary", icon: plusCircle, onClick: () => setIsOpen(true), children: config.buttonLabel }), _jsx(SelectedOrderList, { items: selectedEntities, getItemLabel: config.getItemLabel, emptyLabel: config.emptyLabel, onChange: onChange, onRemove: (id) => onChange(selectedItems.filter((itemId) => itemId !== id)) }), isOpen && (_jsx(Modal, { title: config.modalTitle, onRequestClose: () => setIsOpen(false), size: "fill", children: _jsxs(VStack, { spacing: 4, style: { height: '100%' }, children: [_jsx("div", { style: { flexGrow: 1, minHeight: 0 }, children: _jsx(TypedDataViews, { data: data, fields: config.fields, view: view, onChangeView: setView, paginationInfo: paginationInfo, isLoading: isLoading, defaultLayouts: { table: {} }, getItemId: (item) => String(item.id), selection: selectedItems.map(String), onChangeSelection: (ids) => onChange(ids.map(Number)), actions: [
|
|
88
|
+
{
|
|
89
|
+
id: 'toggle',
|
|
90
|
+
label: (items) => items.length && selectedItems.includes(items[0].id) ? __('Odebrat', 'brilo-blocks') : __('Přidat', 'brilo-blocks'),
|
|
91
|
+
supportsBulk: true,
|
|
92
|
+
callback: (items) => {
|
|
93
|
+
items.forEach((item) => {
|
|
94
|
+
toggleSelected(item.id);
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
] }) }), _jsx(HStack, { justify: "flex-end", children: _jsx(Button, { variant: "primary", onClick: () => setIsOpen(false), children: __('Hotovo', 'brilo-blocks') }) })] }) }))] }));
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual brilo_event picker (table view, search, sort, checkbox selection,
|
|
3
|
+
* reorderable selection list) with title/date columns. See `EntitySelectModal`
|
|
4
|
+
* for the shared DataViews wiring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EventSelectModal: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=EventSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventSelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Event/EventSelectModal.tsx"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,wGAwB3B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { createEntitySelectModal } from './EntitySelectModal';
|
|
3
|
+
const DEFAULT_VIEW = {
|
|
4
|
+
type: 'table',
|
|
5
|
+
search: '',
|
|
6
|
+
filters: [],
|
|
7
|
+
page: 1,
|
|
8
|
+
perPage: 20,
|
|
9
|
+
sort: { field: 'title', direction: 'asc' },
|
|
10
|
+
fields: ['date'],
|
|
11
|
+
titleField: 'title',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Manual brilo_event picker (table view, search, sort, checkbox selection,
|
|
15
|
+
* reorderable selection list) with title/date columns. See `EntitySelectModal`
|
|
16
|
+
* for the shared DataViews wiring.
|
|
17
|
+
*/
|
|
18
|
+
export const EventSelectModal = createEntitySelectModal({
|
|
19
|
+
endpoint: '/wp/v2/brilo_event?per_page=100&orderby=title&order=asc&_fields=id,title,date',
|
|
20
|
+
defaultView: DEFAULT_VIEW,
|
|
21
|
+
buttonLabel: __('Vybrat události', 'brilo-blocks'),
|
|
22
|
+
modalTitle: __('Vybrat události', 'brilo-blocks'),
|
|
23
|
+
emptyLabel: __('Nevybrány žádné události.', 'brilo-blocks'),
|
|
24
|
+
getItemLabel: (item) => item.title.rendered,
|
|
25
|
+
matchesSearch: (item, needle) => item.title.rendered.toLowerCase().includes(needle),
|
|
26
|
+
sortValue: (item, field) => { var _a; return ('title' === field ? item.title.rendered : ((_a = item[field]) !== null && _a !== void 0 ? _a : '')); },
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
id: 'title',
|
|
30
|
+
label: __('Název', 'brilo-blocks'),
|
|
31
|
+
enableHiding: false,
|
|
32
|
+
enableSorting: true,
|
|
33
|
+
render: ({ item }) => item.title.rendered || __('(bez názvu)', 'brilo-blocks'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'date',
|
|
37
|
+
label: __('Datum', 'brilo-blocks'),
|
|
38
|
+
enableSorting: true,
|
|
39
|
+
render: ({ item }) => (item.date ? new Date(item.date).toLocaleDateString() : '—'),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual brilo_event_category picker (table view, search, sort, checkbox
|
|
3
|
+
* selection, reorderable selection list) with name/slug/count columns. See
|
|
4
|
+
* `EntitySelectModal` for the shared DataViews wiring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EventTermSelectModal: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=EventTermSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventTermSelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Event/EventTermSelectModal.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,wGA8B/B,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { createEntitySelectModal } from './EntitySelectModal';
|
|
3
|
+
const DEFAULT_VIEW = {
|
|
4
|
+
type: 'table',
|
|
5
|
+
search: '',
|
|
6
|
+
filters: [],
|
|
7
|
+
page: 1,
|
|
8
|
+
perPage: 20,
|
|
9
|
+
sort: { field: 'name', direction: 'asc' },
|
|
10
|
+
fields: ['slug', 'count'],
|
|
11
|
+
titleField: 'name',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Manual brilo_event_category picker (table view, search, sort, checkbox
|
|
15
|
+
* selection, reorderable selection list) with name/slug/count columns. See
|
|
16
|
+
* `EntitySelectModal` for the shared DataViews wiring.
|
|
17
|
+
*/
|
|
18
|
+
export const EventTermSelectModal = createEntitySelectModal({
|
|
19
|
+
endpoint: '/wp/v2/brilo_event_category?per_page=100&orderby=name&order=asc&_fields=id,name,slug,count',
|
|
20
|
+
defaultView: DEFAULT_VIEW,
|
|
21
|
+
buttonLabel: __('Vybrat kategorie', 'brilo-blocks'),
|
|
22
|
+
modalTitle: __('Vybrat kategorie', 'brilo-blocks'),
|
|
23
|
+
emptyLabel: __('Nevybrány žádné kategorie.', 'brilo-blocks'),
|
|
24
|
+
getItemLabel: (item) => item.name,
|
|
25
|
+
matchesSearch: (item, needle) => item.name.toLowerCase().includes(needle) || item.slug.toLowerCase().includes(needle),
|
|
26
|
+
sortValue: (item, field) => item[field],
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
id: 'name',
|
|
30
|
+
label: __('Název', 'brilo-blocks'),
|
|
31
|
+
enableHiding: false,
|
|
32
|
+
enableSorting: true,
|
|
33
|
+
render: ({ item }) => item.name || __('(bez názvu)', 'brilo-blocks'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'slug',
|
|
37
|
+
label: __('Slug', 'brilo-blocks'),
|
|
38
|
+
enableSorting: true,
|
|
39
|
+
render: ({ item }) => item.slug || '—',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'count',
|
|
43
|
+
label: __('Počet', 'brilo-blocks'),
|
|
44
|
+
enableSorting: true,
|
|
45
|
+
render: ({ item }) => (undefined !== item.count ? String(item.count) : '—'),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual post picker (table view, search, sort, checkbox selection,
|
|
3
|
+
* reorderable selection list) with title/date columns. See `EntitySelectModal`
|
|
4
|
+
* for the shared DataViews wiring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PostSelectModal: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=PostSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostSelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Post/PostSelectModal.tsx"],"names":[],"mappings":"AAqBA;;;;GAIG;AACH,eAAO,MAAM,eAAe,wGAwB1B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { createEntitySelectModal } from '../../components/Event/EntitySelectModal';
|
|
3
|
+
const DEFAULT_VIEW = {
|
|
4
|
+
type: 'table',
|
|
5
|
+
search: '',
|
|
6
|
+
filters: [],
|
|
7
|
+
page: 1,
|
|
8
|
+
perPage: 20,
|
|
9
|
+
sort: { field: 'title', direction: 'asc' },
|
|
10
|
+
fields: ['date'],
|
|
11
|
+
titleField: 'title',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Manual post picker (table view, search, sort, checkbox selection,
|
|
15
|
+
* reorderable selection list) with title/date columns. See `EntitySelectModal`
|
|
16
|
+
* for the shared DataViews wiring.
|
|
17
|
+
*/
|
|
18
|
+
export const PostSelectModal = createEntitySelectModal({
|
|
19
|
+
endpoint: '/wp/v2/posts?per_page=100&orderby=title&order=asc&_fields=id,title,date',
|
|
20
|
+
defaultView: DEFAULT_VIEW,
|
|
21
|
+
buttonLabel: __('Vybrat příspěvky', 'brilo-blocks'),
|
|
22
|
+
modalTitle: __('Vybrat příspěvky', 'brilo-blocks'),
|
|
23
|
+
emptyLabel: __('Nevybrány žádné příspěvky.', 'brilo-blocks'),
|
|
24
|
+
getItemLabel: (item) => item.title.rendered,
|
|
25
|
+
matchesSearch: (item, needle) => item.title.rendered.toLowerCase().includes(needle),
|
|
26
|
+
sortValue: (item, field) => { var _a; return ('title' === field ? item.title.rendered : ((_a = item[field]) !== null && _a !== void 0 ? _a : '')); },
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
id: 'title',
|
|
30
|
+
label: __('Název', 'brilo-blocks'),
|
|
31
|
+
enableHiding: false,
|
|
32
|
+
enableSorting: true,
|
|
33
|
+
render: ({ item }) => item.title.rendered || __('(bez názvu)', 'brilo-blocks'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'date',
|
|
37
|
+
label: __('Datum', 'brilo-blocks'),
|
|
38
|
+
enableSorting: true,
|
|
39
|
+
render: ({ item }) => (item.date ? new Date(item.date).toLocaleDateString() : '—'),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual post category picker (table view, search, sort, checkbox
|
|
3
|
+
* selection, reorderable selection list) with name/slug/count columns. See
|
|
4
|
+
* `EntitySelectModal` for the shared DataViews wiring.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PostTermSelectModal: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
7
|
+
export declare const PostTermSelect: ({ selectedItems, onChange }: import("../../types").SelectControlProps) => import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PostTermSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostTermSelectModal.d.ts","sourceRoot":"","sources":["../../../src/components/Post/PostTermSelectModal.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,wGA8B9B,CAAA;AAEF,eAAO,MAAM,cAAc,wGAAsB,CAAA"}
|