@api-client/ui 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/modeling/internals/DomainAutoFieldsDialog.d.ts.map +1 -1
- package/build/src/modeling/internals/DomainAutoFieldsDialog.js +11 -16
- package/build/src/modeling/internals/DomainAutoFieldsDialog.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modeling/internals/DomainAutoFieldsDialog.ts +11 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainAutoFieldsDialog.d.ts","sourceRoot":"","sources":["../../../../src/modeling/internals/DomainAutoFieldsDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAKhC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAC5D;;OAEG;IACM,QAAQ,CAAC,cAAc,cAAoB;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"DomainAutoFieldsDialog.d.ts","sourceRoot":"","sources":["../../../../src/modeling/internals/DomainAutoFieldsDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAKhC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU;IAC5D;;OAEG;IACM,QAAQ,CAAC,cAAc,cAAoB;IAEpD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CA4J1B;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIX,MAAM,IAAI,cAAc;IAuBjC;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;OAEG;IACH,OAAO,CAAC,WAAW;CAepB"}
|
|
@@ -42,10 +42,15 @@ let DomainAutoFieldsDialog = (() => {
|
|
|
42
42
|
name: 'Name',
|
|
43
43
|
description: 'A human-readable name for the record.',
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
id: 'display-name',
|
|
47
|
+
name: 'Display Name',
|
|
48
|
+
description: 'A user-friendly label for UI presentation.',
|
|
49
|
+
},
|
|
45
50
|
{
|
|
46
51
|
id: 'description',
|
|
47
52
|
name: 'Description',
|
|
48
|
-
description: 'A detailed description of the record.',
|
|
53
|
+
description: 'A detailed description of the record with support for markdown.',
|
|
49
54
|
},
|
|
50
55
|
{
|
|
51
56
|
id: 'public-unique-name',
|
|
@@ -62,6 +67,11 @@ let DomainAutoFieldsDialog = (() => {
|
|
|
62
67
|
name: 'Email Address',
|
|
63
68
|
description: 'Email address with verification support.',
|
|
64
69
|
},
|
|
70
|
+
{
|
|
71
|
+
id: 'role',
|
|
72
|
+
name: 'User Role',
|
|
73
|
+
description: 'Defines the access level or permissions for a user.',
|
|
74
|
+
},
|
|
65
75
|
{
|
|
66
76
|
id: 'first-name',
|
|
67
77
|
name: 'First Name',
|
|
@@ -139,21 +149,6 @@ let DomainAutoFieldsDialog = (() => {
|
|
|
139
149
|
},
|
|
140
150
|
],
|
|
141
151
|
},
|
|
142
|
-
{
|
|
143
|
-
name: 'Session & Security',
|
|
144
|
-
fields: [
|
|
145
|
-
{
|
|
146
|
-
id: 'session-id',
|
|
147
|
-
name: 'Session ID',
|
|
148
|
-
description: 'Unique identifier for user sessions.',
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: 'expires-at',
|
|
152
|
-
name: 'Expires At',
|
|
153
|
-
description: 'When a session or token expires.',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
152
|
{
|
|
158
153
|
name: 'Audit Trail',
|
|
159
154
|
fields: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DomainAutoFieldsDialog.js","sourceRoot":"","sources":["../../../../src/modeling/internals/DomainAutoFieldsDialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;;sBAUF,UAAU;;;;iBAAzC,sBAAuB,SAAQ,WAAU;;;0CAI3D,KAAK,EAAE;YAAC,+LAAS,cAAc,6BAAd,cAAc,uGAAoB;;;QAA3C,yFAA0B,IAAI,GAAG,EAAU;QAEpD;;WAEG;UAJiD;QAHpD;;WAEG;QACM,IAAS,cAAc,oDAAoB;QAA3C,IAAS,cAAc,0DAAoB;QAEpD;;WAEG;QACc,UAAU,gEAAwB;YACjD;gBACE,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,IAAI;wBACR,IAAI,EAAE,YAAY;wBAClB,WAAW,EAAE,gCAAgC;qBAC9C;oBACD;wBACE,EAAE,EAAE,MAAM;wBACV,IAAI,EAAE,MAAM;wBACZ,WAAW,EAAE,uCAAuC;qBACrD;oBACD;wBACE,EAAE,EAAE,aAAa;wBACjB,IAAI,EAAE,aAAa;wBACnB,WAAW,EAAE,uCAAuC;qBACrD;oBACD;wBACE,EAAE,EAAE,oBAAoB;wBACxB,IAAI,EAAE,2BAA2B;wBACjC,WAAW,EAAE,wDAAwD;qBACtE;iBACF;aACF;YACD;gBACE,IAAI,EAAE,kBAAkB;gBACxB,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,OAAO;wBACX,IAAI,EAAE,eAAe;wBACr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G,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1D,CAAA;QACH,CAAC;QAED;;WAEG;QACK,WAAW,CAAC,KAA0B;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACpD,MAAM,OAAO,GAAG;gBACd,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,UAAU;aACvB,CAAA;YAED,OAAO,IAAI,CAAA;8CAC+B,KAAK,CAAC,EAAE,YAAY,QAAQ,CAAC,OAAO,CAAC;8CACrC,UAAU;6BAC3B,KAAK,CAAC,IAAI;sCACD,KAAK,CAAC,WAAW;;KAElD,CAAA;QACH,CAAC;;;AAhRH;;;;;GAKG;AACH,sCA2QC","sourcesContent":["import { html, type TemplateResult } from 'lit'\nimport { state } from 'lit/decorators.js'\nimport { LitElement } from 'lit'\nimport { classMap } from 'lit/directives/class-map.js'\nimport type { UiListSelection } from '../../md/list/ui-list.js'\nimport type { AutoFieldCategory, AutoFieldDefinition, AutoFieldsSelectionResult } from '../types.js'\n\n/**\n * A component for selecting \"auto fields\" to add to an entity.\n *\n * @fires select - Dispatched when fields are selected with AutoFieldsSelectionResult detail\n * @fires cancel - Dispatched when the user cancels the selection\n */\nexport default class DomainAutoFieldsDialog extends LitElement {\n /**\n * The currently selected field IDs\n */\n @state() accessor selectedFields = new Set<string>()\n\n /**\n * The auto field categories and definitions\n */\n private readonly categories: AutoFieldCategory[] = [\n {\n name: 'Core Fields',\n fields: [\n {\n id: 'id',\n name: 'Identifier',\n description: 'The unique ID for each record.',\n },\n {\n id: 'name',\n name: 'Name',\n description: 'A human-readable name for the record.',\n },\n {\n id: 'description',\n name: 'Description',\n description: 'A detailed description of the record.',\n },\n {\n id: 'public-unique-name',\n name: 'Public Unique Name (Slug)',\n description: 'A URL-friendly unique identifier (e.g., \"my-product\").',\n },\n ],\n },\n {\n name: 'User Information',\n fields: [\n {\n id: 'email',\n name: 'Email Address',\n description: 'Email address with verification support.',\n },\n {\n id: 'first-name',\n name: 'First Name',\n description: 'The first name of a person.',\n },\n {\n id: 'last-name',\n name: 'Last Name',\n description: 'The last name of a person.',\n },\n {\n id: 'phone',\n name: 'Phone Number',\n description: 'Phone number with international format support.',\n },\n {\n id: 'avatar-url',\n name: 'Avatar URL',\n description: 'URL to a profile picture or avatar image.',\n },\n ],\n },\n {\n name: 'Lifecycle & Status',\n fields: [\n {\n id: 'status',\n name: 'Status',\n description: 'The current state of the record (e.g., Active, Draft, Archived).',\n },\n {\n id: 'version',\n name: 'Version Number',\n description: 'Tracks changes to prevent editing conflicts.',\n },\n {\n id: 'owner',\n name: 'Owner',\n description: 'Reference to the user or team that owns this record.',\n },\n ],\n },\n {\n name: 'E-commerce',\n fields: [\n {\n id: 'price',\n name: 'Price',\n description: 'Product price with currency support.',\n },\n {\n id: 'unit-price',\n name: 'Unit Price',\n description: 'Price per unit with currency support.',\n },\n {\n id: 'sku',\n name: 'SKU',\n description: 'Stock Keeping Unit - unique product identifier.',\n },\n {\n id: 'quantity',\n name: 'Quantity',\n description: 'Available quantity or stock amount.',\n },\n {\n id: 'weight',\n name: 'Weight',\n description: 'Physical weight of the item.',\n },\n {\n id: 'images',\n name: 'Images',\n description: 'Multiple image URLs for the product.',\n },\n ],\n },\n {\n name: 'Session & Security',\n fields: [\n {\n id: 'session-id',\n name: 'Session ID',\n description: 'Unique identifier for user sessions.',\n },\n {\n id: 'expires-at',\n name: 'Expires At',\n description: 'When a session or token expires.',\n },\n ],\n },\n {\n name: 'Audit Trail',\n fields: [\n {\n id: 'created',\n name: 'Created At',\n description: 'The date and time when the record was created.',\n },\n {\n id: 'updated',\n name: 'Updated At',\n description: 'The date and time when the record was last updated.',\n },\n {\n id: 'updated-by',\n name: 'Updated By',\n description: 'Reference to the user who last updated the record.',\n },\n ],\n },\n {\n name: 'Soft Delete',\n fields: [\n {\n id: 'is-deleted',\n name: 'Is Deleted',\n description: 'A true/false flag indicating if the record is deleted.',\n },\n {\n id: 'deleted',\n name: 'Deleted At',\n description: 'The date and time when the record was deleted.',\n },\n ],\n },\n ]\n\n /**\n * Resets the selection\n */\n reset(): void {\n this.selectedFields.clear()\n this.requestUpdate()\n }\n\n /**\n * Handles field selection toggle\n */\n private handleFieldToggle(fieldId: string): void {\n if (this.selectedFields.has(fieldId)) {\n this.selectedFields.delete(fieldId)\n } else {\n this.selectedFields.add(fieldId)\n }\n this.requestUpdate()\n }\n\n private handleFieldSelect(e: CustomEvent<UiListSelection>): void {\n const { item } = e.detail\n const { id } = item.dataset\n if (!id) return\n this.handleFieldToggle(id)\n }\n\n /**\n * Handles the Add Selected button click\n */\n private handleAddSelected(): void {\n const result: AutoFieldsSelectionResult = {\n selectedFields: Array.from(this.selectedFields),\n }\n this.dispatchEvent(new CustomEvent('select', { detail: result }))\n }\n\n /**\n * Handles the Cancel button click\n */\n private handleCancel(): void {\n this.dispatchEvent(new CustomEvent('cancel'))\n }\n\n override render(): TemplateResult {\n const selectedCount = this.selectedFields.size\n\n return html`\n <ui-list class=\"list\" @select=\"${this.handleFieldSelect}\"\n >${this.categories.map((category) => this.renderCategory(category))}</ui-list\n >\n\n <div class=\"dialog-actions\">\n <ui-button type=\"button\" @click=\"${this.handleCancel}\" class=\"cancel\">Cancel</ui-button>\n <ui-button\n type=\"button\"\n class=\"save\"\n color=\"filled\"\n ?disabled=\"${selectedCount === 0}\"\n @click=\"${this.handleAddSelected}\"\n >\n Add Selected (${selectedCount})\n </ui-button>\n </div>\n `\n }\n\n /**\n * Renders a category section\n */\n private renderCategory(category: AutoFieldCategory): TemplateResult {\n return html`\n <div class=\"category-title title-medium\">${category.name}</div>\n ${category.fields.map((field) => this.renderField(field))}\n `\n }\n\n /**\n * Renders a field item\n */\n private renderField(field: AutoFieldDefinition): TemplateResult {\n const isSelected = this.selectedFields.has(field.id)\n const classes = {\n 'field-item': true,\n 'selected': isSelected,\n }\n\n return html`\n <ui-list-item image=\"avatar\" data-id=\"${field.id}\" class=\"${classMap(classes)}\" lines=\"two\">\n <ui-checkbox slot=\"start\" .checked=\"${isSelected}\"></ui-checkbox>\n <div class=\"label\">${field.name}</div>\n <div slot=\"supporting-text\">${field.description}</div>\n </ui-list-item>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DomainAutoFieldsDialog.js","sourceRoot":"","sources":["../../../../src/modeling/internals/DomainAutoFieldsDialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;;sBAUF,UAAU;;;;iBAAzC,sBAAuB,SAAQ,WAAU;;;0CAI3D,KAAK,EAAE;YAAC,+LAAS,cAAc,6BAAd,cAAc,uGAAoB;;;QAA3C,yFAA0B,IAAI,GAAG,EAAU;QAEpD;;WAEG;UAJiD;QAHpD;;WAEG;QACM,IAAS,cAAc,oDAAoB;QAA3C,IAAS,cAAc,0DAAoB;QAEpD;;WAEG;QACc,UAAU,gEAAwB;YACjD;gBACE,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE;oBACN;wBACE,EAAE,EAAE,IAAI;wBACR,IAAI,EAAE,YAAY;wBAClB,WAAW,EAAE,gCAAgC;qBAC9C;oBACD;wBACE,EAAE,EAAE,MAAM;wBACV,IAAI,EAAE,MAAM;wBACZ,WAAW,EAAE,uCAAuC;qBACrD;oBACD;wBACE,EAAE,EAAE,cAAc;wBAClB,IAAI,EAAE,cAAc;wBACpB,WAAW,EAAE,4CAA4C;qBAC1D;oBACD;wBACE,EAAE,EAAE,aAAa;wBACjB,IAAI,EAAE,aAAa;wBACnB,WAAW,EAAE,iEAAiE;qBAC/E;oBACD;wBACE,EAAE,EAAE,oBAAoB;wBACxB,IAAI,E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AAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1D,CAAA;QACH,CAAC;QAED;;WAEG;QACK,WAAW,CAAC,KAA0B;YAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACpD,MAAM,OAAO,GAAG;gBACd,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,UAAU;aACvB,CAAA;YAED,OAAO,IAAI,CAAA;8CAC+B,KAAK,CAAC,EAAE,YAAY,QAAQ,CAAC,OAAO,CAAC;8CACrC,UAAU;6BAC3B,KAAK,CAAC,IAAI;sCACD,KAAK,CAAC,WAAW;;KAElD,CAAA;QACH,CAAC;;;AA3QH;;;;;GAKG;AACH,sCAsQC","sourcesContent":["import { html, type TemplateResult } from 'lit'\nimport { state } from 'lit/decorators.js'\nimport { LitElement } from 'lit'\nimport { classMap } from 'lit/directives/class-map.js'\nimport type { UiListSelection } from '../../md/list/ui-list.js'\nimport type { AutoFieldCategory, AutoFieldDefinition, AutoFieldsSelectionResult } from '../types.js'\n\n/**\n * A component for selecting \"auto fields\" to add to an entity.\n *\n * @fires select - Dispatched when fields are selected with AutoFieldsSelectionResult detail\n * @fires cancel - Dispatched when the user cancels the selection\n */\nexport default class DomainAutoFieldsDialog extends LitElement {\n /**\n * The currently selected field IDs\n */\n @state() accessor selectedFields = new Set<string>()\n\n /**\n * The auto field categories and definitions\n */\n private readonly categories: AutoFieldCategory[] = [\n {\n name: 'Core Fields',\n fields: [\n {\n id: 'id',\n name: 'Identifier',\n description: 'The unique ID for each record.',\n },\n {\n id: 'name',\n name: 'Name',\n description: 'A human-readable name for the record.',\n },\n {\n id: 'display-name',\n name: 'Display Name',\n description: 'A user-friendly label for UI presentation.',\n },\n {\n id: 'description',\n name: 'Description',\n description: 'A detailed description of the record with support for markdown.',\n },\n {\n id: 'public-unique-name',\n name: 'Public Unique Name (Slug)',\n description: 'A URL-friendly unique identifier (e.g., \"my-product\").',\n },\n ],\n },\n {\n name: 'User Information',\n fields: [\n {\n id: 'email',\n name: 'Email Address',\n description: 'Email address with verification support.',\n },\n {\n id: 'role',\n name: 'User Role',\n description: 'Defines the access level or permissions for a user.',\n },\n {\n id: 'first-name',\n name: 'First Name',\n description: 'The first name of a person.',\n },\n {\n id: 'last-name',\n name: 'Last Name',\n description: 'The last name of a person.',\n },\n {\n id: 'phone',\n name: 'Phone Number',\n description: 'Phone number with international format support.',\n },\n {\n id: 'avatar-url',\n name: 'Avatar URL',\n description: 'URL to a profile picture or avatar image.',\n },\n ],\n },\n {\n name: 'Lifecycle & Status',\n fields: [\n {\n id: 'status',\n name: 'Status',\n description: 'The current state of the record (e.g., Active, Draft, Archived).',\n },\n {\n id: 'version',\n name: 'Version Number',\n description: 'Tracks changes to prevent editing conflicts.',\n },\n {\n id: 'owner',\n name: 'Owner',\n description: 'Reference to the user or team that owns this record.',\n },\n ],\n },\n {\n name: 'E-commerce',\n fields: [\n {\n id: 'price',\n name: 'Price',\n description: 'Product price with currency support.',\n },\n {\n id: 'unit-price',\n name: 'Unit Price',\n description: 'Price per unit with currency support.',\n },\n {\n id: 'sku',\n name: 'SKU',\n description: 'Stock Keeping Unit - unique product identifier.',\n },\n {\n id: 'quantity',\n name: 'Quantity',\n description: 'Available quantity or stock amount.',\n },\n {\n id: 'weight',\n name: 'Weight',\n description: 'Physical weight of the item.',\n },\n {\n id: 'images',\n name: 'Images',\n description: 'Multiple image URLs for the product.',\n },\n ],\n },\n {\n name: 'Audit Trail',\n fields: [\n {\n id: 'created',\n name: 'Created At',\n description: 'The date and time when the record was created.',\n },\n {\n id: 'updated',\n name: 'Updated At',\n description: 'The date and time when the record was last updated.',\n },\n {\n id: 'updated-by',\n name: 'Updated By',\n description: 'Reference to the user who last updated the record.',\n },\n ],\n },\n {\n name: 'Soft Delete',\n fields: [\n {\n id: 'is-deleted',\n name: 'Is Deleted',\n description: 'A true/false flag indicating if the record is deleted.',\n },\n {\n id: 'deleted',\n name: 'Deleted At',\n description: 'The date and time when the record was deleted.',\n },\n ],\n },\n ]\n\n /**\n * Resets the selection\n */\n reset(): void {\n this.selectedFields.clear()\n this.requestUpdate()\n }\n\n /**\n * Handles field selection toggle\n */\n private handleFieldToggle(fieldId: string): void {\n if (this.selectedFields.has(fieldId)) {\n this.selectedFields.delete(fieldId)\n } else {\n this.selectedFields.add(fieldId)\n }\n this.requestUpdate()\n }\n\n private handleFieldSelect(e: CustomEvent<UiListSelection>): void {\n const { item } = e.detail\n const { id } = item.dataset\n if (!id) return\n this.handleFieldToggle(id)\n }\n\n /**\n * Handles the Add Selected button click\n */\n private handleAddSelected(): void {\n const result: AutoFieldsSelectionResult = {\n selectedFields: Array.from(this.selectedFields),\n }\n this.dispatchEvent(new CustomEvent('select', { detail: result }))\n }\n\n /**\n * Handles the Cancel button click\n */\n private handleCancel(): void {\n this.dispatchEvent(new CustomEvent('cancel'))\n }\n\n override render(): TemplateResult {\n const selectedCount = this.selectedFields.size\n\n return html`\n <ui-list class=\"list\" @select=\"${this.handleFieldSelect}\"\n >${this.categories.map((category) => this.renderCategory(category))}</ui-list\n >\n\n <div class=\"dialog-actions\">\n <ui-button type=\"button\" @click=\"${this.handleCancel}\" class=\"cancel\">Cancel</ui-button>\n <ui-button\n type=\"button\"\n class=\"save\"\n color=\"filled\"\n ?disabled=\"${selectedCount === 0}\"\n @click=\"${this.handleAddSelected}\"\n >\n Add Selected (${selectedCount})\n </ui-button>\n </div>\n `\n }\n\n /**\n * Renders a category section\n */\n private renderCategory(category: AutoFieldCategory): TemplateResult {\n return html`\n <div class=\"category-title title-medium\">${category.name}</div>\n ${category.fields.map((field) => this.renderField(field))}\n `\n }\n\n /**\n * Renders a field item\n */\n private renderField(field: AutoFieldDefinition): TemplateResult {\n const isSelected = this.selectedFields.has(field.id)\n const classes = {\n 'field-item': true,\n 'selected': isSelected,\n }\n\n return html`\n <ui-list-item image=\"avatar\" data-id=\"${field.id}\" class=\"${classMap(classes)}\" lines=\"two\">\n <ui-checkbox slot=\"start\" .checked=\"${isSelected}\"></ui-checkbox>\n <div class=\"label\">${field.name}</div>\n <div slot=\"supporting-text\">${field.description}</div>\n </ui-list-item>\n `\n }\n}\n"]}
|