exclude Et2.*(Readonly|Mobile) components from documentation:

- renamed Et2DateSinceReadonly to Et2DateSince as there is no non-readonly class
- enhance getSlClass() in cem.js to also return regular Et2 class, if there is no readonly one
- replace ? in since tag with 23.1 and added @since 23.1.x to Tree widgets (somehow not parsed!)
- updated etemplate2.0.(dtd|rng)
This commit is contained in:
ralf 2024-06-18 11:09:06 +02:00
parent 87153a753c
commit 16d42c69c5
10 changed files with 121 additions and 240 deletions

View File

@ -69,7 +69,7 @@ const formatDate = function(date : Date, options = {units: "YmdHis"})
*
* This is a stripped-down read-only widget used in nextmatch
*/
export class Et2DateSinceReadonly extends Et2DateReadonly
export class Et2DateSince extends Et2DateReadonly
{
static get properties()
{
@ -130,4 +130,4 @@ export class Et2DateSinceReadonly extends Et2DateReadonly
}
// @ts-ignore TypeScript is not recognizing that this widget is a LitElement
customElements.define("et2-date-since", Et2DateSinceReadonly);
customElements.define("et2-date-since", Et2DateSince);

View File

@ -38,6 +38,7 @@ export type TreeItemData = SelectOption & {
/**
* @event {{id: String, item:SlTreeItem}} sl-expand emmited when tree item expands
* //TODO add for other events
* @since 23.1.x
*/
export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
{

View File

@ -41,6 +41,7 @@ type Constructor<T = {}> = new (...args : any[]) => T;
* @event sl-after-hide - Emitted after the suggestion menu closes and all animations are complete.
*
* @csspart form-control - The form control that wraps the label, input, and help text.
* @since 23.1.x
*/
export class Et2TreeDropdown extends SearchMixin<Constructor<any> & Et2InputWidgetInterface & typeof LitElement, TreeSearchResult, TreeSearchResults>(Et2WidgetWithSelectMixin(LitElement))

View File

@ -9,6 +9,9 @@ import {css, PropertyValues, unsafeCSS} from "lit";
import {Et2TreeDropdown} from "./Et2TreeDropdown";
import {Et2CategoryTag} from "../Et2Select/Tag/Et2CategoryTag";
/**
* @since 23.1.x
*/
export class Et2TreeDropdownCategory extends Et2TreeDropdown
{

View File

@ -41,7 +41,7 @@ import './Et2Date/Et2DateDuration';
import './Et2Date/Et2DateDurationReadonly';
import './Et2Date/Et2DateRange';
import './Et2Date/Et2DateReadonly';
import './Et2Date/Et2DateSinceReadonly';
import './Et2Date/Et2DateSince';
import './Et2Date/Et2DateTime';
import './Et2Date/Et2DateTimeOnly';
import './Et2Date/Et2DateTimeOnlyReadonly';

View File

@ -32,7 +32,7 @@
<div class="component-header__info">
<sl-badge variant="neutral" pill>
Since {{component.since or '?' }}
Since {{component.since or '23.1' }}
</sl-badge>
<sl-badge variant="{{ badgeVariant }}" pill style="text-transform: capitalize;">
{{ component.status }}
@ -330,4 +330,4 @@
{% else %}
This component is not correctly documented
{% endif %}
{% endblock %}
{% endblock %}

View File

@ -17,8 +17,9 @@ module.exports.getAllComponents = function ()
// Find a Shoelace class declaration from their custom-elements.json
//
// for Et2* classes, we also look recursive, if they inherit from a Shoelace class
// or a (not included) Readonly or Mobile class, in with case we return the regular Et2-class
//
const getSlClass = function(superclass)
const getSlClass = function(superclass, debug)
{
let sl_class;
if (superclass && superclass.package === "@shoelace-style/shoelace")
@ -28,11 +29,12 @@ module.exports.getAllComponents = function ()
}
else if (superclass && superclass.name.substring(0, 3) === "Et2")
{
const name = superclass.name.replace(/(Readonly|Mobile)$/, '');
customElementsManifest.modules.find(module =>
sl_class = module.declarations.find(declaration => declaration.name === superclass.name));
if (sl_class) sl_class = getSlClass(sl_class.superclass);
sl_class = module.declarations.find(declaration => declaration.name === name));
if (sl_class && name === superclass.name) sl_class = getSlClass(sl_class.superclass);
}
//console.log("getSlClass("+superclass.name+") returning ", sl_class ? sl_class.name+" with attributes: "+sl_class.attributes?.map(attribute => attribute.name).join(", ") : "undefined");
if (debug) console.log("getSlClass("+superclass.name+") returning ", sl_class ? sl_class.name+" with attributes: "+sl_class.attributes?.map(attribute => attribute.name).join(", ") : "undefined");
return sl_class;
}
//
@ -46,7 +48,7 @@ module.exports.getAllComponents = function ()
if (a.name[0] !== '_' && b.name[0] === '_') return -1;
return a.name.localeCompare(b.name);
}
const debug='declaration.name'; // set to declaration.name to get more logging for that component
const debug=''; // set to declaration.name to get more logging for that component
const allComponents = [];
customElementsManifest.modules?.forEach(module =>
@ -56,7 +58,7 @@ module.exports.getAllComponents = function ()
if (declaration.customElement)
{
// check if we have a Shoelace superclass
const sl_class = declaration.superclass ? getSlClass(declaration.superclass) : undefined;
const sl_class = declaration.superclass ? getSlClass(declaration.superclass, debug === declaration.name) : undefined;
if (debug === declaration.name) console.log(declaration.name+": superclass=", declaration.superclass, sl_class ? "found: "+sl_class.name : "not found");
// Generate the dist path based on the src path and attach it to the component
@ -77,7 +79,7 @@ module.exports.getAllComponents = function ()
members = members.concat(sl_members);
}
let methods = members?.filter(prop => prop.kind === 'method' && prop.privacy !== 'private') || [];
if (declaration.name === "Et2ButtonScroll") console.log("found methods: "+methods.map(method => method.name).join(", "));
if (debug === declaration.name) console.log("found methods: "+methods.map(method => method.name).join(", "));
// add non-private and not overwritten Shoelace superclass methods
/* ToDo disabled, as it gives an error later (only copies 8 files and generates none)
if (sl_class)
@ -108,15 +110,15 @@ module.exports.getAllComponents = function ()
methods,
properties,
attributes: declaration.attributes?.concat(sl_class?.attributes?.filter(attribute => !declaration.attributes.find(attr => attr.name === attribute.name))
/*.map(attribute => {
.map(attribute => {
return {...attribute, inheritedFrom: {name: sl_class.name, module: "@shoelace-style/shoelace"}};
})*/)
}))
});
if (debug === declaration.name) console.log("added attributes", allComponents[allComponents.length - 1].attributes);
}
});
});
console.log('Build dependency graphs');
if (debug) console.log('Build dependency graphs');
// Build dependency graphs
allComponents.forEach(component =>
{
@ -145,7 +147,7 @@ module.exports.getAllComponents = function ()
component.dependencies = dependencies.sort();
});
console.log('Add custom docs');
if (debug) console.log('Add custom docs');
// Add custom docs - not monitored for file changes
allComponents.forEach(component =>
{
@ -158,7 +160,7 @@ module.exports.getAllComponents = function ()
fs.readFile(docPath, (err, data) => component.content = data.toString());
}
})
console.log("return allComponentes sorted by name")
if (debug) console.log("return allComponentes sorted by name")
// Sort by name
return allComponents.sort((a, b) =>
{

View File

@ -28,7 +28,7 @@ function replace(string, terms)
export default {
globs: ["api/js/etemplate/**/Et2*.ts","api/js/etemplate/Et2Nextmatch/**/*.ts"],
/** Globs to exclude */
exclude: ["api/js/etemplate/**/test/*"],//, 'et2_*.ts', '**/test/*', '**/*.styles.ts', '**/*.test.ts'],
exclude: ["api/js/etemplate/**/test/*","api/js/etemplate/**/Et2*Readonly.ts","api/js/etemplate/**/Et2*Mobile.ts"],//, 'et2_*.ts', '**/test/*', '**/*.styles.ts', '**/*.test.ts'],
dev: false,
litelement: true,
plugins: [

View File

@ -1312,7 +1312,7 @@
<!ATTLIST et2-nextmatch-header-account
accesskey CDATA #IMPLIED
accountType CDATA #IMPLIED
accountType (accounts|groups|both|owngroups) #IMPLIED
align CDATA #IMPLIED
allowFreeEntries (false|true|1) #IMPLIED
ariaDescription CDATA #IMPLIED
@ -1897,22 +1897,33 @@
<!ATTLIST et2-date-since
accesskey CDATA #IMPLIED
align CDATA #IMPLIED
ariaDescription CDATA #IMPLIED
ariaLabel CDATA #IMPLIED
autocomplete CDATA #IMPLIED
autofocus (false|true|1) #IMPLIED
class CDATA #IMPLIED
data CDATA #IMPLIED
disabled (false|true|1) #IMPLIED
freeMinuteEntry (false|true|1) #IMPLIED
height CDATA #IMPLIED
helpText CDATA #IMPLIED
hidden (false|true|1) #IMPLIED
id CDATA #IMPLIED
inline (false|true|1) #IMPLIED
label CDATA #IMPLIED
noLang (false|true|1) #IMPLIED
onchange CDATA #IMPLIED
onclick CDATA #IMPLIED
parentId CDATA #IMPLIED
placeholder CDATA #IMPLIED
placement CDATA #IMPLIED
readonly (false|true|1) #IMPLIED
required (false|true|1) #IMPLIED
slot CDATA #IMPLIED
span (all|2|3|4) #IMPLIED
statustext CDATA #IMPLIED
style CDATA #IMPLIED
units CDATA #IMPLIED
value CDATA #IMPLIED
width CDATA #IMPLIED>
<!ELEMENT et2-date-time EMPTY>
@ -1986,23 +1997,11 @@
<!ELEMENT et2-date-time-today EMPTY>
<!ATTLIST et2-date-time-today
accesskey CDATA #IMPLIED
align CDATA #IMPLIED
class CDATA #IMPLIED
data CDATA #IMPLIED
disabled (false|true|1) #IMPLIED
height CDATA #IMPLIED
hidden (false|true|1) #IMPLIED
id CDATA #IMPLIED
label CDATA #IMPLIED
noLang (false|true|1) #IMPLIED
onclick CDATA #IMPLIED
parentId CDATA #IMPLIED
slot CDATA #IMPLIED
span (all|2|3|4) #IMPLIED
statustext CDATA #IMPLIED
style CDATA #IMPLIED
value CDATA #IMPLIED
width CDATA #IMPLIED>
<!ELEMENT et2-description EMPTY>
@ -3183,7 +3182,7 @@
<!ATTLIST et2-select-account
accesskey CDATA #IMPLIED
accountType CDATA #IMPLIED
accountType (accounts|groups|both|owngroups) #IMPLIED
align CDATA #IMPLIED
allowFreeEntries (false|true|1) #IMPLIED
ariaDescription CDATA #IMPLIED
@ -4644,25 +4643,11 @@
<!ELEMENT et2-vfs-gid EMPTY>
<!ATTLIST et2-vfs-gid
accesskey CDATA #IMPLIED
align CDATA #IMPLIED
class CDATA #IMPLIED
data CDATA #IMPLIED
disabled (false|true|1) #IMPLIED
height CDATA #IMPLIED
hidden (false|true|1) #IMPLIED
id CDATA #IMPLIED
label CDATA #IMPLIED
noLang (false|true|1) #IMPLIED
onclick CDATA #IMPLIED
parentId CDATA #IMPLIED
searchUrl CDATA #IMPLIED
select_options CDATA #IMPLIED
slot CDATA #IMPLIED
span (all|2|3|4) #IMPLIED
statustext CDATA #IMPLIED
style CDATA #IMPLIED
value CDATA #IMPLIED
width CDATA #IMPLIED>
<!ELEMENT et2-vfs-mime EMPTY>
@ -4833,23 +4818,9 @@
<!ELEMENT et2-vfs-uid EMPTY>
<!ATTLIST et2-vfs-uid
accesskey CDATA #IMPLIED
align CDATA #IMPLIED
class CDATA #IMPLIED
data CDATA #IMPLIED
disabled (false|true|1) #IMPLIED
height CDATA #IMPLIED
hidden (false|true|1) #IMPLIED
id CDATA #IMPLIED
label CDATA #IMPLIED
noLang (false|true|1) #IMPLIED
onclick CDATA #IMPLIED
parentId CDATA #IMPLIED
searchUrl CDATA #IMPLIED
select_options CDATA #IMPLIED
slot CDATA #IMPLIED
span (all|2|3|4) #IMPLIED
statustext CDATA #IMPLIED
style CDATA #IMPLIED
value CDATA #IMPLIED
width CDATA #IMPLIED>

View File

@ -4669,7 +4669,14 @@
<attribute name="accesskey"/>
</optional>
<optional>
<attribute name="accountType"/>
<attribute name="accountType">
<choice>
<value>accounts</value>
<value>groups</value>
<value>both</value>
<value>owngroups</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="align"/>
@ -7331,6 +7338,24 @@
<optional>
<attribute name="align"/>
</optional>
<optional>
<attribute name="ariaDescription"/>
</optional>
<optional>
<attribute name="ariaLabel"/>
</optional>
<optional>
<attribute name="autocomplete"/>
</optional>
<optional>
<attribute name="autofocus">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="class"/>
</optional>
@ -7346,9 +7371,21 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="freeMinuteEntry">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="height"/>
</optional>
<optional>
<attribute name="helpText"/>
</optional>
<optional>
<attribute name="hidden">
<choice>
@ -7361,6 +7398,15 @@
<optional>
<attribute name="id"/>
</optional>
<optional>
<attribute name="inline">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="label"/>
</optional>
@ -7373,12 +7419,39 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="onchange"/>
</optional>
<optional>
<attribute name="onclick"/>
</optional>
<optional>
<attribute name="parentId"/>
</optional>
<optional>
<attribute name="placeholder"/>
</optional>
<optional>
<attribute name="placement"/>
</optional>
<optional>
<attribute name="readonly">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="required">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="slot"/>
</optional>
@ -7401,9 +7474,6 @@
<optional>
<attribute name="units"/>
</optional>
<optional>
<attribute name="value"/>
</optional>
<optional>
<attribute name="width"/>
</optional>
@ -7721,60 +7791,12 @@
</element>
</define>
<define name="attlist.et2-date-time-today" combine="interleave">
<optional>
<attribute name="accesskey"/>
</optional>
<optional>
<attribute name="align"/>
</optional>
<optional>
<attribute name="class"/>
</optional>
<optional>
<attribute name="data"/>
</optional>
<optional>
<attribute name="disabled">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="height"/>
</optional>
<optional>
<attribute name="hidden">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="id"/>
</optional>
<optional>
<attribute name="label"/>
</optional>
<optional>
<attribute name="noLang">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="onclick"/>
</optional>
<optional>
<attribute name="parentId"/>
</optional>
<optional>
<attribute name="slot"/>
</optional>
@ -7788,15 +7810,9 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="statustext"/>
</optional>
<optional>
<attribute name="style"/>
</optional>
<optional>
<attribute name="value"/>
</optional>
<optional>
<attribute name="width"/>
</optional>
@ -12972,7 +12988,14 @@
<attribute name="accesskey"/>
</optional>
<optional>
<attribute name="accountType"/>
<attribute name="accountType">
<choice>
<value>accounts</value>
<value>groups</value>
<value>both</value>
<value>owngroups</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="align"/>
@ -19712,66 +19735,12 @@
</element>
</define>
<define name="attlist.et2-vfs-gid" combine="interleave">
<optional>
<attribute name="accesskey"/>
</optional>
<optional>
<attribute name="align"/>
</optional>
<optional>
<attribute name="class"/>
</optional>
<optional>
<attribute name="data"/>
</optional>
<optional>
<attribute name="disabled">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="height"/>
</optional>
<optional>
<attribute name="hidden">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="id"/>
</optional>
<optional>
<attribute name="label"/>
</optional>
<optional>
<attribute name="noLang">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="onclick"/>
</optional>
<optional>
<attribute name="parentId"/>
</optional>
<optional>
<attribute name="searchUrl"/>
</optional>
<optional>
<attribute name="select_options"/>
</optional>
<optional>
<attribute name="slot"/>
</optional>
@ -19785,15 +19754,9 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="statustext"/>
</optional>
<optional>
<attribute name="style"/>
</optional>
<optional>
<attribute name="value"/>
</optional>
<optional>
<attribute name="width"/>
</optional>
@ -20477,66 +20440,12 @@
</element>
</define>
<define name="attlist.et2-vfs-uid" combine="interleave">
<optional>
<attribute name="accesskey"/>
</optional>
<optional>
<attribute name="align"/>
</optional>
<optional>
<attribute name="class"/>
</optional>
<optional>
<attribute name="data"/>
</optional>
<optional>
<attribute name="disabled">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="height"/>
</optional>
<optional>
<attribute name="hidden">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="id"/>
</optional>
<optional>
<attribute name="label"/>
</optional>
<optional>
<attribute name="noLang">
<choice>
<value>false</value>
<value>true</value>
<value>1</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="onclick"/>
</optional>
<optional>
<attribute name="parentId"/>
</optional>
<optional>
<attribute name="searchUrl"/>
</optional>
<optional>
<attribute name="select_options"/>
</optional>
<optional>
<attribute name="slot"/>
</optional>
@ -20550,15 +20459,9 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="statustext"/>
</optional>
<optional>
<attribute name="style"/>
</optional>
<optional>
<attribute name="value"/>
</optional>
<optional>
<attribute name="width"/>
</optional>