@umbraco-cms/backoffice 14.0.0--preview007-06765466 → 14.0.0--preview007-63654dfd

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.
Files changed (28) hide show
  1. package/dist-cms/custom-elements.json +3 -141
  2. package/dist-cms/packages/core/modal/token/dictionary-item-picker-modal.token.js +1 -0
  3. package/dist-cms/packages/templating/components/templating-item-menu/templating-item-menu.element.d.ts +0 -1
  4. package/dist-cms/packages/templating/components/templating-item-menu/templating-item-menu.element.js +55 -64
  5. package/dist-cms/packages/templating/modals/index.d.ts +1 -0
  6. package/dist-cms/packages/templating/modals/index.js +1 -0
  7. package/dist-cms/packages/templating/modals/manifests.js +6 -0
  8. package/dist-cms/packages/templating/modals/templating-item-picker/templating-item-picker-modal.element.d.ts +1 -1
  9. package/dist-cms/packages/templating/modals/templating-item-picker/templating-item-picker-modal.element.js +37 -34
  10. package/dist-cms/packages/templating/modals/templating-item-picker/templating-item-picker-modal.token.d.ts +2 -2
  11. package/dist-cms/packages/templating/modals/templating-page-field-builder/index.d.ts +2 -0
  12. package/dist-cms/packages/templating/modals/templating-page-field-builder/index.js +2 -0
  13. package/dist-cms/packages/templating/modals/templating-page-field-builder/templating-page-field-builder-modal.element.d.ts +19 -0
  14. package/dist-cms/packages/templating/modals/templating-page-field-builder/templating-page-field-builder-modal.element.js +105 -0
  15. package/dist-cms/packages/templating/modals/templating-page-field-builder/templating-page-field-builder-modal.token.d.ts +7 -0
  16. package/dist-cms/packages/templating/modals/templating-page-field-builder/templating-page-field-builder-modal.token.js +7 -0
  17. package/dist-cms/packages/templating/modals/templating-section-picker/index.d.ts +1 -1
  18. package/dist-cms/packages/templating/modals/templating-section-picker/index.js +1 -1
  19. package/dist-cms/packages/templating/modals/templating-section-picker/templating-section-picker-modal.element.d.ts +4 -7
  20. package/dist-cms/packages/templating/modals/templating-section-picker/templating-section-picker-modal.element.js +133 -94
  21. package/dist-cms/packages/templating/types.d.ts +7 -1
  22. package/dist-cms/packages/templating/types.js +7 -0
  23. package/dist-cms/packages/templating/utils/index.js +1 -1
  24. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  25. package/dist-cms/vscode-html-custom-data.json +6 -38
  26. package/package.json +1 -1
  27. package/dist-cms/packages/templating/modals/templating-section-picker/templating-section-picker-input.element.d.ts +0 -24
  28. package/dist-cms/packages/templating/modals/templating-section-picker/templating-section-picker-input.element.js +0 -157
@@ -9290,11 +9290,6 @@
9290
9290
  "name": "value",
9291
9291
  "type": "string",
9292
9292
  "default": "\"\""
9293
- },
9294
- {
9295
- "name": "hidePartialView",
9296
- "type": "boolean",
9297
- "default": "false"
9298
9293
  }
9299
9294
  ],
9300
9295
  "properties": [
@@ -9304,12 +9299,6 @@
9304
9299
  "type": "string",
9305
9300
  "default": "\"\""
9306
9301
  },
9307
- {
9308
- "name": "hidePartialView",
9309
- "attribute": "hidePartialView",
9310
- "type": "boolean",
9311
- "default": "false"
9312
- },
9313
9302
  {
9314
9303
  "name": "styles",
9315
9304
  "type": "array",
@@ -9334,122 +9323,13 @@
9334
9323
  ]
9335
9324
  },
