@ticatec/uniface-element 5.0.3 → 5.0.5

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 (44) hide show
  1. package/README.md +10 -10
  2. package/README_CN.md +13 -12
  3. package/dist/base-calendar/DateContext.d.ts +1 -0
  4. package/dist/base-calendar/DateContext.js +5 -8
  5. package/dist/composite/pagination_panel/PaginationPanel.svelte +5 -2
  6. package/dist/composite/transfer/Transfer.svelte +0 -1
  7. package/dist/data_display/card/Card.svelte +12 -3
  8. package/dist/data_display/card/Card.svelte.d.ts +6 -0
  9. package/dist/data_display/card/CardAction.d.ts +8 -0
  10. package/dist/data_display/card/CardHeader.svelte +12 -1
  11. package/dist/data_display/card/CommonCardActionBar.svelte +31 -3
  12. package/dist/data_display/card/CommonCardActionBar.svelte.d.ts +5 -0
  13. package/dist/data_display/card/README.md +18 -1
  14. package/dist/data_display/card/README_CN.md +18 -1
  15. package/dist/data_table/DataTable.svelte +31 -1
  16. package/dist/data_table/DataTable.svelte.d.ts +7 -0
  17. package/dist/data_table/lib/virtualWindow.d.ts +37 -0
  18. package/dist/data_table/lib/virtualWindow.js +41 -0
  19. package/dist/data_table/parts/ActionsPanel.svelte +17 -2
  20. package/dist/data_table/parts/ActionsPanel.svelte.d.ts +3 -0
  21. package/dist/data_table/parts/ContentPanel.svelte +26 -1
  22. package/dist/data_table/parts/ContentPanel.svelte.d.ts +6 -1
  23. package/dist/data_table/parts/FixedColumnsPanel.svelte +17 -1
  24. package/dist/data_table/parts/FixedColumnsPanel.svelte.d.ts +4 -1
  25. package/dist/data_table/parts/FixedHeaderPanel.svelte +1 -2
  26. package/dist/form/attachment_files/FileUploadBar.svelte +3 -3
  27. package/dist/form/attachment_files/FileUploadPanel.svelte +1 -1
  28. package/dist/form/color_picker/ColorPickerPanel.svelte +1 -1
  29. package/dist/form/date_picker/DateTimePicker.svelte +1 -1
  30. package/dist/form/options_select/OptionsSelect.svelte +2 -2
  31. package/dist/i18nRes/i18nRes.d.ts +41 -2
  32. package/dist/i18nRes/i18nRes.js +2 -1
  33. package/dist/overlay/dialog/CommonDialog.svelte +1 -1
  34. package/dist/overlay/dialog/Dialog.svelte +1 -1
  35. package/dist/overlay/message-box/MessageBox.svelte.js +3 -3
  36. package/package.json +1 -1
  37. package/dist/layout/flex/FlexBlock.svelte +0 -17
  38. package/dist/layout/flex/FlexBlock.svelte.d.ts +0 -38
  39. package/dist/layout/flex/README.md +0 -148
  40. package/dist/layout/flex/README_CN.md +0 -148
  41. package/dist/layout/flex/index.d.ts +0 -2
  42. package/dist/layout/flex/index.js +0 -2
  43. package/dist/layout/index.d.ts +0 -0
  44. package/dist/layout/index.js +0 -1
@@ -4,6 +4,7 @@
4
4
  import type TableRow from "./TableRow";
5
5
  import { onDestroy, onMount } from "svelte";
6
6
  import i18nRes from "../../i18nRes";
7
+ import type { VirtualWindow } from "../lib/virtualWindow";
7
8
 
8
9
  interface Props {
9
10
  actionsColumn: ActionsColumn;
@@ -13,6 +14,8 @@
13
14
  expandRow?: TableRow | null;
14
15
  rowHeight?: number;
15
16
  headerHeight?: number;
17
+ /** Row window when virtual scrolling is on; null renders every row. */
18
+ vwindow?: VirtualWindow | null;
16
19
  }
17
20
 
18
21
  let {
@@ -23,8 +26,13 @@
23
26
  expandRow = null,
24
27
  rowHeight,
25
28
  headerHeight,
29
+ vwindow = null,
26
30
  }: Props = $props();
