@operato/property-editor 10.29.80 → 10.29.83

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 (73) hide show
  1. package/dist/src/ox-property-editor-number-map.d.ts +13 -1
  2. package/dist/src/ox-property-editor-number-map.js +48 -11
  3. package/dist/stories/ox-properties-dynamic-view.stories.d.ts +60 -0
  4. package/dist/stories/ox-properties-dynamic-view.stories.js +535 -0
  5. package/dist/stories/ox-properties-editor-textarea.stories.d.ts +31 -0
  6. package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
  7. package/package.json +21 -6
  8. package/translations/en.json +2 -1
  9. package/translations/es.json +2 -1
  10. package/translations/ko.json +2 -1
  11. package/translations/ms.json +2 -1
  12. package/translations/zh.json +2 -1
  13. package/CHANGELOG.md +0 -6812
  14. package/dist/src/index.js.map +0 -1
  15. package/dist/src/ox-properties-dynamic-view.js.map +0 -1
  16. package/dist/src/ox-property-editor-3axis.js.map +0 -1
  17. package/dist/src/ox-property-editor-3dish.js.map +0 -1
  18. package/dist/src/ox-property-editor-action.js.map +0 -1
  19. package/dist/src/ox-property-editor-angle.js.map +0 -1
  20. package/dist/src/ox-property-editor-backdrop-faces.js.map +0 -1
  21. package/dist/src/ox-property-editor-checkbox.js.map +0 -1
  22. package/dist/src/ox-property-editor-color.js.map +0 -1
  23. package/dist/src/ox-property-editor-crontab.js.map +0 -1
  24. package/dist/src/ox-property-editor-data.js.map +0 -1
  25. package/dist/src/ox-property-editor-date.js.map +0 -1
  26. package/dist/src/ox-property-editor-datetime.js.map +0 -1
  27. package/dist/src/ox-property-editor-description.js.map +0 -1
  28. package/dist/src/ox-property-editor-duration.js.map +0 -1
  29. package/dist/src/ox-property-editor-file.js.map +0 -1
  30. package/dist/src/ox-property-editor-fill-style.js.map +0 -1
  31. package/dist/src/ox-property-editor-gradient-colorstops.js.map +0 -1
  32. package/dist/src/ox-property-editor-hashtags.js.map +0 -1
  33. package/dist/src/ox-property-editor-image.js.map +0 -1
  34. package/dist/src/ox-property-editor-key-values.js.map +0 -1
  35. package/dist/src/ox-property-editor-legend.js.map +0 -1
  36. package/dist/src/ox-property-editor-mass-fraction.js.map +0 -1
  37. package/dist/src/ox-property-editor-month.js.map +0 -1
  38. package/dist/src/ox-property-editor-multiple-colors.js.map +0 -1
  39. package/dist/src/ox-property-editor-number-map.js.map +0 -1
  40. package/dist/src/ox-property-editor-number.js.map +0 -1
  41. package/dist/src/ox-property-editor-options.js.map +0 -1
  42. package/dist/src/ox-property-editor-partition-keys.js.map +0 -1
  43. package/dist/src/ox-property-editor-password.js.map +0 -1
  44. package/dist/src/ox-property-editor-range.js.map +0 -1
  45. package/dist/src/ox-property-editor-scene-component-id.js.map +0 -1
  46. package/dist/src/ox-property-editor-secret.js.map +0 -1
  47. package/dist/src/ox-property-editor-select.js.map +0 -1
  48. package/dist/src/ox-property-editor-signature.js.map +0 -1
  49. package/dist/src/ox-property-editor-solid-colorstops.js.map +0 -1
  50. package/dist/src/ox-property-editor-string.js.map +0 -1
  51. package/dist/src/ox-property-editor-table-column-config.js.map +0 -1
  52. package/dist/src/ox-property-editor-table.js.map +0 -1
  53. package/dist/src/ox-property-editor-textarea.js.map +0 -1
  54. package/dist/src/ox-property-editor-time.js.map +0 -1
  55. package/dist/src/ox-property-editor-unit-number.js.map +0 -1
  56. package/dist/src/ox-property-editor-value-map.js.map +0 -1
  57. package/dist/src/ox-property-editor-value-ranges.js.map +0 -1
  58. package/dist/src/ox-property-editor-work-shift.js.map +0 -1
  59. package/dist/src/ox-property-editor.js.map +0 -1
  60. package/dist/src/types.js.map +0 -1
  61. package/dist/test/date-editors.test.d.ts +0 -2
  62. package/dist/test/date-editors.test.js +0 -45
  63. package/dist/test/date-editors.test.js.map +0 -1
  64. package/dist/test/dynamic-view-copy.test.d.ts +0 -2
  65. package/dist/test/dynamic-view-copy.test.js +0 -22
  66. package/dist/test/dynamic-view-copy.test.js.map +0 -1
  67. package/dist/test/number-map.test.d.ts +0 -1
  68. package/dist/test/number-map.test.js +0 -117
  69. package/dist/test/number-map.test.js.map +0 -1
  70. package/dist/tsconfig.tsbuildinfo +0 -1
  71. package/test/date-editors.test.ts +0 -50
  72. package/test/dynamic-view-copy.test.ts +0 -27
  73. package/test/number-map.test.ts +0 -133