9336
9325
  {
9337
- "name": "umb-insert-section-checkbox",
9338
- "path": "./../src/packages/templating/modals/templating-section-picker/templating-section-picker-input.element.ts",
9339
- "attributes": [
9340
- {
9341
- "name": "show-mandatory",
9342
- "type": "boolean",
9343
- "default": "false"
9344
- },
9345
- {
9346
- "name": "show-input",
9347
- "type": "boolean",
9348
- "default": "false"
9349
- }
9350
- ],
9326
+ "name": "umb-templating-page-field-builder-modal",
9327
+ "path": "./../src/packages/templating/modals/templating-page-field-builder/templating-page-field-builder-modal.element.ts",
9351
9328
  "properties": [
9352
- {
9353
- "name": "showMandatory",
9354
- "attribute": "show-mandatory",
9355
- "type": "boolean",
9356
- "default": "false"
9357
- },
9358
- {
9359
- "name": "showInput",
9360
- "attribute": "show-input",
9361
- "type": "boolean",
9362
- "default": "false"
9363
- },
9364
- {
9365
- "name": "input"
9366
- },
9367
- {
9368
- "name": "form",
9369
- "type": "HTMLFormElement | undefined"
9370
- },
9371
- {
9372
- "name": "checkbox",
9373
- "type": "HTMLFormElement | undefined"
9374
- },
9375
- {
9376
- "name": "snippet",
9377
- "type": "string"
9378
- },
9379
- {
9380
- "name": "snippetMethod",
9381
- "type": "((value: string, isMandatory: boolean) => string) | undefined"
9382
- },
9383
- {
9384
- "name": "inputValue"
9385
- },
9386
- {
9387
- "name": "isMandatory"
9388
- },
9389
9329
  {
9390
9330
  "name": "styles",
9391
9331
  "type": "array",
9392
- "default": "[null,\"UmbTextStyles\",null]"
9393
- }
9394
- ]
9395
- },
9396
- {
9397
- "name": "umb-insert-section-input",
9398
- "path": "./../src/packages/templating/modals/templating-section-picker/templating-section-picker-input.element.ts",
9399
- "attributes": [
9400
- {
9401
- "name": "show-mandatory",
9402
- "type": "boolean",
9403
- "default": "false"
9404
- },
9405
- {
9406
- "name": "show-input",
9407
- "type": "boolean",
9408
- "default": "false"
9409
- }
9410
- ],
9411
- "properties": [
9412
- {
9413
- "name": "showMandatory",
9414
- "attribute": "show-mandatory",
9415
- "type": "boolean",
9416
- "default": "false"
9417
- },
9418
- {
9419
- "name": "showInput",
9420
- "attribute": "show-input",
9421
- "type": "boolean",
9422
- "default": "false"
9423
- },
9424
- {
9425
- "name": "input"
9426
- },
9427
- {
9428
- "name": "form",
9429
- "type": "HTMLFormElement | undefined"
9430
- },
9431
- {
9432
- "name": "checkbox",
9433
- "type": "HTMLFormElement | undefined"
9434
- },
9435
- {
9436
- "name": "snippet",
9437
- "type": "string"
9438
- },
9439
- {
9440
- "name": "snippetMethod",
9441
- "type": "((value: string, isMandatory: boolean) => string) | undefined"
9442
- },
9443
- {
9444
- "name": "inputValue"
9445
- },
9446
- {
9447
- "name": "isMandatory"
9448
- },
9449
- {
9450
- "name": "styles",
9451
- "type": "array",
9452
- "default": "[null,\"UmbTextStyles\",null]"
9332
+ "default": "[\"UmbTextStyles\",null]"
9453
9333
  }
9454
9334
  ]
9455
9335
  },
@@ -9457,24 +9337,6 @@
9457
9337
  "name": "umb-templating-section-picker-modal",
9458
9338
  "path": "./../src/packages/templating/modals/templating-section-picker/templating-section-picker-modal.element.ts",
9459
9339
  "properties": [
9460
- {
9461
- "name": "checkboxes",
9462
- "type": "NodeListOf<UmbInsertSectionCheckboxElement>"
9463
- },
9464
- {
9465
- "name": "selectedCheckbox",
9466
- "type": "UmbInsertSectionCheckboxElement | null | undefined"
9467
- },
9468
- {
9469
- "name": "snippet",
9470
- "type": "string",
9471
- "default": "\"\""
9472
- },
9473
- {
9474
- "name": "snippetMethods",
9475
- "type": "((sectionName: string, isMandatory: boolean) => string)[]",
9476
- "default": "[\"getRenderBodySnippet\",\"getRenderSectionSnippet\",\"getAddSectionSnippet\"]"
9477
- },
9478
9340
  {
9479
9341
  "name": "styles",
9480
9342
  "type": "array",
@@ -5,6 +5,7 @@ export const UMB_DICTIONARY_ITEM_PICKER_MODAL = new UmbModalToken('Umb.Modal.Tre
5
5
  size: 'small',
6
6
  },
7
7
  data: {
8
+ hideTreeRoot: true,
8
9
  treeAlias: 'Umb.Tree.Dictionary',
9
10
  },
10
11
  });
