@fkui/vue 6.27.0 → 6.29.0

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.
@@ -9,9 +9,10 @@ module.exports = {
9
9
  rules: {
10
10
  "fkui/button-group": "error",
11
11
  "fkui/class-deprecated": "error",
12
+ "fkui/slot-deprecated": "error",
12
13
  "fkui/prefer-ficon": "error",
13
14
  "fkui/required-max-length": "error",
14
- "fkui/finteractivetable-checkbox-description": "error",
15
+ "fkui/finteractivetable-selectable-description": "error",
15
16
  "fkui/ftextfield-formatter-validation": "error",
16
17
  "fkui/no-template-modal": "error",
17
18
  "fkui/ftablecolumn-name": "error",
@@ -448,6 +448,7 @@ module.exports = defineMetadata({
448
448
  "caption",
449
449
  "row-description",
450
450
  "checkbox-description",
451
+ "selectable-description",
451
452
  "empty",
452
453
  "expandable",
453
454
  ],
@@ -1480,4 +1481,44 @@ module.exports = defineMetadata({
1480
1481
  },
1481
1482
  slots: ["default"],
1482
1483
  },
1484
+
1485
+ "f-paginate-dataset": {
1486
+ flow: true,
1487
+ attributes: {
1488
+ "fetch-data": {
1489
+ allowed: allowedIfAttributeIsAbsent("items"),
1490
+ required: false,
1491
+ },
1492
+ items: {
1493
+ allowed: allowedIfAttributeIsAbsent("fetch-data"),
1494
+ required: false,
1495
+ },
1496
+ "items-length": {
1497
+ allowed: allowedIfAttributeIsAbsent("items"),
1498
+ required: false,
1499
+ },
1500
+ "items-per-page": {
1501
+ required: false,
1502
+ },
1503
+ },
1504
+ slots: ["default"],
1505
+ },
1506
+
1507
+ "f-paginator": {
1508
+ flow: true,
1509
+ attributes: {
1510
+ "current-page": {
1511
+ required: false,
1512
+ },
1513
+ "navigator-label": {
1514
+ required: false,
1515
+ },
1516
+ "number-of-pages": {
1517
+ required: false,
1518
+ },
1519
+ "number-of-pages-to-show": {
1520
+ required: false,
1521
+ },
1522
+ },
1523
+ },
1483
1524
  });
@@ -12,4 +12,22 @@ function getDocumentationUrl(path) {
12
12
  return `${homepage}${path}`;
13
13
  }
14
14
 
15
- module.exports = { getDocumentationUrl };
15
+ /**
16
+ * @internal
17
+ * @param {import("html-validate").HtmlElement} element
18
+ * @returns {string[]}
19
+ */
20
+ function getSlots(element) {
21
+ return Object.fromEntries(
22
+ element.childElements
23
+ .filter((it) => it.is("template"))
24
+ .map((it) => {
25
+ const key = it.attributes.find((jt) =>
26
+ jt.key.startsWith("#"),
27
+ )?.key;
28
+ return [key, it];
29
+ }),
30
+ );
31
+ }
32
+
33
+ module.exports = { getDocumentationUrl, getSlots };
@@ -0,0 +1,57 @@
1
+ const {
2
+ Rule,
3
+ TextClassification,
4
+ classifyNodeText,
5
+ } = require("html-validate/node");
6
+ const { getDocumentationUrl, getSlots } = require("./common");
7
+
8
+ /**
9
+ * @param {import("html-validate").ElementReadyEvent} event
10
+ * @returns {boolean}
11
+ */
12
+ function isRelevant(event) {
13
+ return event.target.is("f-interactive-table");
14
+ }
15
+
16
+ class FInteractiveTableSelectableDescription extends Rule {
17
+ documentation() {
18
+ return {
19
+ description:
20
+ "`#selectable-description` slot must implemented and non-empty when `selectable` is enabled",
21
+ url: getDocumentationUrl("/components/table-and-list/table.html"),
22
+ };
23
+ }
24
+
25
+ setup() {
26
+ this.on("element:ready", isRelevant, (event) => {
27
+ const { target } = event;
28
+ const selectable = target.getAttribute("selectable");
29
+ if (!selectable) {
30
+ return;
31
+ }
32
+ const slots = getSlots(target);
33
+ const selectableDescription = slots["#selectable-description"];
34
+ if (!selectableDescription) {
35
+ this.report({
36
+ node: target,
37
+ location: selectable.keyLocation,
38
+ message:
39
+ "#selectable-description slot must be implemented when selectable is enabled",
40
+ });
41
+ return;
42
+ }
43
+
44
+ const textContent = classifyNodeText(selectableDescription);
45
+ if (textContent === TextClassification.EMPTY_TEXT) {
46
+ this.report({
47
+ node: selectableDescription,
48
+ location: selectableDescription.location,
49
+ message:
50
+ "#selectable-description cannot be empty when selectable is enabled",
51
+ });
52
+ }
53
+ });
54
+ }
55
+ }
56
+
57
+ module.exports = FInteractiveTableSelectableDescription;
@@ -1,20 +1,22 @@
1
1
  const buttongroup = require("./buttongroup.rule");
2
2
  const classdeprecated = require("./classdeprecated.rule");
3
- const FInteractiveTableCheckboxDescription = require("./finteractivetable-checkbox-description.rule");
3
+ const FInteractiveTableSelectableDescription = require("./finteractivetable-selectable-description.rule");
4
4
  const FTableColumnName = require("./ftablecolumn-name.rule");
5
5
  const ftextfieldFormatterValidation = require("./ftextfieldFormatterValidation.rule");
6
6
  const NoTemplateModal = require("./no-template-modal.rule");
7
7
  const PreferFIcon = require("./prefer-ficon.rule");
8
8
  const requiredmaxlength = require("./requiredmaxlength.rule");
9
+ const slotdeprecated = require("./slotdeprecated.rule");
9
10
 
10
11
  module.exports = {
11
12
  "fkui/button-group": buttongroup,
12
13
  "fkui/class-deprecated": classdeprecated,
13
14
  "fkui/prefer-ficon": PreferFIcon,
14
15
  "fkui/required-max-length": requiredmaxlength,
15
- "fkui/finteractivetable-checkbox-description":
16
- FInteractiveTableCheckboxDescription,
16
+ "fkui/finteractivetable-selectable-description":
17
+ FInteractiveTableSelectableDescription,
17
18
  "fkui/ftextfield-formatter-validation": ftextfieldFormatterValidation,
18
19
  "fkui/no-template-modal": NoTemplateModal,
19
20
  "fkui/ftablecolumn-name": FTableColumnName,
21
+ "fkui/slot-deprecated": slotdeprecated,
20
22
  };
@@ -0,0 +1,85 @@
1
+ const { Rule } = require("html-validate/node");
2
+ const { getDocumentationUrl, getSlots } = require("./common");
3
+
4
+ /**
5
+ * @typedef {import("html-validate").RuleDocumentation} RuleDocumentation
6
+ */
7
+
8
+ /**
9
+ * @typedef {Object} Entry
10
+ * @property {string} slot
11
+ * @property {string} component
12
+ * @property {string} [replacement]
13
+ * @property {string} [additionalMessage]
14
+ * @property {string} url
15
+ */
16
+
17
+ /** @type {Entry[]} */
18
+ const deprecatedSlots = [
19
+ {
20
+ slot: "#checkbox-description",
21
+ component: "f-interactive-table",
22
+ replacement: "selectable-description",
23
+ url: "/components/table-and-list/table.html",
24
+ },
25
+ ];
26
+
27
+ /**
28
+ * @param {import("html-validate").ElementReadyEvent} event
29
+ * @returns {boolean}
30
+ */
31
+ function isRelevant(event) {
32
+ return deprecatedSlots
33
+ .map((it) => it.component)
34
+ .includes(event.target.tagName);
35
+ }
36
+
37
+ /**
38
+ * @extends {Rule<Entry, void>}
39
+ */
40
+ class SlotDeprecated extends Rule {
41
+ /**
42
+ * @param {Entry} context
43
+ * @returns {RuleDocumentation}
44
+ */
45
+ documentation(context) {
46
+ const { url, replacement, additionalMessage } = context;
47
+ const message = replacement
48
+ ? `Slot \`${context.slot}\` is deprecated and should be replaced with \`${replacement}\``
49
+ : `Slot \`${context.slot}\` is deprecated.`;
50
+ return {
51
+ description: additionalMessage
52
+ ? `${message}\n\n${additionalMessage}`
53
+ : message,
54
+ url: getDocumentationUrl(url),
55
+ };
56
+ }
57
+
58
+ setup() {
59
+ this.on("element:ready", isRelevant, (event) => {
60
+ const { target } = event;
61
+ const slots = getSlots(target);
62
+ const entries = deprecatedSlots.filter((it) =>
63
+ target.is(it.component),
64
+ );
65
+
66
+ for (const entry of entries) {
67
+ const description = slots[entry.slot];
68
+ if (!description) {
69
+ continue;
70
+ }
71
+
72
+ this.report({
73
+ node: target,
74
+ location: description.location,
75
+ message: entry.replacement
76
+ ? `slot "{{ slot }}" is deprecated and replaced with "{{ replacement }}"`
77
+ : `slot "{{ slot }}" is deprecated`,
78
+ context: entry,
79
+ });
80
+ }
81
+ });
82
+ }
83
+ }
84
+
85
+ module.exports = SlotDeprecated;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fkui/vue",
3
- "version": "6.27.0",
3
+ "version": "6.29.0",
4
4
  "description": "Vue implementation of FKUI components",
5
5
  "keywords": [
6
6
  "fkui",
@@ -60,9 +60,9 @@
60
60
  "unit:watch": "jest --watch"
61
61
  },
62
62
  "peerDependencies": {
63
- "@fkui/date": "^6.27.0",
64
- "@fkui/design": "^6.27.0",
65
- "@fkui/logic": "^6.27.0",
63
+ "@fkui/date": "^6.29.0",
64
+ "@fkui/design": "^6.29.0",
65
+ "@fkui/logic": "^6.29.0",
66
66
  "fk-icons": "^4.30.1",
67
67
  "html-validate": ">= 7.9.0",
68
68
  "vue": "^3.5.0"
@@ -79,5 +79,5 @@
79
79
  "node": ">= 20",
80
80
  "npm": ">= 7"
81
81
  },
82
- "gitHead": "1634a325b0102a6aa74fee4b8767d9236a958b31"
82
+ "gitHead": "7152e2e334db2e8ef15828227b7a244bb5e52bc7"
83
83
  }