@@ -15,6 +15,12 @@ export interface NumberMapEntry {
15
15
  /** For an enum: the values it may take. */
16
16
  values?: string[];
17
17
  default?: number | boolean | string;
18
+ /**
19
+ * The things edited together hold different values here (several selected). While the map holds no value for the
20
+ * entry it is shown as mixed -- an empty field saying so, no thumb on the slider, no choice made, an indeterminate
21
+ * checkbox -- not as its default, which none of them may hold. A value given to it is shown as any other.
22
+ */
23
+ mixed?: boolean;
18
24
  }
19
25
  /**
20
26
  * Several numbers kept as one map ({ key: number }) -- a figure's design values and state values a board sets
@@ -28,11 +34,17 @@ export interface NumberMapEntry {
28
34
  *
29
35
  * `property.nested`: a key `a.b` is the value `b` inside the map's `a` -- a figure's motion settings, one map per group
30
36
  * (`{ locomotion: { clip, speed, paused } }`, ADR-0051 §3.2). The key splits at its first dot only.
37
+ *
38
+ * An entry marked `mixed` (several things edited together that hold different values there) is shown as mixed until
39
+ * the map holds a value for it.
31
40
  */
32
41
  export declare class OxPropertyEditorNumberMap extends OxPropertyEditor {
33
42
  static styles: import("lit").CSSResult[];
34
43
  editorTemplate(value: any, spec: PropertySpec): TemplateResult;
35
- /** A checkbox for a boolean, a choice for an enum: what is shown is what the map holds, or the entry's default. */
44
+ /**
45
+ * A checkbox for a boolean, a choice for an enum: what is shown is what the map holds, or the entry's default. A mixed
46
+ * entry is an indeterminate checkbox, or a choice that says it is mixed and is not one of the values.
47
+ */
36
48
  private choiceRow;
37
49
  /** The value a key holds in the map: `a.b` inside `a` when the map is nested. */
38
50
  private read;
@@ -2,7 +2,12 @@ import { __decorate } from "tslib";
2
2
  import { css, html, nothing } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import { i18next } from '@operato/i18n';
5
6
  import { OxPropertyEditor } from './ox-property-editor.js';
7
+ /** The word a mixed entry shows: its own translation when the app has one. */
8
+ function mixedText() {
9
+ return i18next.t('text.mixed-values', { defaultValue: 'Mixed' });
10
+ }
6
11
  /**
7
12
  * Several numbers kept as one map ({ key: number }) -- a figure's design values and state values a board sets
8
13
  * (ADR-0096), a shelf's spacings. Each entry is one compact row: its name, a slider when it has a range, the number
@@ -15,6 +20,9 @@ import { OxPropertyEditor } from './ox-property-editor.js';
15
20
  *
16
21
  * `property.nested`: a key `a.b` is the value `b` inside the map's `a` -- a figure's motion settings, one map per group
17
22
  * (`{ locomotion: { clip, speed, paused } }`, ADR-0051 §3.2). The key splits at its first dot only.
23
+ *
24
+ * An entry marked `mixed` (several things edited together that hold different values there) is shown as mixed until
25
+ * the map holds a value for it.
18
26
  */
19
27
  let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxPropertyEditor {
20
28
  editorTemplate(value, spec) {
@@ -26,9 +34,10 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
26
34
  ${entries.map(entry => {
27
35
  var _a;
28
36
  const held = this.read(value, entry.key, nested);
37
+ const mixed = !!entry.mixed && held === undefined;
29
38
  if (entry.kind === 'boolean' || entry.kind === 'enum')
30
- return this.choiceRow(entry, held !== null && held !== void 0 ? held : entry.default);
31
- const shown = (held !== null && held !== void 0 ? held : entry.default);
39
+ return this.choiceRow(entry, mixed ? undefined : held !== null && held !== void 0 ? held : entry.default, mixed);
40
+ const shown = mixed ? undefined : (held !== null && held !== void 0 ? held : entry.default);
32
41
  const ranged = this.rangeOf(entry);
33
42
  return html `
34
43
  <span name title=${entry.label}>${entry.label}</span>
@@ -40,8 +49,9 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
40
49
  min=${ranged.min}
41
50
  max=${ranged.max}
42
51
  step=${ranged.step}
52
+ ?mixed=${mixed}
43
53
  .value=${String(shown !== null && shown !== void 0 ? shown : ranged.min)}
44
- style=${`--fill: ${this.fillOf(shown !== null && shown !== void 0 ? shown : ranged.min, ranged)}%`}
54
+ style=${`--fill: ${mixed ? 0 : this.fillOf(shown !== null && shown !== void 0 ? shown : ranged.min, ranged)}%`}
45
55
  ?disabled=${this.disabled}
46
56
  @input=${this.onSlide}
47
57
  />`
@@ -51,8 +61,10 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
51
61
  data-key=${entry.key}
52
62
  aria-label=${entry.label}
53
63
  ?wide=${!ranged}
64
+ ?mixed=${mixed}
54
65
  .value=${String(shown !== null && shown !== void 0 ? shown : '')}
55
- placeholder=${ifDefined(this.hintOf(entry))}
66
+ title=${ifDefined(mixed ? this.hintOf(entry) : undefined)}
67
+ placeholder=${ifDefined(mixed ? mixedText() : this.hintOf(entry))}
56
68
  min=${ifDefined(entry.min)}
57
69
  max=${ifDefined(entry.max)}
58
70
  step="any"
@@ -64,15 +76,26 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
64
76
  </div>
65
77
  `;
66
78
  }
67
- /** A checkbox for a boolean, a choice for an enum: what is shown is what the map holds, or the entry's default. */
68
- choiceRow(entry, shown) {
79
+ /**
80
+ * A checkbox for a boolean, a choice for an enum: what is shown is what the map holds, or the entry's default. A mixed
81
+ * entry is an indeterminate checkbox, or a choice that says it is mixed and is not one of the values.
82
+ */
83
+ choiceRow(entry, shown, mixed = false) {
69
84
  var _a, _b;
70
85
  return html `
71
86
  <span name title=${entry.label}>${entry.label}</span>
72
87
  ${entry.kind === 'boolean'
73
- ? html `<input type="checkbox" data-key=${entry.key} aria-label=${entry.label} .checked=${shown === true} ?disabled=${this.disabled} />`
88
+ ? html `<input
89
+ type="checkbox"
90
+ data-key=${entry.key}
91
+ aria-label=${entry.label}
92
+ .checked=${shown === true}
93
+ .indeterminate=${mixed}
94
+ ?disabled=${this.disabled}
95
+ />`
74
96
  : html `<select data-key=${entry.key} aria-label=${entry.label} ?disabled=${this.disabled}>
75
- ${((_a = entry.values) !== null && _a !== void 0 ? _a : []).map(v => html `<option value=${v} ?selected=${v === shown}>${v}</option>`)}
97
+ ${mixed ? html `<option value="" disabled selected hidden>${mixedText()}</option>` : nothing}
98
+ ${((_a = entry.values) !== null && _a !== void 0 ? _a : []).map(v => html `<option value=${v} ?selected=${!mixed && v === shown}>${v}</option>`)}
76
99
  </select>`}
77
100
  <span unit>${(_b = entry.unit) !== null && _b !== void 0 ? _b : ''}</span>
78
101
  `;
@@ -121,7 +144,7 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
121
144
  this._valueChanged(e);
122
145
  }
123
146
  _valueChanged(e) {
124
- var _a, _b, _c, _d, _e;
147
+ var _a, _b, _c, _d;
125
148
  e.stopPropagation();
126
149
  const input = e.target;
127
150
  const key = input.getAttribute('data-key');
@@ -139,8 +162,9 @@ let OxPropertyEditorNumberMap = class OxPropertyEditorNumberMap extends OxProper
139
162
  const number = input.valueAsNumber;
140
163
  const outside = !Number.isFinite(number) || ((entry === null || entry === void 0 ? void 0 : entry.min) !== undefined && number < entry.min) || ((entry === null || entry === void 0 ? void 0 : entry.max) !== undefined && number > entry.max);
141
164
  if (outside) {
142
- /* Not taken: the field shows what the map holds. */
143
- input.value = String((_e = (_d = this.read(this.value, key, nested)) !== null && _d !== void 0 ? _d : entry === null || entry === void 0 ? void 0 : entry.default) !== null && _e !== void 0 ? _e : '');
165
+ /* Not taken: the field shows what the map holds -- for a mixed entry with none, nothing, as before. */
166
+ const held = this.read(this.value, key, nested);
167
+ input.value = String((_d = held !== null && held !== void 0 ? held : ((entry === null || entry === void 0 ? void 0 : entry.mixed) ? '' : entry === null || entry === void 0 ? void 0 : entry.default)) !== null && _d !== void 0 ? _d : '');
144
168
  return;
145
169
  }
146
170
  const taken = input.type === 'range' ? Math.round(number * 100) / 100 : number;
@@ -239,6 +263,19 @@ OxPropertyEditorNumberMap.styles = [
239
263
  background: var(--md-sys-color-primary);
240
264
  }
241
265
 
266
+ /* Mixed: no value to stand at, so no thumb until one is given (a click or a drag gives one to all). */
267
+ :host > div[rows] > input[type='range'][mixed]::-webkit-slider-thumb {
268
+ opacity: 0;
269
+ }
270
+
271
+ :host > div[rows] > input[type='range'][mixed]::-moz-range-thumb {
272
+ opacity: 0;
273
+ }
274
+
275
+ :host > div[rows] > input[type='number'][mixed]::placeholder {
276
+ font-style: italic;
277
+ }
278
+
242
279
  :host > div[rows] > input[type='range']:disabled {
243
280
  cursor: default;
244
281
  opacity: 0.5;
@@ -0,0 +1,60 @@
1
+ import { TemplateResult } from 'lit';
2
+ import '../src/ox-property-editor-3axis.js';
3
+ import '../src/ox-property-editor-3dish.js';
4
+ import '../src/ox-property-editor-angle.js';
5
+ import '../src/ox-property-editor-checkbox.js';
6
+ import '../src/ox-property-editor-color.js';
7
+ import '../src/ox-property-editor-date.js';
8
+ import '../src/ox-property-editor-datetime.js';
9
+ import '../src/ox-property-editor-legend.js';
10
+ import '../src/ox-property-editor-description.js';
11
+ import '../src/ox-property-editor-number.js';
12
+ import '../src/ox-property-editor-unit-number.js';
13
+ import '../src/ox-property-editor-password.js';
14
+ import '../src/ox-property-editor-range.js';
15
+ import '../src/ox-property-editor-select.js';
16
+ import '../src/ox-property-editor-string.js';
17
+ import '../src/ox-property-editor-image.js';
18
+ import '../src/ox-property-editor-file.js';
19
+ import '../src/ox-property-editor-multiple-colors.js';
20
+ import '../src/ox-property-editor-crontab.js';
21
+ import '../src/ox-property-editor-work-shift.js';
22
+ import '../src/ox-property-editor-partition-keys.js';
23
+ import '../src/ox-property-editor-key-values.js';
24
+ import '../src/ox-property-editor-textarea.js';
25
+ import '../src/ox-property-editor-options.js';
26
+ import '../src/ox-property-editor-hashtags.js';
27
+ import '../src/ox-property-editor-signature.js';
28
+ import '../src/ox-property-editor-secret.js';
29
+ import '../src/ox-properties-dynamic-view.js';
30
+ declare const _default: {
31
+ title: string;
32
+ component: string;
33
+ argTypes: {
34
+ title: {
35
+ control: string;
36
+ };
37
+ counter: {
38
+ control: string;
39
+ };
40
+ textColor: {
41
+ control: string;
42
+ };
43
+ };
44
+ };
45
+ export default _default;
46
+ interface Story<T> {
47
+ (args: T): TemplateResult;
48
+ args?: Partial<T>;
49
+ argTypes?: Record<string, unknown>;
50
+ }
51
+ interface ArgTypes {
52
+ title?: string;
53
+ counter?: number;
54
+ textColor?: string;
55
+ slot?: TemplateResult;
56
+ }
57
+ export declare const Regular: Story<ArgTypes>;
58
+ export declare const WithoutActionInjector: () => TemplateResult<1>;
59
+ export declare const WithInfoIcons: () => TemplateResult<1>;
60
+ export declare const WithMultipleIcons: () => TemplateResult<1>;