27
31
 
32
+ // Virtual scrolling: same shared window as the other panels.
33
+ let visibleRows = $derived(vwindow ? rows.slice(vwindow.start, vwindow.end) : rows);
34
+ let startIndex = $derived(vwindow ? vwindow.start : 0);
35
+
28
36
  const handleActionPanelScroll = (e: Event) => {
29
37
  const target = e.target as HTMLDivElement;
30
38
  scrollTop = target.scrollTop;
@@ -54,7 +62,7 @@
54
62
  resizeObserver?.disconnect();
55
63
  });
56
64
 
57
- let actionText = i18nRes.dataTable.actions;
65
+ let actionText = i18nRes.dataTable.actions();
58
66
  </script>
59
67
 
60
68
  <div class="action-panel" bind:this={panel} style="user-select: none; width: {actionsColumn.width}px;">
@@ -65,7 +73,11 @@
65
73
  </div>
66
74
  <div bind:this={scrollPanel} class="rows-container" style="overflow-y: auto" onscroll={handleActionPanelScroll}>
67
75
  <div>
68
- {#each rows as row, idx (idx)}
76
+ {#if vwindow}
77
+ <div style="height: {vwindow.topPad}px"></div>
78
+ {/if}
79
+ {#each visibleRows as row, i (startIndex + i)}
80
+ {@const idx = startIndex + i}
69
81
  <ActionsRow
70
82
  {row}
71
83
  {rowHeight}
@@ -79,6 +91,9 @@
79
91
  <div class="inline-panel" style="height: {inlineRowHeight ?? 0}px"> </div>
80
92
  {/if}
81
93
  {/each}
94
+ {#if vwindow}
95
+ <div style="height: {vwindow.bottomPad}px"></div>
96
+ {/if}
82
97
  </div>
83
98
  </div>
84
99
  <div class="bottom-mask-overlay">
@@ -1,5 +1,6 @@
1
1
  import type ActionsColumn from "../lib/ActionsColumn";
2
2
  import type TableRow from "./TableRow";
3
+ import type { VirtualWindow } from "../lib/virtualWindow";
3
4
  interface Props {
4
5
  actionsColumn: ActionsColumn;
5
6
  scrollTop?: number;
@@ -8,6 +9,8 @@ interface Props {
8
9
  expandRow?: TableRow | null;
9
10
  rowHeight?: number;
10
11
  headerHeight?: number;
12
+ /** Row window when virtual scrolling is on; null renders every row. */
13
+ vwindow?: VirtualWindow | null;
11
14
  }
12
15
  declare const ActionsPanel: import("svelte").Component<Props, {}, "scrollTop">;
13
16
  type ActionsPanel = ReturnType<typeof ActionsPanel>;
@@ -7,6 +7,7 @@
7
7
  import UniDataTable, { type TableEventHandler } from "../UniDataTable";
8
8
  import { OrderDirection } from "../lib/OrderDirection";
9
9
  import type { GetRowFontStyle } from "../../types";
10
+ import type { VirtualWindow } from "../lib/virtualWindow";
10
11
 
11
12
  interface Props {
12
13
  columns: Array<DataColumn>;
@@ -28,6 +29,10 @@
28
29
  handleWidthChange?: TableEventHandler;
29
30
  handleCellClick?: (col: DataColumn) => any;
30
31
  tabWidth: number;
32
+ /** Row window when virtual scrolling is on; null renders every row. */
33
+ vwindow?: VirtualWindow | null;
34
+ /** Measured height of the scrollable data area (drives the virtual window). */
35
+ viewportHeight?: number;
31
36
  }
32
37
 
33
38
  let {
@@ -50,6 +55,8 @@
50
55
  handleWidthChange,
51
56
  handleCellClick,
52
57
  tabWidth = $bindable(0),
58
+ vwindow = null,
59
+ viewportHeight = $bindable(0),
53
60
  }: Props = $props();
54
61
 
55
62
  let scrollLeft = $state(0);
@@ -62,8 +69,13 @@
62
69
  onMount(() => {
63
70
  resizeObserver = new ResizeObserver(() => {
64
71
  viewWidth = Math.round(viewPanel?.clientWidth) - 1;
72
+ viewportHeight = dataPanel?.clientHeight ?? 0;
65
73
  });
66
74
  resizeObserver.observe(viewPanel);
75
+ if (dataPanel) {
76
+ resizeObserver.observe(dataPanel);
77
+ viewportHeight = dataPanel.clientHeight ?? 0;
78
+ }
67
79
  });
68
80
 
69
81
  onDestroy(() => {
@@ -117,6 +129,12 @@
117
129
 
118
130
  let rowWidth = $derived(Math.max(viewWidth, tabWidth));
119
131
  let hasWhitespace = $derived(viewWidth > tabWidth);
132
+
133
+ // Virtual scrolling: render only the windowed slice, padded by spacers so the
134
+ // scroll container keeps its full natural scrollHeight. `startIndex` keeps the
135
+ // rendered rows' absolute indices (striping, keys) stable while scrolling.
136
+ let visibleRows = $derived(vwindow ? rows.slice(vwindow.start, vwindow.end) : rows);
137
+ let startIndex = $derived(vwindow ? vwindow.start : 0);
120
138
  </script>
121
139
 
122
140
  <div class="data-content-panel" bind:this={viewPanel}>
@@ -140,7 +158,11 @@
140
158
  >
141
159
  {#if rows && rows.length > 0}
142
160
  <div style="box-sizing: border-box; width: {rowWidth}px; top: 0px">
143
- {#each rows as row, idx (idx)}
161
+ {#if vwindow}
162
+ <div style="height: {vwindow.topPad}px"></div>
163
+ {/if}
164
+ {#each visibleRows as row, i (startIndex + i)}
165
+ {@const idx = startIndex + i}
144
166
  <DataRow
145
167
  fontStyle={getRowFontStyle?.(row.data)}
146
168
  {rowHeight}
@@ -161,6 +183,9 @@
161
183
  </div>
162
184
  {/if}
163
185
  {/each}
186
+ {#if vwindow}
187
+ <div style="height: {vwindow.bottomPad}px"></div>
188
+ {/if}
164
189
  </div>
165
190
  {:else}
166
191
  <div class="empty-content-board" style="width: 100%">
@@ -3,6 +3,7 @@ import type TableRow from "./TableRow";
3
3
  import UniDataTable, { type TableEventHandler } from "../UniDataTable";
4
4
  import { OrderDirection } from "../lib/OrderDirection";
5
5
  import type { GetRowFontStyle } from "../../types";
6
+ import type { VirtualWindow } from "../lib/virtualWindow";
6
7
  interface Props {
7
8
  columns: Array<DataColumn>;
8
9
  rows: Array<TableRow>;
@@ -23,7 +24,11 @@ interface Props {
23
24
  handleWidthChange?: TableEventHandler;
24
25
  handleCellClick?: (col: DataColumn) => any;
25
26
  tabWidth: number;
27
+ /** Row window when virtual scrolling is on; null renders every row. */
28
+ vwindow?: VirtualWindow | null;
29
+ /** Measured height of the scrollable data area (drives the virtual window). */
30
+ viewportHeight?: number;
26
31
  }
27
- declare const ContentPanel: import("svelte").Component<Props, {}, "rows" | "scrollTop" | "inlineRowHeight" | "tabWidth">;
32
+ declare const ContentPanel: import("svelte").Component<Props, {}, "scrollTop" | "viewportHeight" | "rows" | "inlineRowHeight" | "tabWidth">;
28
33
  type ContentPanel = ReturnType<typeof ContentPanel>;
29
34
  export default ContentPanel;
@@ -10,6 +10,7 @@
10
10
  import type DataColumn from "../lib/DataColumn";
11
11
  import FixedHeaderPanel from "./FixedHeaderPanel.svelte";
12
12
  import { OrderDirection } from "../lib/OrderDirection";
13
+ import type { VirtualWindow } from "../lib/virtualWindow";
13
14
 
14
15
  interface Props {
15
16
  fixedCols?: Array<DataColumn>;
@@ -27,6 +28,8 @@
27
28
  rowHeight?: number;
28
29
  headerHeight?: number;
29
30
  inlineRowHeight?: number;
31
+ /** Row window when virtual scrolling is on; null renders every row. */
32
+ vwindow?: VirtualWindow | null;
30
33
  }
31
34
 
32
35
  let {
@@ -45,8 +48,14 @@
45
48
  rowHeight,
46
49
  headerHeight,
47
50
  inlineRowHeight = 0,
51
+ vwindow = null,
48
52
  }: Props = $props();
49
53
 
54
+ // Virtual scrolling: same shared window as the other panels, so all three
55
+ // render the same absolute row indices (selection state and striping use them).
56
+ let visibleRows = $derived(vwindow ? (rows ?? []).slice(vwindow.start, vwindow.end) : (rows ?? []));
57
+ let startIndex = $derived(vwindow ? vwindow.start : 0);
58
+
50
59
  let selectionMode = $state<SelectionMode>(SelectionMode.None);
51
60
 
52
61
  let selectable = $derived(indicatorColumn?.selectable == true);
@@ -133,7 +142,11 @@
133
142
  />
134
143
  <div class="rows-container" bind:this={viewPanel} onwheel={handleWheelEvent}>
135
144
  <div>
136
- {#each rows ?? [] as row, idx (idx)}
145
+ {#if vwindow}
146
+ <div style="height: {vwindow.topPad}px"></div>
147
+ {/if}
148
+ {#each visibleRows as row, i (startIndex + i)}
149
+ {@const idx = startIndex + i}
137
150
  <FixedRow
138
151
  rowNo={idx + 1}
139
152
  {row}
@@ -153,6 +166,9 @@
153
166
  <div class="inline-panel" style="height: {inlineRowHeight}px"> </div>
154
167
  {/if}
155
168
  {/each}
169
+ {#if vwindow}
170
+ <div style="height: {vwindow.bottomPad}px"></div>
171
+ {/if}
156
172
  </div>
157
173
  </div>
158
174
  <div class="bottom-mask-overlay">
@@ -3,6 +3,7 @@ import type { IndicatorColumn } from "..";
3
3
  import { type RowEventHandler, type TableEventHandler } from "../UniDataTable";
4
4
  import type DataColumn from "../lib/DataColumn";
5
5
  import { OrderDirection } from "../lib/OrderDirection";
6
+ import type { VirtualWindow } from "../lib/virtualWindow";
6
7
  interface Props {
7
8
  fixedCols?: Array<DataColumn>;
8
9
  indicatorColumn?: IndicatorColumn | null;
@@ -19,7 +20,9 @@ interface Props {
19
20
  rowHeight?: number;
20
21
  headerHeight?: number;
21
22
  inlineRowHeight?: number;
23
+ /** Row window when virtual scrolling is on; null renders every row. */
24
+ vwindow?: VirtualWindow | null;
22
25
  }
23
- declare const FixedColumnsPanel: import("svelte").Component<Props, {}, "expandRow" | "scrollTop" | "selectedRows">;
26
+ declare const FixedColumnsPanel: import("svelte").Component<Props, {}, "scrollTop" | "expandRow" | "selectedRows">;
24
27
  type FixedColumnsPanel = ReturnType<typeof FixedColumnsPanel>;
25
28
  export default FixedColumnsPanel;
@@ -2,7 +2,6 @@
2
2
  import type DataColumn from "../lib/DataColumn";
3
3
  import type { IndicatorColumn } from "..";
4
4
  import { type SelectionEventHandler, SelectionMode, type TableEventHandler } from "../UniDataTable";
5
- import utils from "../../overlay/common/utils";
6
5
  import { OrderDirection } from "../lib/OrderDirection";
7
6
  import i18nRes from "../../i18nRes";
8
7
 
@@ -107,7 +106,7 @@
107
106
  {:else}
108
107
  <div style="text-align: center" class="vertical-center">
109
108
  {#if indicatorColumn.displayNo}
110
- <span>{i18nRes.dataTable.rowNo}</span>
109
+ <span>{i18nRes.dataTable.rowNo()}</span>
111
110
  {/if}
112
111
  </div>
113
112
  {/if}
@@ -18,9 +18,9 @@
18
18
  let status: ProgressStatus = $state(getInitialStatus());
19
19
  let progress: number = $state(0);
20
20
 
21
- let cancelLabel: string = i18nRes.common.btnCancel.toString();
22
- let retryLabel: string = i18nRes.upload.btnRetry.toString();
23
- let removeLabel: string = i18nRes.upload.btnRemove.toString();
21
+ let cancelLabel: string = i18nRes.common.btnCancel();
22
+ let retryLabel: string = i18nRes.upload.btnRetry();
23
+ let removeLabel: string = i18nRes.upload.btnRemove();
24
24
 
25
25
  const cancelUpload = async () => {
26
26
  if (await file.cancel()) {
@@ -26,7 +26,7 @@
26
26
  visible?: boolean;
27
27
  } = $props();
28
28
 
29
- let btnPickup = i18nRes.upload.btnPickup.toString();
29
+ let btnPickup = i18nRes.upload.btnPickup();
30
30
 
31
31
  let files: Array<UploadFile> = $state([]);
32
32
  let fileInput: any;
@@ -47,7 +47,7 @@
47
47
 
48
48
  <div class="color-picker">
49
49
  <label for="color-input">
50
- {i18nRes.pickupColor}
50
+ {i18nRes.colorPicker()}
51
51
  </label>
52
52
 
53
53
  <div class="color-input-group">
@@ -44,7 +44,7 @@
44
44
  };
45
45
 
46
46
  const format = $derived(dateFmts[precision]);
47
- const confirmText = $derived(i18nRes.calendar.confirmText as any as string);
47
+ const confirmText = $derived(i18nRes.calendar.confirmText());
48
48
 
49
49
  let isOpen = $state(false);
50
50
  let currentValue = $state<dayjs.Dayjs>(dayjs());
@@ -42,9 +42,9 @@
42
42
  onchange,
43
43
  onfocus,
44
44
  onblur,
45
- filterPlaceholder = i18nRes.common.filterPlaceholder.toString(),
45
+ filterPlaceholder = i18nRes.common.filterPlaceholder(),
46
46
  filterFunction,
47
- noResultsText = i18nRes.common.noResultsText.toString(),
47
+ noResultsText = i18nRes.common.noResultsText(),
48
48
  itemRender,
49
49
  }: Props = $props();
50
50
 
@@ -1,3 +1,42 @@
1
- import { i18nUtils } from "@ticatec/i18n";
2
- declare const i18nRes: ReturnType<typeof i18nUtils.createResourceProxy>;
1
+ import type { ResourceProxy } from "@ticatec/i18n";
2
+ declare const langRes: {
3
+ common: {
4
+ btnClose: string;
5
+ btnCancel: string;
6
+ btnConfirm: string;
7
+ textMore: string;
8
+ filterPlaceholder: string;
9
+ noResultsText: string;
10
+ };
11
+ colorPicker: string;
12
+ calendar: {
13
+ months: string[];
14
+ monthsAbbr: string[];
15
+ weekTitle: string[];
16
+ weekTitleAbbr: string[];
17
+ confirmText: string;
18
+ };
19
+ upload: {
20
+ btnRetry: string;
21
+ btnRemove: string;
22
+ btnPickup: string;
23
+ };
24
+ dataTable: {
25
+ rowNo: string;
26
+ actions: string;
27
+ emptyDataSet: string;
28
+ totalInfo: string;
29
+ rowsPerPage: string;
30
+ };
31
+ transfer: {
32
+ selectIndicator: string;
33
+ };
34
+ };
35
+ /**
36
+ * The shape of this package's translation resources. A language resource file
37
+ * loaded at runtime (e.g. /assets/uniface_zh-CN.json) should provide every key
38
+ * of this structure, wrapped in the `uniface` namespace.
39
+ */
40
+ export type UnifaceLangRes = typeof langRes;
41
+ declare const i18nRes: ResourceProxy<UnifaceLangRes>;
3
42
  export default i18nRes;
@@ -33,7 +33,8 @@ const langRes = {
33
33
  rowNo: "#",
34
34
  actions: "Actions",
35
35
  emptyDataSet: 'Empty dataset',
36
- totalInfo: "Total: <b>{{total}}</b>"
36
+ totalInfo: "Total: <b>{{total}}</b>",
37
+ rowsPerPage: "Rows/Page"
37
38
  },
38
39
  transfer: {
39
40
  selectIndicator: "Selected: {{selected}}/{{total}}"
@@ -35,7 +35,7 @@
35
35
  let dialog: Dialog;
36
36
 
37
37
  const confirmAction = $derived<ButtonAction>({
38
- label: confirmText ?? i18nRes.common.btnConfirm.toString(),
38
+ label: confirmText ?? i18nRes.common.btnConfirm(),
39
39
  type: "primary",
40
40
  disabled: confirmHandler == null || !enableConfirm,
41
41
  handler: async () => {
@@ -34,7 +34,7 @@
34
34
  closeConfirm = null,
35
35
  content$style = '',
36
36
  hideClose = false,
37
- closeButton = i18nRes.common.btnClose,
37
+ closeButton = i18nRes.common.btnClose(),
38
38
  onClose = null,
39
39
  closable = true,
40
40
  dialog$style = "",
@@ -43,14 +43,14 @@ class MessageBoxController {
43
43
  }
44
44
  showInfo = (_message, options = { type: 'info' }) => {
45
45
  const infoButtons = [
46
- { label: i18nRes.common.btnClose, type: 'primary', result: ModalResult.MR_OK }
46
+ { label: i18nRes.common.btnClose(), type: 'primary', result: ModalResult.MR_OK }
47
47
  ];
48
48
  return this.showMessageBox(_message, infoButtons, options);
49
49
  };
50
50
  showConfirm = (_message, options = { type: 'question' }) => {
51
51
  const confirmButtons = [
52
- { label: i18nRes.common.btnConfirm, type: 'primary', result: ModalResult.MR_OK },
53
- { label: i18nRes.common.btnCancel, type: 'secondary', result: ModalResult.MR_CANCEL }
52
+ { label: i18nRes.common.btnConfirm(), type: 'primary', result: ModalResult.MR_OK },
53
+ { label: i18nRes.common.btnCancel(), type: 'secondary', result: ModalResult.MR_CANCEL }
54
54
  ];
55
55
  return this.showMessageBox(_message, confirmButtons, options);
56
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "A comprehensive UI component library for Svelte applications with rich form controls, data tables, layouts and interactive elements",
5
5
  "keywords": [
6
6
  "svelte",
@@ -1,17 +0,0 @@
1
- <script lang="ts">
2
-
3
- export let fixed: boolean = false;
4
- export let style: string = '';
5
- export {className as class };
6
- export let direction: 'horizontal' | 'vertical' = 'horizontal';
7
- export let flex: boolean = false;
8
- export let autoFit: boolean = false;
9
- export let grow: boolean = false;
10
- export let shrink: boolean = false;
11
-
12
- let className:string = '';
13
-
14
- </script>
15
- <div class:flex class="flex-block {className} {flex ? direction : ''}" class:fixed class:grow class:shrink class:auto_fit={autoFit} {style}>
16
- <slot/>
17
- </div>
@@ -1,38 +0,0 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
15
- default: any;
16
- } ? Props extends Record<string, never> ? any : {
17
- children?: any;
18
- } : {});
19
- declare const FlexBlock: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
20
- fixed?: boolean;
21
- style?: string;
22
- class?: string;
23
- direction?: "horizontal" | "vertical";
24
- flex?: boolean;
25
- autoFit?: boolean;
26
- grow?: boolean;
27
- shrink?: boolean;
28
- }, {
29
- default: {};
30
- }>, {
31
- [evt: string]: CustomEvent<any>;
32
- }, {
33
- default: {};
34
- }, {
35
- class: string;
36
- }, string>;
37
- type FlexBlock = InstanceType<typeof FlexBlock>;
38
- export default FlexBlock;
@@ -1,148 +0,0 @@
1
- # FlexBlock
2
-
3
- A flexible flexbox layout component with support for horizontal/vertical directions, resizing, and growth/shrink options.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @ticatec/uniface-element
9
- ```
10
-
11
- ## Import
12
-
13
- ```typescript
14
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
15
- ```
16
-
17
- ## Basic Usage
18
-
19
- ```svelte
20
- <script>
21
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
22
- </script>
23
-
24
- <FlexBlock>
25
- <div>Item 1</div>
26
- <div>Item 2</div>
27
- <div>Item 3</div>
28
- </FlexBlock>
29
- ```
30
-
31
- ## Props
32
-
33
- | Prop | Type | Default | Description |
34
- |------|------|---------|-------------|
35
- | `direction` | `'horizontal' \| 'vertical'` | `'horizontal'` | Flex direction |
36
- | `flex` | `boolean` | `false` | Apply flex styling based on direction |
37
- | `fixed` | `boolean` | `false` | Enable fixed positioning |
38
- | `grow` | `boolean` | `false` | Enable flex-grow |
39
- | `shrink` | `boolean` | `false` | Enable flex-shrink |
40
- | `autoFit` | `boolean` | `false` | Enable auto-fit to content |
41
- | `style` | `string` | `''` | Custom CSS styles for the container |
42
- | `class` | `string` | `''` | Custom CSS class name |
43
-
44
- ## Slots
45
-
46
- | Slot | Description |
47
- |------|-------------|
48
- | `default` | Main content area |
49
-
50
- ## Events
51
-
52
- No custom events.
53
-
54
- ## Examples
55
-
56
- ### Horizontal Layout
57
-
58
- ```svelte
59
- <script>
60
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
61
- </script>
62
-
63
- <FlexBlock direction="horizontal" style="gap: 16px;">
64
- <div>Item 1</div>
65
- <div>Item 2</div>
66
- <div>Item 3</div>
67
- </FlexBlock>
68
- ```
69
-
70
- ### Vertical Layout
71
-
72
- ```svelte
73
- <script>
74
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
75
- </script>
76
-
77
- <FlexBlock direction="vertical" style="gap: 16px;">
78
- <div>Header</div>
79
- <div>Main Content</div>
80
- <div>Footer</div>
81
- </FlexBlock>
82
- ```
83
-
84
- ### Flex Grow and Shrink
85
-
86
- ```svelte
87
- <script>
88
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
89
- </script>
90
-
91
- <FlexBlock direction="horizontal" flex grow shrink>
92
- <div style="flex: 1;">Flexible Item</div>
93
- <div style="width: 200px;">Fixed Item</div>
94
- </FlexBlock>
95
- ```
96
-
97
- ### Auto-Fit Layout
98
-
99
- ```svelte
100
- <script>
101
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
102
- </script>
103
-
104
- <FlexBlock autoFit>
105
- {#each items as item}
106
- <div>{item}</div>
107
- {/each}
108
- </FlexBlock>
109
- ```
110
-
111
- ### Card Grid
112
-
113
- ```svelte
114
- <script>
115
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
116
- </script>
117
-
118
- <FlexBlock direction="horizontal" autoFit style="gap: 16px;">
119
- {#each cards as card}
120
- <div style="border: 1px solid #ddd; padding: 16px; border-radius: 8px;">
121
- <h3>{card.title}</h3>
122
- <p>{card.description}</p>
123
- </div>
124
- {/each}
125
- </FlexBlock>
126
- ```
127
-
128
- ### Fixed Positioning
129
-
130
- ```svelte
131
- <script>
132
- import FlexBlock from '@ticatec/uniface-element/FlexBlock';
133
- </script>
134
-
135
- <FlexBlock fixed direction="vertical" style="position: fixed; top: 0; left: 0; right: 0; height: 100vh;">
136
- <div style="height: 60px;">Header</div>
137
- <div style="flex: 1; overflow: auto;">Main Content</div>
138
- <div style="height: 40px;">Footer</div>
139
- </FlexBlock>
140
- ```
141
-
142
- ## Best Practices
143
-
144
- 1. **Use direction prop** - Choose horizontal or vertical based on your layout needs
145
- 2. **Combine with flex** - Use `flex` prop for responsive layouts that adapt to container size
146
- 3. **Use autoFit** - Enable auto-fit for dynamic content that should wrap
147
- 4. **Use grow/shrink** - Control how items expand or contract within the flex container
148
- 5. **Fixed positioning** - Use `fixed` for sticky layouts that don't scroll with content