@brilo/base-blocks 0.1.37 → 0.1.39
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/form/form-field/edit.d.ts.map +1 -1
- package/build/blocks/form/form-field/edit.js +4 -2
- package/build/blocks/form/form-field/factory.d.ts.map +1 -1
- package/build/blocks/form/form-field/factory.js +2 -0
- package/build/blocks/form/form-field/types.d.ts +2 -0
- package/build/blocks/form/form-field/types.d.ts.map +1 -1
- package/build/blocks/form/form-group/edit.d.ts.map +1 -1
- package/build/blocks/form/form-group/edit.js +59 -10
- package/build/blocks/form/form-group/factory.d.ts.map +1 -1
- package/build/blocks/form/form-group/factory.js +2 -0
- package/build/blocks/form/form-group/types.d.ts +2 -0
- package/build/blocks/form/form-group/types.d.ts.map +1 -1
- 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/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 +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/package.json +2 -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/form/form-field/edit.tsx +26 -1
- package/src/blocks/form/form-field/factory.tsx +2 -0
- package/src/blocks/form/form-field/types.ts +2 -0
- package/src/blocks/form/form-group/edit.tsx +136 -4
- package/src/blocks/form/form-group/editor.scss +46 -33
- package/src/blocks/form/form-group/factory.tsx +2 -0
- package/src/blocks/form/form-group/types.ts +2 -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/Post/PostSelectModal.tsx +51 -0
- package/src/components/Post/PostTermSelectModal.tsx +60 -0
- package/src/index.ts +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/anchor/anchor-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/anchor/anchor-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CACpC,eAAe,SAAS,WAAW,GAAG,OAAO,cAAc,EAC3D,WAAW,SAAS,WAAW,GAAG,OAAO,iBAAiB,EAE1D,OAAO,EAAE,kBAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,GACxD,kBAAkB,CAAC,qBAAqB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CA2B3G"}
|
|
@@ -3,6 +3,7 @@ import { InnerBlocks } from '@wordpress/block-editor';
|
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { ANCHOR_ALIGNMENTS, ANCHOR_COLUMNS } from './constants';
|
|
5
5
|
import { createAnchorGroupEdit } from './edit';
|
|
6
|
+
import { icon as defaultIcon } from './icon';
|
|
6
7
|
export function createAnchorGroupBlock(options) {
|
|
7
8
|
var _a, _b, _c, _d, _e;
|
|
8
9
|
const columnsOptions = (_a = options.columnsOptions) !== null && _a !== void 0 ? _a : ANCHOR_COLUMNS;
|
|
@@ -13,7 +14,7 @@ export function createAnchorGroupBlock(options) {
|
|
|
13
14
|
description: options.description,
|
|
14
15
|
category: (_d = options.category) !== null && _d !== void 0 ? _d : 'layout',
|
|
15
16
|
...(options.parent && { parent: options.parent }),
|
|
16
|
-
icon: (_e = options.icon) !== null && _e !== void 0 ? _e :
|
|
17
|
+
icon: (_e = options.icon) !== null && _e !== void 0 ? _e : { src: defaultIcon },
|
|
17
18
|
supports: { html: false, customClassName: false },
|
|
18
19
|
attributes: {
|
|
19
20
|
columns: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/anchor/anchor-group/icon.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,6BAsBhB,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: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 9H18V10H16V9Z", fill: "#357AB5" }), _jsx("path", { d: "M13 9H14V10H13V9Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "7.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 9H7V10H5V9Z", fill: "#357AB5" }), _jsx("path", { d: "M2 9H3V10H2V9Z", fill: "black" }), _jsx("rect", { x: "11.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M16 16H18V17H16V16Z", fill: "#357AB5" }), _jsx("path", { d: "M13 16H14V17H13V16Z", fill: "black" }), _jsx("rect", { x: "0.5", y: "14.5", width: "8", height: "4", stroke: "black", fill: "none" }), _jsx("path", { d: "M5 16H7V17H5V16Z", fill: "#357AB5" }), _jsx("path", { d: "M2 16H3V17H2V16Z", fill: "black" })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/anchor/anchor-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtG,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAE7D,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/anchor/anchor-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtG,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,kBAKjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_ALLOWED_BLOCKS = ['brilo/button-group'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CareerHeaderAttributes, CareerHeaderOptions } from './types';
|
|
2
|
-
export declare function createCareerHeaderEdit(
|
|
2
|
+
export declare function createCareerHeaderEdit(options: CareerHeaderOptions): ({ attributes, setAttributes, }: {
|
|
3
3
|
attributes: CareerHeaderAttributes;
|
|
4
4
|
setAttributes: (a: Partial<CareerHeaderAttributes>) => void;
|
|
5
5
|
}) => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/edit.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,oCAI9D;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;CAC5D,iCAkDF"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
2
|
+
import { InspectorControls, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
3
3
|
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
5
|
+
import { DEFAULT_ALLOWED_BLOCKS } from './constants';
|
|
6
|
+
export function createCareerHeaderEdit(options) {
|
|
6
7
|
return function Edit({ attributes, setAttributes, }) {
|
|
8
|
+
var _a;
|
|
7
9
|
const { showExcerpt, showLocation, showSalary, showBenefits, showEmploymentType } = attributes;
|
|
8
10
|
const blockProps = useBlockProps({ className: 'wp-block-section' });
|
|
9
|
-
|
|
11
|
+
const innerBlocksProps = useInnerBlocksProps({}, { allowedBlocks: (_a = options.allowedBlocks) !== null && _a !== void 0 ? _a : DEFAULT_ALLOWED_BLOCKS });
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Zobrazené údaje', 'brilo-blocks'), initialOpen: true, children: [_jsx(ToggleControl, { label: __('Zobrazit perex', 'brilo-blocks'), checked: showExcerpt, onChange: (value) => setAttributes({ showExcerpt: value }) }), _jsx(ToggleControl, { label: __('Zobrazit lokalitu', 'brilo-blocks'), checked: showLocation, onChange: (value) => setAttributes({ showLocation: value }) }), _jsx(ToggleControl, { label: __('Zobrazit plat', 'brilo-blocks'), checked: showSalary, onChange: (value) => setAttributes({ showSalary: value }) }), _jsx(ToggleControl, { label: __('Zobrazit benefity', 'brilo-blocks'), checked: showBenefits, onChange: (value) => setAttributes({ showBenefits: value }) }), _jsx(ToggleControl, { label: __('Zobrazit typ úvazku', 'brilo-blocks'), checked: showEmploymentType, onChange: (value) => setAttributes({ showEmploymentType: value }) })] }) }), _jsxs("div", { ...blockProps, children: [_jsxs("div", { className: "components-placeholder", children: [_jsx("div", { className: "components-placeholder__label", children: __('Hlavička kariéry', 'brilo-blocks') }), _jsx("div", { className: "components-placeholder__instructions", children: __('Zobrazí data aktuální pozice — název, perex, lokalitu, plat, benefity a typ úvazku.', 'brilo-blocks') })] }), _jsx("div", { ...innerBlocksProps })] })] }));
|
|
10
13
|
};
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/factory.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,CAAA;AAEzD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAmBhH"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InnerBlocks } from '@wordpress/block-editor';
|
|
1
3
|
import { __ } from '@wordpress/i18n';
|
|
2
4
|
import { createCareerHeaderEdit } from './edit';
|
|
3
5
|
import { icon as defaultIcon } from './icon';
|
|
@@ -19,6 +21,6 @@ export function createCareerHeaderBlock(options) {
|
|
|
19
21
|
showEmploymentType: { type: 'boolean', default: true },
|
|
20
22
|
},
|
|
21
23
|
edit: createCareerHeaderEdit(options),
|
|
22
|
-
save: () =>
|
|
24
|
+
save: () => _jsx(InnerBlocks.Content, {}),
|
|
23
25
|
};
|
|
24
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { CareerHeaderAttributes, CareerHeaderOptions } from './types';
|
|
2
2
|
export { createCareerHeaderBlock } from './factory';
|
|
3
|
+
export { DEFAULT_ALLOWED_BLOCKS } from './constants';
|
|
3
4
|
import type { CareerHeaderOptions } from './types';
|
|
4
5
|
export declare const careerHeaderDefaults: CareerHeaderOptions;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AACxE,OAAO,EAAC,uBAAuB,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AACxE,OAAO,EAAC,uBAAuB,EAAC,MAAM,WAAW,CAAA;AACjD,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAA;AAGlD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAEhD,eAAO,MAAM,oBAAoB,EAAE,mBAIlC,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { createCareerHeaderBlock } from './factory';
|
|
2
|
+
export { DEFAULT_ALLOWED_BLOCKS } from './constants';
|
|
3
|
+
import { DEFAULT_ALLOWED_BLOCKS } from './constants';
|
|
2
4
|
export const careerHeaderDefaults = {
|
|
3
5
|
name: 'brilo/career-header',
|
|
6
|
+
parent: ['brilo/base-section'],
|
|
7
|
+
allowedBlocks: DEFAULT_ALLOWED_BLOCKS,
|
|
4
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/job-position-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,2BAA2B,EAAC,MAAM,WAAW,CAAA;AACrD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AAEjE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAA;AAEpD,eAAO,MAAM,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/job-position-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,2BAA2B,EAAC,MAAM,WAAW,CAAA;AACrD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AAEjE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAA;AAEpD,eAAO,MAAM,wBAAwB,EAAE,uBAGtC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { DocumentsGridAttributes, DocumentsGridOptions, DocumentsGridListingStyle, DocumentsGridMode, DocumentsGridSortBy, } from './types';
|
|
2
2
|
export { createDocumentsGridBlock } from './factory';
|
|
3
3
|
export { DocumentsSelectModal } from './DocumentsSelectModal';
|
|
4
|
+
export { DocumentTermSelectModal } from '../../../components/Document/DocumentTermSelectModal';
|
|
4
5
|
import type { DocumentsGridOptions } from './types';
|
|
5
6
|
export declare const documentsGridDefaults: DocumentsGridOptions;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-grid/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAA;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-grid/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAA;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,+CAA+C,CAAA;AAErF,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,qBAAqB,EAAE,oBAGnC,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createDocumentsGridBlock } from './factory';
|
|
2
2
|
export { DocumentsSelectModal } from './DocumentsSelectModal';
|
|
3
|
+
export { DocumentTermSelectModal } from '../../../components/Document/DocumentTermSelectModal';
|
|
3
4
|
export const documentsGridDefaults = {
|
|
4
5
|
name: 'brilo/documents-grid',
|
|
6
|
+
parent: ['brilo/base-section'],
|
|
5
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAwD,MAAM,SAAS,CAAA;AAepH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,oCAIzD;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAwD,MAAM,SAAS,CAAA;AAepH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,oCAIzD;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,iCAiNF"}
|
|
@@ -20,7 +20,7 @@ function sanitizeHtmlName(raw) {
|
|
|
20
20
|
}
|
|
21
21
|
export function createFormFieldEdit(_options) {
|
|
22
22
|
return function Edit({ attributes, setAttributes, }) {
|
|
23
|
-
var _a, _b, _c, _d, _e, _f;
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
24
24
|
const currentColumns = Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, attributes.columns || MIN_COLUMNS));
|
|
25
25
|
const blockProps = useBlockProps({
|
|
26
26
|
className: clsx('i-form-field', `--type-${attributes.type}`, `--cols-${currentColumns}`, attributes.required && '--required'),
|
|
@@ -37,6 +37,8 @@ export function createFormFieldEdit(_options) {
|
|
|
37
37
|
{ label: __('Žádná', 'brilo-blocks'), value: '' },
|
|
38
38
|
...optionRows.map((row) => ({ label: row.label, value: row.label })),
|
|
39
39
|
];
|
|
40
|
-
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Pole formuláře', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ inputu', 'brilo-blocks'), value: attributes.type, options: FIELD_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (type) => setAttributes({ type: type }) }), attributes.type === 'text' && (
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Pole formuláře', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ inputu', 'brilo-blocks'), value: attributes.type, options: FIELD_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (type) => setAttributes({ type: type }) }), attributes.type === 'text' && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { label: __('Typ textovho inputu', 'brilo-blocks'), value: attributes.textType, options: FIELD_TEXT_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (textType) => setAttributes(textType === 'email'
|
|
41
|
+
? { textType: textType }
|
|
42
|
+
: { textType: textType, isReplyTo: false }) }), attributes.textType === 'email' && (_jsx(ToggleControl, { label: __('Použít jako Reply-To pole', 'brilo-blocks'), help: __('Hodnota tohoto pole se použije jako Reply-To adresa notifikačního e-mailu.', 'brilo-blocks'), checked: (_a = attributes.isReplyTo) !== null && _a !== void 0 ? _a : false, onChange: (isReplyTo) => setAttributes({ isReplyTo }) }))] })), attributes.type !== 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Popisek', 'brilo-blocks'), value: attributes.label, onChange: (label) => setAttributes({ label }) }), _jsx(ToggleControl, { label: __('Povinné', 'brilo-blocks'), checked: attributes.required, onChange: (required) => setAttributes({ required }) }), _jsx(TextControl, { label: __('Název html atributu', 'brilo-blocks'), value: attributes.name, help: __('Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Např. city-born-to. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) }), _jsx(TextControl, { label: __('Placeholder', 'brilo-blocks'), value: attributes.placeholder, onChange: (placeholder) => setAttributes({ placeholder }) }), _jsx(ToggleControl, { label: __('Odesílat do GTM (dataLayer)', 'brilo-blocks'), help: __('Po úspěšném odeslání formuláře se do dataLayer pushne klíč podle názvu html atributu s vyplněnou/vybranou hodnotou tohoto pole.', 'brilo-blocks'), checked: (_b = attributes.gtmEnabled) !== null && _b !== void 0 ? _b : false, onChange: (gtmEnabled) => setAttributes({ gtmEnabled }) })] })), attributes.type === 'select' && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { label: __('Režim selectu', 'brilo-blocks'), value: (_c = attributes.selectMode) !== null && _c !== void 0 ? _c : 'classic', options: FIELD_SELECT_MODES.map((m) => ({ label: m.label, value: m.value })), onChange: (selectMode) => setAttributes({ selectMode: selectMode }) }), _jsx("div", { className: "i-form-field__options-trigger", children: _jsx(Button, { variant: "secondary", onClick: () => setIsOptionsModalOpen(true), children: sprintf(__('Upravit možnosti (%d)', 'brilo-blocks'), optionRows.length) }) }), isOptionsModalOpen && (_jsx(Modal, { title: __('Možnosti pole', 'brilo-blocks'), onRequestClose: () => setIsOptionsModalOpen(false), size: "large", children: _jsx(SelectOptionsRepeater, { rows: optionRows, onChange: updateOptionRows, showEmail: ((_d = attributes.selectMode) !== null && _d !== void 0 ? _d : 'classic') === 'email', onClose: () => setIsOptionsModalOpen(false) }) })), _jsx(SelectControl, { label: __('Výchozí hodnota', 'brilo-blocks'), value: (_e = attributes.defaultValue) !== null && _e !== void 0 ? _e : '', options: selectOptions, onChange: (defaultValue) => setAttributes({ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : '' }) })] })), attributes.type === 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Hodnota', 'brilo-blocks'), value: (_f = attributes.value) !== null && _f !== void 0 ? _f : '', onChange: (value) => setAttributes({ value }), help: __('Hodnota, která bude odeslána s formulářem.', 'brilo-blocks') }), _jsx(TextControl, { label: __('Název html atributu', 'brilo-blocks'), value: attributes.name, help: __('Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) })] })), attributes.type !== 'hidden' && (_jsx(RangeControl, { label: __('Počet sloupců', 'brilo-blocks'), value: currentColumns, min: MIN_COLUMNS, max: MAX_COLUMNS, onChange: (columns) => setAttributes({ columns: Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, columns !== null && columns !== void 0 ? columns : FIELD_COLUMNS_DEFAULT)) }) }))] }) }), _jsx("div", { ...blockProps, children: _jsx("div", { className: "i-form-field__wrapper", children: attributes.type === 'hidden' ? (_jsxs(_Fragment, { children: [_jsx("strong", { children: __('Skryté pole', 'brilo-blocks') }), _jsxs("div", { children: [__('Hodnota', 'brilo-blocks'), ": ", (_g = attributes.value) !== null && _g !== void 0 ? _g : ''] }), _jsxs("div", { children: [__('Název', 'brilo-blocks'), ": ", (_h = attributes.name) !== null && _h !== void 0 ? _h : ''] })] })) : (_jsxs(_Fragment, { children: [_jsx("strong", { children: attributes.label || __('Pole', 'brilo-blocks') }), _jsx("div", { children: attributes.type }), _jsxs("div", { className: "i-form-field__columns-control", children: [_jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.max(MIN_COLUMNS, currentColumns - 1) }), disabled: currentColumns <= MIN_COLUMNS, "aria-label": __('Snížit počet sloupců', 'brilo-blocks'), children: "-" }), _jsx("div", { className: "i-form-field__columns-value", children: `${currentColumns}/${MAX_COLUMNS}` }), _jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.min(MAX_COLUMNS, currentColumns + 1) }), disabled: currentColumns >= MAX_COLUMNS, "aria-label": __('Zvýšit počet sloupců', 'brilo-blocks'), children: "+" })] })] })) }) })] }));
|
|
41
43
|
};
|
|
42
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CA2BvG"}
|
|
@@ -23,6 +23,8 @@ export function createFormFieldBlock(options) {
|
|
|
23
23
|
selectMode: { type: 'string', default: 'classic' },
|
|
24
24
|
defaultValue: { type: 'string', default: '' },
|
|
25
25
|
value: { type: 'string', default: '' },
|
|
26
|
+
isReplyTo: { type: 'boolean', default: false },
|
|
27
|
+
gtmEnabled: { type: 'boolean', default: false },
|
|
26
28
|
},
|
|
27
29
|
edit: createFormFieldEdit(options),
|
|
28
30
|
save: () => null,
|
|
@@ -20,6 +20,8 @@ export interface FormFieldAttributes extends Record<string, unknown> {
|
|
|
20
20
|
selectMode: FormFieldSelectMode;
|
|
21
21
|
defaultValue: string;
|
|
22
22
|
value: string;
|
|
23
|
+
isReplyTo: boolean;
|
|
24
|
+
gtmEnabled: boolean;
|
|
23
25
|
}
|
|
24
26
|
export interface FormFieldOptions extends BriloBlockType {
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAoB,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AACjH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAEvF,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,UAAU,EAAE,mBAAmB,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAoB,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AACjH,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAEvF,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,UAAU,EAAE,mBAAmB,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/edit.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAiB,mBAAmB,EAAE,gBAAgB,EAAyC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/edit.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAiB,mBAAmB,EAAE,gBAAgB,EAAyC,MAAM,SAAS,CAAA;AA8C1H,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,8CAKxD;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IACxD,QAAQ,EAAE,MAAM,CAAA;CACjB,iCAyRF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { InspectorControls, RichText } from '@wordpress/block-editor';
|
|
3
3
|
import { FormTokenField, Notice, PanelBody, SelectControl, TextControl, ToggleControl } from '@wordpress/components';
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { cleanForSlug } from '@wordpress/url';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import { useEffect } from 'react';
|
|
8
|
+
import { useEffect, useMemo } from 'react';
|
|
9
9
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
10
10
|
import { EXTERNAL_METHODS, INTERNAL_SUBMIT_BEHAVIORS, PROCESSING_MODES } from './constants';
|
|
11
11
|
const ALLOWED_BLOCKS = ['brilo/form-field'];
|
|
@@ -14,10 +14,38 @@ function generateFormId(formName) {
|
|
|
14
14
|
const hash = Math.random().toString(36).slice(2, 8);
|
|
15
15
|
return `form-${slug}-${hash}`;
|
|
16
16
|
}
|
|
17
|
+
function slugifyFieldName(raw) {
|
|
18
|
+
return (raw !== null && raw !== void 0 ? raw : '')
|
|
19
|
+
.normalize('NFD')
|
|
20
|
+
.replace(/\p{Diacritic}/gu, '')
|
|
21
|
+
.replace(/[\s_]+/g, '-')
|
|
22
|
+
.replace(/[^a-zA-Z0-9_-]/g, '')
|
|
23
|
+
.replace(/[-_]{2,}/g, '-')
|
|
24
|
+
.replace(/^[-_]+/g, '')
|
|
25
|
+
.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
function gtmPlaceholderValue(type, textType) {
|
|
28
|
+
if (type === 'select') {
|
|
29
|
+
return '<vybraná možnost>';
|
|
30
|
+
}
|
|
31
|
+
if (type === 'textarea') {
|
|
32
|
+
return '<vyplněný text>';
|
|
33
|
+
}
|
|
34
|
+
if (textType === 'email') {
|
|
35
|
+
return '<vyplněný email>';
|
|
36
|
+
}
|
|
37
|
+
if (textType === 'tel') {
|
|
38
|
+
return '<vyplněné telefonní číslo>';
|
|
39
|
+
}
|
|
40
|
+
if (textType === 'number') {
|
|
41
|
+
return '<vyplněné číslo>';
|
|
42
|
+
}
|
|
43
|
+
return '<vyplněná hodnota>';
|
|
44
|
+
}
|
|
17
45
|
export function createFormGroupEdit(options) {
|
|
18
46
|
return function Edit({ attributes, setAttributes, clientId, }) {
|
|
19
47
|
var _a, _b, _c;
|
|
20
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
48
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
21
49
|
const { lockPostSaving, unlockPostSaving } = useDispatch('core/editor');
|
|
22
50
|
const processingMode = (_d = attributes.processingMode) !== null && _d !== void 0 ? _d : 'internal';
|
|
23
51
|
const isInternal = processingMode === 'internal';
|
|
@@ -25,16 +53,37 @@ export function createFormGroupEdit(options) {
|
|
|
25
53
|
const recipients = Array.isArray(attributes.senders) ? attributes.senders : [];
|
|
26
54
|
const isRecipientsMissing = isInternal && recipients.length === 0;
|
|
27
55
|
const isExternalUrlMissing = isExternal && ((_e = attributes.externalUrl) !== null && _e !== void 0 ? _e : '').trim() === '';
|
|
56
|
+
const { replyToCount, gtmFields } = useSelect((select) => {
|
|
57
|
+
const editor = select('core/block-editor');
|
|
58
|
+
const blocks = editor.getBlocks(clientId) || [];
|
|
59
|
+
const replyToCount = blocks.filter((block) => block.attributes.type === 'text' && block.attributes.textType === 'email' && block.attributes.isReplyTo === true).length;
|
|
60
|
+
const gtmFields = blocks.filter((block) => block.attributes.gtmEnabled).map((block) => block.attributes);
|
|
61
|
+
return { replyToCount, gtmFields };
|
|
62
|
+
}, [clientId]);
|
|
63
|
+
const hasMultipleReplyTo = replyToCount > 1;
|
|
64
|
+
const gtmPreview = useMemo(() => {
|
|
65
|
+
var _a;
|
|
66
|
+
const preview = {
|
|
67
|
+
event: ((_a = attributes.gtmEventName) !== null && _a !== void 0 ? _a : '').trim() || '<název eventu>',
|
|
68
|
+
url: '<URL stránky, odkud bylo odesláno>',
|
|
69
|
+
};
|
|
70
|
+
gtmFields.forEach((field) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const name = (field.name && field.name.trim() !== '' ? field.name : slugifyFieldName((_a = field.label) !== null && _a !== void 0 ? _a : '')) || '<pole-bez-nazvu>';
|
|
73
|
+
preview[name] = gtmPlaceholderValue(field.type, field.textType);
|
|
74
|
+
});
|
|
75
|
+
return preview;
|
|
76
|
+
}, [attributes.gtmEventName, gtmFields]);
|
|
28
77
|
useEffect(() => {
|
|
29
78
|
const lockName = `brilo-form-group-${clientId}`;
|
|
30
|
-
if (isRecipientsMissing || isExternalUrlMissing) {
|
|
79
|
+
if (isRecipientsMissing || isExternalUrlMissing || hasMultipleReplyTo) {
|
|
31
80
|
lockPostSaving(lockName);
|
|
32
81
|
}
|
|
33
82
|
else {
|
|
34
83
|
unlockPostSaving(lockName);
|
|
35
84
|
}
|
|
36
85
|
return () => unlockPostSaving(lockName);
|
|
37
|
-
}, [clientId, isRecipientsMissing, isExternalUrlMissing, lockPostSaving, unlockPostSaving]);
|
|
86
|
+
}, [clientId, isRecipientsMissing, isExternalUrlMissing, hasMultipleReplyTo, lockPostSaving, unlockPostSaving]);
|
|
38
87
|
// Generated once and persisted into the block's attributes so it stays stable across edits.
|
|
39
88
|
// biome-ignore lint/correctness/useExhaustiveDependencies: must run once on mount only
|
|
40
89
|
useEffect(() => {
|
|
@@ -51,10 +100,10 @@ export function createFormGroupEdit(options) {
|
|
|
51
100
|
orientation: 'horizontal',
|
|
52
101
|
layout: { type: 'default' },
|
|
53
102
|
});
|
|
54
|
-
return (_jsxs(_Fragment, { children: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
103
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Formulář', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('ID formuláře', 'brilo-blocks'), value: (_j = attributes.formId) !== null && _j !== void 0 ? _j : '', readOnly: true, onChange: () => { }, help: __('Generuje se automaticky, slouží k jednoznačné identifikaci formuláře.', 'brilo-blocks') }), _jsx(TextControl, { label: __('Název formuláře (volitelné)', 'brilo-blocks'), value: (_k = attributes.formName) !== null && _k !== void 0 ? _k : '', placeholder: __('Např. Kontaktní formulář', 'brilo-blocks'), onChange: (formName) => setAttributes({ formName }) }), _jsx(SelectControl, { label: __('Zpracování', 'brilo-blocks'), value: processingMode, options: PROCESSING_MODES.map((m) => ({ label: m.label, value: m.value })), onChange: (mode) => setAttributes({ processingMode: mode }) }), isExternal && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { label: __('Metoda odeslání', 'brilo-blocks'), value: (_l = attributes.externalMethod) !== null && _l !== void 0 ? _l : 'POST', options: EXTERNAL_METHODS.map((m) => ({ label: m.label, value: m.value })), onChange: (externalMethod) => setAttributes({ externalMethod: externalMethod }) }), _jsx(TextControl, { label: __('Externí URL', 'brilo-blocks'), value: (_m = attributes.externalUrl) !== null && _m !== void 0 ? _m : '', onChange: (externalUrl) => setAttributes({ externalUrl }) }), isExternalUrlMissing && (_jsx(Notice, { status: "warning", isDismissible: false, children: __('Pole „Externí URL“ je povinné pro externí zpracování.', 'brilo-blocks') }))] })), isInternal && (_jsxs(_Fragment, { children: [_jsx(FormTokenField, { label: __('Komu (příjemci)', 'brilo-blocks'), value: recipients, __next40pxDefaultSize: true, onChange: (senders) => setAttributes({
|
|
104
|
+
senders: (senders !== null && senders !== void 0 ? senders : [])
|
|
105
|
+
.map((item) => (typeof item === 'string' ? item.trim() : ''))
|
|
106
|
+
.filter((item) => item.length > 0),
|
|
107
|
+
}) }), isRecipientsMissing && (_jsx(Notice, { status: "warning", isDismissible: false, children: __('Pole „Komu (příjemci)“ je povinné. Vyplňte alespoň jeden e-mail příjemce.', 'brilo-blocks') })), _jsx(TextControl, { label: __('Od koho (From email)', 'brilo-blocks'), value: (_o = attributes.fromEmail) !== null && _o !== void 0 ? _o : '', onChange: (fromEmail) => setAttributes({ fromEmail }) }), _jsx(TextControl, { label: __('Předmět emailu', 'brilo-blocks'), value: (_p = attributes.subject) !== null && _p !== void 0 ? _p : '', placeholder: __('Potvrzení odeslaného formuláře', 'brilo-blocks'), onChange: (subject) => setAttributes({ subject }) }), _jsx(SelectControl, { label: __('Po odeslání', 'brilo-blocks'), value: (_q = attributes.internalSubmitBehavior) !== null && _q !== void 0 ? _q : 'stay', options: INTERNAL_SUBMIT_BEHAVIORS.map((b) => ({ label: b.label, value: b.value })), onChange: (internalSubmitBehavior) => setAttributes({ internalSubmitBehavior: internalSubmitBehavior }) }), ((_r = attributes.internalSubmitBehavior) !== null && _r !== void 0 ? _r : 'stay') === 'redirect' && (_jsx(TextControl, { label: __('URL děkovné stránky', 'brilo-blocks'), value: (_s = attributes.internalRedirectUrl) !== null && _s !== void 0 ? _s : '', onChange: (internalRedirectUrl) => setAttributes({ internalRedirectUrl }) })), _jsx(TextControl, { label: __('Úspěšná zpráva', 'brilo-blocks'), value: (_t = attributes.successMessage) !== null && _t !== void 0 ? _t : '', onChange: (successMessage) => setAttributes({ successMessage }) })] })), hasMultipleReplyTo && (_jsx(Notice, { status: "warning", isDismissible: false, children: __('Formulář obsahuje více polí označených jako Reply-To. Podporováno je pouze jedno takové pole.', 'brilo-blocks') })), _jsx(TextControl, { label: __('Titulek tlačítka odeslání', 'brilo-blocks'), value: (_u = (_a = attributes.submit) === null || _a === void 0 ? void 0 : _a.label) !== null && _u !== void 0 ? _u : 'Odeslat', onChange: (label) => setAttributes({ submit: { label } }) })] }), isInternal && (_jsxs(PanelBody, { title: __('Google Tag Manager', 'brilo-blocks'), initialOpen: false, children: [_jsx(ToggleControl, { label: __('Odesílat data do dataLayer', 'brilo-blocks'), help: __('Po úspěšném odeslání formuláře se pushne event do window.dataLayer. Zbytek (cíle, tagy) se nastavuje v GTM.', 'brilo-blocks'), checked: (_v = attributes.gtmEnabled) !== null && _v !== void 0 ? _v : false, onChange: (gtmEnabled) => setAttributes({ gtmEnabled }) }), ((_w = attributes.gtmEnabled) !== null && _w !== void 0 ? _w : false) && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Název GTM eventu', 'brilo-blocks'), placeholder: __('napr. website_form', 'brilo-blocks'), value: (_x = attributes.gtmEventName) !== null && _x !== void 0 ? _x : '', onChange: (gtmEventName) => setAttributes({ gtmEventName }), help: __('Pushne se { event: <tento název>, url: <stránka, odkud bylo odesláno>, ...pole s GTM }. Jednotlivá pole si zapnete u nich ("Odesílat do GTM").', 'brilo-blocks') }), ((_y = attributes.gtmEventName) !== null && _y !== void 0 ? _y : '').trim() === '' && (_jsx(Notice, { status: "warning", isDismissible: false, children: __('Bez názvu eventu se dataLayer push neodešle.', 'brilo-blocks') })), _jsx("p", { children: _jsx("strong", { children: __('Náhled objektu při úspěšném odeslání:', 'brilo-blocks') }) }), _jsx("pre", { className: "g-form__gtm-preview", children: JSON.stringify(gtmPreview, null, 2) }), gtmFields.length === 0 && (_jsx(Notice, { status: "info", isDismissible: false, children: __('Žádné pole formuláře nemá zapnuté "Odesílat do GTM" - do dataLayer půjde jen event a url. Zapněte to u polí, jejichž hodnotu chcete v dataLayer mít.', 'brilo-blocks') }))] }))] }))] }), _jsxs("div", { ...blockProps, children: [_jsx("div", { ...innerBlocksProps }), _jsxs("div", { className: "g-form__gdpr", children: [_jsxs("div", { className: "g-form__gdpr-header", children: [_jsx("strong", { children: __('GDPR obsah', 'brilo-blocks') }), _jsx(ToggleControl, { label: __('S checkboxem?', 'brilo-blocks'), checked: (_z = (_b = attributes.gdpr) === null || _b === void 0 ? void 0 : _b.checkbox) !== null && _z !== void 0 ? _z : true, onChange: (checkbox) => { var _a; var _b; return setAttributes({ gdpr: { content: (_b = (_a = attributes.gdpr) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : '', checkbox } }); } })] }), _jsx(RichText, { className: "g-form__gdpr-content", tagName: "div", value: (_0 = (_c = attributes.gdpr) === null || _c === void 0 ? void 0 : _c.content) !== null && _0 !== void 0 ? _0 : '', allowedFormats: ['core/bold', 'core/link'], onChange: (content) => { var _a; var _b; return setAttributes({ gdpr: { content, checkbox: (_b = (_a = attributes.gdpr) === null || _a === void 0 ? void 0 : _a.checkbox) !== null && _b !== void 0 ? _b : true } }); }, placeholder: __('Text GDPR souhlasu…', 'brilo-blocks') })] })] })] }));
|
|
59
108
|
};
|
|
60
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CA6BvG"}
|
|
@@ -26,6 +26,8 @@ export function createFormGroupBlock(options) {
|
|
|
26
26
|
submit: { type: 'object', default: { label: 'Odeslat' } },
|
|
27
27
|
gdpr: { type: 'object', default: { content: '', checkbox: true } },
|
|
28
28
|
successMessage: { type: 'string', default: 'Formulář byl úspěšně odeslán.' },
|
|
29
|
+
gtmEnabled: { type: 'boolean', default: false },
|
|
30
|
+
gtmEventName: { type: 'string', default: '' },
|
|
29
31
|
},
|
|
30
32
|
edit: createFormGroupEdit(options),
|
|
31
33
|
save: () => _jsx(InnerBlocks.Content, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,CAAA;AACpD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,CAAA;AAC3C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,CAAA;AAExD,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,cAAc,CAAA;IAC9B,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAA;IACvB,IAAI,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAC,CAAA;IAC1C,cAAc,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,CAAA;AACpD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,CAAA;AAC3C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,CAAA;AAExD,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,cAAc,CAAA;IAC9B,cAAc,EAAE,cAAc,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAA;IACvB,IAAI,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAC,CAAA;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG"}
|
|
@@ -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;AAE3C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,oBAAoB,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAElD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,GAAG,cAAc,CAAA;AAC3H,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAA;AAC/C,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEzD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,eAAe,CAAA;IACrB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAA;AAEpD,MAAM,MAAM,uBAAuB,GAC/B,UAAU,
|
|
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;AAE3C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,oBAAoB,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAElD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,aAAa,GAAG,cAAc,CAAA;AAC3H,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,CAAA;AAC/C,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEzD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,eAAe,CAAA;IACrB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAA;AAEpD,MAAM,MAAM,uBAAuB,GAC/B,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAA;AAElB,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,oBAAoB,CAAA;IAC1B,GAAG,CAAC,EAAE,kBAAkB,CAAA;IACxB,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE;QACX,KAAK,CAAC,EAAE;YACN,GAAG,CAAC,EAAE,eAAe,CAAA;YACrB,MAAM,CAAC,EAAE,eAAe,CAAA;SACzB,CAAA;KACF,CAAA;IACD,eAAe,EAAE,eAAe,CAAA;CACjC;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,GAAG,aAAa,GAAG,YAAY,GAAG,iBAAiB,CAAA;AAEnH,MAAM,WAAW,kBAAkB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAE,SAAQ,cAAc;IACxH,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAA;IACzC,eAAe,CAAC,EAAE;SACf,CAAC,IAAI,MAAM,MAAM,GAAG;YACnB,IAAI,EAAE,MAAM,CAAA;YACZ,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;SACnB;KACF,CAAA;IACD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,KAAK,SAAS,CAAA;IAClF,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAC/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual document_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 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,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"}
|