@uxland/primary-shell 5.7.0 → 5.7.1

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.
@@ -2,6 +2,6 @@ import { ConfirmationContentProps, ConfirmationOptions, ConfirmationResult, Conf
2
2
 
3
3
  import * as React from "react";
4
4
  export declare class ParimariaInteractionServiceImpl extends PrimariaInteractionService {
5
- confirm<TData = undefined, TResult = undefined>(data: TData | undefined, DialogComponent: React.ComponentType<ConfirmationContentProps<TData, TResult> | ConfirmationWithResultContentProps<TData, TResult>> | (new () => HTMLElement), options?: ConfirmationOptions | undefined): Promise<ConfirmationResult<TResult | undefined>>;
5
+ confirm<TData = undefined, TResult = undefined>(data: TData | undefined, DialogComponent: React.ComponentType<ConfirmationContentProps<TData, TResult> | ConfirmationWithResultContentProps<TData, TResult>> | (new () => HTMLElement), options?: ConfirmationOptions | undefined, styles?: any): Promise<ConfirmationResult<TResult | undefined>>;
6
6
  confirmMessage(message: string, options?: ConfirmationOptions | undefined): Promise<ConfirmationResult>;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -29,15 +29,20 @@ export class ParimariaInteractionServiceImpl extends PrimariaInteractionService
29
29
  | React.ComponentType<ConfirmationContentProps<TData, TResult> | ConfirmationWithResultContentProps<TData, TResult>>
30
30
  | (new () => HTMLElement),
31
31
  options?: ConfirmationOptions | undefined,
32
+ styles?: any
32
33
  ): Promise<ConfirmationResult<TResult | undefined>> {
33
34
  const finalOptions: ConfirmationOptions = { ...defaultOptions, ...(options || {}) };
34
35
  return new Promise((resolve) => {
35
36
  const div = document.createElement("div");
36
37
  document.body.appendChild(div);
37
- const style = document.createElement("style");
38
- style.textContent = modalStyles;
39
-
40
- document.head.appendChild(style);
38
+ const wrapperStyles = document.createElement("style");
39
+ wrapperStyles.textContent = modalStyles;
40
+ document.head.appendChild(wrapperStyles);
41
+ if(styles) {
42
+ const style = document.createElement("style");
43
+ style.textContent = styles;
44
+ document.head.appendChild(style);
45
+ }
41
46
 
42
47
  const DialogWrapper = () => {
43
48
  const [result, setResult] = useState<ConfirmationResult<TResult | undefined>>();
@@ -9,6 +9,7 @@ import {
9
9
  IActivityHistoryFilter,
10
10
  } from "../../model";
11
11
  import { translate } from "../../../../localization";
12
+ import { when } from "lit/directives/when.js";
12
13
 
13
14
  const filterTemplates = {
14
15
  [ActivityHistoryFilterType.Switch]: (id, title, handleChange, isSelected, isEnabled) => html`
@@ -108,8 +109,10 @@ const customFilterTemplate = (
108
109
  group: IActivityHistoryCustomFilterGroup,
109
110
  ) => {
110
111
  if (filter.type === ActivityHistoryFilterType.Dropdown) {
111
- const elements = filter?.options.map(option => ({ value: option.id, label: option.title || option.id }));
112
- return html`
112
+ const elements = filter?.options.map((option) => ({ value: option.id, label: option.title || option.id }));
113
+ return when(
114
+ elements.length > 0,
115
+ () => html`
113
116
  <dss-input-dropdown
114
117
  inputsize="md"
115
118
  icon=""
@@ -117,28 +120,30 @@ const customFilterTemplate = (
117
120
  dropdownFixed
118
121
  type="default"
119
122
  .elements=${elements}
120
- @onInputDropdownChange=${(e) =>
121
- props._onChangeCustomFilterAllValues(group.id, filter.id, e.detail.selectedValue)
122
- }
123
+ @onInputDropdownChange=${(e) => props._onChangeCustomFilterAllValues(group.id, filter.id, e.detail.selectedValue)}
123
124
  .selectedValue=${filter.enabledValues}
124
125
  selectorStyle="max-height: 450px"
125
126
  >
126
127
  <label slot="label">${filter.title}</label>
127
128
  <input slot="input" type="text" class="dss-input" autocomplete="off" />
128
129
  </dss-input-dropdown>
129
- `;
130
+ `,
131
+ );
130
132
  }
131
133
 
132
134
  return filter.singleOption
133
135
  ? getFilterTemplate(filter, props._onChangeCustomFilterValue.bind(props), group)
134
- : html`
136
+ : when(
137
+ !!filter.options?.length,
138
+ () => html`
135
139
  <primaria-accordion isOpen>
136
140
  <div class="custom-filter-title" slot="title">${filter.title}</div>
137
141
  <div class="custom-filter-content" slot="content">
138
- ${filter.options.map(option =>
139
- getFilterTemplate(filter, props._onChangeCustomFilterValue.bind(props), group, option)
142
+ ${filter.options.map((option) =>
143
+ getFilterTemplate(filter, props._onChangeCustomFilterValue.bind(props), group, option),
140
144
  )}
141
145
  </div>
142
146
  </primaria-accordion>
143
- `;
147
+ `,
148
+ );
144
149
  };