aio-entitykit 2.0.2 → 2.0.3

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 (5) hide show
  1. package/d1.css +3 -77
  2. package/index.css +187 -36
  3. package/index.d.ts +10 -3
  4. package/index.js +51 -24
  5. package/package.json +1 -1
package/d1.css CHANGED
@@ -822,7 +822,7 @@
822
822
  height: 2.4em;
823
823
  cursor:pointer;
824
824
  }
825
- .ai-form-submit-button{
825
+ .d1 .ai-form-submit-button{
826
826
  background: var(--d1-active);
827
827
  color:#555;
828
828
  border: none;
@@ -832,83 +832,9 @@
832
832
  cursor:pointer;
833
833
  }
834
834
  .ai-form-wizard-step-button:disabled,.ai-form-wizard-submit-button:disabled{
835
- cursor:pointer;
835
+ cursor:not-allowed;
836
836
  opacity:0.5;
837
837
  }
838
- .d1 .entity-card{
839
- background: var(--d1-active);
840
- padding:0.5em;
841
- display:flex;
842
- flex-direction: column;
843
- gap:0.5em;
844
- border-radius:0.8em;
845
- color:#333;
846
- }
847
- .d1 .entity-card-header{
848
- display: flex;
849
- align-items: center;
850
- }
851
- .d1 .entity-card-toggle-icon{
852
- display: flex;
853
- align-items: center;
854
- justify-content: center;
855
- width:24px;
856
- height:30px;
857
- }
858
- .d1 .entity-card-title{
859
- cursor: pointer;
860
- flex:1;
861
- font-weight:bold;
862
- }
863
- .d1 .entity-row{
864
- display: flex;
865
- flex-direction: column;
866
- padding: 0.2em;
867
- justify-content: center;
868
- gap:0.4em;
869
- }
870
- .d1 .entity-row-header{
871
- display: flex;
872
- align-items: center;
873
- }
874
- .d1 .entity-table-deselect-all{
875
- height:30px;
876
- width: 30px;
877
- display:flex;
878
- align-items: center;
879
- justify-content: center;
880
- }
881
- .d1 .entity-table-selected-options{
882
- display: flex;
883
- align-items: center;
884
- justify-content: center;
885
- }
886
- .d1 .entity-table-today{
887
- font-size:0.7em;
888
- width:100%;
889
- display: flex;
890
- justify-content: center;
891
- }
892
- .d1 .entity-table .aio-table{
893
- flex:1;
894
- overflow: hidden;
895
- }
896
- .d1 .entity-table-toolbar{
897
- display: flex;
898
- align-items: center;
899
- gap:3em;
900
- font-size:0.8em;
901
- }
902
838
  .d1 .date-box{
903
- display:flex;
904
- align-items: center;
905
- justify-content: center;
906
- border-radius:1em;
907
- cursor:pointer;
908
- font-size:0.8em;
909
- width:48px;
910
- height:48px;
911
- text-align: center;
912
839
  border:1px solid var(--d1-border-medium);
913
- padding:0;
914
- }
840
+ }
package/index.css CHANGED
@@ -1,81 +1,232 @@
1
- .date-filter{
1
+ .date-filter {
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 0.5em;
5
5
  padding: 0 0.5em;
6
- padding-bottom:0.5em;
6
+ padding-bottom: 0.5em;
7
7
  }
8
- .date-filter-toolbar{
9
- display:flex;
8
+
9
+ .date-filter-toolbar {
10
+ display: flex;
10
11
  flex-direction: row;
11
12
  align-items: center;
12
13
  }
13
- .date-filter-toolbar-buttons{
14
- display:flex;
14
+
15
+ .date-filter-toolbar-buttons {
16
+ display: flex;
15
17
  flex-direction: row;
16
18
  gap: 0.5em;
17
19
  }
18
- .date-filter-input{
19
- display:flex;
20
+
21
+ .date-filter-input {
22
+ display: flex;
20
23
  align-items: center;
21
24
  justify-content: center;
22
25
  border-radius: 0.4em;
23
- cursor:pointer;
24
- font-size: 1em;
26
+ cursor: pointer;
25
27
  width: 48px;
26
28
  height: 48px;
27
29
  text-align: center;
28
- border:none;
30
+ border: none;
29
31
  }
30
- .date-filter-result{
31
- border:none;
32
+
33
+ .date-filter-result {
34
+ border: none;
32
35
  border-radius: 0.4em;
33
- padding:0 1em;
34
- height:2.4em;
35
- font-size:1em;
36
+ padding: 0 1em;
37
+ height: 2.4em;
36
38
  font-weight: bold;
37
- background:linear-gradient(180deg, #f7e5b3, #9a7e2f);
39
+ background: linear-gradient(180deg, #f7e5b3, #9a7e2f);
38
40
  }
39
- .time-range{
40
- display:flex;
41
+
42
+ .time-range {
43
+ display: flex;
41
44
  flex-direction: row;
42
45
  align-items: center;
43
46
  border-radius: 0;
44
47
  padding: 0;
45
48
  border: 1px solid #444;
46
49
  }
47
- .time-range-splitter{
50
+
51
+ .time-range-splitter {
48
52
  width: 1px;
49
53
  background-color: #444;
50
54
  height: 100%;
51
55
  }
52
- .time-range-input{
53
- border:none;
54
- font-size: 1em;
56
+
57
+ .time-range-input {
58
+ border: none;
55
59
  border-radius: 0;
56
60
  background: none;
57
61
  }
58
- .card-row{
62
+
63
+ .card-rows {
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 1em;
67
+ }
68
+
69
+ .card-rows-placeholder {
70
+ font-size: 80%;
71
+ width: 100%;
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ }
76
+
77
+ .card-row {
59
78
  display: flex;
60
79
  padding: 0.5em 0.75em;
61
80
  margin: 0.25em 0;
62
81
  border-radius: 0.4em;
63
82
  align-items: center;
64
- background:rgba(0,0,0,0.2);
83
+ background: rgba(0, 0, 0, 0.2);
84
+ }
85
+
86
+ .card-row-value {
87
+ font-weight: bold;
88
+ font-size: 80%;
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ }
93
+
94
+ .card-row-label {
95
+ font-size: 80%;
65
96
  }
66
- .entity-row-title{
67
- flex:1;
68
- font-size:0.8em;
69
- font-weight:bold;
97
+
98
+ .entity-row {
99
+ display: flex;
100
+ flex-direction: column;
101
+ padding: 0.6em 0.2em !important;
102
+ justify-content: center;
103
+ gap: 0.4em;
70
104
  }
71
- .entity-table-selected{
72
- padding:0 1em;
73
- height:2.4em;
74
- display:flex;
105
+
106
+ .entity-row-header {
107
+ display: flex;
108
+ align-items: center;
109
+ }
110
+
111
+ .entity-card {
112
+ background: var(--d1-active);
113
+ padding: 0.5em;
114
+ display: flex;
115
+ flex-direction: column;
116
+ gap: 0.5em;
117
+ border-radius: 0.8em;
118
+ color: #333;
119
+ }
120
+
121
+ .entity-card-toggle-icon {
122
+ display: flex;
75
123
  align-items: center;
76
- color:orange;
124
+ justify-content: center;
125
+ width: 24px;
126
+ height: 30px;
77
127
  }
78
- .entity-card-title{
79
- display:flex;
128
+
129
+ .entity-card-header {
130
+ display: flex;
80
131
  align-items: center;
132
+ }
133
+ .entity-card-title {
134
+ cursor: pointer;
135
+ flex: 1;
136
+ padding: 0;
137
+ background: none;
138
+ }
139
+ .entity-table-deselect-all {
140
+ height: 30px;
141
+ width: 30px;
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: center;
145
+ }
146
+
147
+ .entity-table-selected-options {
148
+ display: flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ }
152
+
153
+ .entity-table-today {
154
+ width: 100%;
155
+ display: flex;
156
+ justify-content: center;
157
+ }
158
+
159
+ .entity-table .aio-table {
160
+ flex: 1;
161
+ overflow: hidden;
162
+ }
163
+
164
+ .entity-table-toolbar {
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 3em;
168
+ }
169
+
170
+ .date-box {
171
+ display: flex;
172
+ align-items: center;
173
+ justify-content: center;
174
+ border-radius: 1em;
175
+ cursor: pointer;
176
+ width: 48px;
177
+ height: 48px;
178
+ text-align: center;
179
+ border: 1px solid var(--d1-border-medium);
180
+ padding: 0;
181
+ }
182
+
183
+ .entity-row-title {
184
+ flex: 1;
185
+ }
186
+
187
+ .entity-table-selected {
188
+ padding: 0 1em;
189
+ height: 2.4em;
190
+ display: flex;
191
+ align-items: center;
192
+ color: orange;
193
+ }
194
+
195
+ .entity-card-title {
196
+ display: flex;
197
+ align-items: center;
198
+ }
199
+
200
+ .entity-table-header {
201
+ display: flex;
202
+ }
203
+
204
+ .entity-table-side-button {
205
+ margin-inline-end: 1em;
206
+ padding: 1em;
207
+ border-radius: 100%;
208
+ }
209
+
210
+ .entity-table-align-vh {
211
+ display: flex;
212
+ align-items: center;
213
+ justify-content: center;
214
+ }
215
+
216
+ .card-box {
217
+ display: flex;
218
+ flex: 1;
219
+ flex-direction: column;
220
+ border-radius: 0.8em;
221
+ align-items: center;
222
+ font-size: 80%;
223
+ opacity: 0.9;
224
+ }
225
+
226
+ .card-box-value {
227
+ font-weight: bold;
228
+ }
229
+
230
+ .entity-table .aio-input-tree-option {
231
+ min-height: 2.4em !important;
81
232
  }
package/index.d.ts CHANGED
@@ -14,7 +14,6 @@ type I_EntityTable<T> = {
14
14
  root?: boolean;
15
15
  popup?: any;
16
16
  cordova?: AIOCordova;
17
- io?: boolean;
18
17
  sideOptions?: {
19
18
  text: string;
20
19
  value: any;
@@ -31,8 +30,17 @@ type I_EntityTable<T> = {
31
30
  getCardOptions?: (row: T, parent: T | false) => I_option[];
32
31
  getSelectedOptions?: (selected: T[], parent?: T) => I_option[];
33
32
  getRootOptions?: () => I_option[];
34
- getCardTitle: (row: T) => string;
33
+ getCardTitle: (row: T) => ReactNode;
34
+ getCardOptionsType?: (row: T) => 'button' | 'onTitle';
35
+ getCardSubtitle?: (row: T) => ReactNode;
36
+ onSearch?: (searchValue: string) => void;
37
+ toggleIcon?: (row: T) => {
38
+ close?: ReactNode;
39
+ open?: ReactNode;
40
+ leaf?: ReactNode;
41
+ } | undefined;
35
42
  archive?: boolean;
43
+ reOrder?: 'dir';
36
44
  filteredData?: T[];
37
45
  };
38
46
  export declare const EntityTable: <T>(props: I_EntityTable<T>) => import("react/jsx-runtime").JSX.Element;
@@ -79,7 +87,6 @@ export declare const CardBox: FC<{
79
87
  onClick?: () => void;
80
88
  type: number;
81
89
  isPrice?: boolean;
82
- thin?: boolean;
83
90
  }>;
84
91
  export declare const Panel: FC<{
85
92
  label?: ReactNode;
package/index.js CHANGED
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { createContext, useContext, useEffect, useState } from "react";
12
- import { AIDate, AISelect, AITime, AITree } from 'aio-input';
12
+ import AIOInput, { AIDate, AISelect, AITime, AITree } from 'aio-input';
13
13
  import AIOTable from 'aio-table';
14
14
  import { AddToAttrs, classListToString, GetSvg, SplitNumber, useSide } from 'aio-utils';
15
15
  import AIODate from 'aio-date';
16
16
  import Icon from '@mdi/react';
17
- import { mdiCheckboxMarked, mdiClose, mdiDownload, mdiListBox, mdiUpload } from "@mdi/js";
17
+ import { mdiCheckboxMarked, mdiClose, mdiDownload, mdiListBox, mdiSelect, mdiUpload } from "@mdi/js";
18
18
  import './index.css';
19
19
  const Context = createContext({});
20
20
  const Provider = ({ children, value }) => {
@@ -23,7 +23,7 @@ const Provider = ({ children, value }) => {
23
23
  const useProvider = () => useContext(Context);
24
24
  export const EntityTable = (props) => {
25
25
  const DATE = new AIODate();
26
- const { table, moveTo, entity, popup, archive, filteredData } = props;
26
+ const { table, moveTo, entity, popup, archive, filteredData, onSearch } = props;
27
27
  const [showArchive, setShowArchive] = useState(false);
28
28
  const { data } = entity;
29
29
  const [selected, setSelected] = useState({});
@@ -129,6 +129,8 @@ export const EntityTable = (props) => {
129
129
  setSelected({});
130
130
  })
131
131
  },
132
+ { show: props.reOrder === 'dir', text: 'جابجایی به بالا', onClick: () => entity.changeOrderByDir(row, -1) },
133
+ { show: props.reOrder === 'dir', text: 'جابجایی به پایین', onClick: () => entity.changeOrderByDir(row, 1) },
132
134
  { show: !!archive && !row.archive, text: 'انتقال به آرشیو', onClick: () => { if (!!archive) {
133
135
  entity.edit(Object.assign(Object.assign({}, row), { archive: true }));
134
136
  } } },
@@ -149,8 +151,8 @@ export const EntityTable = (props) => {
149
151
  });
150
152
  const rows = filteredData ? filteredData : data;
151
153
  const attrs = AddToAttrs(props.attrs, { className: 'entity-table' });
152
- return (_jsx(Provider, { value: { selected, setSelected, getRootOptions, rootProps: props, getOptions, entity, getOptionDetails, showArchive, setShowArchive, select }, children: _jsxs("div", Object.assign({}, attrs, { children: [_jsx("div", { className: "entity-table-today", style: { background: 'rgba(0,0,0,0.2)' }, children: DATE.getDateByPattern(DATE.getToday(true), 'امروز {weekDay} {day} {monthString} {year}') }), _jsxs("div", { className: "flex flex-row", children: [!!props.sideOptions && !!props.sideOptions.length &&
153
- _jsx("div", { className: "border-0 ml-2 px-2 py-2 rounded-full", onClick: () => side.open(), children: _jsx(Icon, { path: mdiListBox, size: 1 }) }), !!props.header && props.header()] }), _jsx(Selected, {}), _jsx(AIOTable, Object.assign({}, table, { value: rows, headerAttrs: { style: { display: 'none' } }, rowTemplate: ({ row, rowIndex }) => _jsx(Card, { row: row, index: rowIndex }), toolbar: () => _jsx(TableToolbar, {}) })), _jsx("div", { className: "mb-2" }), !!props.footer && props.footer(), side.render()] })) }));
154
+ return (_jsx(Provider, { value: { selected, setSelected, getRootOptions, rootProps: props, getOptions, entity, getOptionDetails, showArchive, setShowArchive, select }, children: _jsxs("div", Object.assign({}, attrs, { children: [_jsx("div", { className: "entity-table-today", style: { background: 'rgba(0,0,0,0.2)' }, children: DATE.getDateByPattern(DATE.getToday(true), 'امروز {weekDay} {day} {monthString} {year}') }), _jsxs("div", { className: "entity-table-header", children: [!!props.sideOptions && !!props.sideOptions.length &&
155
+ _jsx("div", { className: "entity-table-side-button", onClick: () => side.open(), children: _jsx(Icon, { path: mdiListBox, size: 1 }) }), !!props.header && props.header()] }), _jsx(Selected, {}), _jsx(AIOTable, Object.assign({}, table, { onSearch: onSearch, value: rows, headerAttrs: { style: { display: 'none' } }, rowTemplate: ({ row, rowIndex }) => _jsx(Card, { row: row, index: rowIndex }), toolbar: () => _jsx(TableToolbar, {}) })), _jsx("div", { style: { marginBottom: '1em' } }), !!props.footer && props.footer(), side.render()] })) }));
154
156
  };
155
157
  const Selected = () => {
156
158
  const { selected, rootProps, getOptionDetails, entity, setSelected } = useProvider();
@@ -188,19 +190,18 @@ const TableToolbar = () => {
188
190
  const options = getRootOptions();
189
191
  const res = getOptionDetails(options);
190
192
  return (_jsxs("div", { className: "entity-table-toolbar", children: [!!res.length &&
191
- _jsx(AISelect, { rtl: true, options: res, text: new GetSvg().getIcon('mdiPlusThick', .8), caret: false, justify: true, className: 'd1-bg-cream flex flex-row items-center justify-center', style: { background: 'none', border: 'none', height: 30, width: 30, padding: 0, } }), node] }));
193
+ _jsx(AISelect, { rtl: true, options: res, text: new GetSvg().getIcon('mdiDotsHorizontal', .8), caret: false, justify: true, className: 'd1-bg-cream entity-table-align-vh', style: { background: 'none', border: 'none', height: 30, width: 30, padding: 0, } }), node] }));
192
194
  };
193
195
  export const Card = ({ row }) => {
194
- const { rootProps, getOptions, entity, showArchive, select, selected } = useProvider();
196
+ const { rootProps, entity, selected } = useProvider();
195
197
  const rowId = entity.id.get(row);
196
198
  const isSelected = selected[rowId];
197
- const { getCardContent, getCardTitle } = rootProps;
199
+ const { getCardContent } = rootProps;
198
200
  const [open, setOpen] = useState(false);
199
- //const tree = useMemo(() => {return <CardTree<T> row={row as any} open={open} />}, [row, selected, open])
200
- return (_jsxs("div", { className: "entity-card", children: [_jsxs("div", { className: "entity-card-header", children: [_jsx("div", { className: "entity-card-toggle-icon", onClick: () => setOpen(!open), children: new GetSvg().getIcon(open ? 'mdiChevronDown' : 'mdiChevronLeft', .8) }), _jsxs("div", { className: "entity-card-title", style: { flex: 1, color: isSelected ? 'orange' : undefined }, onClick: () => select(row), children: [!!isSelected && _jsx(Icon, { path: mdiCheckboxMarked, size: 0.8, color: 'orange' }), getCardTitle(row)] }), !!getOptions && _jsx(CardOptions, { row: row, parent: false, isRoot: true })] }), getCardContent(row, false, 'root'), _jsx(CardTree, { row: row, open: open })] }));
201
+ return (_jsxs("div", { className: "entity-card", children: [_jsx(CardHeader, { isRoot: true, row: row, before: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '0.4em' }, children: [_jsx("div", { className: "entity-card-toggle-icon", onClick: (e) => { e.stopPropagation(); setOpen(!open); }, children: new GetSvg().getIcon(open ? 'mdiChevronDown' : 'mdiChevronLeft', .8) }), !!isSelected && _jsx(Icon, { path: mdiCheckboxMarked, size: 0.8, color: 'orange' })] }) }), getCardContent(row, false, 'root'), _jsx(CardTree, { row: row, open: open })] }));
201
202
  };
202
203
  const CardTree = ({ row, open }) => {
203
- const { entity, showArchive } = useProvider();
204
+ const { entity, showArchive, rootProps } = useProvider();
204
205
  const childs = entity.childs.get(row);
205
206
  if (!childs || !childs.length || !open) {
206
207
  return null;
@@ -210,24 +211,50 @@ const CardTree = ({ row, open }) => {
210
211
  text: (row, { parentOptions }) => _jsx(CardTreeRow, { row: row, parentOptions: parentOptions }),
211
212
  value: (o) => entity.id.get(o),
212
213
  show: (o) => showArchive ? true : !o.archive,
213
- className: () => `${'d1-bg-dark-gray'} !rounded-md`,
214
- style: () => ({ borderBottom: '2px dashed #333' })
214
+ className: () => `${'d1-bg-dark-gray'}`,
215
+ style: () => ({ borderBottom: '2px dashed #333', borderRadius: '0.5em' }),
216
+ toggleIcon: rootProps.toggleIcon ? (row) => rootProps.toggleIcon(row) : undefined
215
217
  } }));
216
218
  };
217
219
  const CardTreeRow = ({ row, parentOptions }) => {
218
- const { rootProps, getOptions, entity, select, selected } = useProvider();
219
- const { getCardContent, getCardTitle } = rootProps;
220
+ const { rootProps, entity, selected } = useProvider();
221
+ const { getCardContent } = rootProps;
220
222
  const rowId = entity.id.get(row);
221
223
  const isSelected = selected[rowId];
222
224
  const childs = entity.childs.get(row);
223
225
  const parentOption = parentOptions.length ? parentOptions[parentOptions.length - 1] : undefined;
224
226
  const parent = parentOption ? parentOption.optionOrg : false;
225
- console.log('tree row');
226
- return (_jsxs("div", { className: classListToString(["entity-row", isSelected ? 'selected' : undefined]), children: [_jsxs("div", { className: "entity-row-header", children: [!!isSelected && _jsx(Icon, { path: mdiCheckboxMarked, size: 0.8, color: 'orange' }), _jsx("div", { className: 'entity-row-title', style: { color: isSelected ? 'orange' : undefined }, onClick: () => select(row), children: getCardTitle(row) }), !!getOptions && _jsx(CardOptions, { row: row, parent: parent })] }), getCardContent(row, parent, childs ? 'node' : 'leaf')] }));
227
+ return (_jsxs("div", { className: classListToString(["entity-row", isSelected ? 'selected' : undefined]), children: [_jsx(CardHeader, { row: row, isRoot: false }), getCardContent(row, parent, childs ? 'node' : 'leaf')] }));
227
228
  };
228
- const CardOptions = ({ row, parent, isRoot }) => {
229
+ const CardHeader = ({ row, before, isRoot }) => {
230
+ const { entity, selected, rootProps, select } = useProvider();
231
+ const { getCardOptionsType = (() => 'button') } = rootProps;
232
+ const rowId = entity.id.get(row);
233
+ const isSelected = selected[rowId];
234
+ const cardOptionsType = getCardOptionsType(row);
235
+ if (cardOptionsType === 'onTitle') {
236
+ return (_jsxs("div", { className: "entity-card-header", children: [_jsx(CardOptionsOnTitle, { row: row, parent: false, isRoot: isRoot, isSelected: isSelected, before: before }), !!rootProps.getSelectedOptions && _jsx("div", { className: "entity-card-select-icon", onClick: () => select(row), children: _jsx(Icon, { path: mdiSelect, size: 0.7 }) })] }));
237
+ }
238
+ else {
239
+ return (_jsxs("div", { className: "entity-card-header", children: [_jsx(CardTitle, { isSelected: isSelected, before: before, row: row }), _jsx(CardOptionsButton, { row: row, parent: false, isRoot: true })] }));
240
+ }
241
+ };
242
+ const CardTitle = ({ row, before, isSelected }) => {
243
+ const { rootProps, select } = useProvider();
244
+ const { getCardTitle } = rootProps;
245
+ const hasBefore = !!before || !!isSelected;
246
+ return (_jsx(AIOInput, { type: 'button', text: getCardTitle(row), before: !hasBefore ? undefined :
247
+ _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '0.4em' }, children: [!!before && before, !!isSelected && _jsx(Icon, { path: mdiCheckboxMarked, size: 0.8, color: 'orange' })] }), className: "entity-card-title", style: { flex: 1, color: isSelected ? 'orange' : undefined }, onClick: () => select(row) }));
248
+ };
249
+ const CardOptionsButton = ({ row, parent, isRoot }) => {
229
250
  const { getOptions } = useProvider();
230
- return (_jsx(AISelect, { text: new GetSvg().getIcon('mdiDotsHorizontal', .8), caret: false, options: getOptions(row, parent, !!isRoot), justify: true, className: `${!isRoot ? 'd1-bg-cream' : 'd1-bg-gray'}`, style: { background: 'none', border: 'none', height: 30, width: 42, fontSize: '0.7em' }, popover: { modalAttrs: { style: { fontSize: '0.8em' } } } }));
251
+ return (_jsx(AISelect, { text: new GetSvg().getIcon('mdiDotsHorizontal', .8), caret: false, options: getOptions(row, parent, !!isRoot), justify: true, className: `${!isRoot ? 'd1-bg-cream' : 'd1-bg-gray'}`, style: { background: 'none', border: 'none', height: 24, width: 42, fontSize: '0.7em' }, popover: { modalAttrs: { style: { fontSize: '0.8em' } } } }));
252
+ };
253
+ const CardOptionsOnTitle = ({ row, parent, isRoot, isSelected, before }) => {
254
+ const { getOptions, rootProps } = useProvider();
255
+ const { getCardSubtitle } = rootProps;
256
+ const subtitle = getCardSubtitle ? getCardSubtitle(row) : undefined;
257
+ return (_jsx(AISelect, { className: "entity-card-title", rtl: true, subtext: subtitle, text: rootProps.getCardTitle(row), caret: false, options: getOptions(row, parent, !!isRoot), style: { flex: 1, color: isSelected ? 'orange' : undefined, border: 'none', height: 'fit-content' }, before: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '0.4em' }, children: [!!before && before, !!isSelected && _jsx(Icon, { path: mdiCheckboxMarked, size: 0.8, color: 'orange' })] }), popover: { modalAttrs: { style: { fontSize: '0.8em' } } } }));
231
258
  };
232
259
  export const DateFilter = ({ result, fromDate, toDate, onChange }) => {
233
260
  const DATE = new AIODate();
@@ -294,10 +321,10 @@ export const TimeRange = ({ fromDate, toDate, onChange }) => {
294
321
  export const CardRow = ({ label, value, color, onClick }) => {
295
322
  return (_jsxs("div", { className: 'card-row', onClick: () => { if (onClick) {
296
323
  onClick();
297
- } }, children: [_jsx("div", { className: "text-sm", children: label }), _jsx("div", { className: "flex-1" }), _jsx("div", { className: "font-bold text-sm flex flex-row items-center justify-center", style: { color }, children: value })] }));
324
+ } }, children: [_jsx("div", { className: "card-row-label", children: label }), _jsx("div", { style: { flex: 1 } }), _jsx("div", { className: "card-row-value", style: { color }, children: value })] }));
298
325
  };