@@ -1,73 +0,0 @@
1
- const {
2
- Rule,
3
- TextClassification,
4
- classifyNodeText,
5
- } = require("html-validate/node");
6
- const { getDocumentationUrl } = require("./common");
7
-
8
- /**
9
- * @param {import("html-validate").ElementReadyEvent} event
10
- * @returns {boolean}
11
- */
12
- function isRelevant(event) {
13
- return event.target.is("f-interactive-table");
14
- }
15
-
16
- /**
17
- * @param {import("html-validate").HtmlElement} element
18
- * @returns {string[]}
19
- */
20
- function getSlots(element) {
21
- return Object.fromEntries(
22
- element.childElements
23
- .filter((it) => it.is("template"))
24
- .map((it) => {
25
- const key = it.attributes.find((jt) =>
26
- jt.key.startsWith("#"),
27
- )?.key;
28
- return [key, it];
29
- }),
30
- );
31
- }
32
-
33
- class FInteractiveTableCheckboxDescription extends Rule {
34
- documentation() {
35
- return {
36
- description:
37
- "`#checkbox-description` slot must implemented and non-empty when `selectable` is enabled",
38
- url: getDocumentationUrl("/components/table-and-list/table.html"),
39
- };
40
- }
41
-
42
- setup() {
43
- this.on("element:ready", isRelevant, (event) => {
44
- const { target } = event;
45
- const selectable = target.getAttribute("selectable");
46
- if (!selectable) {
47
- return;
48
- }
49
- const slots = getSlots(target);
50
- const checkboxDescription = slots["#checkbox-description"];
51
- if (!checkboxDescription) {
52
- this.report({
53
- node: target,
54
- location: selectable.keyLocation,
55
- message:
56
- "#checkbox-description slot must be implemented when selectable is enabled",
57
- });
58
- return;
59
- }
60
- const textContent = classifyNodeText(checkboxDescription);
61
- if (textContent === TextClassification.EMPTY_TEXT) {
62
- this.report({
63
- node: checkboxDescription,
64
- location: checkboxDescription.location,
65
- message:
66
- "#checkbox-description cannot be empty when selectable is enabled",
67
- });
68
- }
69
- });
70
- }
71
- }
72
-
73
- module.exports = FInteractiveTableCheckboxDescription;