@@ -6,7 +6,6 @@ export declare class UmbTemplatingInsertMenuElement extends UmbLitElement {
6
6
  private _modalContext?;
7
7
  constructor();
8
8
  determineInsertValue(modalValue: UmbTemplatingItemPickerModalValue): Promise<void>;
9
- hidePartialView: boolean;
10
9
  render(): import("lit-html").TemplateResult<1>;
11
10
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
12
11
  }
@@ -9,14 +9,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
13
- if (kind === "m") throw new TypeError("Private method is not writable");
14
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
15
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
16
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17
- };
18
- var _UmbTemplatingInsertMenuElement_instances, _UmbTemplatingInsertMenuElement_openModal, _UmbTemplatingInsertMenuElement_dictionaryDetailRepository, _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet, _UmbTemplatingInsertMenuElement_getPartialViewSnippet, _UmbTemplatingInsertMenuElement_openChooseTypeModal, _UmbTemplatingInsertMenuElement_openInsertPageFieldSidebar, _UmbTemplatingInsertMenuElement_openInsertPartialViewSidebar, _UmbTemplatingInsertMenuElement_openInsertDictionaryItemModal, _UmbTemplatingInsertMenuElement_dispatchInsertEvent;
19
- import { UMB_PARTIAL_VIEW_PICKER_MODAL, } from '../../modals/partial-view-picker/partial-view-picker-modal.token.js';
12
+ var _UmbTemplatingInsertMenuElement_instances, _UmbTemplatingInsertMenuElement_dictionaryDetailRepository, _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet, _UmbTemplatingInsertMenuElement_openTemplatingItemPickerModal, _UmbTemplatingInsertMenuElement_openPartialViewPickerModal, _UmbTemplatingInsertMenuElement_openDictionaryItemPickerModal, _UmbTemplatingInsertMenuElement_openPageFieldBuilderModal, _UmbTemplatingInsertMenuElement_dispatchInsertEvent;
13
+ import { UMB_PARTIAL_VIEW_PICKER_MODAL } from '../../modals/partial-view-picker/partial-view-picker-modal.token.js';
14
+ import { UMB_TEMPLATING_PAGE_FIELD_BUILDER_MODAL } from '../../modals/templating-page-field-builder/templating-page-field-builder-modal.token.js';
20
15
  import { CodeSnippetType } from '../../types.js';
21
16
  import { UMB_TEMPLATING_ITEM_PICKER_MODAL, } from '../../modals/templating-item-picker/templating-item-picker-modal.token.js';
22
17
  import { getInsertDictionarySnippet, getInsertPartialSnippet } from '../../utils/index.js';
@@ -30,29 +25,7 @@ let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement extend
30
25
  super();
31
26
  _UmbTemplatingInsertMenuElement_instances.add(this);
32
27
  this.value = '';
33
- _UmbTemplatingInsertMenuElement_openModal.set(this, void 0);
34
28
  _UmbTemplatingInsertMenuElement_dictionaryDetailRepository.set(this, new UmbDictionaryDetailRepository(this));