299
326
  export const CardRows = ({ rows, placeholder = 'موردی وجود ندارد' }) => {
300
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [!rows.length && _jsx("div", { className: "text-xs w-full flex flex-row items-center justify-center", children: placeholder }), rows.map((r, i) => {
327
+ return (_jsxs("div", { className: "card-rows", children: [!rows.length && _jsx("div", { className: "card-rows-placeholder", children: placeholder }), rows.map((r, i) => {
301
328
  const { onClick, isPrice } = r[2] || {};
302
329
  let value = r[1];
303
330
  if (isPrice && (typeof r[1] === 'number' || typeof r[1] === 'string')) {
@@ -306,8 +333,8 @@ export const CardRows = ({ rows, placeholder = 'موردی وجود ندارد'
306
333
  return _jsx(CardRow, { label: r[0], value: value, onClick: onClick }, i);
307
334
  })] }));
308
335
  };
309
- export const CardBox = ({ thin, type, label, value, color, onClick, isPrice }) => {
310
- let cls = `flex flex-col flex-1 items-center rounded-lg${!thin ? ' py-2' : ''}`;
336
+ export const CardBox = ({ type, label, value, color, onClick, isPrice }) => {
337
+ let cls = `card-box`;
311
338
  if (type === 0) {
312
339
  cls += ' d1-bg-cream';
313
340
  }
@@ -321,7 +348,7 @@ export const CardBox = ({ thin, type, label, value, color, onClick, isPrice }) =
321
348
  }
322
349
  return (_jsxs("div", { className: cls, style: style, onClick: () => { if (onClick) {
323
350
  onClick();
324
- } }, children: [_jsx("div", { className: "text-xs", children: label }), _jsx("div", { className: "flex-1" }), _jsx("div", { className: "font-bold text-sm", style: { color }, children: isPrice ? SplitNumber(value) : value })] }));
351
+ } }, children: [_jsx("div", { className: 'card-box-label', children: label }), _jsx("div", { style: { flex: 1 } }), _jsx("div", { className: "card-box-value", style: { color }, children: isPrice ? SplitNumber(value) : value })] }));
325
352
  };
326
353
  export const Panel = ({ label, content }) => {
327
354
  return (_jsxs("div", { className: 'd1-panel', children: [!!label && _jsx("div", { className: "d1-panel-label d1-panel-label-online-rtl", children: label }), content] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-entitykit",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "kit",
5
5
  "main": "index.js",
6
6
  "scripts": {