Plugin Directory

Changeset 2977841


Ignore:
Timestamp:
10/11/2023 10:14:29 PM (2 years ago)
Author:
taskotr
Message:

New version: 1.7.0

Location:
sortable-block
Files:
38 added
21 edited

Legend:

Unmodified
Added
Removed
  • sortable-block/trunk/build/container/block.json

    r2967229 r2977841  
    33  "apiVersion": 2,
    44  "name": "sortable/container",
    5   "version": "1.6.0",
     5  "version": "1.7.0",
    66  "title": "Sortable",
    77  "category": "widgets",
     
    2525      "default": "desc"
    2626    },
     27    "filter": {
     28      "type": "object",
     29      "default": {
     30        "displayType": "",
     31        "date": "",
     32        "dateFilterType": "on",
     33        "includeDateTime": false,
     34        "ignoreOutdated": false
     35      }
     36    },
    2737    "separator": {
    2838      "type": "object",
    2939      "default": {}
    3040    }
     41  },
     42  "providesContext": {
     43    "sortable/filter": "filter"
    3144  },
    3245  "supports": {
  • sortable-block/trunk/build/container/index.asset.php

    r2967229 r2977841  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '38ad668d8b06006db7ea');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '54664318c5129816edb3');
  • sortable-block/trunk/build/container/index.css

    r2887945 r2977841  
    1 .wp-block-sortable-container .block-editor-button-block-appender{margin-block:1rem}.wp-block-sortable-container>.block-list-appender{align-self:center;line-height:inherit;list-style:none;position:relative;right:auto}.wp-block-sortable-container>.block-list-appender .block-editor-button-block-appender{flex-direction:row}.wp-block-sortable-container>.block-list-appender .block-editor-button-block-appender:after{content:attr(aria-label);font-weight:700}.wp-block-sortable-container.is-list>.block-list-appender{width:100%}.wp-block-sortable-container.is-grid>.block-list-appender{grid-column:1/-1}.wp-block-sortable-container .components-placeholder__label .dashicon{margin-right:1rem}
     1.wp-block-sortable-container .block-editor-button-block-appender{margin-block:1rem}.wp-block-sortable-container>.block-list-appender{align-self:center;line-height:inherit;list-style:none;position:relative;right:auto}.wp-block-sortable-container>.block-list-appender .block-editor-button-block-appender{flex-direction:row}.wp-block-sortable-container>.block-list-appender .block-editor-button-block-appender:after{content:attr(aria-label);font-weight:700}.wp-block-sortable-container.is-list>.block-list-appender{width:100%}.wp-block-sortable-container.is-grid>.block-list-appender{grid-column:1/-1}.wp-block-sortable-container .components-placeholder__label .dashicon{margin-right:1rem}.block-editor-block-inspector .sortable-block__date-row .components-datetime .components-base-control{margin-block-end:0}.sortable-block__ignore-date-warnings{border-block-start:1px solid #e0e0e0;margin-block-start:10px;padding-block-start:15px}.block-library-sortable-pattern__selection-modal .block-editor-block-patterns-list{display:grid;gap:32px;grid-template-columns:repeat(3,minmax(0,1fr));padding-block:.5em}.block-library-sortable-pattern__selection-modal .block-editor-block-patterns-list .block-editor-block-preview__container{border:2px solid #e0e0e0;border-radius:8px;padding-block:1em}.block-library-sortable-pattern__selection-modal .block-editor-block-patterns-list__item:hover .block-editor-block-preview__container{box-shadow:0 0 0 6px #eee,0 0 10px 6px #ddd}
  • sortable-block/trunk/build/container/index.js

    r2967229 r2977841  
    1 !function(){var e,t={506:function(e,t,r){"use strict";var o=window.wp.blocks,n=window.wp.element,a=window.wp.blockEditor,l=window.wp.data,i=r(184),s=r.n(i),c=window.wp.i18n,d=window.wp.editor,p=window.wp.components,u=window.wp.primitives,m=(0,n.createElement)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(u.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),h=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"}));const v=["sortable/entry"];function g(e){const{clientId:t,attributes:r,setAttributes:o}=e,{width:i,style:u,color:g}=r.separator||{},b={...i&&{"--wp--sortable-container--separator--width":i},...u&&{"--wp--sortable-container--separator--style":u},...g&&{"--wp--sortable-container--separator--color":g}},w=(0,a.__experimentalGetGapCSSValue)(r.style?.spacing?.blockGap),f={...w&&{"--wp--sortable-container--spacing--gap":w}},y=(0,a.useBlockProps)({className:s()({"is-list":"list"===r.layout,"is-grid":"grid"===r.layout,[`columns-${r.columns}`]:"grid"===r.layout,"has-separator":i||u||g}),style:{...b,...f}}),{replaceInnerBlocks:k}=(0,l.useDispatch)(a.store),_=(0,l.useSelect)((e=>e(d.store).getEditorSettings()),[]),{childBlocks:B}=(0,l.useSelect)((e=>{const{getBlocks:r}=e(a.store);return{childBlocks:r(t)}}),[t]);(0,n.useEffect)((()=>{if(B.length>0&&!r.orderBy||r.order){let e=[];e="asc"===r.order?[...B].sort(((e,t)=>Number(new Date(e.attributes.dateTime))-Number(new Date(t.attributes.dateTime)))):[...B].sort(((e,t)=>Number(new Date(t.attributes.dateTime))-Number(new Date(e.attributes.dateTime)))),o({orderBy:"date"}),k(t,e,!1)}}),[r.orderBy,r.order]),(0,n.useEffect)((()=>{""===r.order&&o({order:"desc"})}),[r.order]);const E="grid"===r.layout?"horizontal":"vertical",S=(0,a.useInnerBlocksProps)(y,{allowedBlocks:v,orientation:E,renderAppender:a.InnerBlocks.ButtonBlockAppender});return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(a.InspectorControls,null,"grid"===r.layout&&(0,n.createElement)(p.PanelBody,{title:(0,c.__)("Grid settings")},(0,n.createElement)(p.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,c.__)("Columns"),value:r.columns,onChange:e=>o({columns:e}),min:2,max:6,required:!0})),(0,n.createElement)(p.PanelBody,{title:(0,c.__)("Order settings")},(0,n.createElement)(p.SelectControl,{label:(0,c.__)("Order"),value:r.order,options:[{label:(0,c.__)("Newest to oldest"),value:"desc"},{label:(0,c.__)("Oldest to newest"),value:"asc"}],onChange:e=>o({order:e}),__nextHasNoMarginBottom:!0}))),(0,n.createElement)(a.InspectorControls,{group:"styles"},(0,n.createElement)(p.__experimentalToolsPanel,{label:(0,c.__)("Separator")},(0,n.createElement)(p.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,c.__)("Appearance"),hasValue:()=>!!r.separator,onDeselect:()=>o({separator:void 0})},(0,n.createElement)(p.__experimentalBorderControl,{colors:_?.colors,onChange:e=>{o({separator:e})},value:r.separator,withSlider:!0})))),(0,n.createElement)(a.BlockControls,null,(0,n.createElement)(p.ToolbarGroup,{controls:[{icon:m,title:(0,c.__)("List view"),onClick:()=>o({layout:"list"}),isActive:"list"===r.layout},{icon:h,title:(0,c.__)("Grid view"),onClick:()=>o({layout:"grid"}),isActive:"grid"===r.layout}]})),(0,n.createElement)("div",{...S}))}function b(e){const{clientId:t,name:r,openPatternSelectionModal:i,setAttributes:s}=e,d="blank",u="content",[m,h]=(0,n.useState)("picker"),{blockType:v,defaultVariation:b,variations:w}=(0,l.useSelect)((e=>{const{getBlockVariations:t,getBlockType:n,getDefaultBlockVariation:a}=e(o.store);return{blockType:n(r),defaultVariation:a(r,"block"),variations:t(r,"block")}}),[r,t]),{replaceInnerBlocks:f}=(0,l.useDispatch)(a.store),y=(0,a.useBlockProps)();return m===d?(0,n.createElement)(a.__experimentalBlockVariationPicker,{icon:v?.icon?.src,label:v?.title,variations:w,onSelect:(e=b)=>{if(e.innerBlocks.length){if(e.attributes&&s(e.attributes),e.innerBlocks){const r=e.innerBlocks,n=(0,o.createBlocksFromInnerBlocksTemplate)(r);f(t,n,!0)}h(u)}else h(u)},allowSkip:!0}):m===u?(0,n.createElement)(g,{...e}):(0,n.createElement)("div",{...y},(0,n.createElement)(p.Placeholder,{icon:v?.icon?.src,label:v?.title,instructions:(0,c.__)("Choose a pattern or start blank.")},(0,n.createElement)(p.Button,{variant:"primary",onClick:i},(0,c.__)("Choose")),(0,n.createElement)(p.Button,{variant:"secondary",onClick:()=>{h(d)}},(0,c.__)("Start blank"))))}function w({clientId:e,attributes:t,setIsPatternSelectionModalOpen:r}){const{replaceBlock:o,selectBlock:i}=(0,l.useDispatch)(a.store),s=function(e){return(0,l.useSelect)((t=>{const{getBlockRootClientId:r,getPatternsByBlockTypes:o}=t(a.store);return o("sortable/container",r(e))}),[e])}(e);return(0,n.createElement)(p.Modal,{overlayClassName:"block-library-sortable-pattern__selection-modal",title:(0,c.__)("Choose a pattern"),onRequestClose:()=>r(!1),isFullScreen:!0},(0,n.createElement)("div",{className:"block-library-sortable-pattern__selection-content"},(0,n.createElement)(a.__experimentalBlockPatternsList,{blockPatterns:s,shownPatterns:s,onClickPattern:(r,n)=>{const{newBlocks:a,clientIds:l}=f(n,t);o(e,a),l[0]&&i(l[0])}})))}const f=e=>({newBlocks:e.map((e=>e)),clientIds:e.map((e=>e.clientId))});const y=(0,n.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,n.createElement)(p.Path,{d:"M24 9h-2v-5h-7v-2h9v7zm-9 13v-2h7v-5h2v7h-9zm-15-7h2v5h7v2h-9v-7zm9-13v2h-7v5h-2v-7h9z"})),k=(0,n.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,n.createElement)(p.Path,{d:"M6 6h-6v-6h6v6zm9-6h-6v6h6v-6zm9 0h-6v6h6v-6zm-18 9h-6v6h6v-6zm9 0h-6v6h6v-6zm9 0h-6v6h6v-6zm-18 9h-6v6h6v-6zm9 0h-6v6h6v-6zm9 0h-6v6h6v-6z"})),_=(0,n.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,n.createElement)(p.Path,{d:"M24 3h-24v-2h24v2zm0 3h-24v2h24v-2zm0 5h-24v2h24v-2zm0 5h-24v2h24v-2zm0 5h-24v2h24v-2z"}));var B=[{name:"empty-container",title:(0,c.__)("Empty"),icon:y,description:(0,c.__)("Display an empty container"),attributes:{layout:"list",columns:3,orderBy:"date",order:"desc"},innerBlocks:[],scope:["block"],isDefault:!0},{name:"grid-date-title-description",title:(0,c.__)("Grid View"),icon:k,description:(0,c.__)("Display multiple columns in a grid with date, title and description"),attributes:{layout:"grid",columns:3,orderBy:"date",order:"desc"},innerBlocks:[["sortable/entry",{dateTime:"2022-12-15T17:56:46"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-08-25T17:37:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-06-02T17:36:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]]],scope:["block"]},{name:"list-date-title-description",title:(0,c.__)("List View"),icon:_,description:(0,c.__)("Display multiple lines in a list with date, title and description"),attributes:{layout:"list",columns:3,orderBy:"date",order:"desc"},innerBlocks:[["sortable/entry",{dateTime:"2022-12-15T17:56:46"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-08-25T17:37:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-06-02T17:36:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]]],scope:["block"]}],E=JSON.parse('{"u2":"sortable/container"}'),S=[{attributes:{layout:{type:"string",default:"list"},columns:{type:"number",default:3},orderBy:{type:"string",default:"date"},order:{type:"string",default:"desc"}},save(e){const{attributes:t}=e,r=a.useInnerBlocksProps.save(a.useBlockProps.save({className:s()({"is-list":"list"===t.layout,"is-grid":"grid"===t.layout,[`columns-${t.columns}`]:"grid"===t.layout})}));return(0,n.createElement)("div",{...r})}}];(0,o.registerBlockType)(E.u2,{edit:e=>{const{clientId:t,attributes:r}=e,[o,i]=(0,n.useState)(!1),s=(0,l.useSelect)((e=>!!e(a.store).getBlocks(t).length),[t])?g:b;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(s,{...e,openPatternSelectionModal:()=>i(!0)}),o&&(0,n.createElement)(w,{clientId:t,attributes:r,setIsPatternSelectionModalOpen:i}))},save:function(e){const{attributes:t}=e,{width:r,style:o,color:l}=t.separator||{},i={...r&&{"--wp--sortable-container--separator--width":r},...o&&{"--wp--sortable-container--separator--style":o},...l&&{"--wp--sortable-container--separator--color":l}},c=(0,a.__experimentalGetGapCSSValue)(t.style?.spacing?.blockGap),d={...c&&{"--wp--sortable-container--spacing--gap":c}},p=a.useInnerBlocksProps.save(a.useBlockProps.save({className:s()({"is-list":"list"===t.layout,"is-grid":"grid"===t.layout,[`columns-${t.columns}`]:"grid"===t.layout,"has-separator":r||o||l}),style:{...i,...d}}));return(0,n.createElement)("div",{...p})},variations:B,deprecated:S})},184:function(e,t){var r;!function(){"use strict";var o={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var l=n.apply(null,r);l&&e.push(l)}}else if("object"===a){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var i in r)o.call(r,i)&&r[i]&&e.push(i)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(r=function(){return n}.apply(t,[]))||(e.exports=r)}()}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,e=[],o.O=function(t,r,n,a){if(!r){var l=1/0;for(d=0;d<e.length;d++){r=e[d][0],n=e[d][1],a=e[d][2];for(var i=!0,s=0;s<r.length;s++)(!1&a||l>=a)&&Object.keys(o.O).every((function(e){return o.O[e](r[s])}))?r.splice(s--,1):(i=!1,a<l&&(l=a));if(i){e.splice(d--,1);var c=n();void 0!==c&&(t=c)}}return t}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[r,n,a]},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={837:0,989:0};o.O.j=function(t){return 0===e[t]};var t=function(t,r){var n,a,l=r[0],i=r[1],s=r[2],c=0;if(l.some((function(t){return 0!==e[t]}))){for(n in i)o.o(i,n)&&(o.m[n]=i[n]);if(s)var d=s(o)}for(t&&t(r);c<l.length;c++)a=l[c],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return o.O(d)},r=self.webpackChunksortable=self.webpackChunksortable||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}();var n=o.O(void 0,[989],(function(){return o(506)}));n=o.O(n)}();
     1!function(){var e,t={687:function(e,t,r){"use strict";var l=window.wp.blocks,a=window.wp.element,o=window.wp.blockEditor,n=window.wp.data,i=window.React,s=r(184),c=r.n(s),d=window.wp.i18n,p=window.wp.editor,u=window.wp.components,h=window.wp.primitives,m=(0,i.createElement)(h.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,i.createElement)(h.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),b=(0,i.createElement)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(h.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"}));const f=["sortable/entry"];function v(e){const{clientId:t,attributes:r,setAttributes:l}=e,{width:s,style:h,color:v}=r.separator||{},g={...s&&{"--wp--sortable-container--separator--width":s},...h&&{"--wp--sortable-container--separator--style":h},...v&&{"--wp--sortable-container--separator--color":v}},w=(0,o.__experimentalGetGapCSSValue)(r.style?.spacing?.blockGap),y={...w&&{"--wp--sortable-container--spacing--gap":w}},_=(0,o.useBlockProps)({className:c()({"is-list":"list"===r.layout,"is-grid":"grid"===r.layout,[`columns-${r.columns}`]:"grid"===r.layout,"has-separator":s||h||v}),style:{...g,...y}}),{replaceInnerBlocks:k}=(0,n.useDispatch)(o.store),E=(0,n.useSelect)((e=>e(p.store).getEditorSettings()),[]),{childBlocks:B}=(0,n.useSelect)((e=>{const{getBlocks:r}=e(o.store);return{childBlocks:r(t)}}),[t]);(0,a.useEffect)((()=>{if(B.length>0&&!r.orderBy||r.order){let e=[];e="asc"===r.order?[...B].sort(((e,t)=>Number(new Date(e.attributes.dateTime))-Number(new Date(t.attributes.dateTime)))):[...B].sort(((e,t)=>Number(new Date(t.attributes.dateTime))-Number(new Date(e.attributes.dateTime)))),l({orderBy:"date"}),k(t,e,!1)}}),[r.orderBy,r.order]),(0,a.useEffect)((()=>{""===r.order&&l({order:"desc"})}),[r.order]);const S="grid"===r.layout?"horizontal":"vertical",z=(0,o.useInnerBlocksProps)(_,{allowedBlocks:f,orientation:S,renderAppender:o.InnerBlocks.ButtonBlockAppender});return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(o.InspectorControls,null,"grid"===r.layout&&(0,i.createElement)(u.PanelBody,{title:(0,d.__)("Layout")},(0,i.createElement)(u.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,d.__)("Columns"),value:r.columns,onChange:e=>l({columns:e}),min:2,max:6,required:!0})),(0,i.createElement)(u.PanelBody,{title:(0,d.__)("Visibility","sortable")},(0,i.createElement)(u.RadioControl,{label:(0,d.__)("Filter Options","sortable"),help:(0,d.__)("Select 'All Entries' to show all, or 'Specific Date' to display based on a specific date","sortable"),options:[{label:(0,d.__)("All Entries","sortable"),value:""},{label:(0,d.__)("Specific Date","sortable"),value:"date"}],selected:r.filter.displayType||"",onChange:e=>{const t=(new Date).toISOString();l({filter:{...r.filter,displayType:e,date:"date"!==e||r.filter.date?""===e?"":r.filter.date:t}})}}),"date"===r.filter.displayType&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(u.PanelRow,null,(0,i.createElement)(u.SelectControl,{label:(0,d.__)("Date Filter Type","sortable"),value:r.filter.dateFilterType,options:[{label:(0,d.__)("On a Specific Date","sortable"),value:"on"},{label:(0,d.__)("Before a Specific Date","sortable"),value:"before"},{label:(0,d.__)("After a Specific Date","sortable"),value:"after"}],onChange:e=>l({filter:{...r.filter,dateFilterType:e}}),help:"before"===r.filter.dateFilterType?(0,d.__)("Display entries that occur before the selected filter date below.","sortable"):"after"===r.filter.dateFilterType?(0,d.__)("Display entries that occur before the selected after date below.","sortable"):(0,d.__)("Display entries that occur on the selected filter date below.","sortable")})),(0,i.createElement)(u.PanelRow,null,(0,i.createElement)(u.CheckboxControl,{checked:!!r.filter.includeDateTime,label:(0,d.__)("Include time information","sortable"),help:(0,d.__)("Check this box to include options for selecting hours and minutes along with the filter date below.","sortable"),onChange:e=>l({filter:{...r.filter,includeDateTime:e}})})),(0,i.createElement)(u.PanelRow,{className:"sortable-block__date-row"},r.filter.includeDateTime?(0,i.createElement)(u.DateTimePicker,{is12Hour:!0,currentDate:r.filter.date,onChange:e=>l({filter:{...r.filter,date:e}})}):(0,i.createElement)(u.DatePicker,{currentDate:r.filter.date,onChange:e=>l({filter:{...r.filter,date:e}})})),(0,i.createElement)(u.PanelRow,{className:"sortable-block__ignore-date-warnings"},(0,i.createElement)(u.CheckboxControl,{checked:!!r.filter.ignoreOutdated,help:(0,d.__)("Check this box to ignore editor warnings for Sortable Entry blocks with dates older than the set filter date.","sortable"),label:(0,d.__)("Hide date-related warnings","sortable"),onChange:e=>l({filter:{...r.filter,ignoreOutdated:e}})})))),(0,i.createElement)(u.PanelBody,{title:(0,d.__)("Order")},(0,i.createElement)(u.SelectControl,{label:(0,d.__)("Order"),value:r.order,options:[{label:(0,d.__)("Newest to oldest"),value:"desc"},{label:(0,d.__)("Oldest to newest"),value:"asc"}],onChange:e=>l({order:e}),__nextHasNoMarginBottom:!0}))),(0,i.createElement)(o.InspectorControls,{group:"styles"},(0,i.createElement)(u.__experimentalToolsPanel,{label:(0,d.__)("Separator")},(0,i.createElement)(u.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,d.__)("Appearance"),hasValue:()=>!!r.separator,onDeselect:()=>l({separator:void 0})},(0,i.createElement)(u.__experimentalBorderControl,{colors:E?.colors,onChange:e=>{l({separator:e})},value:r.separator,withSlider:!0})))),(0,i.createElement)(o.BlockControls,null,(0,i.createElement)(u.ToolbarGroup,{controls:[{icon:m,title:(0,d.__)("List view"),onClick:()=>l({layout:"list"}),isActive:"list"===r.layout},{icon:b,title:(0,d.__)("Grid view"),onClick:()=>l({layout:"grid"}),isActive:"grid"===r.layout}]})),(0,i.createElement)("div",{...z}))}function g(e){const{clientId:t,name:r,openPatternSelectionModal:i,setAttributes:s}=e,c="blank",p="content",[h,m]=(0,a.useState)("picker"),{blockType:b,defaultVariation:f,variations:g}=(0,n.useSelect)((e=>{const{getBlockVariations:t,getBlockType:a,getDefaultBlockVariation:o}=e(l.store);return{blockType:a(r),defaultVariation:o(r,"block"),variations:t(r,"block")}}),[r,t]),{replaceInnerBlocks:w}=(0,n.useDispatch)(o.store),y=(0,o.useBlockProps)();return h===c?(0,a.createElement)(o.__experimentalBlockVariationPicker,{icon:b?.icon?.src,label:b?.title,variations:g,onSelect:(e=f)=>{if(e.innerBlocks.length){if(e.attributes&&s(e.attributes),e.innerBlocks){const r=e.innerBlocks,a=(0,l.createBlocksFromInnerBlocksTemplate)(r);w(t,a,!0)}m(p)}else m(p)},allowSkip:!0}):h===p?(0,a.createElement)(v,{...e}):(0,a.createElement)("div",{...y},(0,a.createElement)(u.Placeholder,{icon:b?.icon?.src,label:b?.title,instructions:(0,d.__)("Choose a pattern or start blank.")},(0,a.createElement)(u.Button,{variant:"primary",onClick:i},(0,d.__)("Choose")),(0,a.createElement)(u.Button,{variant:"secondary",onClick:()=>{m(c)}},(0,d.__)("Start blank"))))}function w({clientId:e,attributes:t,setIsPatternSelectionModalOpen:r}){const{replaceBlock:l,selectBlock:i}=(0,n.useDispatch)(o.store),s=function(e){return(0,n.useSelect)((t=>{const{getBlockRootClientId:r,getPatternsByBlockTypes:l}=t(o.store);return l("sortable/container",r(e))}),[e])}(e);return(0,a.createElement)(u.Modal,{overlayClassName:"block-library-sortable-pattern__selection-modal",title:(0,d.__)("Choose a pattern"),onRequestClose:()=>r(!1),isFullScreen:!0},(0,a.createElement)("div",{className:"block-library-sortable-pattern__selection-content"},(0,a.createElement)(o.__experimentalBlockPatternsList,{blockPatterns:s,shownPatterns:s,onClickPattern:(r,a)=>{const{newBlocks:o,clientIds:n}=y(a,t);l(e,o),n[0]&&i(n[0])}})))}const y=e=>({newBlocks:e.map((e=>e)),clientIds:e.map((e=>e.clientId))});const _=(0,a.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,a.createElement)(u.Path,{d:"M24 9h-2v-5h-7v-2h9v7zm-9 13v-2h7v-5h2v7h-9zm-15-7h2v5h7v2h-9v-7zm9-13v2h-7v5h-2v-7h9z"})),k=(0,a.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,a.createElement)(u.Path,{d:"M6 6h-6v-6h6v6zm9-6h-6v6h6v-6zm9 0h-6v6h6v-6zm-18 9h-6v6h6v-6zm9 0h-6v6h6v-6zm9 0h-6v6h6v-6zm-18 9h-6v6h6v-6zm9 0h-6v6h6v-6zm9 0h-6v6h6v-6z"})),E=(0,a.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,a.createElement)(u.Path,{d:"M24 3h-24v-2h24v2zm0 3h-24v2h24v-2zm0 5h-24v2h24v-2zm0 5h-24v2h24v-2zm0 5h-24v2h24v-2z"}));var B=[{name:"empty-container",title:(0,d.__)("Empty"),icon:_,description:(0,d.__)("Display an empty container"),attributes:{layout:"list",columns:3,orderBy:"date",order:"desc"},innerBlocks:[],scope:["block"],isDefault:!0},{name:"grid-date-title-description",title:(0,d.__)("Grid View"),icon:k,description:(0,d.__)("Display multiple columns in a grid with date, title and description"),attributes:{layout:"grid",columns:3,orderBy:"date",order:"desc"},innerBlocks:[["sortable/entry",{dateTime:"2022-12-15T17:56:46"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-08-25T17:37:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-06-02T17:36:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]]],scope:["block"]},{name:"list-date-title-description",title:(0,d.__)("List View"),icon:E,description:(0,d.__)("Display multiple lines in a list with date, title and description"),attributes:{layout:"list",columns:3,orderBy:"date",order:"desc"},innerBlocks:[["sortable/entry",{dateTime:"2022-12-15T17:56:46"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-08-25T17:37:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]],["sortable/entry",{dateTime:"2022-06-02T17:36:00"},[["core/group",{},[["sortable/date",{fontSize:"small"}],["core/heading",{fontSize:"large",placeholder:"Enter title..."}]]],["core/paragraph",{placeholder:"Enter description..."}]]]],scope:["block"]}],S=JSON.parse('{"u2":"sortable/container"}'),z=[{attributes:{layout:{type:"string",default:"list"},columns:{type:"number",default:3},orderBy:{type:"string",default:"date"},order:{type:"string",default:"desc"},separator:{type:"object",default:{}}}},{attributes:{layout:{type:"string",default:"list"},columns:{type:"number",default:3},orderBy:{type:"string",default:"date"},order:{type:"string",default:"desc"}},save(e){const{attributes:t}=e,r=o.useInnerBlocksProps.save(o.useBlockProps.save({className:c()({"is-list":"list"===t.layout,"is-grid":"grid"===t.layout,[`columns-${t.columns}`]:"grid"===t.layout})}));return(0,i.createElement)("div",{...r})}}];(0,l.registerBlockType)(S.u2,{edit:e=>{const{clientId:t,attributes:r}=e,[l,i]=(0,a.useState)(!1),s=(0,n.useSelect)((e=>!!e(o.store).getBlocks(t).length),[t])?v:g;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(s,{...e,openPatternSelectionModal:()=>i(!0)}),l&&(0,a.createElement)(w,{clientId:t,attributes:r,setIsPatternSelectionModalOpen:i}))},save:function(e){const{attributes:t}=e,{width:r,style:l,color:n}=t.separator||{},i={...r&&{"--wp--sortable-container--separator--width":r},...l&&{"--wp--sortable-container--separator--style":l},...n&&{"--wp--sortable-container--separator--color":n}},s=(0,o.__experimentalGetGapCSSValue)(t.style?.spacing?.blockGap),d={...s&&{"--wp--sortable-container--spacing--gap":s}},p=o.useInnerBlocksProps.save(o.useBlockProps.save({className:c()({"is-list":"list"===t.layout,"is-grid":"grid"===t.layout,[`columns-${t.columns}`]:"grid"===t.layout,"has-separator":r||l||n}),style:{...i,...d}}));return(0,a.createElement)("div",{...p})},variations:B,deprecated:z})},184:function(e,t){var r;!function(){"use strict";var l={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var n=a.apply(null,r);n&&e.push(n)}}else if("object"===o){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var i in r)l.call(r,i)&&r[i]&&e.push(i)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},r={};function l(e){var a=r[e];if(void 0!==a)return a.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,l),o.exports}l.m=t,e=[],l.O=function(t,r,a,o){if(!r){var n=1/0;for(d=0;d<e.length;d++){r=e[d][0],a=e[d][1],o=e[d][2];for(var i=!0,s=0;s<r.length;s++)(!1&o||n>=o)&&Object.keys(l.O).every((function(e){return l.O[e](r[s])}))?r.splice(s--,1):(i=!1,o<n&&(n=o));if(i){e.splice(d--,1);var c=a();void 0!==c&&(t=c)}}return t}o=o||0;for(var d=e.length;d>0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[r,a,o]},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={837:0,989:0};l.O.j=function(t){return 0===e[t]};var t=function(t,r){var a,o,n=r[0],i=r[1],s=r[2],c=0;if(n.some((function(t){return 0!==e[t]}))){for(a in i)l.o(i,a)&&(l.m[a]=i[a]);if(s)var d=s(l)}for(t&&t(r);c<n.length;c++)o=n[c],l.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return l.O(d)},r=self.webpackChunksortable=self.webpackChunksortable||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}();var a=l.O(void 0,[989],(function(){return l(687)}));a=l.O(a)}();
  • sortable-block/trunk/build/entry/block.json

    r2967229 r2977841  
    33  "apiVersion": 2,
    44  "name": "sortable/entry",
    5   "version": "1.6.0",
     5  "version": "1.7.0",
    66  "title": "Sortable Entry",
    77  "category": "widgets",
     
    2222    "sortable/entryDateTime": "dateTime"
    2323  },
     24  "usesContext": [
     25    "sortable/filter"
     26  ],
    2427  "textdomain": "sortable",
    2528  "editorScript": "file:./index.js",
  • sortable-block/trunk/build/entry/index.asset.php

    r2958501 r2977841  
    1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '5b47a02e3f62bc67b775');
     1<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '88a52c7cf680c3d3e523');
  • sortable-block/trunk/build/entry/index.css

    r2892965 r2977841  
    1 .wp-block-sortable-entry>.block-list-appender .block-editor-button-block-appender{border:1px dashed;box-shadow:none;flex-direction:row}.wp-block-sortable-entry>.block-list-appender .block-editor-button-block-appender:after{content:attr(aria-label)}.block-editor-block-inspector .sortable-block__date-row .components-datetime .components-base-control{margin-bottom:0}
     1.wp-block-sortable-entry.is-outdated{display:block;opacity:.5}.wp-block-sortable-entry.is-outdated.has-child-selected,.wp-block-sortable-entry.is-outdated.is-selected{opacity:1}.wp-block-sortable-entry>.block-list-appender .block-editor-button-block-appender{border:1px dashed;box-shadow:none;flex-direction:row}.wp-block-sortable-entry>.block-list-appender .block-editor-button-block-appender:after{content:attr(aria-label)}.sortable-block__warning-modal.components-modal__frame{max-width:400px}.sortable-block__warning-modal .sortable-block__warning-modal-content{margin-block-end:1.25em}.sortable-block__warning-modal .sortable-block__warning-modal-content ul{list-style-type:disc;padding-inline-start:1em}.sortable-block__warning-modal .sortable-block__warning-modal-content ol{margin-inline:0;padding-inline:1.25em}.block-editor-block-inspector .sortable-block__date-row .components-datetime .components-base-control{margin-block-end:0}
  • sortable-block/trunk/build/entry/index.js

    r2958501 r2977841  
    1 !function(){"use strict";var e,t={900:function(){var e=window.wp.blocks,t=window.wp.element,r=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.components,c=window.wp.data;const l=["sortable/date","core/heading","core/paragraph","core/media-text","core/group","core/columns","core/block"];var i=JSON.parse('{"u2":"sortable/entry"}');(0,e.registerBlockType)(i.u2,{edit:function(e){const{clientId:i,attributes:s,setAttributes:a}=e,{dateTime:u}=s,d=(0,n.useBlockProps)(),{updateBlockAttributes:p}=(0,c.useDispatch)(n.store),{rootClientId:f,childBlocks:w}=(0,c.useSelect)((e=>{const{getBlockRootClientId:t,getBlock:r}=e(n.store),o=t(i),c=r(i);return{rootClientId:o,childBlocks:c?c.innerBlocks:[]}}),[i]);(0,t.useEffect)((()=>{u||(a({dateTime:new Date}),p(f,{orderBy:""}))}),[u]);const k=(0,n.useInnerBlocksProps)(d,{allowedBlocks:l,orientation:"horizontal",renderAppender:w.length?void 0:n.InnerBlocks.ButtonBlockAppender});return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(o.PanelBody,{title:(0,r.__)("Date Settings","sortable")},(0,t.createElement)(o.PanelRow,{className:"sortable-block__date-row"},(0,t.createElement)(o.DateTimePicker,{currentDate:u,onChange:e=>{a({dateTime:e}),p(f,{orderBy:""})},is12Hour:!0})))),(0,t.createElement)("div",{...k}))},save:function(){const e=n.useInnerBlocksProps.save(n.useBlockProps.save());return(0,t.createElement)("div",{...e})}})}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var c=r[e]={exports:{}};return t[e](c,c.exports,n),c.exports}n.m=t,e=[],n.O=function(t,r,o,c){if(!r){var l=1/0;for(u=0;u<e.length;u++){r=e[u][0],o=e[u][1],c=e[u][2];for(var i=!0,s=0;s<r.length;s++)(!1&c||l>=c)&&Object.keys(n.O).every((function(e){return n.O[e](r[s])}))?r.splice(s--,1):(i=!1,c<l&&(l=c));if(i){e.splice(u--,1);var a=o();void 0!==a&&(t=a)}}return t}c=c||0;for(var u=e.length;u>0&&e[u-1][2]>c;u--)e[u]=e[u-1];e[u]=[r,o,c]},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={955:0,22:0};n.O.j=function(t){return 0===e[t]};var t=function(t,r){var o,c,l=r[0],i=r[1],s=r[2],a=0;if(l.some((function(t){return 0!==e[t]}))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var u=s(n)}for(t&&t(r);a<l.length;a++)c=l[a],n.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return n.O(u)},r=self.webpackChunksortable=self.webpackChunksortable||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}();var o=n.O(void 0,[22],(function(){return n(900)}));o=n.O(o)}();
     1!function(){var e,t={27:function(e,t,n){"use strict";var r=window.wp.blocks,o=window.React,l=n(184),a=n.n(l),i=window.wp.i18n,s=window.wp.blockEditor,c=window.wp.components,u=window.wp.element,d=window.wp.data,m=window.wp.primitives,b=(0,o.createElement)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,o.createElement)(m.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"}));const p=["sortable/date","core/heading","core/paragraph","core/media-text","core/cover","core/group","core/columns","core/buttons","core/block"];var f=JSON.parse('{"u2":"sortable/entry"}'),g=[{save(){const e=s.useInnerBlocksProps.save(s.useBlockProps.save());return(0,o.createElement)("div",{...e})}}];(0,r.registerBlockType)(f.u2,{edit:function(e){const{context:t,clientId:n,attributes:r,setAttributes:l}=e,{updateBlockAttributes:m}=(0,d.useDispatch)(s.store),[f,g]=(0,u.useState)(!1),{date:v,dateFilterType:h,includeDateTime:w,ignoreOutdated:k}=t["sortable/filter"];let E=!1;const _=new Date(r.dateTime),y=new Date(v);isNaN(y.getTime())?""!==v&&console.error("Invalid date:",v):(w||(_.setHours(0,0,0,0),y.setHours(0,0,0,0)),("on"===h&&_.getTime()!==y.getTime()||"after"===h&&_<=y||"before"===h&&_>=y)&&(E=!0));const B=(0,s.useBlockProps)({"data-event-date":r.dateTime?r.dateTime:"",className:a()({"is-outdated":E})}),{rootClientId:S,childBlocks:T}=(0,d.useSelect)((e=>{const{getBlockRootClientId:t,getBlock:r}=e(s.store),o=t(n),l=r(n);return{rootClientId:o,childBlocks:l?l.innerBlocks:[]}}),[n]);(0,u.useEffect)((()=>{r.dateTime||(l({dateTime:new Date}),m(S,{orderBy:""}))}),[S,r.dateTime]);const O=(0,s.useInnerBlocksProps)(B,{allowedBlocks:p,orientation:"vertical",renderAppender:T.length?void 0:s.InnerBlocks.ButtonBlockAppender});return(0,o.createElement)(o.Fragment,null,f&&y&&(0,o.createElement)(c.Modal,{title:(0,i.__)("This Block's Date is Old","sortable"),onRequestClose:()=>g(!1),className:"sortable-block__warning-modal"},(0,o.createElement)("div",{className:"sortable-block__warning-modal-content"},(0,o.createElement)("p",null,(0,i.__)('You are seeing this notice because the date on this "Sortable Entry" block is older than the date you set on the "Sortable" block.',"sortable")),(0,o.createElement)("p",null,(0,o.createElement)("strong",null,(0,i.__)("Here's a summary of the dates:","sortable"))),(0,o.createElement)("ul",null,(0,o.createElement)("li",null,(0,i.__)('Date set in "Sortable":',"sortable")," ",(0,o.createElement)("strong",null,y.toLocaleString("en-US",{month:"long",day:"2-digit",year:"numeric"}))),(0,o.createElement)("li",null,(0,i.__)('Date on this "Sortable Entry":',"sortable")," ",(0,o.createElement)("strong",null,_.toLocaleString("en-US",{month:"long",day:"2-digit",year:"numeric"})))),(0,o.createElement)("p",null,(0,o.createElement)("strong",null,(0,i.__)("To resolve warning, you can:","sortable"))),(0,o.createElement)("ol",null,(0,o.createElement)("li",null,(0,i.__)('Ignore warnings by changing a setting in the "Sortable" block.',"sortable")),(0,o.createElement)("li",null,(0,i.__)('Change the date in the "Sortable" block to cover more dates.',"sortable")),(0,o.createElement)("li",null,(0,i.__)('Update the date on this "Sortable Entry" block to a newer date.',"sortable"))),(0,o.createElement)("p",null,(0,i.__)("Changes can be made in the block settings sidebar.","sortable"))),(0,o.createElement)(c.Button,{variant:"secondary",onClick:()=>g(!1)},(0,i.__)("Close Warning","sortable"))),E&&!k&&(0,o.createElement)(s.BlockControls,null,(0,o.createElement)(c.Toolbar,null,(0,o.createElement)(c.Button,{label:(0,i.__)("Inspect visibility problem","sortable"),icon:b,onClick:()=>{g(!f)},isPressed:f}))),(0,o.createElement)(s.InspectorControls,null,(0,o.createElement)(c.PanelBody,{title:(0,i.__)("Date","sortable")},(0,o.createElement)(c.PanelRow,{className:"sortable-block__date-row"},(0,o.createElement)(c.DateTimePicker,{currentDate:r.dateTime,onChange:e=>{l({dateTime:e}),m(S,{orderBy:""})},is12Hour:!0})))),(0,o.createElement)("div",{...O}))},save:function(){return(0,u.createElement)(s.InnerBlocks.Content,null)},deprecated:g})},184:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var l=typeof n;if("string"===l||"number"===l)e.push(n);else if(Array.isArray(n)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===l){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var i in n)r.call(n,i)&&n[i]&&e.push(i)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var l=n[e]={exports:{}};return t[e](l,l.exports,r),l.exports}r.m=t,e=[],r.O=function(t,n,o,l){if(!n){var a=1/0;for(u=0;u<e.length;u++){n=e[u][0],o=e[u][1],l=e[u][2];for(var i=!0,s=0;s<n.length;s++)(!1&l||a>=l)&&Object.keys(r.O).every((function(e){return r.O[e](n[s])}))?n.splice(s--,1):(i=!1,l<a&&(a=l));if(i){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[n,o,l]},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={955:0,22:0};r.O.j=function(t){return 0===e[t]};var t=function(t,n){var o,l,a=n[0],i=n[1],s=n[2],c=0;if(a.some((function(t){return 0!==e[t]}))){for(o in i)r.o(i,o)&&(r.m[o]=i[o]);if(s)var u=s(r)}for(t&&t(n);c<a.length;c++)l=a[c],r.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return r.O(u)},n=self.webpackChunksortable=self.webpackChunksortable||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var o=r.O(void 0,[22],(function(){return r(27)}));o=r.O(o)}();
  • sortable-block/trunk/build/entry/style-index.css

    r2967229 r2977841  
    1 .wp-block-sortable-entry{height:100%;width:100%}.wp-block-sortable-entry>:first-child{margin-block-start:0}.wp-block-sortable-entry>:last-child{margin-block-end:0}
     1.wp-block-sortable-entry{height:100%;width:100%}.wp-block-sortable-entry.is-outdated{display:none}.wp-block-sortable-entry>:first-child{margin-block-start:0}.wp-block-sortable-entry>:last-child{margin-block-end:0}
  • sortable-block/trunk/readme.txt

    r2976121 r2977841  
    66Requires at Least: 6.1
    77Requires PHP:      7.4
    8 Stable tag:        1.6.0
     8Stable tag:        1.7.0
    99Text Domain:       sortable
    1010License:           GPLv2 or later
     
    4141This level of ease in installation and personalization ensures not just a user-friendly experience but also a quick setup, letting you focus more on creating engaging events and less on overcoming technical hurdles.
    4242
     43[📒 READ FULL DOCUMENTATION](https://sortable.themesharbor.com/)
     44
    4345=== Examples ===
    4446
     
    8789== Screenshots ==
    8890
    89 1. Preview of Sortable block in the block inserter.
    90 
    91 2. Preview of Sortable block toolbar, with active "List view" layout.
    92 
    93 3. Preview of Sortable block settings, focusing on Order settings.
    94 
    95 4. Preview of Sortable block button that adds Sortable Entry into the block.
    96 
    97 5. Preview of Sortable Entry block settings, focusing on Date settings.
    98 
    99 6. Preview of Sortable Entry block button that adds content into the block.
     911. This image displays the search results in the Block Inserter when the keyword “Sortable” is entered. It also shows pre-made block patterns associated with the keyword below the search.
     92
     932. This image demonstrates the Sortable block being added to the content area after selecting it from the Block Inserter. Note, the Block Inserter can also be closed using the top bar.
     94
     953. This image displays a placeholder screen for the Sortable block, allowing to either select a pre-designed pattern based on Sortable or start blank.
     96
     974. This image displays three variations to start blank: Empty, Grid View, List View. Each option offers a starting layout, including a pre-made content.
     98
     995. This image showcases the Sortable block with pre-made content arranged in a list layout, with active List View layout.
     100
     1016. This image showcases the Sortable block with pre-made content arranged in a grid layout, with active Grid View layout. Note, this layout also offers Layout settings that allow configuring the number of columns.
     102
     1037. This image showcases the Sortable block with no content, displaying only the ‘Add Sortable Entry‘ button for adding events to manage. Note, by default, the Sortable block adopts the List View layout.
     104
     1058. This image displays a Sortable Entry block (as a child) with empty content within the Sortable block (as a parent). A Sortable Entry is an event that can be sorted by date within the Sortable block, serving as a container for an event layout that can be built with WordPress blocks.
     106
     1079. This image displays a Sortable Entry block with the ‘Add Block‘ button clicked, revealing a modal showcasing common blocks with an option to view more available blocks for creating an event layout.
     108
     10910. This image displays a Sortable Entry block with the active Block settings sidebar. In the sidebar, the Date settings section is shown for configuring the time and date of the event.
    100110
    101111== Changelog ==
     112
     113= 1.7.0 - October 11, 2023 =
     114
     115* Add: support for older Sortable block versions;
     116* Add: introduce date-related warnings in Sortable Entry blocks;
     117* Add: support for filter date in Sortable block;
     118* Add: warning modal for Sortable Entry blocks with old date in editor;
     119* Add: server-side rendering support for Sortable Entry block;
     120* Add: visibility settings in Sortable block;
     121* Add: allow to filter Sortable Entry blocks by specific date;
     122* Add: allow to hide outdated Sortable Entry blocks;
     123* Add: support for old versions of Sortable Entry;
     124* Add: allow to use Cover block within Sortable Entry block;
     125* Add: allow to use Buttons block within Sortable Entry block;
     126* Add: pre-made pattern to create Media Mentions section;
     127* Update: pattern choose modal layout in Sortable block;
     128* Update: file formatting;
     129* Update: refactor render for block specific patterns;
     130* Update: showcase information and main block focus in readme;
     131* Update: settings labels in Sortable block;
     132* Fix: wrong inner blocks orientation icons in Sortable Entry block;
    102133
    103134= 1.6.0 - September 14, 2023 =
  • sortable-block/trunk/sortable.php

    r2967229 r2977841  
    55 * Requires at least: 6.1
    66 * Requires PHP:      7.4
    7  * Version:           1.6.0
     7 * Version:           1.7.0
    88 * Author:            Taras Dashkevych
    99 * Author URI:        https://tarascodes.com/
     
    1414 * @package           Sortable
    1515 */
     16
     17define( 'SORTABLE_BLOCK_PLUGIN', __FILE__ );
     18define( 'SORTABLE_BLOCK_PLUGIN_DIR_URL', plugin_dir_url( SORTABLE_BLOCK_PLUGIN ) );
    1619
    1720/**
     
    3033        )
    3134    );
     35
    3236    // Register Sortable Entry block.
    33     register_block_type( __DIR__ . '/build/entry' );
     37    register_block_type(
     38        __DIR__ . '/build/entry',
     39        array(
     40            'render_callback' => 'sortable_render_block_sortable_entry',
     41        )
     42    );
     43
    3444    // Register Sortable block.
    3545    register_block_type( __DIR__ . '/build/container' );
    36     // Register Pattern.
    37     register_block_pattern(
    38         'sortable/changelog-layout-1',
    39         array(
    40             'title'       => esc_html__( 'Changelog List', 'sortable' ),
    41             'description' => _x( 'Layout to create changelog list with version number, date, and list.', 'Block pattern description', 'sortable' ),
    42             'blockTypes'  => array( 'sortable/container' ),
    43             'content'     => '<!-- wp:sortable/container -->
    44             <div class="wp-block-sortable-container is-list">
    45                 <!-- wp:sortable/entry {"dateTime":"2023-08-28T10:21:00"} -->
    46                 <div class="wp-block-sortable-entry">
    47                     <!-- wp:group {"style":{"spacing":{"blockGap":"1.5em"}},"layout":{"type":"constrained"}} -->
    48                     <div class="wp-block-group">
    49                         <!-- wp:separator {"backgroundColor":"cyan-bluish-gray"} -->
    50                         <hr class="wp-block-separator has-text-color has-cyan-bluish-gray-color has-alpha-channel-opacity has-cyan-bluish-gray-background-color has-background" />
    51                         <!-- /wp:separator -->
    52                         <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","orientation":"vertical"}} -->
    53                         <div class="wp-block-group">
    54                             <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"center"}} -->
    55                             <div class="wp-block-group">
    56                                 <!-- wp:paragraph -->
    57                                 <p><strong>1.1.0</strong></p>
    58                                 <!-- /wp:paragraph -->
    59                                 <!-- wp:sortable/date {"textColor":"vivid-purple"} /-->
    60                             </div>
    61                             <!-- /wp:group -->
    62                             <!-- wp:list {"fontSize":"normal"} -->
    63                             <ul class="has-normal-font-size">
    64                                 <!-- wp:list-item -->
    65                                 <li><strong>Add:</strong> support for colors in Sortable Date block;</li>
    66                                 <!-- /wp:list-item -->
    67                                 <!-- wp:list-item -->
    68                                 <li><strong>Add:</strong> support for padding dimensions in Sortable Date block;</li>
    69                                 <!-- /wp:list-item -->
    70                                 <!-- wp:list-item -->
    71                                 <li><strong>Update:</strong> improve Insert buttons in the editor;</li>
    72                                 <!-- /wp:list-item -->
    73                                 <!-- wp:list-item -->
    74                                 <li><strong>Update:</strong> detect time format in Sortable Date block;</li>
    75                                 <!-- /wp:list-item -->
    76                                 <!-- wp:list-item -->
    77                                 <li><strong>Update:</strong> allow Group block in Sortable Entry;</li>
    78                                 <!-- /wp:list-item -->
    79                                 <!-- wp:list-item -->
    80                                 <li><strong>Fix:</strong> style back-end issues;</li>
    81                                 <!-- /wp:list-item -->
    82                                 <!-- wp:list-item -->
    83                                 <li><strong>Fix:</strong> button contrast issue in Sortable Container;</li>
    84                                 <!-- /wp:list-item -->
    85                                 <!-- wp:list-item -->
    86                                 <li><strong>Fix:</strong> wrong time output in Sortable Date block when viewed on front-end;</li>
    87                                 <!-- /wp:list-item -->
    88                             </ul>
    89                             <!-- /wp:list -->
    90                         </div>
    91                         <!-- /wp:group -->
    92                     </div>
    93                     <!-- /wp:group -->
    94                 </div>
    95                 <!-- /wp:sortable/entry -->
    96                 <!-- wp:sortable/entry {"dateTime":"2023-07-12T10:21:00"} -->
    97                 <div class="wp-block-sortable-entry">
    98                     <!-- wp:group {"style":{"spacing":{"blockGap":"1.5em"}},"layout":{"type":"constrained"}} -->
    99                     <div class="wp-block-group">
    100                         <!-- wp:separator {"backgroundColor":"cyan-bluish-gray"} -->
    101                         <hr class="wp-block-separator has-text-color has-cyan-bluish-gray-color has-alpha-channel-opacity has-cyan-bluish-gray-background-color has-background" />
    102                         <!-- /wp:separator -->
    103                         <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","orientation":"vertical"}} -->
    104                         <div class="wp-block-group">
    105                             <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"center"}} -->
    106                             <div class="wp-block-group">
    107                                 <!-- wp:paragraph -->
    108                                 <p><strong>1.0.1</strong></p>
    109                                 <!-- /wp:paragraph -->
    110                                 <!-- wp:sortable/date {"textColor":"vivid-purple"} /-->
    111                             </div>
    112                             <!-- /wp:group -->
    113                             <!-- wp:list {"fontSize":"normal"} -->
    114                             <ul class="has-normal-font-size">
    115                                 <!-- wp:list-item -->
    116                                 <li><strong>Update:</strong> allow Group block in Sortable Entry;</li>
    117                                 <!-- /wp:list-item -->
    118                                 <!-- wp:list-item -->
    119                                 <li><strong>Update:</strong> detect time format in Sortable Date block;</li>
    120                                 <!-- /wp:list-item -->
    121                                 <!-- wp:list-item -->
    122                                 <li><strong>Update:</strong> improve Insert buttons in the editor;</li>
    123                                 <!-- /wp:list-item -->
    124                                 <!-- wp:list-item -->
    125                                 <li><strong>Fix:</strong> style back-end issues;</li>
    126                                 <!-- /wp:list-item -->
    127                                 <!-- wp:list-item -->
    128                                 <li><strong>Fix:</strong> wrong time output in Sortable Date block when viewed on front-end;</li>
    129                                 <!-- /wp:list-item -->
    130                             </ul>
    131                             <!-- /wp:list -->
    132                         </div>
    133                         <!-- /wp:group -->
    134                     </div>
    135                     <!-- /wp:group -->
    136                 </div>
    137                 <!-- /wp:sortable/entry -->
    138                 <!-- wp:sortable/entry {"dateTime":"2022-05-05T10:21:00"} -->
    139                 <div class="wp-block-sortable-entry">
    140                     <!-- wp:group {"style":{"spacing":{"blockGap":"1.5em"}},"layout":{"type":"constrained"}} -->
    141                     <div class="wp-block-group">
    142                         <!-- wp:separator {"backgroundColor":"cyan-bluish-gray"} -->
    143                         <hr class="wp-block-separator has-text-color has-cyan-bluish-gray-color has-alpha-channel-opacity has-cyan-bluish-gray-background-color has-background" />
    144                         <!-- /wp:separator -->
    145                         <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","orientation":"vertical"}} -->
    146                         <div class="wp-block-group">
    147                             <!-- wp:group {"style":{"spacing":{"blockGap":"1em"}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"center"}} -->
    148                             <div class="wp-block-group">
    149                                 <!-- wp:paragraph -->
    150                                 <p><strong>1.0.0</strong></p>
    151                                 <!-- /wp:paragraph -->
    152                                 <!-- wp:sortable/date {"textColor":"vivid-purple"} /-->
    153                             </div>
    154                             <!-- /wp:group -->
    155                             <!-- wp:list {"fontSize":"normal"} -->
    156                             <ul class="has-normal-font-size">
    157                                 <!-- wp:list-item -->
    158                                 <li>Initial release.</li>
    159                                 <!-- /wp:list-item -->
    160                             </ul>
    161                             <!-- /wp:list -->
    162                         </div>
    163                         <!-- /wp:group -->
    164                     </div>
    165                     <!-- /wp:group -->
    166                 </div>
    167                 <!-- /wp:sortable/entry -->
    168             </div>
    169             <!-- /wp:sortable/container -->',
    170         )
     46
     47    // Get availible patterns.
     48    $pattern_namespaces = glob( dirname( __FILE__ ) . '/patterns/*' );
     49
     50    // Get patterns namespace only.
     51    $pattern_namespaces = array_map(
     52        function( $type_path ) {
     53            return basename( $type_path, '.php' );
     54        },
     55        $pattern_namespaces
    17156    );
     57
     58    // Registers block patterns.
     59    foreach ( $pattern_namespaces as $pattern_namespace ) {
     60        $pattern_file = __DIR__ . '/patterns/' . $pattern_namespace . '.php';
     61
     62        if ( ! file_exists( $pattern_file ) ) {
     63            continue;
     64        }
     65
     66        register_block_pattern(
     67            'sortable/' . $pattern_namespace,
     68            require $pattern_file
     69        );
     70    }
    17271}
    17372add_action( 'init', 'sortable_plugin_init' );
     
    204103    );
    205104}
     105
     106/**
     107 * Render callback function for the Sortable Entry block.
     108 *
     109 * @param array    $attributes Block attributes.
     110 * @param string   $content    Block default content.
     111 * @param WP_Block $block      Block instance.
     112 *
     113 * @return string Return block's content.
     114 */
     115function sortable_render_block_sortable_entry( $attributes, $content, $block ) {
     116    // Access block context using the context property of the $block object.
     117    $context = $block->context;
     118
     119    // Use the $context variable to access contextual information.
     120    $filter_settings = isset( $context['sortable/filter'] ) ? $context['sortable/filter'] : null;
     121
     122    // Extract filter settings.
     123    $filter_date_value = isset( $filter_settings['date'] ) ? $filter_settings['date'] : '';
     124    $filter_date_type  = isset( $filter_settings['dateFilterType'] ) ? $filter_settings['dateFilterType'] : 'on';
     125    $include_date_time = isset( $filter_settings['includeDateTime'] ) ? $filter_settings['includeDateTime'] : false;
     126
     127    // Determine if block is outdated.
     128    $is_outdated = false;
     129
     130    // Only check for outdated blocks if filter date value is not empty.
     131    if ( ! empty( $filter_date_value ) ) {
     132        $block_date  = new DateTime( $attributes['dateTime'] );
     133        $filter_date = new DateTime( $filter_date_value );
     134
     135        // Reset time to midnight if includeDateTime is false.
     136        if ( ! $include_date_time ) {
     137            $block_date->setTime( 0, 0, 0 );
     138            $filter_date->setTime( 0, 0, 0 );
     139        }
     140
     141        if (
     142            ( 'on' === $filter_date_type && $block_date !== $filter_date ) ||
     143            ( 'after' === $filter_date_type && $block_date <= $filter_date ) ||
     144            ( 'before' === $filter_date_type && $block_date >= $filter_date )
     145        ) {
     146            $is_outdated = true;
     147        }
     148    }
     149
     150    // Prepare wrapper attributes.
     151    $wrapper_attributes = get_block_wrapper_attributes(
     152        array(
     153            'data-event-date' => esc_attr( $attributes['dateTime'] ),
     154            'class'           => $is_outdated ? 'is-outdated' : '',
     155        )
     156    );
     157
     158    if ( $is_outdated ) {
     159        return false;
     160    }
     161
     162    // Return block content with wrapper attributes.
     163    return sprintf(
     164        '<div %1$s>%2$s</div>',
     165        $wrapper_attributes,
     166        $content
     167    );
     168}
Note: See TracChangeset for help on using the changeset viewer.