@ticatec/uniface-element 0.1.65 → 0.1.67

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,7 +5,7 @@ declare const _default: {
5
5
  sleep: (n: number) => Promise<void>;
6
6
  getNumberRegex: (precision: number | null | undefined, allowNegative: boolean) => string;
7
7
  isValidNumber: (n: number, precision: number | null | undefined, allowNegative: boolean, max?: number | null, min?: number | null) => boolean;
8
- formatNumber: (n: number | null, precision: number | null | undefined) => string;
8
+ formatNumber: (n: number | string | null, precision: number | null | undefined) => string;
9
9
  filterFiles: (files: Array<File>, accept: string) => File[];
10
10
  getNestedObject: (obj: any, keys: string[]) => any;
11
11
  getNestedValue: (data: any, key: string) => any;
@@ -65,7 +65,8 @@ const isValidNumber = (n, precision, allowNegative, max = null, min = null) => {
65
65
  return valid;
66
66
  };
67
67
  const formatNumber = (n, precision) => {
68
- if (n == null) {
68
+ n = typeof n == "string" ? parseFloat(n) : n;
69
+ if (n == null || isNaN(n)) {
69
70
  return '';
70
71
  }
71
72
  else {
@@ -19,8 +19,6 @@
19
19
  editor.focus();
20
20
  }
21
21
 
22
- const ctrlKeys: Array<string> = ['Backspace', 'Delete', 'Tab', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
23
-
24
22
  let regex: RegExp;
25
23
 
26
24
  let editor: any;
@@ -28,7 +28,7 @@ export default class UniDataTable {
28
28
  this._frozenColumns = [];
29
29
  this._columns = [];
30
30
  (columns ?? []).forEach(col => {
31
- if (col.visible) {
31
+ if (col.visible != false) {
32
32
  if (col.frozen) {
33
33
  this._frozenColumns.push(col);
34
34
  }
@@ -46,7 +46,7 @@ export default class UniDataTable {
46
46
  this._frozenColumns.forEach((col, idx) => {
47
47
  if (col.visible != false) {
48
48
  this._frozenWidth += col.width;
49
- colStyle += `#tab-${this.id} .fz_col-${idx - inv} {width: ${col.width}px; ext-align: ${col.align ?? 'left'}}\n`;
49
+ colStyle += `#tab-${this.id} .fz_col-${idx - inv} {width: ${col.width}px; text-align: ${col.align ?? 'left'}}\n`;
50
50
  }
51
51
  else {
52
52
  inv++;
@@ -63,16 +63,37 @@
63
63
  selectionMode = selectedRows.length == rows.length ? SelectionMode.All : selectedRows.length == 0 ? SelectionMode.None : SelectionMode.Partial;
64
64
  }
65
65
 
66
+ let viewPanel: any;
67
+
68
+ const handleWheelEvent = (e: WheelEvent) => {
69
+ let maxSh = viewPanel.scrollHeight - viewPanel.clientHeight;
70
+ if (maxSh > 0) {
71
+ if (e.deltaY != 0) {
72
+ scrollTop = scrollTop + e.deltaY;
73
+ if (scrollTop < 0) {
74
+ scrollTop = 0;
75
+ }
76
+ if (scrollTop > maxSh) {
77
+ scrollTop = maxSh;
78
+ }
79
+ setTimeout(() => {
80
+ scrollTop = viewPanel.scrollTop;
81
+ }, 200);
82
+ }
83
+ }
84
+ }
66
85
 
67
- $: console.log('选中行', selectionMode)
86
+ $: if (viewPanel && scrollTop > -1) {
87
+ viewPanel.scrollTop = scrollTop;
88
+ }
68
89
 
69
90
  </script>
70
91
 
71
92
  <div class="left-fixed-panel" style="width: {width}px">
72
93
  <FixedHeaderPanel {selectionMode} {orderColumn} {orderDirection} {handleCellClick} {handleWidthChange} columns={fixedCols} {indicatorColumn}
73
94
  {handleToggleSelectAll} {rowHeight}/>
74
- <div class="rows-container">
75
- <div style="top: {-scrollTop}px">
95
+ <div class="rows-container" bind:this={viewPanel} on:wheel|passive={handleWheelEvent}>
96
+ <div>
76
97
  {#each rows ?? [] as row, idx}
77
98
  <FixedRow rowNo={idx+1} {row} selected={selectedRows.indexOf(row.data) > -1} alternative={idx % 2 == 1} {selectable}
78
99
  cols={fixedCols} {expandRow} {rowHeight} {expandable} {handleRowExpand} {handleRowSelectChange} {indicatorColumn}/>
@@ -6,6 +6,9 @@
6
6
  import type {DialogCloseConfirm} from "./DialogCloseConfirm";
7
7
 
8
8
  export let title: string;
9
+ export let width: string = 'unset';
10
+ export let height: string = 'unset';
11
+
9
12
  export let closeConfirm: DialogCloseConfirm | null = null;
10
13
  export let content$style: string = '';
11
14
  export let closeHandler: () => void;
@@ -35,6 +38,6 @@
35
38
 
36
39
  </script>
37
40
 
38
- <Dialog {title} {content$style} {closeHandler} {actions} {closeConfirm}>
41
+ <Dialog {title} {content$style} {width} {height} {closeHandler} {actions} {closeConfirm}>
39
42
  <slot></slot>
40
43
  </Dialog>
@@ -19,6 +19,8 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
19
19
  } : {});
20
20
  declare const CommonDialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
21
  title: string;
22
+ width?: string;
23
+ height?: string;
22
24
  closeConfirm?: DialogCloseConfirm | null;
23
25
  content$style?: string;
24
26
  closeHandler: () => void;
@@ -7,6 +7,9 @@
7
7
  import {onMount} from "svelte";
8
8
 
9
9
  export let title: string;
10
+
11
+ export let width: string = 'unset';
12
+ export let height: string = 'unset';
10
13
  export let actions: ButtonActions | null = null;
11
14
  export let closeConfirm: DialogCloseConfirm | null = null;
12
15
  export let content$style: string = '';
@@ -52,9 +55,10 @@
52
55
 
53
56
  $: dialogActions = actions ? [...actions, closeAction] : [closeAction];
54
57
 
58
+
55
59
  </script>
56
60
 
57
- <div class="uniface-dialog" style="{startMove ? 'cursor: move' : ''}" transition:fade={{duration: 500}} aria-hidden="true"
61
+ <div class="uniface-dialog" style="width: {width}; height: {height}; {startMove ? 'cursor: move' : ''}" transition:fade={{duration: 500}} aria-hidden="true"
58
62
  on:mouseleave={handleMouseUp} on:mousemove={handleMouseMove}>
59
63
  <div>
60
64
  <div class="uniface-dialog-box" style="top: {top}px; left: {left}px">
@@ -20,6 +20,8 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
20
20
  } : {});
21
21
  declare const Dialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
22
22
  title: string;
23
+ width?: string;
24
+ height?: string;
23
25
  actions?: ButtonActions | null;
24
26
  closeConfirm?: DialogCloseConfirm | null;
25
27
  content$style?: string;
@@ -7,7 +7,7 @@
7
7
  import {dialogs} from "./Dialogs";
8
8
 
9
9
  export const open = (component: any, params: any) => {
10
- let dialog = {id: (new Date().getTime()).toString(36) ,component, params};
10
+ let dialog = {id: (new Date().getTime()).toString(36), component, params};
11
11
  params.closeHandler = () => {
12
12
  dialogs.removeDialog(dialog.id);
13
13
  }
@@ -32,7 +32,9 @@
32
32
  </script>
33
33
 
34
34
  <div bind:this={board} class="uniface-dialog-board" style="display: {$dialogs.length > 0 ? 'block' : 'none'}">
35
- {#each $dialogs as dialog}
36
- <svelte:component this={dialog.component} {...dialog.params}></svelte:component>
37
- {/each}
35
+ <div style="width: 100%; height: 100%; position: relative">
36
+ {#each $dialogs as dialog}
37
+ <svelte:component this={dialog.component} {...dialog.params}></svelte:component>
38
+ {/each}
39
+ </div>
38
40
  </div>
@@ -1,4 +1,4 @@
1
- <script lang="ts">
1
+ <script lang="ts">
2
2
 
3
3
  import {DisplayMode} from "../common/DisplayMode";
4
4
  import CommonEditor from "../common-editor/CommonEditor.svelte";
@@ -3738,7 +3738,7 @@ root {
3738
3738
  --uniface-data-table-header-bg: #F8FAFC;
3739
3739
  --uniface-data-table-shadow-gap: 2px;
3740
3740
  --uniface-data-table-header-divid-color: #B3BCCA;
3741
- --uniface-data-table-cell-padding: 3px 4px;
3741
+ --uniface-data-table-cell-padding: 3px 6px;
3742
3742
  --uniface-data-table-inline-row-panel-border: 1px solid #F8FAFC;
3743
3743
  --uniface-data-table-inline-row-panel-bg: #F1F5F9;
3744
3744
  --uniface-scroll-color: #e1e1e180;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",