Skip to content

Commit

Permalink
feat(foxy-gift-card-code-form): rewrite with internal controls
Browse files Browse the repository at this point in the history
  • Loading branch information
pheekus committed Mar 29, 2024
1 parent d1236f5 commit 3ccf1fa
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 1,441 deletions.
77 changes: 50 additions & 27 deletions custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -13576,6 +13576,21 @@
"path": "./src/elements/public/GiftCardCodeForm/index.ts",
"description": "Form element for creating or editing gift card codes (`fx:gift_card_code`).",
"attributes": [
{
"name": "simplify-ns-loading",
"type": "boolean",
"default": "false"
},
{
"name": "ns",
"type": "string",
"default": "\"defaultNS\""
},
{
"name": "status",
"description": "Status message to render at the top of the form. If `null`, the message is hidden.",
"type": "object"
},
{
"name": "mode",
"type": "string",
Expand Down Expand Up @@ -13608,16 +13623,6 @@
"name": "hiddencontrols",
"default": "\"False\""
},
{
"name": "simplify-ns-loading",
"type": "boolean",
"default": "false"
},
{
"name": "ns",
"type": "string",
"default": "\"defaultNS\""
},
{
"name": "lang",
"description": "Optional ISO 639-1 code describing the language element content is written in.\nChanging the `lang` attribute will update the value of this property.",
Expand Down Expand Up @@ -13653,6 +13658,35 @@
}
],
"properties": [
{
"name": "simplifyNsLoading",
"attribute": "simplify-ns-loading",
"type": "boolean",
"default": "false"
},
{
"name": "ns",
"attribute": "ns",
"type": "string",
"default": "\"defaultNS\""
},
{
"name": "t",
"type": "Translator",
"default": "\"(key, options) => {\\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\\n\\n if (!I18nElement) return key;\\n\\n let keys: string[];\\n\\n if (this.simplifyNsLoading) {\\n const namespaces = this.ns.split(' ').filter(v => v.length > 0);\\n const path = [...namespaces.slice(1), key].join('.');\\n keys = namespaces[0] ? [`${namespaces[0]}:${path}`] : [path];\\n } else {\\n keys = this.ns\\n .split(' ')\\n .reverse()\\n .map(v => v.trim())\\n .filter(v => v.length > 0)\\n .reverse()\\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`);\\n }\\n\\n keys.push(key);\\n\\n return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();\\n }\""
},
{
"name": "generalErrorPrefix",
"description": "Validation errors with this prefix will show up at the top of the form.",
"type": "string",
"default": "\"error:\""
},
{
"name": "status",
"attribute": "status",
"description": "Status message to render at the top of the form. If `null`, the message is hidden.",
"type": "object"
},
{
"name": "templates",
"type": "Templates",
Expand Down Expand Up @@ -13709,23 +13743,6 @@
"name": "hiddenSelector",
"type": "BooleanSelector"
},
{
"name": "simplifyNsLoading",
"attribute": "simplify-ns-loading",
"type": "boolean",
"default": "false"
},
{
"name": "ns",
"attribute": "ns",
"type": "string",
"default": "\"defaultNS\""
},
{
"name": "t",
"type": "Translator",
"default": "\"(key, options) => {\\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\\n\\n if (!I18nElement) return key;\\n\\n let keys: string[];\\n\\n if (this.simplifyNsLoading) {\\n const namespaces = this.ns.split(' ').filter(v => v.length > 0);\\n const path = [...namespaces.slice(1), key].join('.');\\n keys = namespaces[0] ? [`${namespaces[0]}:${path}`] : [path];\\n } else {\\n keys = this.ns\\n .split(' ')\\n .reverse()\\n .map(v => v.trim())\\n .filter(v => v.length > 0)\\n .reverse()\\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`);\\n }\\n\\n keys.push(key);\\n\\n return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();\\n }\""
},
{
"name": "UpdateEvent",
"description": "Instances of this event are dispatched on an element whenever it changes its\nstate (e.g. when going from `busy` to `idle` or on `form` data change).\nThis event isn't cancelable, and it does not bubble.",
Expand Down Expand Up @@ -13833,6 +13850,12 @@
{
"name": "end-date:after"
},
{
"name": "logs:before"
},
{
"name": "logs:after"
},
{
"name": "timestamps:before"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const summary: Summary = {
localName: 'foxy-gift-card-code-form',
translatable: true,
configurable: {
sections: ['timestamps'],
sections: ['timestamps', 'logs'],
buttons: ['create', 'delete'],
inputs: ['code', 'current-balance', 'end-date'],
},
Expand Down
Loading

0 comments on commit 3ccf1fa

Please sign in to comment.