35
- _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet.set(this, async (modalValue) => {
36
- const unique = modalValue.selection[0];
37
- if (unique === null)
38
- return;
39
- const { data } = await __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_dictionaryDetailRepository, "f").requestByUnique(unique);
40
- this.value = getInsertDictionarySnippet(data?.name ?? '');
41
- });
42
- _UmbTemplatingInsertMenuElement_getPartialViewSnippet.set(this, async (modalValue) => {
43
- this.value = getInsertPartialSnippet(modalValue.selection?.[0] ?? '');
44
- });
45
- _UmbTemplatingInsertMenuElement_openChooseTypeModal.set(this, () => {
46
- __classPrivateFieldSet(this, _UmbTemplatingInsertMenuElement_openModal, this._modalContext?.open(UMB_TEMPLATING_ITEM_PICKER_MODAL, {
47
- data: {
48
- hidePartialViews: this.hidePartialView,
49
- },
50
- }), "f");
51
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_openModal, "f")?.onSubmit().then((closedModal) => {
52
- this.determineInsertValue(closedModal);
53
- });
54
- });
55
- this.hidePartialView = false;
56
29
  this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => {
57
30
  this._modalContext = instance;
58
31
  });
@@ -61,11 +34,17 @@ let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement extend
61
34
  const { type, value } = modalValue;
62
35
  switch (type) {
63
36
  case CodeSnippetType.partialView: {
64
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_getPartialViewSnippet, "f").call(this, value);
37
+ this.value = getInsertPartialSnippet(value);
38
+ __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
65
39
  break;
66
40
  }
67
41
  case CodeSnippetType.dictionaryItem: {
68
- await __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet, "f").call(this, value);
42
+ await __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet).call(this, value);
43
+ __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
44
+ break;
45
+ }
46
+ case CodeSnippetType.pageField: {
47
+ this.value = value;
69
48
  __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
70
49
  break;
71
50
  }
@@ -74,7 +53,10 @@ let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement extend
74
53
  render() {
75
54
  return html `
76
55
  <uui-button-group>
77
- <uui-button look="secondary" @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_openChooseTypeModal, "f")} label=${this.localize.term('template_insert')}>
56
+ <uui-button
57
+ look="secondary"
58
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openTemplatingItemPickerModal)}
59
+ label=${this.localize.term('template_insert')}>
78
60
  <uui-icon name="icon-add"></uui-icon>${this.localize.term('template_insert')}
79
61
  </uui-button>
80
62
  <umb-dropdown
@@ -87,53 +69,65 @@ let UmbTemplatingInsertMenuElement = class UmbTemplatingInsertMenuElement extend
87
69
  class="insert-menu-item"
88
70
  label=${this.localize.term('template_insertPageField')}
89
71
  title=${this.localize.term('template_insertPageField')}
90
- @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openInsertPageFieldSidebar)}></uui-menu-item>
72
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openPageFieldBuilderModal)}></uui-menu-item>
91
73
  <uui-menu-item
92
74
  class="insert-menu-item"
93
75
  label=${this.localize.term('template_insertPartialView')}
94
76
  title=${this.localize.term('template_insertPartialView')}
95
- @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openInsertPartialViewSidebar)}>
77
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openPartialViewPickerModal)}>
96
78
  </uui-menu-item>
97
79
  <uui-menu-item
98
80
  class="insert-menu-item"
99
81
  label=${this.localize.term('template_insertDictionaryItem')}
100
82
  title=${this.localize.term('template_insertDictionaryItem')}
101
- @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openInsertDictionaryItemModal)}>
83
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_openDictionaryItemPickerModal)}>
102
84
  </uui-menu-item>
103
85
  </umb-dropdown>
104
86
  </uui-button-group>
105
87
  `;
106
88
  }
107
89
  };
108
- _UmbTemplatingInsertMenuElement_openModal = new WeakMap();
109
90
  _UmbTemplatingInsertMenuElement_dictionaryDetailRepository = new WeakMap();
110
- _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet = new WeakMap();
111
- _UmbTemplatingInsertMenuElement_getPartialViewSnippet = new WeakMap();
112
- _UmbTemplatingInsertMenuElement_openChooseTypeModal = new WeakMap();
113
91
  _UmbTemplatingInsertMenuElement_instances = new WeakSet();
114
- _UmbTemplatingInsertMenuElement_openInsertPageFieldSidebar = function _UmbTemplatingInsertMenuElement_openInsertPageFieldSidebar() {
115
- //this.#openModel = this._modalContext?.open();
92
+ _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet = async function _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet(unique) {
93
+ if (unique === null)
94
+ return;
95
+ const { data } = await __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_dictionaryDetailRepository, "f").requestByUnique(unique);
96
+ this.value = getInsertDictionarySnippet(data?.name ?? '');
116
97
  };
