@design.estate/dees-catalog 1.0.192 → 1.0.194

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "1.0.192",
3
+ "version": "1.0.194",
4
4
  "private": false,
5
5
  "description": "website for lossless.com",
6
6
  "main": "dist_ts_web/index.js",
@@ -24,7 +24,7 @@
24
24
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
25
25
  "@push.rocks/smartpromise": "^4.0.3",
26
26
  "@push.rocks/smartstring": "^4.0.9",
27
- "@tsclass/tsclass": "^4.0.42",
27
+ "@tsclass/tsclass": "^4.0.43",
28
28
  "highlight.js": "11.8.0",
29
29
  "pdfjs-dist": "^3.10.111"
30
30
  },
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '1.0.192',
6
+ version: '1.0.194',
7
7
  description: 'website for lossless.com'
8
8
  }
@@ -16,11 +16,12 @@ export class DeesMobilenavigation extends DeesElement {
16
16
  // STATIC
17
17
  public static demo = () => html`
18
18
  <dees-button @click=${() => {
19
- DeesMobilenavigation.createAndInit([
19
+ DeesMobilenavigation.createAndShow([
20
20
  {
21
21
  name: 'Test',
22
- action: () => {
22
+ action: async (deesMobileNav) => {
23
23
  alert('test');
24
+ return null;
24
25
  },
25
26
  },
26
27
  ]);
@@ -28,7 +29,7 @@ export class DeesMobilenavigation extends DeesElement {
28
29
  `;
29
30
 
30
31
  private static singletonRef: DeesMobilenavigation;
31
- public static async createAndInit(menuItemsArg: plugins.tsclass.website.IMenuItem[]) {
32
+ public static async createAndShow(menuItemsArg: plugins.tsclass.website.IMenuItem<DeesMobilenavigation>[]) {
32
33
  if (!this.singletonRef) {
33
34
  this.singletonRef = new DeesMobilenavigation();
34
35
  document.body.append(this.singletonRef);
@@ -134,7 +135,7 @@ export class DeesMobilenavigation extends DeesElement {
134
135
  class="menuItem"
135
136
  @click="${() => {
136
137
  this.hide();
137
- menuItem.action();
138
+ menuItem.action(this);
138
139
  }}"
139
140
  >
140
141
  ${menuItem.name}
@@ -16,7 +16,22 @@ export const demoFunc = () => html`
16
16
  >
17
17
  </dees-input-text>
18
18
  </dees-form>
19
- `
19
+ `,
20
+ menuOptions: [{
21
+ name: 'Cancel',
22
+ iconName: null,
23
+ action: async (deesModalArg) => {
24
+ deesModalArg.destroy();
25
+ return null;
26
+ }
27
+ }, {
28
+ name: 'Ok',
29
+ iconName: null,
30
+ action: async (deesModalArg) => {
31
+ deesModalArg.destroy();
32
+ return null;
33
+ }
34
+ }],
20
35
  });
21
36
  }}>open modal</dees-button>
22
37
  `
@@ -1,3 +1,4 @@
1
+ import * as plugins from './plugins.js';
1
2
  import { demoFunc } from './dees-modal.demo.js';
2
3
  import {
3
4
  customElement,
@@ -27,11 +28,16 @@ export class DeesModal extends DeesElement {
27
28
  // STATIC
28
29
  public static demo = demoFunc;
29
30
 
30
- public static async createAndShow(optionsArg: { heading: string; content: TemplateResult }) {
31
+ public static async createAndShow(optionsArg: {
32
+ heading: string;
33
+ content: TemplateResult;
34
+ menuOptions: plugins.tsclass.website.IMenuItem<DeesModal>[];
35
+ }) {
31
36
  const body = document.body;
32
37
  const modal = new DeesModal();
33
38
  modal.heading = optionsArg.heading;
34
39
  modal.content = optionsArg.content;
40
+ modal.menuOptions = optionsArg.menuOptions;
35
41
  modal.windowLayer = await DeesWindowLayer.createAndShow();
36
42
  modal.windowLayer.addEventListener('click', async () => {
37
43
  await modal.destroy();
@@ -50,6 +56,9 @@ export class DeesModal extends DeesElement {
50
56
  @state({})
51
57
  public content: TemplateResult;
52
58
 
59
+ @state({})
60
+ public menuOptions: plugins.tsclass.website.IMenuItem<DeesModal>[] = [];
61
+
53
62
  constructor() {
54
63
  super();
55
64
  }
@@ -64,6 +73,8 @@ export class DeesModal extends DeesElement {
64
73
  .modalContainer {
65
74
  display: flex;
66
75
  position: fixed;
76
+ top: 0px;
77
+ left: 0px;
67
78
  width: 100vw;
68
79
  height: 100vh;
69
80
  box-sizing: border-box;
@@ -104,7 +115,6 @@ export class DeesModal extends DeesElement {
104
115
  }
105
116
  .modal .bottomButtons {
106
117
  display: grid;
107
- grid-template-columns: 1fr 1fr;
108
118
  border-top: 1px solid #222;
109
119
  }
110
120
 
@@ -127,13 +137,23 @@ export class DeesModal extends DeesElement {
127
137
 
128
138
  public render(): TemplateResult {
129
139
  return html`
140
+ <style>
141
+ .modal .bottomButtons {
142
+ grid-template-columns: ${cssManager.cssGridColumns(this.menuOptions.length, 0)};
143
+ }
144
+ </style>
130
145
  <div class="modalContainer" @click=${this.handleOutsideClick}>
131
146
  <div class="modal">
132
147
  <div class="heading">${this.heading}</div>
133
148
  <div class="content">${this.content}</div>
134
149
  <div class="bottomButtons">
135
- <div class="bottomButton">Cancel</div>
136
- <div class="bottomButton">OK</div>
150
+ ${this.menuOptions.map(
151
+ (actionArg) => html`
152
+ <div class="bottomButton" @click=${() => {
153
+ actionArg.action(this);
154
+ }}>${actionArg.name}</div>
155
+ `
156
+ )}
137
157
  </div>
138
158
  </div>
139
159
  </div>