@ticatec/uniface-element 0.1.20 → 0.1.21

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,6 +1,19 @@
1
1
  export type ActionCallback = () => void;
2
2
  export default interface CardAction {
3
+ /**
4
+ * 使用icon字体
5
+ */
3
6
  icon?: string;
7
+ /**
8
+ * 直接嵌入图标
9
+ */
10
+ img?: string;
11
+ /**
12
+ *
13
+ */
4
14
  disabled?: boolean;
15
+ /**
16
+ *
17
+ */
5
18
  callback: ActionCallback;
6
19
  }
@@ -21,7 +21,11 @@
21
21
  <div class="card-action-bar simple">
22
22
  {#each actions as action}
23
23
  <div class:disabled={action.disabled} class="action-item">
24
- <i class={action.icon} aria-hidden="true" on:click={handleActionClick(action)}></i>
24
+ {#if action.icon}
25
+ <i class={action.icon} aria-hidden="true" on:click={handleActionClick(action)}></i>
26
+ {:else if action.img}
27
+ <img class="card-action-img" alt="" src={action.img} aria-hidden="true" on:click={handleActionClick(action)}/>
28
+ {/if}
25
29
  </div>
26
30
  {/each}
27
31
  </div>
@@ -10,7 +10,7 @@
10
10
  export let content$style: string = '';
11
11
  export let closeHandler: () => void;
12
12
  export let enableConfirm: boolean = true;
13
- export let confirmHandler: (()=>Promise<void>) | null = null;
13
+ export let confirmHandler: (()=>Promise<any>) | null = null;
14
14
  export let confirmText: string | null = null;
15
15
 
16
16
  let confirmAction: ButtonAction = {
@@ -23,7 +23,7 @@ declare const CommonDialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_Pr
23
23
  content$style?: string;
24
24
  closeHandler: () => void;
25
25
  enableConfirm?: boolean;
26
- confirmHandler?: (() => Promise<void>) | null;
26
+ confirmHandler?: (() => Promise<any>) | null;
27
27
  confirmText?: string | null;
28
28
  }, {
29
29
  default: {};
@@ -10,12 +10,14 @@ declare enum ModalResult {
10
10
  MR_CLOSE = 3
11
11
  }
12
12
  declare const InfoButtons: {
13
- label: string;
13
+ text: string;
14
+ key: string;
14
15
  type: string;
15
16
  result: ModalResult;
16
17
  }[];
17
18
  declare const ConfirmButtons: {
18
- label: string;
19
+ text: string;
20
+ key: string;
19
21
  type: string;
20
22
  result: ModalResult;
21
23
  }[];
@@ -1,4 +1,5 @@
1
1
  import i18n from "@ticatec/i18n";
2
+ import langRes from "../i18n_resources/uniface_en_resource";
2
3
  ;
3
4
  var ModalResult;
4
5
  (function (ModalResult) {
@@ -7,11 +8,11 @@ var ModalResult;
7
8
  ModalResult[ModalResult["MR_CLOSE"] = 3] = "MR_CLOSE";
8
9
  })(ModalResult || (ModalResult = {}));
9
10
  const InfoButtons = [
10
- { label: i18n.getText('uniface.btnClose', 'Close'), type: 'primary', result: ModalResult.MR_OK }
11
+ { text: langRes.uniface.btnClose, key: 'uniface.btnClose', type: 'primary', result: ModalResult.MR_OK }
11
12
  ];
12
13
  const ConfirmButtons = [
13
- { label: i18n.getText('uniface.btnCancel', 'Cancel'), type: 'default', result: ModalResult.MR_CANCEL },
14
- { label: i18n.getText('uniface.btnConfirm', 'OK'), type: 'primary', result: ModalResult.MR_OK }
14
+ { text: langRes.uniface.btnConfirm, key: 'uniface.btnConfirm', type: 'primary', result: ModalResult.MR_OK },
15
+ { text: langRes.uniface.btnCancel, key: 'uniface.btnCancel', type: 'secondary', result: ModalResult.MR_CANCEL }
15
16
  ];
16
17
  const initialize = (showInfo, showConfirm) => {
17
18
  window.MessageBox = {
@@ -5,6 +5,7 @@
5
5
  import Button from "../button";
6
6
  import {fade} from "svelte/transition";
7
7
  import utils from "../common/utils";
8
+ import i18n from "@ticatec/i18n";
8
9
 
9
10
  export let appTitle: string = null as unknown as string;
10
11
 
@@ -27,6 +28,7 @@
27
28
  }
28
29
 
29
30
  let showMessageBox = (_message: string, _buttons: Array<any> | null, _title: string, _type: string | null, _escapeHTML: boolean = true): Promise<any> => {
31
+ console.log('显示消息框')
30
32
  if (!visible) {
31
33
  top = 0;
32
34
  left = 0;
@@ -34,6 +36,12 @@
34
36
  message = _message;
35
37
  title = _title ?? appTitle;
36
38
  escapeHTML = _escapeHTML != false;
39
+ if (_buttons) {
40
+ _buttons.forEach(button => {
41
+ console.log(button.key, i18n.getText(button.key, button.text));
42
+ button.label = i18n.getText(button.key, button.text)
43
+ });
44
+ }
37
45
  buttons = _buttons;
38
46
  iconType = _type == null ? 'uniface-icon-alert-circle' : _type == 'info' ? 'uniface-icon-help-circle' : 'uniface-icon-alert-triangle';
39
47
  type = _type ?? "info";
@@ -1665,6 +1665,8 @@
1665
1665
  --uniface-card-icon-color: #374151;
1666
1666
  --uniface-card-icon-hover-color: #37415170;
1667
1667
  --uniface-card-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
1668
+ --uniface-action-image-size: 15px;
1669
+ --uniface-action-image-hover-size: 18px;
1668
1670
  }
1669
1671
 
1670
1672
  .uniface-card {
@@ -1719,6 +1721,20 @@
1719
1721
  flex: 1;
1720
1722
  position: relative;
1721
1723
  padding: 10px;
1724
+ font-size: var(--uniface-action-image-size);
1725
+ }
1726
+ .uniface-card > div .card-action-bar.simple .action-item .card-action-img {
1727
+ width: var(--uniface-action-image-size);
1728
+ height: var(--uniface-action-image-size);
1729
+ cursor: pointer;
1730
+ }
1731
+ .uniface-card > div .card-action-bar.simple .action-item .card-action-img:hover {
1732
+ width: var(--uniface-action-image-hover-size);
1733
+ height: var(--uniface-action-image-hover-size);
1734
+ }
1735
+ .uniface-card > div .card-action-bar.simple .action-item .card-action-img:active {
1736
+ position: relative;
1737
+ top: 1px;
1722
1738
  }
1723
1739
  .uniface-card > div .card-action-bar.simple .action-item:not(:first-child)::before {
1724
1740
  content: "";
@@ -1733,7 +1749,7 @@
1733
1749
  color: var(--uniface-card-primary-text-color, #374151);
1734
1750
  }
1735
1751
  .uniface-card > div .card-action-bar.simple .action-item i:hover {
1736
- color: var(--uniface-card-icon-hover-color, rgba(55, 65, 81, 0.4392156863));
1752
+ font-size: var(--uniface-action-image-hover-size);
1737
1753
  }
1738
1754
  .uniface-card > div .card-action-bar.simple .action-item i:active {
1739
1755
  position: relative;
@@ -1741,6 +1757,7 @@
1741
1757
  }
1742
1758
  .uniface-card > div .card-action-bar.simple .action-item.disabled i {
1743
1759
  cursor: default;
1760
+ font-size: var(--uniface-action-image-size);
1744
1761
  color: var(--uniface-disabled-button-text-color, #B3BCCA);
1745
1762
  }
1746
1763
  .uniface-card > div .card-action-bar.simple .action-item.disabled i:hover {
@@ -1750,6 +1767,18 @@
1750
1767
  position: relative;
1751
1768
  top: 0;
1752
1769
  }
1770
+ .uniface-card > div .card-action-bar.simple .action-item.disabled .card-action-img {
1771
+ filter: grayscale(100%);
1772
+ cursor: default;
1773
+ }
1774
+ .uniface-card > div .card-action-bar.simple .action-item.disabled .card-action-img:hover {
1775
+ width: var(--uniface-action-image-size);
1776
+ height: var(--uniface-action-image-size);
1777
+ }
1778
+ .uniface-card > div .card-action-bar.simple .action-item.disabled .card-action-img:active {
1779
+ position: relative;
1780
+ top: 0;
1781
+ }
1753
1782
  .uniface-card > div .card-content {
1754
1783
  overflow: hidden;
1755
1784
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticatec/uniface-element",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "uniface web elements",
5
5
  "scripts": {
6
6
  "dev": "vite dev",