117
- _UmbTemplatingInsertMenuElement_openInsertPartialViewSidebar = function _UmbTemplatingInsertMenuElement_openInsertPartialViewSidebar() {
118
- __classPrivateFieldSet(this, _UmbTemplatingInsertMenuElement_openModal, this._modalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL), "f");
119
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_openModal, "f")?.onSubmit().then((value) => {
120
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_getPartialViewSnippet, "f").call(this, value).then(() => {
121
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
122
- });
123
- });
98
+ _UmbTemplatingInsertMenuElement_openTemplatingItemPickerModal = async function _UmbTemplatingInsertMenuElement_openTemplatingItemPickerModal() {
99
+ const itemPickerContext = this._modalContext?.open(UMB_TEMPLATING_ITEM_PICKER_MODAL);
100
+ await itemPickerContext?.onSubmit();
101
+ const value = itemPickerContext?.getValue();
102
+ if (!value)
103
+ return;
104
+ this.determineInsertValue(value);
124
105
  };
125
- _UmbTemplatingInsertMenuElement_openInsertDictionaryItemModal = function _UmbTemplatingInsertMenuElement_openInsertDictionaryItemModal() {
126
- __classPrivateFieldSet(this, _UmbTemplatingInsertMenuElement_openModal, this._modalContext?.open(UMB_DICTIONARY_ITEM_PICKER_MODAL, {
127
- data: {
128
- pickableFilter: (item) => item.unique !== null,
129
- hideTreeRoot: true,
130
- },
131
- }), "f");
132
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_openModal, "f")?.onSubmit().then((value) => {
133
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_getDictionaryItemSnippet, "f").call(this, value).then(() => {
134
- __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
135
- });
136
- });
106
+ _UmbTemplatingInsertMenuElement_openPartialViewPickerModal = async function _UmbTemplatingInsertMenuElement_openPartialViewPickerModal() {
107
+ const partialViewPickerContext = this._modalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL);
108
+ await partialViewPickerContext?.onSubmit();
109
+ const path = partialViewPickerContext?.getValue().selection[0];
110
+ if (!path)
111
+ return;
112
+ this.determineInsertValue({ type: CodeSnippetType.partialView, value: path });
113
+ };
114
+ _UmbTemplatingInsertMenuElement_openDictionaryItemPickerModal = async function _UmbTemplatingInsertMenuElement_openDictionaryItemPickerModal() {
115
+ const dictionaryItemPickerContext = this._modalContext?.open(UMB_DICTIONARY_ITEM_PICKER_MODAL);
116
+ await dictionaryItemPickerContext?.onSubmit();
117
+ const item = dictionaryItemPickerContext?.getValue().selection[0];
118
+ if (!item)
119
+ return;
120
+ this.determineInsertValue({ type: CodeSnippetType.dictionaryItem, value: item });
121
+ };
122
+ _UmbTemplatingInsertMenuElement_openPageFieldBuilderModal = async function _UmbTemplatingInsertMenuElement_openPageFieldBuilderModal() {
123
+ const pageFieldBuilderContext = this._modalContext?.open(UMB_TEMPLATING_PAGE_FIELD_BUILDER_MODAL);
124
+ await pageFieldBuilderContext?.onSubmit();
125
+ const output = pageFieldBuilderContext?.getValue().output;
126
+ if (!output)
127
+ return;
128
+ // The output is already built due to the preview in the modal. Can insert it directly now.
129
+ this.value = output;
130
+ __classPrivateFieldGet(this, _UmbTemplatingInsertMenuElement_instances, "m", _UmbTemplatingInsertMenuElement_dispatchInsertEvent).call(this);
137
131
  };
