@brilo/base-blocks 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -11
- package/build/.tsbuildinfo +1 -1
- package/build/blocks/accordion/accordion-group/constants.d.ts +2 -0
- package/build/blocks/accordion/accordion-group/constants.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-group/constants.js +1 -0
- package/build/blocks/accordion/accordion-group/edit.d.ts +6 -0
- package/build/blocks/accordion/accordion-group/edit.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-group/edit.js +21 -0
- package/build/blocks/accordion/accordion-group/factory.d.ts +5 -0
- package/build/blocks/accordion/accordion-group/factory.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-group/factory.js +26 -0
- package/build/blocks/accordion/accordion-group/index.d.ts +5 -0
- package/build/blocks/accordion/accordion-group/index.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-group/index.js +7 -0
- package/build/blocks/accordion/accordion-group/types.d.ts +9 -0
- package/build/blocks/accordion/accordion-group/types.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-group/types.js +1 -0
- package/build/blocks/accordion/accordion-item/edit.d.ts +6 -0
- package/build/blocks/accordion/accordion-item/edit.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-item/edit.js +14 -0
- package/build/blocks/accordion/accordion-item/factory.d.ts +5 -0
- package/build/blocks/accordion/accordion-item/factory.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-item/factory.js +21 -0
- package/build/blocks/accordion/accordion-item/index.d.ts +5 -0
- package/build/blocks/accordion/accordion-item/index.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-item/index.js +5 -0
- package/build/blocks/accordion/accordion-item/types.d.ts +7 -0
- package/build/blocks/accordion/accordion-item/types.d.ts.map +1 -0
- package/build/blocks/accordion/accordion-item/types.js +1 -0
- package/build/blocks/document/documents-group/DocumentsSelectModal.d.ts +12 -0
- package/build/blocks/document/documents-group/DocumentsSelectModal.d.ts.map +1 -0
- package/build/blocks/document/documents-group/DocumentsSelectModal.js +153 -0
- package/build/blocks/document/documents-group/constants.d.ts +7 -0
- package/build/blocks/document/documents-group/constants.d.ts.map +1 -0
- package/build/blocks/document/documents-group/constants.js +5 -0
- package/build/blocks/document/documents-group/edit.d.ts +6 -0
- package/build/blocks/document/documents-group/edit.d.ts.map +1 -0
- package/build/blocks/document/documents-group/edit.js +27 -0
- package/build/blocks/document/documents-group/factory.d.ts +5 -0
- package/build/blocks/document/documents-group/factory.d.ts.map +1 -0
- package/build/blocks/document/documents-group/factory.js +50 -0
- package/build/blocks/document/documents-group/icon.d.ts +2 -0
- package/build/blocks/document/documents-group/icon.d.ts.map +1 -0
- package/build/blocks/document/documents-group/icon.js +2 -0
- package/build/blocks/document/documents-group/index.d.ts +6 -0
- package/build/blocks/document/documents-group/index.d.ts.map +1 -0
- package/build/blocks/document/documents-group/index.js +5 -0
- package/build/blocks/document/documents-group/types.d.ts +22 -0
- package/build/blocks/document/documents-group/types.d.ts.map +1 -0
- package/build/blocks/document/documents-group/types.js +1 -0
- package/build/blocks/layout/layout-aside/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-aside/icon.d.ts.map +1 -1
- package/build/blocks/layout/layout-content/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-content/icon.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/edit.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/edit.js +1 -1
- package/build/blocks/layout/layout-content-w-aside/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/icon.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.js +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -0
- package/package.json +6 -1
- package/src/blocks/accordion/accordion-group/constants.ts +1 -0
- package/src/blocks/accordion/accordion-group/edit.tsx +45 -0
- package/src/blocks/accordion/accordion-group/factory.tsx +29 -0
- package/src/blocks/accordion/accordion-group/index.ts +11 -0
- package/src/blocks/accordion/accordion-group/types.ts +10 -0
- package/src/blocks/accordion/accordion-item/edit.tsx +47 -0
- package/src/blocks/accordion/accordion-item/factory.tsx +24 -0
- package/src/blocks/accordion/accordion-item/index.ts +9 -0
- package/src/blocks/accordion/accordion-item/types.ts +7 -0
- package/src/blocks/document/documents-group/DocumentsSelectModal.tsx +273 -0
- package/src/blocks/document/documents-group/constants.ts +7 -0
- package/src/blocks/document/documents-group/edit.tsx +96 -0
- package/src/blocks/document/documents-group/factory.tsx +59 -0
- package/src/blocks/document/documents-group/icon.tsx +9 -0
- package/src/blocks/document/documents-group/index.ts +15 -0
- package/src/blocks/document/documents-group/types.ts +25 -0
- package/src/blocks/layout/layout-aside/factory.tsx +1 -3
- package/src/blocks/layout/layout-aside/icon.tsx +1 -6
- package/src/blocks/layout/layout-content/editor.scss +1 -1
- package/src/blocks/layout/layout-content/factory.tsx +1 -3
- package/src/blocks/layout/layout-content/icon.tsx +1 -6
- package/src/blocks/layout/layout-content-w-aside/edit.tsx +5 -1
- package/src/blocks/layout/layout-content-w-aside/factory.tsx +1 -3
- package/src/blocks/layout/layout-content-w-aside/icon.tsx +1 -6
- package/src/blocks/sections/base-section/controls.tsx +7 -1
- package/src/index.ts +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,YAAI,GAAG,EAAE,GAAG,CAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ACCORDION_HEADING_LEVELS = ['2', '3'];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AccordionGroupAttributes, AccordionGroupOptions } from './types';
|
|
2
|
+
export declare function createAccordionGroupEdit(options: AccordionGroupOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
attributes: AccordionGroupAttributes;
|
|
4
|
+
setAttributes: (a: Partial<AccordionGroupAttributes>) => 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/accordion/accordion-group/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAwB,MAAM,SAAS,CAAA;AAEnG,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,iCA8BF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InspectorControls } from '@wordpress/block-editor';
|
|
3
|
+
import { PanelBody, SelectControl } from '@wordpress/components';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
6
|
+
import { ACCORDION_HEADING_LEVELS } from './constants';
|
|
7
|
+
export function createAccordionGroupEdit(options) {
|
|
8
|
+
return function Edit({ attributes, setAttributes, }) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const { headingLevel } = attributes;
|
|
11
|
+
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
12
|
+
blockClassName: (_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-accordion wp-block-section',
|
|
13
|
+
containerClassName: (_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'g-accordion__items',
|
|
14
|
+
allowedBlocks: options.allowedBlocks,
|
|
15
|
+
template: options.template,
|
|
16
|
+
orientation: 'vertical',
|
|
17
|
+
layout: { type: 'default' },
|
|
18
|
+
});
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: _jsx(SelectControl, { label: __('Level nadpisu', 'brilo-blocks'), value: headingLevel, options: ACCORDION_HEADING_LEVELS.map((level) => ({ value: level, label: `H${level}` })), onChange: (value) => setAttributes({ headingLevel: value }) }) }) }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { AccordionGroupAttributes, AccordionGroupOptions } from './types';
|
|
3
|
+
export type { AccordionGroupAttributes, AccordionGroupOptions };
|
|
4
|
+
export declare function createAccordionGroupBlock(options: AccordionGroupOptions): BlockConfiguration<AccordionGroupAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,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,CAmBtH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InnerBlocks } from '@wordpress/block-editor';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { ACCORDION_HEADING_LEVELS } from './constants';
|
|
5
|
+
import { createAccordionGroupEdit } from './edit';
|
|
6
|
+
export function createAccordionGroupBlock(options) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
return {
|
|
9
|
+
name: options.name,
|
|
10
|
+
title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Accordion', 'brilo-blocks'),
|
|
11
|
+
description: options.description,
|
|
12
|
+
category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
|
|
13
|
+
...(options.parent && { parent: options.parent }),
|
|
14
|
+
icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'editor-ul',
|
|
15
|
+
supports: { html: false, customClassName: false },
|
|
16
|
+
attributes: {
|
|
17
|
+
headingLevel: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: ACCORDION_HEADING_LEVELS[1],
|
|
20
|
+
enum: [...ACCORDION_HEADING_LEVELS],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
edit: createAccordionGroupEdit(options),
|
|
24
|
+
save: () => _jsx(InnerBlocks.Content, {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { AccordionGroupAttributes, AccordionGroupOptions, AccordionHeadingLevel } from './types';
|
|
2
|
+
export { createAccordionGroupBlock } from './factory';
|
|
3
|
+
import type { AccordionGroupOptions } from './types';
|
|
4
|
+
export declare const accordionGroupDefaults: AccordionGroupOptions;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AACnG,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AAEnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAKpC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BriloBlockType } from '../../../types';
|
|
2
|
+
import type { ACCORDION_HEADING_LEVELS } from './constants';
|
|
3
|
+
export type AccordionHeadingLevel = (typeof ACCORDION_HEADING_LEVELS)[number];
|
|
4
|
+
export interface AccordionGroupAttributes extends Record<string, unknown> {
|
|
5
|
+
headingLevel: AccordionHeadingLevel;
|
|
6
|
+
}
|
|
7
|
+
export interface AccordionGroupOptions extends BriloBlockType {
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,aAAa,CAAA;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,YAAY,EAAE,qBAAqB,CAAA;CACpC;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AccordionItemAttributes, AccordionItemOptions } from './types';
|
|
2
|
+
export declare function createAccordionItemEdit(_options: AccordionItemOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
attributes: AccordionItemAttributes;
|
|
4
|
+
setAttributes: (a: Partial<AccordionItemAttributes>) => 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/accordion/accordion-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,oCAIjE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,iCAgCF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
3
|
+
import { BaseControl } from '@wordpress/components';
|
|
4
|
+
import { Icon, chevronDown } from '@wordpress/icons';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
export function createAccordionItemEdit(_options) {
|
|
8
|
+
return function Edit({ attributes, setAttributes, }) {
|
|
9
|
+
const { title } = attributes;
|
|
10
|
+
const blockProps = useBlockProps({ className: clsx('accordion-item') });
|
|
11
|
+
const innerBlocksProps = useInnerBlocksProps({});
|
|
12
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { ...blockProps, children: [_jsxs("header", { className: "accordion-item__header flex gap-2", children: [_jsx(RichText, { identifier: "title", className: "title u-text-editable grow", tagName: "h3", value: title, allowedFormats: [], onChange: (value) => setAttributes({ title: value }), placeholder: __('Nadpis prvku', 'brilo-blocks'), "data-custom-placeholder": true }), _jsxs("label", { className: "accordion-item__dropdown flex items-center justify-center cursor-pointer", children: [_jsx(Icon, { icon: chevronDown, size: 32, className: "accordion-item__dropdown-icon", color: "white" }), _jsx("input", { type: "checkbox", defaultChecked: true })] })] }), _jsx(BaseControl, { label: __('Obsah:', 'brilo-blocks'), className: "accordion-item__content", children: _jsx("div", { ...innerBlocksProps }) })] }) }));
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { AccordionItemAttributes, AccordionItemOptions } from './types';
|
|
3
|
+
export type { AccordionItemAttributes, AccordionItemOptions };
|
|
4
|
+
export declare function createAccordionItemBlock(options: AccordionItemOptions): BlockConfiguration<AccordionItemAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,YAAY,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,CAAA;AAE3D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAenH"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InnerBlocks } from '@wordpress/block-editor';
|
|
3
|
+
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { createAccordionItemEdit } from './edit';
|
|
5
|
+
export function createAccordionItemBlock(options) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
return {
|
|
8
|
+
name: options.name,
|
|
9
|
+
title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Accordion položka', 'brilo-blocks'),
|
|
10
|
+
description: options.description,
|
|
11
|
+
category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
|
|
12
|
+
...(options.parent && { parent: options.parent }),
|
|
13
|
+
icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'editor-ul',
|
|
14
|
+
supports: { html: false, customClassName: false },
|
|
15
|
+
attributes: {
|
|
16
|
+
title: { type: 'string', default: '' },
|
|
17
|
+
},
|
|
18
|
+
edit: createAccordionItemEdit(options),
|
|
19
|
+
save: () => _jsx(InnerBlocks.Content, {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { AccordionItemAttributes, AccordionItemOptions } from './types';
|
|
2
|
+
export { createAccordionItemBlock } from './factory';
|
|
3
|
+
import type { AccordionItemOptions } from './types';
|
|
4
|
+
export declare const accordionItemDefaults: AccordionItemOptions;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAC1E,OAAO,EAAC,wBAAwB,EAAC,MAAM,WAAW,CAAA;AAElD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,qBAAqB,EAAE,oBAGnC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,uBAAwB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectControlProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Manual document picker built on the real @wordpress/dataviews package: a
|
|
5
|
+
* fill-size modal (table view, search, sort, checkbox selection) for
|
|
6
|
+
* browsing/selecting documents, plus an up/down-reorderable list of the
|
|
7
|
+
* current selection below (drag-and-drop conflicted with the block editor's
|
|
8
|
+
* own native block dragging — see git history). Local to this block — not a
|
|
9
|
+
* shared @brilo/gutenberg-toolkit component.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DocumentsSelectModal({ selectedItems, onChange }: SelectControlProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=DocumentsSelectModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/DocumentsSelectModal.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAgH/C;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAC,aAAa,EAAE,QAAQ,EAAC,EAAE,kBAAkB,qBAiJjF"}
|
|
@@ -0,0 +1,153 @@
|
|
|
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 DEFAULT_VIEW = {
|
|
10
|
+
type: 'table',
|
|
11
|
+
search: '',
|
|
12
|
+
filters: [],
|
|
13
|
+
page: 1,
|
|
14
|
+
perPage: 20,
|
|
15
|
+
sort: { field: 'title', direction: 'asc' },
|
|
16
|
+
fields: ['document_file_display', 'document_category_names', 'document_alt_title', 'document_url'],
|
|
17
|
+
titleField: 'title',
|
|
18
|
+
};
|
|
19
|
+
function useDocuments() {
|
|
20
|
+
const [documents, setDocuments] = useState([]);
|
|
21
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setIsLoading(true);
|
|
24
|
+
apiFetch({
|
|
25
|
+
path: '/wp/v2/document?per_page=100&orderby=title&order=asc&' +
|
|
26
|
+
'_fields=id,title,date,document_alt_title,document_url,document_file_display,document_category_names',
|
|
27
|
+
})
|
|
28
|
+
.then((result) => setDocuments(result))
|
|
29
|
+
.catch(() => setDocuments([]))
|
|
30
|
+
.finally(() => setIsLoading(false));
|
|
31
|
+
}, []);
|
|
32
|
+
return { documents, isLoading };
|
|
33
|
+
}
|
|
34
|
+
function SelectedOrderList({ items, onChange, onRemove, }) {
|
|
35
|
+
if (0 === items.length) {
|
|
36
|
+
return _jsx("p", { className: "i-documents-select-modal__empty", children: __('Nevybrány žádné dokumenty.', 'brilo-blocks') });
|
|
37
|
+
}
|
|
38
|
+
const move = (index, direction) => {
|
|
39
|
+
const target = index + direction;
|
|
40
|
+
if (target < 0 || target >= items.length) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const next = [...items];
|
|
44
|
+
[next[index], next[target]] = [next[target], next[index]];
|
|
45
|
+
onChange(next.map((item) => item.id));
|
|
46
|
+
};
|
|
47
|
+
return (_jsx(VStack, { spacing: 2, children: items.map((item, index) => (_jsx(Card, { size: "small", className: "i-documents-select-modal__item", children: _jsx(CardBody, { children: _jsxs(HStack, { alignment: "center", children: [_jsx("span", { className: "i-documents-select-modal__item-title", style: {
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
minWidth: 0,
|
|
50
|
+
textAlign: 'left',
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
textOverflow: 'ellipsis',
|
|
53
|
+
whiteSpace: 'nowrap',
|
|
54
|
+
}, children: item.title.rendered || __('(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))) }));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Manual document picker built on the real @wordpress/dataviews package: a
|
|
58
|
+
* fill-size modal (table view, search, sort, checkbox selection) for
|
|
59
|
+
* browsing/selecting documents, plus an up/down-reorderable list of the
|
|
60
|
+
* current selection below (drag-and-drop conflicted with the block editor's
|
|
61
|
+
* own native block dragging — see git history). Local to this block — not a
|
|
62
|
+
* shared @brilo/gutenberg-toolkit component.
|
|
63
|
+
*/
|
|
64
|
+
export function DocumentsSelectModal({ selectedItems, onChange }) {
|
|
65
|
+
const { documents, isLoading } = useDocuments();
|
|
66
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
67
|
+
const [view, setView] = useState(DEFAULT_VIEW);
|
|
68
|
+
const selectedDocuments = useMemo(() => selectedItems.map((id) => documents.find((doc) => doc.id === id)).filter((doc) => undefined !== doc), [selectedItems, documents]);
|
|
69
|
+
const fields = useMemo(() => [
|
|
70
|
+
{
|
|
71
|
+
id: 'title',
|
|
72
|
+
label: __('Název', 'brilo-blocks'),
|
|
73
|
+
enableHiding: false,
|
|
74
|
+
enableSorting: true,
|
|
75
|
+
render: ({ item }) => item.title.rendered || __('(bez názvu)', 'brilo-blocks'),
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'document_file_display',
|
|
79
|
+
label: __('Soubor', 'brilo-blocks'),
|
|
80
|
+
enableSorting: false,
|
|
81
|
+
render: ({ item }) => item.document_file_display || '—',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'document_category_names',
|
|
85
|
+
label: __('Kategorie', 'brilo-blocks'),
|
|
86
|
+
enableSorting: false,
|
|
87
|
+
render: ({ item }) => item.document_category_names || '—',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'document_alt_title',
|
|
91
|
+
label: __('Alternativní titulek', 'brilo-blocks'),
|
|
92
|
+
enableSorting: false,
|
|
93
|
+
render: ({ item }) => item.document_alt_title || '—',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'document_url',
|
|
97
|
+
label: __('Alternativní URL', 'brilo-blocks'),
|
|
98
|
+
enableSorting: false,
|
|
99
|
+
render: ({ item }) => item.document_url || '—',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'date',
|
|
103
|
+
label: __('Datum', 'brilo-blocks'),
|
|
104
|
+
enableSorting: true,
|
|
105
|
+
render: ({ item }) => (item.date ? new Date(item.date).toLocaleDateString() : '—'),
|
|
106
|
+
},
|
|
107
|
+
], []);
|
|
108
|
+
const { data, paginationInfo } = useMemo(() => {
|
|
109
|
+
var _a;
|
|
110
|
+
var _b, _c;
|
|
111
|
+
let filtered = documents;
|
|
112
|
+
if (view.search) {
|
|
113
|
+
const needle = view.search.toLowerCase();
|
|
114
|
+
filtered = filtered.filter((doc) => doc.title.rendered.toLowerCase().includes(needle));
|
|
115
|
+
}
|
|
116
|
+
if ((_a = view.sort) === null || _a === void 0 ? void 0 : _a.field) {
|
|
117
|
+
const { field, direction } = view.sort;
|
|
118
|
+
const sorted = [...filtered];
|
|
119
|
+
sorted.sort((a, b) => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const valueA = 'title' === field ? a.title.rendered : ((_a = a[field]) !== null && _a !== void 0 ? _a : '');
|
|
122
|
+
const valueB = 'title' === field ? b.title.rendered : ((_b = b[field]) !== null && _b !== void 0 ? _b : '');
|
|
123
|
+
const result = String(valueA).localeCompare(String(valueB));
|
|
124
|
+
return 'desc' === direction ? -result : result;
|
|
125
|
+
});
|
|
126
|
+
filtered = sorted;
|
|
127
|
+
}
|
|
128
|
+
const perPage = (_b = view.perPage) !== null && _b !== void 0 ? _b : 20;
|
|
129
|
+
const page = (_c = view.page) !== null && _c !== void 0 ? _c : 1;
|
|
130
|
+
const start = (page - 1) * perPage;
|
|
131
|
+
return {
|
|
132
|
+
data: filtered.slice(start, start + perPage),
|
|
133
|
+
paginationInfo: { totalItems: filtered.length, totalPages: Math.ceil(filtered.length / perPage) || 1 },
|
|
134
|
+
};
|
|
135
|
+
}, [documents, view]);
|
|
136
|
+
const toggleSelected = (id) => {
|
|
137
|
+
onChange(selectedItems.includes(id) ? selectedItems.filter((itemId) => itemId !== id) : [...selectedItems, id]);
|
|
138
|
+
};
|
|
139
|
+
return (_jsxs(VStack, { spacing: 3, className: "i-documents-select-modal", children: [_jsx(Button, { variant: "secondary", icon: plusCircle, onClick: () => setIsOpen(true), children: __('Vybrat dokumenty', 'brilo-blocks') }), _jsx(SelectedOrderList, { items: selectedDocuments, onChange: onChange, onRemove: (id) => onChange(selectedItems.filter((itemId) => itemId !== id)) }), isOpen && (_jsx(Modal, { title: __('Vybrat dokumenty', 'brilo-blocks'), onRequestClose: () => setIsOpen(false), size: "fill", children: _jsxs(VStack, { spacing: 4, style: { height: '100%' }, children: [_jsx("div", { style: { flexGrow: 1, minHeight: 0 }, children: _jsx(DataViews, { data: data, fields: 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: [
|
|
140
|
+
{
|
|
141
|
+
id: 'toggle',
|
|
142
|
+
label: (items) => items.length && selectedItems.includes(items[0].id) ? __('Odebrat', 'brilo-blocks') : __('Přidat', 'brilo-blocks'),
|
|
143
|
+
// supportsBulk is what makes DataViews render a checkbox per row —
|
|
144
|
+
// without it there's no way to select items other than this menu.
|
|
145
|
+
supportsBulk: true,
|
|
146
|
+
callback: (items) => {
|
|
147
|
+
items.forEach((item) => {
|
|
148
|
+
toggleSelected(item.id);
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
] }) }), _jsx(HStack, { justify: "flex-end", children: _jsx(Button, { variant: "primary", onClick: () => setIsOpen(false), children: __('Hotovo', 'brilo-blocks') }) })] }) }))] }));
|
|
153
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentsGroupColumns, DocumentsGroupMode, DocumentsGroupListingStyle, DocumentsGroupSortBy } from './types';
|
|
2
|
+
export declare const DOCUMENTS_GROUP_MODE_DEFAULT: DocumentsGroupMode;
|
|
3
|
+
export declare const DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT: DocumentsGroupListingStyle;
|
|
4
|
+
export declare const DOCUMENTS_GROUP_SORT_BY_DEFAULT: DocumentsGroupSortBy;
|
|
5
|
+
export declare const DOCUMENTS_GROUP_COLUMNS_DEFAULT: DocumentsGroupColumns;
|
|
6
|
+
export declare const DOCUMENTS_GROUP_COLUMNS: DocumentsGroupColumns[];
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAExH,eAAO,MAAM,4BAA4B,EAAE,kBAA6B,CAAA;AACxE,eAAO,MAAM,qCAAqC,EAAE,0BAAsC,CAAA;AAC1F,eAAO,MAAM,+BAA+B,EAAE,oBAAqC,CAAA;AACnF,eAAO,MAAM,+BAA+B,EAAE,qBAAyB,CAAA;AACvE,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAAoB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const DOCUMENTS_GROUP_MODE_DEFAULT = 'manual';
|
|
2
|
+
export const DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT = 'classic';
|
|
3
|
+
export const DOCUMENTS_GROUP_SORT_BY_DEFAULT = 'manual-order';
|
|
4
|
+
export const DOCUMENTS_GROUP_COLUMNS_DEFAULT = 1;
|
|
5
|
+
export const DOCUMENTS_GROUP_COLUMNS = [1, 2, 3, 4, 6];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DocumentsGroupAttributes, DocumentsGroupOptions } from './types';
|
|
2
|
+
export declare function createDocumentsGroupEdit(options: DocumentsGroupOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
attributes: DocumentsGroupAttributes;
|
|
4
|
+
setAttributes: (a: Partial<DocumentsGroupAttributes>) => 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/document/documents-group/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAE5E,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,iCA8EF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { DOCUMENTS_GROUP_COLUMNS } from './constants';
|
|
6
|
+
export function createDocumentsGroupEdit(options) {
|
|
7
|
+
return function Edit({ attributes, setAttributes, }) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const { mode, listingStyle, sortBy, columns, selectedDocuments, selectedCategories } = attributes;
|
|
10
|
+
const blockProps = useBlockProps({ className: 'wp-block-section' });
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Nastavení výpisu', 'brilo-blocks'), initialOpen: true, children: [_jsxs(ToggleGroupControl, { label: __('Zdroj dokumentů', 'brilo-blocks'), value: mode, onChange: (value) => {
|
|
12
|
+
const nextMode = value;
|
|
13
|
+
setAttributes({
|
|
14
|
+
mode: nextMode,
|
|
15
|
+
sortBy: 'manual' === nextMode ? sortBy : sortBy === 'manual-order' ? 'menu_order' : sortBy,
|
|
16
|
+
});
|
|
17
|
+
}, isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "manual", label: __('Ruční výběr', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "category", label: __('Dle kategorie', 'brilo-blocks') })] }), _jsxs(ToggleGroupControl, { label: __('Styl výpisu', 'brilo-blocks'), value: listingStyle, onChange: (value) => setAttributes({ listingStyle: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "classic", label: __('Klasický výpis', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "group-by-category", label: __('Dle kategorií', 'brilo-blocks') })] }), _jsxs(ToggleGroupControl, { label: __('Řazení', 'brilo-blocks'), value: sortBy, onChange: (value) => setAttributes({ sortBy: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "menu_order", label: __('Pořadí', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "date", label: __('Datum', 'brilo-blocks') }), 'manual' === mode && _jsx(ToggleGroupControlOption, { value: "manual-order", label: __('Dle výběru', 'brilo-blocks') })] }), _jsx(ToggleGroupControl, { label: __('Počet sloupců', 'brilo-blocks'), help: 'group-by-category' === listingStyle ? __('Platí pro seznam dokumentů uvnitř každé kategorie.', 'brilo-blocks') : undefined, value: String(columns), onChange: (value) => setAttributes({ columns: Number(value) }), isBlock: true, children: DOCUMENTS_GROUP_COLUMNS.map((c) => (_jsx(ToggleGroupControlOption, { value: String(c), label: String(c) }, c))) })] }) }), _jsxs("div", { ...blockProps, children: ['category' === mode &&
|
|
18
|
+
((_a = options.renderCategoryControl) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
19
|
+
selectedItems: selectedCategories,
|
|
20
|
+
onChange: (ids) => setAttributes({ selectedCategories: ids }),
|
|
21
|
+
})), 'manual' === mode &&
|
|
22
|
+
((_b = options.renderDocumentsControl) === null || _b === void 0 ? void 0 : _b.call(options, {
|
|
23
|
+
selectedItems: selectedDocuments,
|
|
24
|
+
onChange: (ids) => setAttributes({ selectedDocuments: ids }),
|
|
25
|
+
}))] })] }));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { DocumentsGroupAttributes, DocumentsGroupOptions } from './types';
|
|
3
|
+
export type { DocumentsGroupAttributes, DocumentsGroupOptions };
|
|
4
|
+
export declare function createDocumentsGroupBlock(options: DocumentsGroupOptions): BlockConfiguration<DocumentsGroupAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAUzD,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,CA4CtH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { DOCUMENTS_GROUP_COLUMNS_DEFAULT, DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT, DOCUMENTS_GROUP_MODE_DEFAULT, DOCUMENTS_GROUP_SORT_BY_DEFAULT, } from './constants';
|
|
3
|
+
import { createDocumentsGroupEdit } from './edit';
|
|
4
|
+
import { icon as defaultIcon } from './icon';
|
|
5
|
+
export function createDocumentsGroupBlock(options) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
return {
|
|
8
|
+
name: options.name,
|
|
9
|
+
title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Dokumenty', 'brilo-blocks'),
|
|
10
|
+
description: options.description,
|
|
11
|
+
category: (_b = options.category) !== null && _b !== void 0 ? _b : 'widgets',
|
|
12
|
+
...(options.parent && { parent: options.parent }),
|
|
13
|
+
icon: (_c = options.icon) !== null && _c !== void 0 ? _c : { src: defaultIcon },
|
|
14
|
+
supports: { html: false, customClassName: false },
|
|
15
|
+
attributes: {
|
|
16
|
+
mode: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: DOCUMENTS_GROUP_MODE_DEFAULT,
|
|
19
|
+
enum: ['manual', 'category'],
|
|
20
|
+
},
|
|
21
|
+
listingStyle: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT,
|
|
24
|
+
enum: ['classic', 'group-by-category'],
|
|
25
|
+
},
|
|
26
|
+
sortBy: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: DOCUMENTS_GROUP_SORT_BY_DEFAULT,
|
|
29
|
+
enum: ['menu_order', 'date', 'manual-order'],
|
|
30
|
+
},
|
|
31
|
+
columns: {
|
|
32
|
+
type: 'number',
|
|
33
|
+
default: DOCUMENTS_GROUP_COLUMNS_DEFAULT,
|
|
34
|
+
enum: [1, 2, 3, 4, 6],
|
|
35
|
+
},
|
|
36
|
+
selectedDocuments: {
|
|
37
|
+
type: 'array',
|
|
38
|
+
default: [],
|
|
39
|
+
items: { type: 'number' },
|
|
40
|
+
},
|
|
41
|
+
selectedCategories: {
|
|
42
|
+
type: 'array',
|
|
43
|
+
default: [],
|
|
44
|
+
items: { type: 'number' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
edit: createDocumentsGroupEdit(options),
|
|
48
|
+
save: () => null,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/icon.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,6BAQhB,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 1H12L16 5V19H4V1Z", stroke: "black", fill: "none" }), _jsx("path", { d: "M12 1V5H16", stroke: "black", fill: "none" }), _jsx("line", { x1: "6.5", y1: "9", x2: "13.5", y2: "9", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "12", x2: "13.5", y2: "12", stroke: "black" }), _jsx("line", { x1: "6.5", y1: "15", x2: "11", y2: "15", stroke: "black" })] }));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { DocumentsGroupAttributes, DocumentsGroupOptions, DocumentsGroupListingStyle, DocumentsGroupMode, DocumentsGroupSortBy, } from './types';
|
|
2
|
+
export { createDocumentsGroupBlock } from './factory';
|
|
3
|
+
export { DocumentsSelectModal } from './DocumentsSelectModal';
|
|
4
|
+
import type { DocumentsGroupOptions } from './types';
|
|
5
|
+
export declare const documentsGroupDefaults: DocumentsGroupOptions;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAE3D,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAEpC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BriloBlockType } from '../../../types';
|
|
2
|
+
export type DocumentsGroupMode = 'manual' | 'category';
|
|
3
|
+
export type DocumentsGroupListingStyle = 'classic' | 'group-by-category';
|
|
4
|
+
export type DocumentsGroupSortBy = 'menu_order' | 'date' | 'manual-order';
|
|
5
|
+
export type DocumentsGroupColumns = 1 | 2 | 3 | 4 | 6;
|
|
6
|
+
export interface DocumentsGroupAttributes extends Record<string, unknown> {
|
|
7
|
+
mode: DocumentsGroupMode;
|
|
8
|
+
listingStyle: DocumentsGroupListingStyle;
|
|
9
|
+
sortBy: DocumentsGroupSortBy;
|
|
10
|
+
columns: DocumentsGroupColumns;
|
|
11
|
+
selectedDocuments: number[];
|
|
12
|
+
selectedCategories: number[];
|
|
13
|
+
}
|
|
14
|
+
export interface SelectControlProps {
|
|
15
|
+
selectedItems: number[];
|
|
16
|
+
onChange: (ids: number[]) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface DocumentsGroupOptions extends BriloBlockType {
|
|
19
|
+
renderCategoryControl?: (props: SelectControlProps) => JSX.Element;
|
|
20
|
+
renderDocumentsControl?: (props: SelectControlProps) => JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,CAAA;AACtD,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,mBAAmB,CAAA;AACxE,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,MAAM,GAAG,cAAc,CAAA;AACzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErD,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,IAAI,EAAE,kBAAkB,CAAA;IACxB,YAAY,EAAE,0BAA0B,CAAA;IACxC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,OAAO,EAAE,qBAAqB,CAAA;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAClC;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;IAClE,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-aside/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,SAAS,CAAA;AAE1D,wBAAgB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-aside/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,SAAS,CAAA;AAE1D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAa3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-aside/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-aside/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,IAAI,mBAIhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-content/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-content/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAajG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-content/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/layout-content/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,IAAI,mBAIhB,CAAA"}
|