@ticatec/uniface-element 0.3.4 → 0.3.6

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.
@@ -1,4 +1,4 @@
1
- export type HrefBuilder = (item: any) => Array<HrefLink> | HrefLink;
1
+ export type HrefBuilder = (item: any) => Array<HrefLink> | HrefLink | string;
2
2
  export type HrefAction = () => void;
3
3
  export default interface HrefLink {
4
4
  /**
@@ -5,7 +5,7 @@
5
5
  export let data;
6
6
  export let href: HrefBuilder;
7
7
 
8
- let list: Array<HrefLink> = [];
8
+ let list: Array<HrefLink | string> = [];
9
9
 
10
10
 
11
11
  $: {
@@ -15,7 +15,11 @@
15
15
  </script>
16
16
  <div style="display: flex; flex-direction: row; gap: 8px; justify-content: center">
17
17
  {#each list as item, idx}
18
- <button class="link-style" on:click|preventDefault={()=>item.action()}>{item.text}</button>
18
+ {#if typeof item == "string"}
19
+ <span>{item}</span>
20
+ {:else}
21
+ <button class="link-style" on:click|preventDefault={()=>item.action()}>{item.text}</button>
22
+ {/if}
19
23
  {/each}
20
24
  </div>
21
25
 
@@ -29,6 +33,7 @@
29
33
  font: inherit;
30
34
  padding: 0;
31
35
  }
36
+
32
37
  button.link-style:focus {
33
38
  outline: none;
34
39
  }
@@ -15,6 +15,7 @@
15
15
  export let value: any = null;
16
16
  export let keyField: string = "code";
17
17
  export let textField: string = "text";
18
+ export let displayCode: boolean = false;
18
19
  export let menu$height: number = 0;
19
20
  export let style: string = '';
20
21
  export let placeholder: string = "";
@@ -162,8 +163,8 @@
162
163
  let isUserTyping: boolean = false;
163
164
 
164
165
  const handleInput = () => {
166
+ isUserTyping = true;
165
167
  if (!composing) {
166
- isUserTyping = true;
167
168
  text = inputText;
168
169
  value = null;
169
170
  oninput?.(text);
@@ -193,6 +194,9 @@
193
194
  const handleBlur = (event: FocusEvent) => {
194
195
  if (!showPopup) {
195
196
  hasFocus = false;
197
+ if (value == null) {
198
+ text = '';
199
+ }
196
200
  onblur?.();
197
201
  }
198
202
  };
@@ -222,9 +226,9 @@
222
226
  // 如果已选择值,根据焦点状态显示keyField或textField
223
227
  let selectedItem = options.find(op => op[keyField] == value);
224
228
  if (selectedItem) {
225
- inputText = hasFocus ? selectedItem[keyField] : selectedItem[textField];
229
+ inputText = hasFocus && displayCode ? selectedItem[keyField] : selectedItem[textField];
226
230
  } else {
227
- inputText = hasFocus ? value : text;
231
+ inputText = hasFocus && displayCode ? value : text;
228
232
  }
229
233
  }
230
234
  }
@@ -23,6 +23,7 @@ declare const InputOptionsSelect: $$__sveltets_2_IsomorphicComponent<{
23
23
  value?: any;
24
24
  keyField?: string;
25
25
  textField?: string;
26
+ displayCode?: boolean;
26
27
  menu$height?: number;
27
28
  style?: string;
28
29
  placeholder?: string;
@@ -184,7 +184,7 @@
184
184
  {#if readonly === false && (filter || lazyLoader)}
185
185
  <div class="header-search">
186
186
  <SearchBox bind:this={searchBox} compact variant="plain" disabled={isBusy} style="width: 100%" bind:value={filterText}
187
- onChange={handleCriteriaChange}/>
187
+ onchange={handleCriteriaChange}/>
188
188
  </div>
189
189
  {/if}
190
190
  </div>
@@ -195,7 +195,7 @@
195
195
  {#if selectMode === "multiple"}
196
196
  <div class="listview-item" style="display: flex; flex-direction: row; align-items: center; gap: 8px">
197
197
  <CheckBox style="flex: 0 0 auto; margin-left: 8px" {readonly} value={selectedList.indexOf(item) > -1}
198
- onChange={handleSelectionChanged(item)}/>
198
+ onchange={handleSelectionChanged(item)}/>
199
199
  <div style="flex: 1 1 auto; cursor: pointer" aria-hidden="true" on:click={handleSelectionChanged(item)}>
200
200
  <svelte:component this={itemRender} {readonly} {item} {...item$props}/>
201
201
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
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",