138
132
  _UmbTemplatingInsertMenuElement_dispatchInsertEvent = function _UmbTemplatingInsertMenuElement_dispatchInsertEvent() {
139
133
  this.dispatchEvent(new CustomEvent('insert', { bubbles: false, cancelable: true, composed: false }));
@@ -157,9 +151,6 @@ UmbTemplatingInsertMenuElement.styles = [
157
151
  __decorate([
158
152
  property()
159
153
  ], UmbTemplatingInsertMenuElement.prototype, "value", void 0);
160
- __decorate([
161
- property({ type: Boolean })
162
- ], UmbTemplatingInsertMenuElement.prototype, "hidePartialView", void 0);
163
154
  UmbTemplatingInsertMenuElement = __decorate([
164
155
  customElement('umb-templating-insert-menu')
165
156
  ], UmbTemplatingInsertMenuElement);
@@ -1,3 +1,4 @@
1
1
  export * from './templating-section-picker/index.js';
2
2
  export * from './templating-item-picker/index.js';
3
3
  export * from './partial-view-picker/index.js';
4
+ export * from './templating-page-field-builder/index.js';
@@ -1,3 +1,4 @@
1
1
  export * from './templating-section-picker/index.js';
2
2
  export * from './templating-item-picker/index.js';
3
3
  export * from './partial-view-picker/index.js';
4
+ export * from './templating-page-field-builder/index.js';
@@ -11,5 +11,11 @@ const modals = [
11
11
  name: 'Templating Section Picker Modal',
12
12
  js: () => import('./templating-section-picker/templating-section-picker-modal.element.js'),
13
13
  },
14
+ {
15
+ type: 'modal',
16
+ alias: 'Umb.Modal.TemplatingPageFieldBuilder',
17
+ name: 'Templating Page Field Builder Modal',
18
+ js: () => import('./templating-page-field-builder/templating-page-field-builder-modal.element.js'),
19
+ },
14
20
  ];
15
21
  export const manifests = [...modals];
@@ -3,7 +3,7 @@ import { UmbModalBaseElement } from '../../../core/modal/index.js';
3
3
  export declare class UmbTemplatingItemPickerModalElement extends UmbModalBaseElement<UmbTemplatingItemPickerModalData, UmbTemplatingItemPickerModalValue> {
4
4
  #private;
5
5
  private _close;
6
- private _modalContext?;
6
+ private _itemModalContext?;
7
7
  constructor();
8
8
  render(): import("lit-html").TemplateResult<1>;
9
9
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
@@ -4,20 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
13
7
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14
8
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
16
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
11
  };
18
- var _UmbTemplatingItemPickerModalElement_instances, _UmbTemplatingItemPickerModalElement_openModal, _UmbTemplatingItemPickerModalElement_openInsertPartialViewSidebar, _UmbTemplatingItemPickerModalElement_openInsertDictionaryItemModal, _UmbTemplatingItemPickerModalElement_renderItems;
12
+ var _UmbTemplatingItemPickerModalElement_instances, _UmbTemplatingItemPickerModalElement_openTemplatingPageFieldModal, _UmbTemplatingItemPickerModalElement_openPartialViewPickerModal, _UmbTemplatingItemPickerModalElement_openDictionaryItemPickerModal, _UmbTemplatingItemPickerModalElement_renderItems;
19
13
  import { CodeSnippetType } from '../../types.js';
20
14
  import { UMB_PARTIAL_VIEW_PICKER_MODAL } from '../partial-view-picker/partial-view-picker-modal.token.js';
15
+ import { UMB_TEMPLATING_PAGE_FIELD_BUILDER_MODAL } from '../templating-page-field-builder/templating-page-field-builder-modal.token.js';
21
16
  import { UmbTextStyles } from '../../../../shared/style/index.js';
22
17
  import { css, html, customElement } from '../../../../external/lit/index.js';
23
18
  import { UMB_MODAL_MANAGER_CONTEXT, UMB_DICTIONARY_ITEM_PICKER_MODAL, UmbModalBaseElement, } from '../../../core/modal/index.js';
@@ -28,9 +23,8 @@ let UmbTemplatingItemPickerModalElement = class UmbTemplatingItemPickerModalElem
28
23
  constructor() {
29
24
  super();
30
25
  _UmbTemplatingItemPickerModalElement_instances.add(this);
31
- _UmbTemplatingItemPickerModalElement_openModal.set(this, void 0);
32
26
  this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => {
33
- this._modalContext = instance;
27
+ this._itemModalContext = instance;
34
28
  });
35
29
  }
