@wordpress/dataviews 12.0.1-next.v.202602091733.0 → 12.0.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.
- package/CHANGELOG.md +39 -1
- package/README.md +3 -1
- package/build/components/dataform-controls/color.cjs +19 -30
- package/build/components/dataform-controls/color.cjs.map +3 -3
- package/build/components/dataform-controls/date.cjs.map +1 -1
- package/build/components/dataform-controls/datetime.cjs +12 -21
- package/build/components/dataform-controls/datetime.cjs.map +2 -2
- package/build/components/dataform-layouts/card/index.cjs +112 -164
- package/build/components/dataform-layouts/card/index.cjs.map +3 -3
- package/build/components/dataform-layouts/index.cjs +1 -1
- package/build/components/dataform-layouts/index.cjs.map +1 -1
- package/build/components/dataform-layouts/normalize-form.cjs +2 -1
- package/build/components/dataform-layouts/normalize-form.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/dropdown.cjs +79 -65
- package/build/components/dataform-layouts/panel/dropdown.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/index.cjs +13 -177
- package/build/components/dataform-layouts/panel/index.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/modal.cjs +12 -9
- package/build/components/dataform-layouts/panel/modal.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/summary-button.cjs +125 -56
- package/build/components/dataform-layouts/panel/summary-button.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs +59 -0
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs +45 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs +36 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs +77 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs.map +7 -0
- package/build/components/dataviews-bulk-actions/index.cjs +2 -2
- package/build/components/dataviews-bulk-actions/index.cjs.map +2 -2
- package/build/components/dataviews-context/index.cjs +1 -0
- package/build/components/dataviews-context/index.cjs.map +2 -2
- package/build/components/dataviews-filters/filter.cjs.map +1 -1
- package/build/components/dataviews-filters/search-widget.cjs +25 -11
- package/build/components/dataviews-filters/search-widget.cjs.map +2 -2
- package/build/components/dataviews-filters/toggle.cjs +6 -2
- package/build/components/dataviews-filters/toggle.cjs.map +2 -2
- package/build/components/dataviews-footer/index.cjs +28 -12
- package/build/components/dataviews-footer/index.cjs.map +3 -3
- package/build/components/dataviews-item-actions/index.cjs +0 -1
- package/build/components/dataviews-item-actions/index.cjs.map +2 -2
- package/build/components/dataviews-layout/index.cjs +12 -0
- package/build/components/dataviews-layout/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/activity/index.cjs +41 -26
- package/build/components/dataviews-layouts/activity/index.cjs.map +3 -3
- package/build/components/dataviews-layouts/grid/composite-grid.cjs +2 -0
- package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
- package/build/components/dataviews-layouts/grid/index.cjs +19 -14
- package/build/components/dataviews-layouts/grid/index.cjs.map +3 -3
- package/build/components/dataviews-layouts/list/index.cjs +13 -9
- package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/picker-table/index.cjs +1 -1
- package/build/components/dataviews-layouts/picker-table/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/index.cjs +40 -19
- package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
- package/build/dataviews/index.cjs +9 -2
- package/build/dataviews/index.cjs.map +3 -3
- package/build/dataviews-picker/index.cjs +1 -0
- package/build/dataviews-picker/index.cjs.map +2 -2
- package/build/hooks/use-data.cjs +46 -0
- package/build/hooks/use-data.cjs.map +7 -0
- package/build/hooks/use-delayed-loading.cjs +47 -0
- package/build/hooks/use-delayed-loading.cjs.map +7 -0
- package/build/types/dataform.cjs.map +1 -1
- package/build-module/components/dataform-controls/color.mjs +24 -31
- package/build-module/components/dataform-controls/color.mjs.map +2 -2
- package/build-module/components/dataform-controls/date.mjs.map +1 -1
- package/build-module/components/dataform-controls/datetime.mjs +13 -22
- package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
- package/build-module/components/dataform-layouts/card/index.mjs +113 -161
- package/build-module/components/dataform-layouts/card/index.mjs.map +3 -3
- package/build-module/components/dataform-layouts/index.mjs +1 -1
- package/build-module/components/dataform-layouts/index.mjs.map +1 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs +2 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/dropdown.mjs +81 -67
- package/build-module/components/dataform-layouts/panel/dropdown.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/index.mjs +14 -178
- package/build-module/components/dataform-layouts/panel/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/modal.mjs +12 -9
- package/build-module/components/dataform-layouts/panel/modal.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/summary-button.mjs +117 -58
- package/build-module/components/dataform-layouts/panel/summary-button.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs +38 -0
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs +14 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs +15 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs +46 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs.map +7 -0
- package/build-module/components/dataviews-bulk-actions/index.mjs +2 -2
- package/build-module/components/dataviews-bulk-actions/index.mjs.map +2 -2
- package/build-module/components/dataviews-context/index.mjs +1 -0
- package/build-module/components/dataviews-context/index.mjs.map +2 -2
- package/build-module/components/dataviews-filters/filter.mjs.map +1 -1
- package/build-module/components/dataviews-filters/search-widget.mjs +25 -11
- package/build-module/components/dataviews-filters/search-widget.mjs.map +2 -2
- package/build-module/components/dataviews-filters/toggle.mjs +6 -2
- package/build-module/components/dataviews-filters/toggle.mjs.map +2 -2
- package/build-module/components/dataviews-footer/index.mjs +28 -12
- package/build-module/components/dataviews-footer/index.mjs.map +2 -2
- package/build-module/components/dataviews-item-actions/index.mjs +0 -1
- package/build-module/components/dataviews-item-actions/index.mjs.map +2 -2
- package/build-module/components/dataviews-layout/index.mjs +12 -0
- package/build-module/components/dataviews-layout/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/activity/index.mjs +41 -26
- package/build-module/components/dataviews-layouts/activity/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs +2 -0
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/index.mjs +19 -14
- package/build-module/components/dataviews-layouts/grid/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/list/index.mjs +13 -9
- package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/picker-table/index.mjs +1 -1
- package/build-module/components/dataviews-layouts/picker-table/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/index.mjs +40 -19
- package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
- package/build-module/dataviews/index.mjs +9 -2
- package/build-module/dataviews/index.mjs.map +2 -2
- package/build-module/dataviews-picker/index.mjs +1 -0
- package/build-module/dataviews-picker/index.mjs.map +2 -2
- package/build-module/hooks/use-data.mjs +25 -0
- package/build-module/hooks/use-data.mjs.map +7 -0
- package/build-module/hooks/use-delayed-loading.mjs +22 -0
- package/build-module/hooks/use-delayed-loading.mjs.map +7 -0
- package/build-style/style-rtl.css +190 -31
- package/build-style/style.css +190 -31
- package/build-types/components/dataform-controls/color.d.ts.map +1 -1
- package/build-types/components/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts +16 -0
- package/build-types/components/dataform-controls/utils/use-disabled-date-matchers.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/card/index.d.ts +1 -10
- package/build-types/components/dataform-layouts/card/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/normalize-form.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/dropdown.d.ts +2 -13
- package/build-types/components/dataform-layouts/panel/dropdown.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/modal.d.ts +2 -11
- package/build-types/components/dataform-layouts/panel/modal.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts +6 -5
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts +3 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts +23 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts.map +1 -0
- package/build-types/components/dataviews-context/index.d.ts +1 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/toggle.d.ts.map +1 -1
- package/build-types/components/dataviews-footer/index.d.ts +1 -1
- package/build-types/components/dataviews-footer/index.d.ts.map +1 -1
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layout/index.d.ts +1 -1
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/activity/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts +2 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/picker-activity/index.d.ts +3 -0
- package/build-types/components/dataviews-layouts/picker-activity/index.d.ts.map +1 -0
- package/build-types/components/dataviews-layouts/table/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts +25 -0
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts.map +1 -0
- package/build-types/components/dataviews-layouts/utils/grid-config-options.d.ts +2 -0
- package/build-types/components/dataviews-layouts/utils/grid-config-options.d.ts.map +1 -0
- package/build-types/components/dataviews-layouts/utils/use-infinite-scroll.d.ts +22 -0
- package/build-types/components/dataviews-layouts/utils/use-infinite-scroll.d.ts.map +1 -0
- package/build-types/dataform/stories/index.story.d.ts +9 -1
- package/build-types/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/dataform/stories/layout-panel.d.ts +3 -1
- package/build-types/dataform/stories/layout-panel.d.ts.map +1 -1
- package/build-types/dataviews/index.d.ts.map +1 -1
- package/build-types/dataviews/stories/empty.d.ts.map +1 -1
- package/build-types/dataviews/stories/fixtures.d.ts +1 -0
- package/build-types/dataviews/stories/fixtures.d.ts.map +1 -1
- package/build-types/dataviews/stories/free-composition.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-table.d.ts.map +1 -1
- package/build-types/dataviews/stories/minimal-ui.d.ts.map +1 -1
- package/build-types/dataviews/stories/with-card.d.ts.map +1 -1
- package/build-types/dataviews-picker/index.d.ts.map +1 -1
- package/build-types/field-types/utils/is-valid-date-boundary.d.ts +7 -0
- package/build-types/field-types/utils/is-valid-date-boundary.d.ts.map +1 -0
- package/build-types/hooks/test/use-data.d.ts +2 -0
- package/build-types/hooks/test/use-data.d.ts.map +1 -0
- package/build-types/hooks/use-data.d.ts +12 -0
- package/build-types/hooks/use-data.d.ts.map +1 -0
- package/build-types/hooks/use-delayed-loading.d.ts +4 -0
- package/build-types/hooks/use-delayed-loading.d.ts.map +1 -0
- package/build-types/hooks/use-infinite-scroll.d.ts +21 -0
- package/build-types/hooks/use-infinite-scroll.d.ts.map +1 -0
- package/build-types/hooks/use-selected-items.d.ts +19 -0
- package/build-types/hooks/use-selected-items.d.ts.map +1 -0
- package/build-types/types/dataform.d.ts +3 -0
- package/build-types/types/dataform.d.ts.map +1 -1
- package/build-wp/index.js +2898 -2198
- package/package.json +21 -21
- package/src/components/dataform-controls/color.tsx +29 -36
- package/src/components/dataform-controls/date.tsx +2 -2
- package/src/components/dataform-controls/datetime.tsx +19 -34
- package/src/components/dataform-controls/style.scss +4 -0
- package/src/components/dataform-layouts/card/index.tsx +118 -185
- package/src/components/dataform-layouts/index.tsx +1 -1
- package/src/components/dataform-layouts/normalize-form.ts +1 -0
- package/src/components/dataform-layouts/panel/dropdown.tsx +95 -96
- package/src/components/dataform-layouts/panel/index.tsx +10 -245
- package/src/components/dataform-layouts/panel/modal.tsx +16 -20
- package/src/components/dataform-layouts/panel/style.scss +110 -27
- package/src/components/dataform-layouts/panel/summary-button.tsx +140 -62
- package/src/components/dataform-layouts/panel/utils/get-first-validation-error.ts +47 -0
- package/src/components/dataform-layouts/panel/utils/get-label-classname.ts +18 -0
- package/src/components/dataform-layouts/panel/utils/get-label-content.tsx +24 -0
- package/src/components/dataform-layouts/panel/utils/use-field-from-form-field.ts +78 -0
- package/src/components/dataform-layouts/regular/style.scss +7 -0
- package/src/components/dataform-layouts/test/normalize-form.ts +5 -0
- package/src/components/dataviews-bulk-actions/index.tsx +2 -2
- package/src/components/dataviews-context/index.ts +2 -0
- package/src/components/dataviews-filters/filter.tsx +1 -1
- package/src/components/dataviews-filters/search-widget.tsx +10 -2
- package/src/components/dataviews-filters/style.scss +8 -0
- package/src/components/dataviews-filters/toggle.tsx +10 -3
- package/src/components/dataviews-footer/index.tsx +39 -12
- package/src/components/dataviews-footer/style.scss +6 -1
- package/src/components/dataviews-item-actions/index.tsx +0 -3
- package/src/components/dataviews-item-actions/style.scss +7 -0
- package/src/components/dataviews-layout/index.tsx +24 -0
- package/src/components/dataviews-layouts/activity/index.tsx +29 -22
- package/src/components/dataviews-layouts/activity/style.scss +5 -0
- package/src/components/dataviews-layouts/grid/composite-grid.tsx +5 -1
- package/src/components/dataviews-layouts/grid/index.tsx +19 -22
- package/src/components/dataviews-layouts/grid/style.scss +5 -0
- package/src/components/dataviews-layouts/list/index.tsx +18 -18
- package/src/components/dataviews-layouts/list/style.scss +5 -0
- package/src/components/dataviews-layouts/picker-table/index.tsx +1 -1
- package/src/components/dataviews-layouts/table/index.tsx +48 -22
- package/src/components/dataviews-layouts/table/style.scss +8 -2
- package/src/dataform/stories/index.story.tsx +5 -0
- package/src/dataform/stories/layout-panel.tsx +19 -2
- package/src/dataform/test/dataform.tsx +2 -2
- package/src/dataviews/index.tsx +11 -3
- package/src/dataviews/stories/empty.tsx +1 -7
- package/src/dataviews/stories/fixtures.tsx +89 -0
- package/src/dataviews/stories/free-composition.tsx +0 -5
- package/src/dataviews/stories/layout-table.tsx +1 -7
- package/src/dataviews/stories/minimal-ui.tsx +0 -5
- package/src/dataviews/stories/with-card.tsx +1 -7
- package/src/dataviews/style.scss +25 -0
- package/src/dataviews-picker/index.tsx +2 -1
- package/src/hooks/use-data.ts +45 -0
- package/src/hooks/use-delayed-loading.ts +21 -0
- package/src/types/dataform.ts +4 -0
|
@@ -2,28 +2,102 @@
|
|
|
2
2
|
@use "@wordpress/base-styles/colors" as *;
|
|
3
3
|
@use "@wordpress/base-styles/z-index" as *;
|
|
4
4
|
|
|
5
|
-
.dataforms-layouts-panel__field {
|
|
5
|
+
.dataforms-layouts-panel__field-trigger {
|
|
6
|
+
position: relative;
|
|
7
|
+
color: inherit;
|
|
8
|
+
display: flex;
|
|
6
9
|
width: 100%;
|
|
7
|
-
min-height: $grid-unit-
|
|
8
|
-
|
|
9
|
-
align-items: flex-start
|
|
10
|
+
min-height: $grid-unit-30;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
border-radius: $radius-small;
|
|
14
|
+
isolation: isolate;
|
|
15
|
+
|
|
16
|
+
&--label-side {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
gap: var(--wpds-dimension-gap-md);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--label-top {
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns: 1fr auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--label-none {
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:not(.is-disabled):hover {
|
|
31
|
+
color: var(--wp-admin-theme-color);
|
|
32
|
+
|
|
33
|
+
.dataforms-layouts-panel__field-trigger-icon {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dataforms-layouts-panel__field-label {
|
|
38
|
+
color: var(--wp-admin-theme-color);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.is-disabled {
|
|
43
|
+
cursor: default;
|
|
44
|
+
|
|
45
|
+
.dataforms-layouts-panel__field-control {
|
|
46
|
+
color: $gray-700;
|
|
47
|
+
font-weight: var(--wpds-font-weight-regular);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dataforms-layouts-panel__field-trigger--edit-always
|
|
53
|
+
.dataforms-layouts-panel__field-trigger-icon {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
fill: currentColor;
|
|
56
|
+
|
|
57
|
+
&:hover,
|
|
58
|
+
&:focus-visible {
|
|
59
|
+
fill: var(--wp-admin-theme-color);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.dataforms-layouts-panel__field-trigger-icon {
|
|
64
|
+
padding: 0;
|
|
65
|
+
color: var(--wp-admin-theme-color);
|
|
66
|
+
flex: 0 0 auto;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
border-radius: var(--wpds-border-radius-xs);
|
|
10
69
|
|
|
11
|
-
|
|
12
|
-
|
|
70
|
+
&:focus-visible {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
outline:
|
|
73
|
+
var(--wpds-border-width-focus) solid
|
|
74
|
+
var(--wp-admin-theme-color);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dataforms-layouts-panel__field-dropdown-anchor {
|
|
79
|
+
width: 100%;
|
|
80
|
+
|
|
81
|
+
.components-dropdown {
|
|
82
|
+
width: 100%;
|
|
13
83
|
}
|
|
14
84
|
}
|
|
15
85
|
|
|
16
86
|
.dataforms-layouts-panel__field-label {
|
|
17
87
|
width: 38%;
|
|
18
88
|
flex-shrink: 0;
|
|
19
|
-
min-height: $grid-unit-
|
|
89
|
+
min-height: $grid-unit-30;
|
|
20
90
|
display: flex;
|
|
21
91
|
align-items: center;
|
|
22
92
|
line-height: $grid-unit-05 * 5;
|
|
23
93
|
hyphens: auto;
|
|
94
|
+
color: $gray-700;
|
|
95
|
+
text-transform: capitalize;
|
|
24
96
|
|
|
25
|
-
|
|
26
|
-
|
|
97
|
+
.components-base-control__label {
|
|
98
|
+
display: inline;
|
|
99
|
+
margin-bottom: 0;
|
|
100
|
+
line-height: inherit;
|
|
27
101
|
}
|
|
28
102
|
|
|
29
103
|
&.has-error {
|
|
@@ -32,8 +106,14 @@
|
|
|
32
106
|
}
|
|
33
107
|
|
|
34
108
|
.dataforms-layouts-panel__field-label-error-content {
|
|
109
|
+
position: relative;
|
|
110
|
+
z-index: 1;
|
|
35
111
|
cursor: help;
|
|
36
112
|
fill: $alert-red;
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: $grid-unit-05;
|
|
37
117
|
svg {
|
|
38
118
|
fill: currentColor;
|
|
39
119
|
}
|
|
@@ -41,26 +121,33 @@
|
|
|
41
121
|
|
|
42
122
|
.dataforms-layouts-panel__field-control {
|
|
43
123
|
flex-grow: 1;
|
|
44
|
-
min-
|
|
124
|
+
min-width: 0;
|
|
125
|
+
min-height: $grid-unit-30;
|
|
126
|
+
line-height: var(--wpds-font-line-height-md);
|
|
45
127
|
display: flex;
|
|
46
128
|
align-items: center;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
font-weight: var(--wpds-font-weight-medium);
|
|
47
131
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
text-align: left;
|
|
51
|
-
white-space: normal;
|
|
52
|
-
text-wrap: balance; // Fallback for Safari.
|
|
53
|
-
text-wrap: pretty;
|
|
54
|
-
min-height: $button-size-compact;
|
|
132
|
+
> * {
|
|
133
|
+
min-width: 0;
|
|
55
134
|
}
|
|
135
|
+
}
|
|
56
136
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
137
|
+
.dataforms-layouts-panel__field-trigger--label-top
|
|
138
|
+
.dataforms-layouts-panel__field-label {
|
|
139
|
+
width: 100%;
|
|
140
|
+
}
|
|
60
141
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
142
|
+
.dataforms-layouts-panel__field-trigger--label-top
|
|
143
|
+
.dataforms-layouts-panel__field-control {
|
|
144
|
+
grid-column: 1 / -1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.dataforms-layouts-panel__field-trigger--label-top
|
|
148
|
+
.dataforms-layouts-panel__field-trigger-icon {
|
|
149
|
+
grid-row: 1;
|
|
150
|
+
grid-column: 2;
|
|
64
151
|
}
|
|
65
152
|
|
|
66
153
|
.dataforms-layouts-panel__field-dropdown .components-popover__content {
|
|
@@ -79,7 +166,3 @@
|
|
|
79
166
|
.components-popover.components-dropdown__content.dataforms-layouts-panel__field-dropdown {
|
|
80
167
|
z-index: z-index(".components-popover.components-dropdown__content.dataforms-layouts-panel__field-dropdown");
|
|
81
168
|
}
|
|
82
|
-
|
|
83
|
-
.dataforms-layouts-panel__summary-button:empty {
|
|
84
|
-
min-width: $admin-sidebar-width;
|
|
85
|
-
}
|
|
@@ -1,92 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { Button } from '@wordpress/components';
|
|
9
|
+
import { Button, Icon, Tooltip } from '@wordpress/components';
|
|
5
10
|
import { sprintf, _x } from '@wordpress/i18n';
|
|
11
|
+
import { error as errorIcon, pencil } from '@wordpress/icons';
|
|
12
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
13
|
+
import { useRef } from '@wordpress/element';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
16
|
* Internal dependencies
|
|
9
17
|
*/
|
|
10
|
-
import type {
|
|
18
|
+
import type {
|
|
19
|
+
FieldValidity,
|
|
20
|
+
NormalizedField,
|
|
21
|
+
NormalizedFormField,
|
|
22
|
+
NormalizedPanelLayout,
|
|
23
|
+
} from '../../../types';
|
|
24
|
+
import getLabelClassName from './utils/get-label-classname';
|
|
25
|
+
import getLabelContent from './utils/get-label-content';
|
|
26
|
+
import getFirstValidationError from './utils/get-first-validation-error';
|
|
11
27
|
|
|
12
|
-
function SummaryButton< Item >( {
|
|
13
|
-
summaryFields,
|
|
28
|
+
export default function SummaryButton< Item >( {
|
|
14
29
|
data,
|
|
15
|
-
|
|
30
|
+
field,
|
|
16
31
|
fieldLabel,
|
|
32
|
+
summaryFields,
|
|
33
|
+
validity,
|
|
34
|
+
touched,
|
|
17
35
|
disabled,
|
|
18
36
|
onClick,
|
|
19
37
|
'aria-expanded': ariaExpanded,
|
|
20
38
|
}: {
|
|
21
|
-
summaryFields: NormalizedField< Item >[];
|
|
22
39
|
data: Item;
|
|
23
|
-
|
|
40
|
+
field: NormalizedFormField;
|
|
24
41
|
fieldLabel?: string;
|
|
42
|
+
summaryFields: NormalizedField< Item >[];
|
|
43
|
+
validity?: FieldValidity;
|
|
44
|
+
touched: boolean;
|
|
25
45
|
disabled?: boolean;
|
|
26
46
|
onClick: () => void;
|
|
27
47
|
'aria-expanded'?: boolean;
|
|
28
48
|
} ) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
const { labelPosition, editVisibility } =
|
|
50
|
+
field.layout as NormalizedPanelLayout;
|
|
51
|
+
const errorMessage = getFirstValidationError( validity );
|
|
52
|
+
const showError = touched && !! errorMessage;
|
|
53
|
+
const labelClassName = getLabelClassName( labelPosition, showError );
|
|
54
|
+
const labelContent = getLabelContent( showError, errorMessage, fieldLabel );
|
|
55
|
+
const className = clsx(
|
|
56
|
+
'dataforms-layouts-panel__field-trigger',
|
|
57
|
+
`dataforms-layouts-panel__field-trigger--label-${ labelPosition }`,
|
|
58
|
+
{
|
|
59
|
+
'is-disabled': disabled,
|
|
60
|
+
'dataforms-layouts-panel__field-trigger--edit-always':
|
|
61
|
+
editVisibility === 'always',
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const controlId = useInstanceId(
|
|
66
|
+
SummaryButton,
|
|
67
|
+
'dataforms-layouts-panel__field-control'
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const ariaLabel = showError
|
|
71
|
+
? sprintf(
|
|
72
|
+
// translators: %s: Field name.
|
|
73
|
+
_x( 'Edit %s (has errors)', 'field' ),
|
|
74
|
+
fieldLabel || ''
|
|
75
|
+
)
|
|
76
|
+
: sprintf(
|
|
40
77
|
// translators: %s: Field name.
|
|
41
78
|
_x( 'Edit %s', 'field' ),
|
|
42
79
|
fieldLabel || ''
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const rowRef = useRef< HTMLDivElement >( null );
|
|
83
|
+
|
|
84
|
+
const handleRowClick = () => {
|
|
85
|
+
const selection =
|
|
86
|
+
rowRef.current?.ownerDocument.defaultView?.getSelection();
|
|
87
|
+
if ( selection && selection.toString().length > 0 ) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
onClick();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const handleKeyDown = ( event: React.KeyboardEvent ) => {
|
|
94
|
+
if (
|
|
95
|
+
event.target === event.currentTarget &&
|
|
96
|
+
( event.key === 'Enter' || event.key === ' ' )
|
|
97
|
+
) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
onClick();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div
|
|
105
|
+
ref={ rowRef }
|
|
106
|
+
className={ className }
|
|
107
|
+
onClick={ ! disabled ? handleRowClick : undefined }
|
|
108
|
+
onKeyDown={ ! disabled ? handleKeyDown : undefined }
|
|
109
|
+
>
|
|
110
|
+
{ labelPosition !== 'none' && (
|
|
111
|
+
<span className={ labelClassName }>{ labelContent }</span>
|
|
112
|
+
) }
|
|
113
|
+
{ labelPosition === 'none' && showError && (
|
|
114
|
+
<Tooltip text={ errorMessage } placement="top">
|
|
115
|
+
<span className="dataforms-layouts-panel__field-label-error-content">
|
|
116
|
+
<Icon icon={ errorIcon } size={ 16 } />
|
|
117
|
+
</span>
|
|
118
|
+
</Tooltip>
|
|
43
119
|
) }
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
summaryFields.length > 1
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
120
|
+
<span
|
|
121
|
+
id={ `${ controlId }` }
|
|
122
|
+
className="dataforms-layouts-panel__field-control"
|
|
123
|
+
>
|
|
124
|
+
{ summaryFields.length > 1 ? (
|
|
125
|
+
<span
|
|
126
|
+
style={ {
|
|
127
|
+
display: 'flex',
|
|
128
|
+
flexDirection: 'column',
|
|
52
129
|
alignItems: 'flex-start',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
130
|
+
width: '100%',
|
|
131
|
+
gap: '2px',
|
|
132
|
+
} }
|
|
133
|
+
>
|
|
134
|
+
{ summaryFields.map( ( summaryField ) => (
|
|
135
|
+
<span
|
|
136
|
+
key={ summaryField.id }
|
|
137
|
+
style={ { width: '100%' } }
|
|
138
|
+
>
|
|
139
|
+
<summaryField.render
|
|
140
|
+
item={ data }
|
|
141
|
+
field={ summaryField }
|
|
142
|
+
/>
|
|
143
|
+
</span>
|
|
144
|
+
) ) }
|
|
145
|
+
</span>
|
|
146
|
+
) : (
|
|
147
|
+
summaryFields.map( ( summaryField ) => (
|
|
148
|
+
<summaryField.render
|
|
69
149
|
key={ summaryField.id }
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
150
|
+
item={ data }
|
|
151
|
+
field={ summaryField }
|
|
152
|
+
/>
|
|
153
|
+
) )
|
|
154
|
+
) }
|
|
155
|
+
</span>
|
|
156
|
+
{ ! disabled && (
|
|
157
|
+
<Button
|
|
158
|
+
className="dataforms-layouts-panel__field-trigger-icon"
|
|
159
|
+
label={ ariaLabel }
|
|
160
|
+
showTooltip={ false }
|
|
161
|
+
icon={ pencil }
|
|
162
|
+
size="small"
|
|
163
|
+
aria-expanded={ ariaExpanded }
|
|
164
|
+
aria-haspopup="dialog"
|
|
165
|
+
aria-describedby={ `${ controlId }` }
|
|
166
|
+
/>
|
|
87
167
|
) }
|
|
88
|
-
</
|
|
168
|
+
</div>
|
|
89
169
|
);
|
|
90
170
|
}
|
|
91
|
-
|
|
92
|
-
export default SummaryButton;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { FieldValidity } from '../../../../types';
|
|
2
|
+
|
|
3
|
+
function getFirstValidationError(
|
|
4
|
+
validity: FieldValidity | undefined
|
|
5
|
+
): string | undefined {
|
|
6
|
+
if ( ! validity ) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const validityRules = Object.keys( validity ).filter(
|
|
11
|
+
( key ) => key !== 'children'
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
for ( const key of validityRules ) {
|
|
15
|
+
const rule = validity[ key as keyof Omit< FieldValidity, 'children' > ];
|
|
16
|
+
if ( rule === undefined ) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if ( rule.type === 'invalid' ) {
|
|
21
|
+
if ( rule.message ) {
|
|
22
|
+
return rule.message;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Provide default message for required validation (message is optional)
|
|
26
|
+
if ( key === 'required' ) {
|
|
27
|
+
return 'A required field is empty';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return 'Unidentified validation error';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check children recursively
|
|
35
|
+
if ( validity.children ) {
|
|
36
|
+
for ( const childValidity of Object.values( validity.children ) ) {
|
|
37
|
+
const childError = getFirstValidationError( childValidity );
|
|
38
|
+
if ( childError ) {
|
|
39
|
+
return childError;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default getFirstValidationError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import type { LabelPosition } from '../../../../types';
|
|
6
|
+
|
|
7
|
+
function getLabelClassName(
|
|
8
|
+
labelPosition: LabelPosition,
|
|
9
|
+
showError?: boolean
|
|
10
|
+
) {
|
|
11
|
+
return clsx(
|
|
12
|
+
'dataforms-layouts-panel__field-label',
|
|
13
|
+
`dataforms-layouts-panel__field-label--label-position-${ labelPosition }`,
|
|
14
|
+
{ 'has-error': showError }
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default getLabelClassName;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Icon, Tooltip } from '@wordpress/components';
|
|
5
|
+
import { error as errorIcon } from '@wordpress/icons';
|
|
6
|
+
|
|
7
|
+
function getLabelContent(
|
|
8
|
+
showError?: boolean,
|
|
9
|
+
errorMessage?: string,
|
|
10
|
+
fieldLabel?: string
|
|
11
|
+
) {
|
|
12
|
+
return showError ? (
|
|
13
|
+
<Tooltip text={ errorMessage } placement="top">
|
|
14
|
+
<span className="dataforms-layouts-panel__field-label-error-content">
|
|
15
|
+
<Icon icon={ errorIcon } size={ 16 } />
|
|
16
|
+
{ fieldLabel }
|
|
17
|
+
</span>
|
|
18
|
+
</Tooltip>
|
|
19
|
+
) : (
|
|
20
|
+
fieldLabel
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default getLabelContent;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useContext } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type {
|
|
10
|
+
NormalizedFormField,
|
|
11
|
+
NormalizedField,
|
|
12
|
+
NormalizedPanelLayout,
|
|
13
|
+
} from '../../../../types';
|
|
14
|
+
import { getSummaryFields } from '../../get-summary-fields';
|
|
15
|
+
import DataFormContext from '../../../dataform-context';
|
|
16
|
+
|
|
17
|
+
const getFieldDefinition = < Item >(
|
|
18
|
+
field: NormalizedFormField,
|
|
19
|
+
fields: NormalizedField< Item >[]
|
|
20
|
+
) => {
|
|
21
|
+
const fieldDefinition = fields.find( ( _field ) => _field.id === field.id );
|
|
22
|
+
|
|
23
|
+
if ( ! fieldDefinition ) {
|
|
24
|
+
return fields.find( ( _field ) => {
|
|
25
|
+
if ( !! field.children ) {
|
|
26
|
+
const simpleChildren = field.children.filter(
|
|
27
|
+
( child ) => ! child.children
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if ( simpleChildren.length === 0 ) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return _field.id === simpleChildren[ 0 ].id;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return _field.id === field.id;
|
|
38
|
+
} );
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return fieldDefinition;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Determines the field definition and summary fields for a panel layout.
|
|
46
|
+
*
|
|
47
|
+
* Summary fields are determined with the following priority:
|
|
48
|
+
* 1. Use layout.summary fields if they exist
|
|
49
|
+
* 2. Fall back to the field definition that matches the form field's id
|
|
50
|
+
* 3. If the form field id doesn't exist, pick the first child field
|
|
51
|
+
* 4. If no field definition is found, return empty summary fields
|
|
52
|
+
*
|
|
53
|
+
* @param field The form field to get definition for
|
|
54
|
+
* @return Object containing fieldDefinition, fieldLabel, and summaryFields
|
|
55
|
+
*/
|
|
56
|
+
function useFieldFromFormField( field: NormalizedFormField ) {
|
|
57
|
+
const { fields } = useContext( DataFormContext );
|
|
58
|
+
const layout = field.layout as NormalizedPanelLayout;
|
|
59
|
+
const summaryFields = getSummaryFields( layout.summary, fields );
|
|
60
|
+
const fieldDefinition = getFieldDefinition( field, fields );
|
|
61
|
+
const fieldLabel = !! field.children ? field.label : fieldDefinition?.label;
|
|
62
|
+
|
|
63
|
+
if ( summaryFields.length === 0 ) {
|
|
64
|
+
return {
|
|
65
|
+
summaryFields: fieldDefinition ? [ fieldDefinition ] : [],
|
|
66
|
+
fieldDefinition,
|
|
67
|
+
fieldLabel,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
summaryFields,
|
|
73
|
+
fieldDefinition,
|
|
74
|
+
fieldLabel,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default useFieldFromFormField;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/colors" as *;
|
|
1
2
|
@use "@wordpress/base-styles/variables" as *;
|
|
2
3
|
|
|
3
4
|
.dataforms-layouts-regular__field {
|
|
@@ -5,6 +6,12 @@
|
|
|
5
6
|
min-height: $grid-unit-40;
|
|
6
7
|
justify-content: flex-start !important;
|
|
7
8
|
align-items: flex-start !important;
|
|
9
|
+
|
|
10
|
+
.components-base-control__label,
|
|
11
|
+
.components-input-control__label,
|
|
12
|
+
.components-form-token-field__label {
|
|
13
|
+
color: $gray-900;
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
.dataforms-layouts-regular__field-label {
|
|
@@ -139,6 +139,7 @@ describe( 'normalizeFormFields', () => {
|
|
|
139
139
|
type: 'panel',
|
|
140
140
|
openAs: 'dropdown',
|
|
141
141
|
summary: [],
|
|
142
|
+
editVisibility: 'on-hover',
|
|
142
143
|
},
|
|
143
144
|
fields: [
|
|
144
145
|
{
|
|
@@ -148,6 +149,7 @@ describe( 'normalizeFormFields', () => {
|
|
|
148
149
|
labelPosition: 'side',
|
|
149
150
|
openAs: 'dropdown',
|
|
150
151
|
summary: [],
|
|
152
|
+
editVisibility: 'on-hover',
|
|
151
153
|
},
|
|
152
154
|
},
|
|
153
155
|
],
|
|
@@ -166,6 +168,7 @@ describe( 'normalizeFormFields', () => {
|
|
|
166
168
|
type: 'panel',
|
|
167
169
|
openAs: 'dropdown',
|
|
168
170
|
summary: [],
|
|
171
|
+
editVisibility: 'on-hover',
|
|
169
172
|
},
|
|
170
173
|
fields: [
|
|
171
174
|
{
|
|
@@ -175,6 +178,7 @@ describe( 'normalizeFormFields', () => {
|
|
|
175
178
|
labelPosition: 'top',
|
|
176
179
|
openAs: 'dropdown',
|
|
177
180
|
summary: [],
|
|
181
|
+
editVisibility: 'on-hover',
|
|
178
182
|
},
|
|
179
183
|
},
|
|
180
184
|
],
|
|
@@ -358,6 +362,7 @@ describe( 'normalizeFormFields', () => {
|
|
|
358
362
|
labelPosition: 'side',
|
|
359
363
|
openAs: 'dropdown',
|
|
360
364
|
summary: [],
|
|
365
|
+
editVisibility: 'on-hover',
|
|
361
366
|
},
|
|
362
367
|
},
|
|
363
368
|
],
|
|
@@ -320,7 +320,7 @@ function FooterContent< Item >( {
|
|
|
320
320
|
const [ actionInProgress, setActionInProgress ] = useState< string | null >(
|
|
321
321
|
null
|
|
322
322
|
);
|
|
323
|
-
const footerContentRef = useRef< JSX.Element
|
|
323
|
+
const footerContentRef = useRef< React.JSX.Element >( undefined );
|
|
324
324
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
325
325
|
|
|
326
326
|
const bulkActions = useMemo(
|
|
@@ -359,7 +359,7 @@ function FooterContent< Item >( {
|
|
|
359
359
|
);
|
|
360
360
|
if ( ! actionInProgress ) {
|
|
361
361
|
if ( footerContentRef.current ) {
|
|
362
|
-
footerContentRef.current =
|
|
362
|
+
footerContentRef.current = undefined;
|
|
363
363
|
}
|
|
364
364
|
return renderFooterContent(
|
|
365
365
|
data,
|
|
@@ -56,6 +56,7 @@ type DataViewsContextType< Item > = {
|
|
|
56
56
|
setIsShowingFilter: ( value: boolean ) => void;
|
|
57
57
|
config: { perPageSizes: number[] };
|
|
58
58
|
empty?: ReactNode;
|
|
59
|
+
hasInitiallyLoaded?: boolean;
|
|
59
60
|
hasInfiniteScrollHandler: boolean;
|
|
60
61
|
itemListLabel?: string;
|
|
61
62
|
onReset?: ( () => void ) | false;
|
|
@@ -84,6 +85,7 @@ const DataViewsContext = createContext< DataViewsContextType< any > >( {
|
|
|
84
85
|
filters: [],
|
|
85
86
|
isShowingFilter: false,
|
|
86
87
|
setIsShowingFilter: () => {},
|
|
88
|
+
hasInitiallyLoaded: false,
|
|
87
89
|
hasInfiniteScrollHandler: false,
|
|
88
90
|
config: {
|
|
89
91
|
perPageSizes: [],
|
|
@@ -51,7 +51,7 @@ interface OperatorSelectorProps {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
interface FilterProps extends OperatorSelectorProps {
|
|
54
|
-
addFilterRef: RefObject< HTMLButtonElement >;
|
|
54
|
+
addFilterRef: RefObject< HTMLButtonElement | null >;
|
|
55
55
|
openedFilter: string | null;
|
|
56
56
|
fields: NormalizedField< any >[];
|
|
57
57
|
}
|