@pageboard/html 0.14.11 → 0.14.12

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.
@@ -5,31 +5,38 @@ exports.fieldset = {
5
5
  group: 'block',
6
6
  context: 'form//',
7
7
  properties: {
8
+ plain: {
9
+ title: 'Plain',
10
+ description: 'Without legend or borders',
11
+ type: 'boolean',
12
+ default: false
13
+ },
8
14
  name: {
9
- title: 'Show if input[name]',
15
+ title: 'When input named',
10
16
  type: 'string',
11
17
  format: 'singleline',
12
18
  nullable: true,
13
19
  $helper: 'form-element'
14
20
  },
21
+ op: {
22
+ title: 'Condition',
23
+ anyOf: [{
24
+ const: 'eq',
25
+ title: 'is equal to'
26
+ }, {
27
+ const: 'neq',
28
+ title: 'is not equal to'
29
+ }],
30
+ default: 'eq'
31
+ },
15
32
  value: {
16
- title: 'matches this value',
33
+ title: 'Value',
17
34
  type: 'string',
18
- format: 'singleline',
19
- $filter: {
20
- name: 'element-value',
21
- using: 'name'
22
- }
23
- },
24
- plain: {
25
- title: 'Plain',
26
- description: 'Without legend or borders',
27
- type: 'boolean',
28
- default: false
35
+ format: 'singleline'
29
36
  }
30
37
  },
31
38
  contents: "fieldset_legend block+",
32
- html: '<fieldset class="[plain]" data-name="[name]" data-value="[value]" is="element-fieldset"></fieldset>',
39
+ html: '<fieldset class="[plain]" data-name="[name]" data-op="[op]" data-value="[value]" is="element-fieldset"></fieldset>',
33
40
  scripts: ["../ui/fieldset.js"],
34
41
  stylesheets: ['../ui/fieldset.css']
35
42
  };
@@ -9,7 +9,7 @@ exports.pagination = {
9
9
  fetch: {
10
10
  title: 'Fetch block',
11
11
  type: 'string',
12
- format: 'id', // FIXME this cannot work because fetch id changes on copy
12
+ format: 'id',
13
13
  $filter: {
14
14
  name: 'action',
15
15
  action: 'read'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageboard/html",
3
- "version": "0.14.11",
3
+ "version": "0.14.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "repository": {
package/ui/fieldset.css CHANGED
@@ -7,6 +7,7 @@ fieldset:not(.plain) {
7
7
  }
8
8
  fieldset.plain {
9
9
  padding:0;
10
+ margin: 0;
10
11
  }
11
12
  fieldset.plain > legend {
12
13
  display:none;
package/ui/fieldset.js CHANGED
@@ -1,14 +1,21 @@
1
1
  class HTMLElementFieldSet extends Page.create(HTMLFieldSetElement) {
2
2
  static defaults = {
3
3
  dataName: null,
4
+ dataOp: null,
4
5
  dataValue: null
5
6
  };
6
7
 
8
+ #compare(to) {
9
+ const { value } = this.options;
10
+ if (this.options.op == "neq") return value != to;
11
+ else return value == to;
12
+ }
13
+
7
14
  fill(query) {
8
15
  if (this.isContentEditable || !this.options?.name || !this.form) return;
9
16
  if (!query) query = this.form.read(true);
10
17
  const val = query[this.options.name];
11
- const disabled = this.disabled = this.hidden = val != this.options.value;
18
+ const disabled = this.disabled = this.hidden = !this.#compare(val);
12
19
  for (const node of this.querySelectorAll('[name]')) {
13
20
  node.disabled = disabled;
14
21
  }
package/ui/select.css CHANGED
@@ -5,6 +5,9 @@ element-select.ui.multiple.dropdown > .label {
5
5
  vertical-align: baseline;
6
6
  line-height: inherit;
7
7
  }
8
+ element-select[disabled] {
9
+ pointer-events: none;
10
+ }
8
11
 
9
12
  [contenteditable] .ui.dropdown[block-focused] > .menu {
10
13
  overflow: visible;
package/ui/select.js CHANGED
@@ -59,6 +59,7 @@ class HTMLElementSelect extends Page.Element {
59
59
 
60
60
  handleClick(e, state) {
61
61
  if (state.scope.$write) return;
62
+ if (this.disabled) return;
62
63
  const node = e.target;
63
64
  const item = node.closest('element-select .item');
64
65
  if (item) {