36
30
  render() {
@@ -46,41 +40,50 @@ let UmbTemplatingItemPickerModalElement = class UmbTemplatingItemPickerModalElem
46
40
  `;
47
41
  }
48
42
  };
49
- _UmbTemplatingItemPickerModalElement_openModal = new WeakMap();
50
43
  _UmbTemplatingItemPickerModalElement_instances = new WeakSet();
51
- _UmbTemplatingItemPickerModalElement_openInsertPartialViewSidebar = function _UmbTemplatingItemPickerModalElement_openInsertPartialViewSidebar() {
52
- __classPrivateFieldSet(this, _UmbTemplatingItemPickerModalElement_openModal, this._modalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL), "f");
53
- __classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_openModal, "f")?.onSubmit().then((partialViewPickerModalValue) => {
54
- if (partialViewPickerModalValue) {
55
- this.value = {
56
- type: CodeSnippetType.partialView,
57
- value: partialViewPickerModalValue.selection[0],
58
- };
59
- this.modalContext?.submit();
60
- }
61
- });
44
+ _UmbTemplatingItemPickerModalElement_openTemplatingPageFieldModal = async function _UmbTemplatingItemPickerModalElement_openTemplatingPageFieldModal() {
45
+ const pageFieldBuilderContext = this._itemModalContext?.open(UMB_TEMPLATING_PAGE_FIELD_BUILDER_MODAL);
46
+ await pageFieldBuilderContext?.onSubmit();
47
+ const output = pageFieldBuilderContext?.getValue().output;
48
+ if (output) {
49
+ this.value = { value: output, type: CodeSnippetType.pageField };
50
+ this.modalContext?.submit();
51
+ }
62
52
  };
63
- _UmbTemplatingItemPickerModalElement_openInsertDictionaryItemModal = function _UmbTemplatingItemPickerModalElement_openInsertDictionaryItemModal() {
64
- __classPrivateFieldSet(this, _UmbTemplatingItemPickerModalElement_openModal, this._modalContext?.open(UMB_DICTIONARY_ITEM_PICKER_MODAL, {
53
+ _UmbTemplatingItemPickerModalElement_openPartialViewPickerModal = async function _UmbTemplatingItemPickerModalElement_openPartialViewPickerModal() {
54
+ const partialViewPickerContext = this._itemModalContext?.open(UMB_PARTIAL_VIEW_PICKER_MODAL);
55
+ await partialViewPickerContext?.onSubmit();
56
+ const path = partialViewPickerContext?.getValue().selection[0];
57
+ if (path) {
58
+ const regex = /^%2F|%25dot%25cshtml$/g;
59
+ const prettyPath = path.replace(regex, '').replace(/%2F/g, '/');
60
+ this.value = {
61
+ value: prettyPath,
62
+ type: CodeSnippetType.partialView,
63
+ };
64
+ this.modalContext?.submit();
65
+ }
66
+ };
67
+ _UmbTemplatingItemPickerModalElement_openDictionaryItemPickerModal = async function _UmbTemplatingItemPickerModalElement_openDictionaryItemPickerModal() {
68
+ const dictionaryItemPickerModal = this._itemModalContext?.open(UMB_DICTIONARY_ITEM_PICKER_MODAL, {
65
69
  data: {
66
- hideTreeRoot: true,
67
70
  pickableFilter: (item) => item.unique !== null,
68
71
  },
69
- }), "f");
70
- __classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_openModal, "f")?.onSubmit().then((dictionaryItemPickerModalValue) => {
71
- if (dictionaryItemPickerModalValue) {
72
- this.value = { value: dictionaryItemPickerModalValue, type: CodeSnippetType.dictionaryItem };
73
- this.modalContext?.submit();
74
- }
75
72
  });
73
+ await dictionaryItemPickerModal?.onSubmit();
74
+ const dictionaryItem = dictionaryItemPickerModal?.getValue().selection[0];
75
+ if (dictionaryItem) {
76
+ this.value = { value: dictionaryItem, type: CodeSnippetType.dictionaryItem };
77
+ this.modalContext?.submit();
78
+ }
76
79
  };
77
80
  _UmbTemplatingItemPickerModalElement_renderItems = function _UmbTemplatingItemPickerModalElement_renderItems() {
78
81
  return html `<div id="main">
79
82
  <uui-button
80
- @click=${() => console.log('to be continued')}
83
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_instances, "m", _UmbTemplatingItemPickerModalElement_openTemplatingPageFieldModal)}
81
84
  look="placeholder"
82
85
  label=${this.localize.term('template_insert')}>
83
- <h3><umb-localize key="template_insertPageField">Value</umb-localize> (Not implemented)</h3>
86
+ <h3><umb-localize key="template_insertPageField">Value</umb-localize></h3>
84
87
  <p>
85
88
  <umb-localize key="template_insertPageFieldDesc">
86
89
  Displays the value of a named field from the current page, with options to modify the value or fallback to
@@ -89,7 +92,7 @@ _UmbTemplatingItemPickerModalElement_renderItems = function _UmbTemplatingItemPi
89
92
  </p>
90
93
  </uui-button>
91
94
  <uui-button
92
- @click=${__classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_instances, "m", _UmbTemplatingItemPickerModalElement_openInsertPartialViewSidebar)}
95
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_instances, "m", _UmbTemplatingItemPickerModalElement_openPartialViewPickerModal)}
93
96
  look="placeholder"
94
97
  label=${this.localize.term('template_insert')}>
95
98
  <h3><umb-localize key="template_insertPartialView">Partial view</umb-localize></h3>
@@ -101,7 +104,7 @@ _UmbTemplatingItemPickerModalElement_renderItems = function _UmbTemplatingItemPi
101
104
  </p>
102
105
  </uui-button>
103
106
  <uui-button
104
- @click=${__classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_instances, "m", _UmbTemplatingItemPickerModalElement_openInsertDictionaryItemModal)}
107
+ @click=${__classPrivateFieldGet(this, _UmbTemplatingItemPickerModalElement_instances, "m", _UmbTemplatingItemPickerModalElement_openDictionaryItemPickerModal)}
105
108
  look="placeholder"
106
109
  label=${this.localize.term('template_insertDictionaryItem')}>
107
110
  <h3><umb-localize key="template_insertDictionaryItem">Dictionary Item</umb-localize></h3>
@@ -1,10 +1,10 @@
1
1
  import type { CodeSnippetType } from '../../types.js';
2
- import { type UmbDictionaryItemPickerModalValue, UmbModalToken } from '../../../core/modal/index.js';
2
+ import { UmbModalToken } from '../../../core/modal/index.js';
3
3
  export interface UmbTemplatingItemPickerModalData {
4
4
  hidePartialViews?: boolean;
5
5
  }
6
6
  export type UmbTemplatingItemPickerModalValue = {
7
- value: string | UmbDictionaryItemPickerModalValue;
7
+ value: string;
8
8
  type: CodeSnippetType;
9
9
  };
10
10
  export declare const UMB_TEMPLATING_ITEM_PICKER_MODAL: UmbModalToken<UmbTemplatingItemPickerModalData, UmbTemplatingItemPickerModalValue>;
@@ -0,0 +1,2 @@
1
+ export * from './templating-page-field-builder-modal.element.js';
2
+ export * from './templating-page-field-builder-modal.token.js';
@@ -0,0 +1,2 @@
1
+ export * from './templating-page-field-builder-modal.element.js';
2
+ export * from './templating-page-field-builder-modal.token.js';
@@ -0,0 +1,19 @@
1
+ import type { UmbTemplatingPageFieldBuilderModalData, UmbTemplatingPageFieldBuilderModalValue } from './templating-page-field-builder-modal.token.js';
2
+ import { UmbModalBaseElement } from '../../../core/modal/index.js';
3
+ export declare class UmbTemplatingPageFieldBuilderModalElement extends UmbModalBaseElement<UmbTemplatingPageFieldBuilderModalData, UmbTemplatingPageFieldBuilderModalValue> {
4
+ private _close;
5
+ private _submit;
6
+ private _field?;
7
+ private _haveDefault;
8
+ private _default?;
9
+ private _recursive;
10
+ /** TODO: Implement "Choose field" */
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
13
+ }
14
+ export default UmbTemplatingPageFieldBuilderModalElement;
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'umb-templating-page-field-builder-modal': UmbTemplatingPageFieldBuilderModalElement;
18
+ }
19
+ }